32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
42 if (!empty($conf->project->enabled)) {
43 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
48 $langs->loadLangs(array(
'products',
'stocks',
'companies',
'categories'));
50 $action =
GETPOST(
'action',
'aZ09');
51 $cancel =
GETPOST(
'cancel',
'alpha');
53 $projectid =
GETPOST(
'projectid',
'int');
56 $socid =
GETPOST(
'socid',
'int');
59 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
60 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68 $backtopage =
GETPOST(
'backtopage',
'alpha');
75 $hookmanager->initHooks(array(
'warehousecard',
'globalcard'));
81 $extrafields->fetch_name_optionals_label($object->table_element);
84 if ($id > 0 || !empty($ref)) {
85 $ret = $object->fetch($id, $ref);
92 $usercanread = (($user->rights->stock->lire));
93 $usercancreate = (($user->rights->stock->creer));
94 $usercandelete = (($user->rights->stock->supprimer));
104 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
108 if (empty($reshook)) {
109 $backurlforlist = DOL_URL_ROOT.
'/product/stock/list.php';
111 if (empty($backtopage) || ($cancel && empty($id))) {
112 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
113 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
114 $backtopage = $backurlforlist;
116 $backtopage = DOL_URL_ROOT.
'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
122 if (!empty($backtopageforcancel)) {
123 header(
"Location: ".$backtopageforcancel);
125 } elseif (!empty($backtopage)) {
126 header(
"Location: ".$backtopage);
133 if ($action ==
'add' && $user->rights->stock->creer) {
134 $object->ref = (string)
GETPOST(
"ref",
"alpha");
135 $object->fk_parent = (int)
GETPOST(
"fk_parent",
"int");
136 $object->fk_project =
GETPOST(
'projectid',
'int');
137 $object->label = (string)
GETPOST(
"libelle",
"alpha");
138 $object->description = (string)
GETPOST(
"desc",
"alpha");
139 $object->statut =
GETPOST(
"statut",
"int");
140 $object->lieu = (string)
GETPOST(
"lieu",
"alpha");
141 $object->address = (string)
GETPOST(
"address",
"alpha");
142 $object->zip = (string)
GETPOST(
"zipcode",
"alpha");
143 $object->town = (string)
GETPOST(
"town",
"alpha");
144 $object->country_id =
GETPOST(
"country_id");
145 $object->phone = (string)
GETPOST(
"phone",
"alpha");
146 $object->fax = (string)
GETPOST(
"fax",
"alpha");
148 if (!empty($object->label)) {
150 $ret = $extrafields->setOptionalsFromPost(
null, $object);
157 $id = $object->create($user);
161 $categories =
GETPOST(
'categories',
'array');
162 $object->setCategories($categories);
163 if (!empty($backtopage)) {
164 $backtopage = str_replace(
"__ID__", $id, $backtopage);
165 header(
"Location: ".$backtopage);
168 header(
"Location: card.php?id=".urlencode($id));
177 setEventMessages($langs->trans(
"ErrorWarehouseRefRequired"),
null,
'errors');
183 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->stock->supprimer) {
184 $object->fetch(
GETPOST(
'id',
'int'));
185 $result = $object->delete($user);
188 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1');
197 if ($action ==
'update' && !$cancel) {
198 if ($object->fetch($id)) {
199 $object->label =
GETPOST(
"libelle");
200 $object->fk_parent =
GETPOST(
"fk_parent");
201 $object->fk_project =
GETPOST(
'projectid');
202 $object->description =
GETPOST(
"desc");
203 $object->statut =
GETPOST(
"statut");
204 $object->lieu =
GETPOST(
"lieu");
205 $object->address =
GETPOST(
"address");
206 $object->zip =
GETPOST(
"zipcode");
207 $object->town =
GETPOST(
"town");
208 $object->country_id =
GETPOST(
"country_id");
209 $object->phone =
GETPOST(
"phone");
213 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
219 $ret = $object->update($id, $user);
229 $categories =
GETPOST(
'categories',
'array');
230 $object->setCategories($categories);
237 } elseif ($action ==
'update_extras') {
241 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
246 $result = $object->insertExtraFields();
253 $action =
'edit_extras';
255 } elseif ($action ==
'classin' && $usercancreate) {
257 $object->setProject(
GETPOST(
'projectid',
'int'));
260 if ($cancel == $langs->trans(
"Cancel")) {
266 $upload_dir = $conf->stock->dir_output;
267 $permissiontoadd = $user->rights->stock->creer;
268 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
276 $productstatic =
new Product($db);
281 if (!empty($conf->project->enabled)) {
285 $title = $langs->trans(
"WarehouseCard");
286 if ($action ==
'create') {
287 $title = $langs->trans(
"NewWarehouse");
290 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
294 if ($action ==
'create') {
299 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
300 print
'<input type="hidden" name="token" value="'.newToken().
'">';
301 print
'<input type="hidden" name="action" value="add">';
302 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
306 print
'<table class="border centpercent">';
309 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value=""></td></tr>';
311 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" size="40" value="'.(!empty($object->lieu) ? $object->lieu :
'').
'"></td></tr>';
314 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
315 print
img_picto(
'',
'stock').$formproduct->selectWarehouses((
GETPOSTISSET(
'fk_parent') ?
GETPOST(
'fk_parent',
'int') :
'ifone'),
'fk_parent',
'', 1);
319 if (!empty($conf->project->enabled)) {
320 $langs->load(
'projects');
321 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
322 print
img_picto(
'',
'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
323 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>';
328 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
330 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
331 $doleditor =
new DolEditor(
'desc', (!empty($object->description) ? $object->description :
''),
'', 180,
'dolibarr_notes',
'In',
false,
true, empty($conf->fckeditor->enabled) ?
'' : $conf->fckeditor->enabled, ROWS_5,
'90%');
332 $doleditor->Create();
335 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
336 print (!empty($object->address) ? $object->address :
'');
337 print
'</textarea></td></tr>';
340 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
341 print $formcompany->select_ziptown((!empty($object->zip) ? $object->zip :
''),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
343 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
344 print $formcompany->select_ziptown((!empty($object->town) ? $object->town :
''),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
348 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
349 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
350 print
$form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code),
'country_id');
352 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
357 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
358 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
359 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
360 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
362 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
363 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
366 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
367 print
'<select id="warehousestatus" name="statut" class="flat">';
368 foreach ($object->statuts as $key => $value) {
370 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
372 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
380 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
384 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
385 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_WAREHOUSE,
'',
'parent', 64, 0, 1);
386 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo,
GETPOST(
'categories',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
393 print
$form->buttonsSaveCancel(
"Create");
398 if ($id > 0 || $ref) {
400 $result = $object->fetch($id, $ref);
402 print
'No record found';
409 if ($action <>
'edit' && $action <>
're-edit') {
417 if ($action ==
'delete') {
418 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAWarehouse"), $langs->trans(
"ConfirmDeleteWarehouse", $object->label),
"confirm_delete",
'', 0, 2);
423 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
424 if (empty($reshook)) {
426 } elseif ($reshook > 0) {
434 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
436 $morehtmlref =
'<div class="refidno">';
437 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.$object->lieu;
440 if (!empty($conf->project->enabled)) {
441 $langs->load(
"projects");
442 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
443 if ($usercancreate) {
444 if ($action !=
'classify') {
445 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
447 if ($action ==
'classify') {
448 $projectid = $object->fk_project;
449 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
450 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
451 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
452 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
453 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
454 $morehtmlref .=
'</form>';
456 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, ($socid > 0 ? $socid : -1), $object->fk_project,
'none', 0, 0, 0, 1);
459 if (!empty($object->fk_project)) {
461 $proj->fetch($object->fk_project);
462 $morehtmlref .=
' : '.$proj->getNomUrl(1);
464 $morehtmlref .=
' - '.$proj->title;
471 $morehtmlref .=
'</div>';
474 if ($user->socid && !in_array(
'stock', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
478 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
480 print
'<div class="fichecenter">';
481 print
'<div class="fichehalfleft">';
482 print
'<div class="underbanner clearboth"></div>';
484 print
'<table class="border centpercent tableforfield">';
487 $parentwarehouse =
new Entrepot($db);
488 if (!empty($object->fk_parent) && $parentwarehouse->fetch($object->fk_parent) > 0) {
489 print
'<tr><td>'.$langs->trans(
"ParentWarehouse").
'</td><td>';
490 print $parentwarehouse->getNomUrl(3);
497 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr($object->description).
'</td></tr>';
499 $calcproductsunique = $object->nb_different_products();
500 $calcproducts = $object->nb_products();
503 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
504 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
508 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
509 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
510 print empty($valtoshow) ?
'0' : $valtoshow;
516 print
'<div class="fichehalfright">';
517 print
'<div class="underbanner clearboth"></div>';
519 print
'<table class="border centpercent tableforfield">';
522 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
523 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
527 if (!empty($user->rights->stock->mouvement->lire)) {
528 $sql =
"SELECT max(m.datem) as datem";
529 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
530 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
531 $resqlbis = $db->query($sql);
533 $obj = $db->fetch_object($resqlbis);
534 $lastmovementdate = $db->jdate($obj->datem);
538 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
539 if ($lastmovementdate) {
541 print
' ';
542 print
img_picto($langs->trans(
'LastMovement'),
'movement',
'class="pictofixedwidth"');
543 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?id='.$object->id.
'">'.$langs->trans(
"FullList").
'</a>';
545 print $langs->trans(
"None");
551 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
555 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
556 print
$form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
565 print
'<div class="clearboth"></div>';
573 print
"<div class=\"tabsAction\">\n";
576 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
577 if (empty($reshook)) {
578 if (empty($action) || $action ==
'classin') {
579 if ($user->rights->stock->creer) {
580 print
'<a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
582 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Modify").
'</a>';
585 if ($user->rights->stock->supprimer) {
586 print
'<a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
588 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
'</a>';
603 print
'<table class="noborder centpercent">';
604 print
"<tr class=\"liste_titre\">";
606 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle',
$parameters);
607 print $hookmanager->resPrint;
610 print_liste_field_titre(
"NumberOfUnit",
"",
"ps.reel",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
611 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
614 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"AverageUnitPricePMPShort"), $langs->trans(
"AverageUnitPricePMPDesc")),
"",
"p.pmp",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
615 print_liste_field_titre(
"EstimatedStockValueShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
616 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
617 print_liste_field_titre(
"SellPriceMin",
"",
"p.price",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
619 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
620 print_liste_field_titre(
"EstimatedStockValueSellShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
622 if ($user->rights->stock->mouvement->creer) {
625 if ($user->rights->stock->creer) {
629 $parameters = array(
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
630 $reshook = $hookmanager->executeHooks(
'printFieldListTitle',
$parameters);
631 print $hookmanager->resPrint;
635 $totalvalue = $totalvaluesell = 0;
638 $separatedPMP =
false;
639 if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
640 $separatedPMP =
true;
643 $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,";
644 $sql .=
"p.tosell, p.tobuy,";
645 $sql .=
"p.accountancy_code_sell,";
646 $sql .=
"p.accountancy_code_sell_intra,";
647 $sql .=
"p.accountancy_code_sell_export,";
648 $sql .=
"p.accountancy_code_buy,";
649 $sql .=
"p.accountancy_code_buy_intra,";
650 $sql .=
"p.accountancy_code_buy_export,";
651 $sql .=
'p.barcode,';
653 $sql .=
" pa.pmp as ppmp,";
655 $sql .=
" p.pmp as ppmp,";
657 $sql .=
" ps.reel as value";
658 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
663 $reshook = $hookmanager->executeHooks(
'printFieldListSelect',
$parameters);
667 $sql .= $hookmanager->resPrint;
668 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
671 $sql .=
", ".MAIN_DB_PREFIX.
"product_perentity as pa";
674 $sql .=
" WHERE ps.fk_product = p.rowid";
675 $sql .=
" AND ps.reel <> 0";
676 $sql .=
" AND ps.fk_entrepot = ".((int) $object->id);
679 $sql .=
" AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
682 $sql .= $db->order($sortfield, $sortorder);
685 $resql = $db->query($sql);
687 $num = $db->num_rows(
$resql);
692 $objp = $db->fetch_object(
$resql);
696 $sql =
"SELECT label";
697 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
698 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
699 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
702 $result = $db->query($sql);
704 $objtp = $db->fetch_object($result);
705 if ($objtp->label !=
'') {
706 $objp->produit = $objtp->label;
712 print
'<tr class="oddeven">';
715 $reshook = $hookmanager->executeHooks(
'printFieldListValue',
$parameters);
716 print $hookmanager->resPrint;
718 $productstatic->id = $objp->rowid;
719 $productstatic->ref = $objp->ref;
720 $productstatic->label = $objp->produit;
721 $productstatic->type = $objp->type;
722 $productstatic->entity = $objp->entity;
723 $productstatic->status_batch = $objp->tobatch;
724 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
725 $productstatic->fk_unit = $objp->fk_unit;
727 $productstatic->status = $objp->tosell;
728 $productstatic->status_buy = $objp->tobuy;
729 $productstatic->barcode = $objp->barcode;
730 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
731 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
732 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
733 $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
734 $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
735 $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
738 print $productstatic->getNomUrl(1,
'stock', 16);
742 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).
'">'.
dol_escape_htmltag($objp->produit).
'</td>';
744 print
'<td class="right">';
746 print empty($valtoshow) ?
'0' : $valtoshow;
748 $totalunit += $objp->value;
750 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
752 print
'<td align="left">';
753 if (is_null($productstatic->fk_unit)) {
754 $productstatic->fk_unit = 1;
756 print $langs->trans($productstatic->getLabelOfUnit());
760 print
'<td class="right nowraponall">'.price(
price2num($objp->ppmp,
'MU')).
'</td>';
763 print
'<td class="right amount nowraponall">'.price(
price2num($objp->ppmp * $objp->value,
'MT')).
'</td>';
764 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
767 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
768 $pricemin = $objp->price;
769 print
'<td class="right">';
773 print
'<td class="right">';
777 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
779 if ($user->rights->stock->mouvement->creer) {
780 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.$object->id.
'&id='.$objp->rowid.
'&action=transfert&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
781 print
img_picto($langs->trans(
"TransferStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
782 print $langs->trans(
"TransferStock");
786 if ($user->rights->stock->creer) {
787 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.$object->id.
'&id='.$objp->rowid.
'&action=correction&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
788 print
img_picto($langs->trans(
"CorrectStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
789 print $langs->trans(
"CorrectStock");
793 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
795 $units = $productstatic->fk_unit;
796 } elseif ($productstatic->fk_unit != $units) {
807 print
'<tr class="liste_total"><td class="liste_total" colspan="2">'.$langs->trans(
"Total").
'</td>';
808 print
'<td class="liste_total right">';
809 $valtoshow =
price2num($totalunit,
'MS');
810 if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) {
811 print empty($valtoshow) ?
'0' : $valtoshow;
814 print
'<td class="liste_total">';
815 if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) {
816 print $langs->trans($productstatic->getLabelOfUnit());
819 print
'<td class="liste_total right">'.price(
price2num($totalvalue,
'MT')).
'</td>';
820 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
821 print
'<td class="liste_total"> </td>';
822 print
'<td class="liste_total right">'.price(
price2num($totalvaluesell,
'MT')).
'</td>';
825 if ($user->rights->stock->mouvement->creer) {
826 print
'<td class="liste_total"> </td>';
829 if ($user->rights->stock->creer) {
830 print
'<td class="liste_total"> </td>';
844 if ($action ==
'edit' || $action ==
're-edit') {
845 $langs->trans(
"WarehouseEdit");
847 print
'<form action="card.php" method="POST">';
848 print
'<input type="hidden" name="token" value="'.newToken().
'">';
849 print
'<input type="hidden" name="action" value="update">';
850 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
856 print
'<table class="border centpercent">';
859 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value="'.$object->label.
'"></td></tr>';
861 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.
'"></td></tr>';
864 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
865 print $formproduct->selectWarehouses($object->fk_parent,
'fk_parent',
'', 1);
869 if (!empty($conf->project->enabled)) {
870 $projectid = $object->fk_project;
871 $langs->load(
'projects');
872 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
873 print
img_picto(
'',
'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
874 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>';
879 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
881 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
882 $doleditor =
new DolEditor(
'desc', $object->description,
'', 180,
'dolibarr_notes',
'In',
false,
true, $conf->fckeditor->enabled, ROWS_5,
'90%');
883 $doleditor->Create();
886 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
887 print $object->address;
888 print
'</textarea></td></tr>';
891 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
892 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
894 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
895 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
899 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
900 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
901 print
$form->select_country($object->country_id ? $object->country_id : $mysoc->country_code,
'country_id');
903 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
908 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
909 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
910 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
911 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td><td>';
912 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
913 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
916 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
917 print
'<select id="warehousestatus" name="statut" class="flat">';
918 foreach ($object->statuts as $key => $value) {
919 if ($key == $object->statut) {
920 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
922 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
931 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
932 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
933 print $hookmanager->resPrint;
934 if (empty($reshook)) {
935 print $object->showOptionals($extrafields,
'edit',
$parameters);
940 print
'<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
941 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_WAREHOUSE,
'',
'parent', 64, 0, 1);
943 $cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
944 $arrayselected = array();
945 foreach ($cats as $cat) {
946 $arrayselected[] = $cat->id;
948 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
956 print
$form->buttonsSaveCancel();
967 $modulepart =
'stock';
969 if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
971 print
'<div class="fichecenter"><div class="fichehalfleft">';
972 print
'<a name="builddoc"></a>';
976 $relativepath = $object->ref.
'/'.$objectref.
'.pdf';
977 $filedir = $conf->stock->dir_output.
'/'.$objectref;
978 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
979 $genallowed = $usercanread;
980 $delallowed = $usercancreate;
981 $modulepart =
'stock';
983 print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0,
'', 0,
'',
'',
'', $object);
984 $somethingshown = $formfile->numoffiles;
986 print
'</div><div class="fichehalfright">';
990 $morehtmlcenter =
'';
994 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
996 $somethingshown =
$formactions->showactions($object,
'stock', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
998 print
'</div></div>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif($action=='specimen') elseif($action=='setmodel') elseif($action=='del') elseif($action=='setdoc') $formactions
View.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage products or services.
Class to manage projects.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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...
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.