34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
59$langs->loadLangs(array(
'products',
'stocks',
'companies',
'categories'));
61$action =
GETPOST(
'action',
'aZ09');
62$cancel =
GETPOST(
'cancel',
'alpha');
64$backtopage =
GETPOST(
'backtopage',
'alpha');
65$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
75$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
76$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
85$hookmanager->initHooks(array(
'warehousecard',
'stocklist',
'globalcard'));
90$usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'read');
96$extrafields->fetch_name_optionals_label(
$object->table_element);
99if ($id > 0 || !empty($ref)) {
100 $ret =
$object->fetch($id, $ref);
107$usercanread = $user->hasRight(
'stock',
'lire');
108$usercancreate = $user->hasRight(
'stock',
'creer');
109$usercandelete = $user->hasRight(
'stock',
'supprimer');
110$permissiontoeditextra = $usercancreate;
111if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
113 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
123$parameters = array(
'context' =>
'warehousecard',
'id' => $id,
'ref' => $ref);
124$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
128if (empty($reshook)) {
129 $backurlforlist = DOL_URL_ROOT.
'/product/stock/list.php';
131 if (empty($backtopage) || ($cancel && empty($id))) {
132 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
133 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
134 $backtopage = $backurlforlist;
136 $backtopage = DOL_URL_ROOT.
'/product/stock/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
142 if (!empty($backtopageforcancel)) {
143 header(
"Location: ".$backtopageforcancel);
145 } elseif (!empty($backtopage)) {
146 header(
"Location: ".$backtopage);
153 if ($action ==
'add' && $user->hasRight(
'stock',
'creer')) {
170 $ret = $extrafields->setOptionalsFromPost(
null, $object);
181 $categories =
GETPOST(
'categories',
'array:int');
182 $object->setCategories($categories);
183 if (!empty($backtopage)) {
184 $backtopage = str_replace(
"__ID__", (
string) $id, $backtopage);
185 header(
"Location: ".$backtopage);
188 header(
"Location: card.php?id=".urlencode((
string) ($id)));
197 setEventMessages($langs->trans(
"ErrorWarehouseRefRequired"),
null,
'errors');
203 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'stock',
'supprimer')) {
205 $result =
$object->delete($user);
208 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1');
217 if ($action ==
'update' && !$cancel && $user->hasRight(
'stock',
'creer')) {
233 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
239 $ret =
$object->update($id, $user);
249 $categories =
GETPOST(
'categories',
'array:int');
250 $object->setCategories($categories);
257 } elseif ($action ==
'update_extras' && $permissiontoeditextra) {
260 $attribute_name =
GETPOST(
'attribute',
'aZ09');
263 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
269 $result =
$object->updateExtraField($attribute_name,
'PRODUCT_MODIFY');
277 $action =
'edit_extras';
279 } elseif ($action ==
'classin' && $usercancreate) {
284 if ($cancel == $langs->trans(
"Cancel")) {
289 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
292 $upload_dir =
$conf->stock->dir_output;
293 $permissiontoadd = $user->hasRight(
'stock',
'creer');
294 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
312$title = $langs->trans(
"WarehouseCard");
313if ($action ==
'create') {
314 $title = $langs->trans(
"NewWarehouse");
317$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
318llxHeader(
"", $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_card');
321if ($action ==
'create') {
326 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
327 print
'<input type="hidden" name="token" value="'.newToken().
'">';
328 print
'<input type="hidden" name="action" value="add">';
329 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
333 print
'<table class="border centpercent">';
336 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input class="width200" name="libelle" value=""></td></tr>';
338 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" size="40" value="'.(!empty(
$object->lieu) ?
$object->lieu :
'').
'"></td></tr>';
341 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
342 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET(
'fk_parent') ?
GETPOSTINT(
'fk_parent') :
'ifone'),
'fk_parent',
'', 1);
347 $langs->load(
'projects');
348 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
349 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), (
string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
350 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$socid.
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create&socid='.$socid).
'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans(
"AddProject").
'"></span></a>';
355 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
357 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
358 $doleditor =
new DolEditor(
'desc', (!empty(
$object->description) ?
$object->description :
''),
'', 180,
'dolibarr_notes',
'In', false, true,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
359 $doleditor->Create();
362 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
364 print
'</textarea></td></tr>';
367 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
368 print $formcompany->select_ziptown((!empty(
$object->zip) ?
$object->zip :
''),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
370 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
371 print $formcompany->select_ziptown((!empty(
$object->town) ?
$object->town :
''),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
375 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
376 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
377 print $form->select_country((!empty(
$object->country_id) ?
$object->country_id :
$mysoc->country_code),
'country_id');
379 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
384 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
385 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
386 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
387 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
389 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
390 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
398 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
399 print
'<select id="warehousestatus" name="statut" class="flat minwidth100">';
400 foreach (
$object->labelStatus as $key => $value) {
402 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
404 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
412 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
416 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
417 print $form->selectCategories(Categorie::TYPE_WAREHOUSE,
'categories', $object);
424 print $form->buttonsSaveCancel(
"Create");
429 if ($id > 0 || $ref) {
431 $result =
$object->fetch($id, $ref);
433 print
'No record found';
438 if ($action !=
'edit' && $action !=
're-edit') {
446 if ($action ==
'delete') {
447 $formquestion = array(
448 array(
'type' =>
'other',
'name' =>
'info',
'label' =>
img_warning(
'').$langs->trans(
"WarningThisWIllAlsoDeleteStock"),
'morecss' =>
'warning')
450 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteAWarehouse"), $langs->trans(
"ConfirmDeleteWarehouse",
$object->label),
"confirm_delete", $formquestion, 0, 2);
454 $parameters = array(
'context' =>
'warehousecard',
'formConfirm' => $formconfirm);
455 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
456 if (empty($reshook)) {
457 $formconfirm .= $hookmanager->resPrint;
458 } elseif ($reshook > 0) {
459 $formconfirm = $hookmanager->resPrint;
466 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
468 $morehtmlref =
'<div class="refidno">';
469 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.
$object->lieu;
473 $langs->load(
"projects");
474 $morehtmlref .=
'<br>'.img_picto(
'',
'project',
'class="pictofixedwidth"').
' '.$langs->trans(
'Project').
' ';
475 if ($usercancreate) {
476 if ($action !=
'classify') {
477 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
479 if ($action ==
'classify') {
480 $projectid =
$object->fk_project;
481 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
482 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
483 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
484 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), (
string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
485 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
486 $morehtmlref .=
'</form>';
488 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, ($socid > 0 ? $socid : -1), (
string)
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
491 if (!empty(
$object->fk_project)) {
493 $proj->fetch(
$object->fk_project);
494 $morehtmlref .=
' : '.$proj->getNomUrl(1);
496 $morehtmlref .=
' - '.$proj->title;
503 $morehtmlref .=
'</div>';
506 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
510 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
512 print
'<div class="fichecenter">';
513 print
'<div class="fichehalfleft">';
514 print
'<div class="underbanner clearboth"></div>';
516 print
'<table class="border centpercent tableforfield">';
520 if (!empty(
$object->fk_parent) && $parentwarehouse->fetch(
$object->fk_parent) > 0) {
521 print
'<tr><td>'.$langs->trans(
"ParentWarehouse").
'</td><td>';
522 print $parentwarehouse->getNomUrl(3);
529 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr(
$object->description).
'</td></tr>';
533 $labelusagestring =
$object->fields[
'warehouse_usage'][
'arrayofkeyval'][empty(
$object->warehouse_usage) ? 1 :
$object->warehouse_usage];
534 $labelusage = $labelusagestring ? $langs->trans($labelusagestring) :
'Unknown';
535 print
'<td class="titlefield tdtop">'.$langs->trans(
"WarehouseUsage").
'</td><td>'.
dol_htmlentitiesbr($labelusage).
'</td></tr>';
538 $calcproductsunique =
$object->nb_different_products();
539 $calcproducts =
$object->nb_products();
542 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
543 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
547 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
548 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
549 print empty($valtoshow) ?
'0' : $valtoshow;
555 print
'<div class="fichehalfright">';
556 print
'<div class="underbanner clearboth"></div>';
558 print
'<table class="border centpercent tableforfield">';
561 if ($usercancreadsupplierprice) {
562 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
563 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1,
$conf->currency);
568 if ($user->hasRight(
'stock',
'mouvement',
'lire')) {
569 $sql =
"SELECT max(m.datem) as datem";
570 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
571 $sql .=
" WHERE m.fk_entrepot = ".((int)
$object->id);
572 $lastmovementdate = 0;
573 $resqlbis =
$db->query($sql);
575 $obj =
$db->fetch_object($resqlbis);
576 $lastmovementdate =
$db->jdate($obj->datem);
580 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
581 if ($lastmovementdate) {
583 print
' ';
584 print
img_picto($langs->trans(
'LastMovement'),
'movement',
'class="pictofixedwidth"');
585 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?id='.
$object->id.
'">'.$langs->trans(
"FullList").
'</a>';
587 print $langs->trans(
"None");
593 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
597 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
598 print $form->showCategories(
$object->id, Categorie::TYPE_WAREHOUSE, 1);
607 print
'<div class="clearboth"></div>';
615 print
"<div class=\"tabsAction\">\n";
617 $parameters = array(
'context' =>
'warehousecard');
618 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
619 if (empty($reshook)) {
620 if (empty($action) || $action ==
'classin') {
621 if ($user->hasRight(
'stock',
'creer')) {
622 print
'<a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
624 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Modify").
'</a>';
627 if ($user->hasRight(
'stock',
'supprimer')) {
628 print
'<a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
630 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
'</a>';
649 print
'<div class="div-table-responsive">';
650 print
'<table class="noborder centpercent liste">';
651 print
'<tr class="liste_titre">';
652 $parameters = array(
'context' =>
'warehousecard',
'totalarray' => &
$totalarray);
653 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
654 print $hookmanager->resPrint;
669 if ($usercancreadsupplierprice) {
670 print_liste_field_titre($form->textwithpicto($langs->trans(
"AverageUnitPricePMPShort"), $langs->trans(
"AverageUnitPricePMPDesc")),
"",
"p.pmp",
"",
"&id=".$object->id,
'', $sortfield, $sortorder,
'right ');
689 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
693 if ($user->hasRight(
'stock',
'creer')) {
698 $parameters = array(
'context' =>
'warehousecard',
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
699 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
700 print $hookmanager->resPrint;
704 $totalvalue = $totalvaluesell = 0;
707 $separatedPMP =
false;
709 $separatedPMP =
true;
712 $sql =
"SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,";
713 $sql .=
"p.tosell, p.tobuy,";
714 $sql .=
"p.accountancy_code_sell,";
715 $sql .=
"p.accountancy_code_sell_intra,";
716 $sql .=
"p.accountancy_code_sell_export,";
717 $sql .=
"p.accountancy_code_buy,";
718 $sql .=
"p.accountancy_code_buy_intra,";
719 $sql .=
"p.accountancy_code_buy_export,";
720 $sql .=
'p.barcode,';
722 $sql .=
" pa.pmp as ppmp,";
724 $sql .=
" p.pmp as ppmp,";
726 $sql .=
" ps.reel as value";
730 $sql .=
", (ps.reel * p.pmp) as svalue";
732 $parameters = array(
'context' =>
'warehousecard');
733 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
737 $sql .= $hookmanager->resPrint;
738 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
741 $sql .=
", ".MAIN_DB_PREFIX.
"product_perentity as pa";
743 $parameters = array(
'context' =>
'warehousecard');
744 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters);
748 $sql .= $hookmanager->resPrint;
750 $sql .=
" WHERE ps.fk_product = p.rowid";
751 $sql .=
" AND ps.reel <> 0";
752 $sql .=
" AND ps.fk_entrepot = ".((int)
$object->id);
755 $sql .=
" AND pa.fk_product = p.rowid AND pa.entity = ".(int)
$conf->entity;
757 $parameters = array(
'context' =>
'warehousecard');
758 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
762 $sql .= $hookmanager->resPrint;
764 $sql .=
$db->order($sortfield, $sortorder);
767 $resql =
$db->query($sql);
769 $num =
$db->num_rows($resql);
775 $objp =
$db->fetch_object($resql);
779 $sql =
"SELECT label";
780 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
781 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
782 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
785 $result =
$db->query($sql);
787 $objtp =
$db->fetch_object($result);
788 if (isset($objtp->label) && $objtp->label !=
'') {
789 $objp->produit = $objtp->label;
795 print
'<tr class="oddeven">';
797 $productstatic->id = $objp->rowid;
798 $productstatic->ref = $objp->ref;
799 $productstatic->label = $objp->produit;
800 $productstatic->type = $objp->type;
801 $productstatic->entity = $objp->entity;
802 $productstatic->status_batch = $objp->tobatch;
804 $productstatic->fk_unit = $objp->fk_unit;
806 $productstatic->status = $objp->tosell;
807 $productstatic->status_buy = $objp->tobuy;
808 $productstatic->barcode = $objp->barcode;
809 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
810 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
811 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
812 $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
813 $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
814 $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
818 print $productstatic->getNomUrl(1,
'stock', 16);
822 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).
'">'.
dol_escape_htmltag($objp->produit).
'</td>';
825 print
'<td class="right">';
827 print empty($valtoshow) ?
'0' : $valtoshow;
829 $totalunit += $objp->value;
833 print
'<td align="left">';
834 if (is_null($productstatic->fk_unit)) {
835 $productstatic->fk_unit = 1;
837 print $productstatic->getLabelOfUnit(
'long', $langs);
840 if ($usercancreadsupplierprice) {
842 print
'<td class="right nowraponall">'.price(
price2num($objp->ppmp,
'MU')).
'</td>';
845 print
'<td class="right amount nowraponall">'.price(
price2num($objp->ppmp * $objp->value,
'MT')).
'</td>';
846 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
851 $pricemin = $objp->price;
852 print
'<td class="right">';
856 print
'<td class="right">';
860 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
863 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
864 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.
$object->id.
'&id='.$objp->rowid.
'&action=transfer&token='.newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
865 print
img_picto($langs->trans(
"TransferStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
866 print $langs->trans(
"TransferStock");
871 if ($user->hasRight(
'stock',
'creer')) {
872 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.
$object->id.
'&id='.$objp->rowid.
'&action=correction&token='.newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
873 print
img_picto($langs->trans(
"CorrectStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
874 print $langs->trans(
"CorrectStock");
878 $parameters = array(
'context' =>
'warehousecard',
'obj' => $objp,
'totalarray' => &
$totalarray);
879 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
880 print $hookmanager->resPrint;
887 $units = $productstatic->fk_unit;
888 } elseif ($productstatic->fk_unit != $units) {
900 $totalarray[
'val'][
'units'] = $productstatic->getLabelOfUnit(
'long', $langs);
902 $parameters = array(
'context' =>
'warehousecard',
'totalarray' => &
$totalarray);
904 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters, $object);
910 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
920 if ($action ==
'edit' || $action ==
're-edit') {
921 $langs->trans(
"WarehouseEdit");
923 print
'<form action="card.php" method="POST">';
924 print
'<input type="hidden" name="token" value="'.newToken().
'">';
925 print
'<input type="hidden" name="action" value="update">';
926 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
932 print
'<table class="border centpercent">';
935 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value="'.
$object->label.
'"></td></tr>';
937 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" class="minwidth300" value="'.
$object->lieu.
'"></td></tr>';
940 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
941 print $formproduct->selectWarehouses(
$object->fk_parent,
'fk_parent',
'', 1);
946 $projectid =
$object->fk_project;
947 $langs->load(
'projects');
948 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
949 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), (
string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
950 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.($socid > 0 ? $socid :
"").
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create'.($socid > 0 ?
'&socid='.$socid :
"")).
'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans(
"AddProject").
'"></span></a>';
955 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
957 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
958 $doleditor =
new DolEditor(
'desc',
$object->description,
'', 180,
'dolibarr_notes',
'In',
false,
true,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
959 $doleditor->Create();
962 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
964 print
'</textarea></td></tr>';
967 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
968 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
970 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
971 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
975 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
976 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
977 print $form->select_country(
$object->country_id ?
$object->country_id :
$mysoc->country_code,
'country_id');
979 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
984 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
985 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
986 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
987 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td><td>';
988 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
989 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
992 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
993 print
'<select id="warehousestatus" name="statut" class="flat">';
994 foreach (
$object->labelStatus as $key => $value) {
996 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
998 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
1007 $parameters = array(
'context' =>
'warehousecard',
'colspan' =>
' colspan="3"',
'cols' =>
'3');
1008 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1009 print $hookmanager->resPrint;
1010 if (empty($reshook)) {
1011 print
$object->showOptionals($extrafields,
'edit', $parameters);
1016 print
'<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1017 print $form->selectCategories(Categorie::TYPE_WAREHOUSE,
'categories', $object);
1025 print $form->buttonsSaveCancel();
1036$modulepart =
'stock';
1038if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
1040 print
'<div class="fichecenter"><div class="fichehalfleft">';
1041 print
'<a name="builddoc"></a>';
1045 $relativepath =
$object->ref.
'/'.$objectref.
'.pdf';
1046 $filedir =
$conf->stock->dir_output.
'/'.$objectref;
1047 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1048 $genallowed = $usercanread;
1049 $delallowed = $usercancreate;
1050 $modulepart =
'stock';
1052 print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'',
'',
'',
'',
'', $object);
1053 $somethingshown = $formfile->numoffiles;
1055 print
'</div><div class="fichehalfright">';
1059 $morehtmlcenter =
'';
1063 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1065 $somethingshown = $formactions->showactions($object,
'stock', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1067 print
'</div></div>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage products or services.
Class to manage projects.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
stock_prepare_head($object)
Prepare array with list of tabs.