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';
44if (isModEnabled(
'project')) {
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'));
94$extrafields->fetch_name_optionals_label(
$object->table_element);
97if ($id > 0 || !empty($ref)) {
98 $ret =
$object->fetch($id, $ref);
105$usercanread = $user->hasRight(
'stock',
'lire');
106$usercancreate = $user->hasRight(
'stock',
'creer');
107$usercandelete = $user->hasRight(
'stock',
'supprimer');
108$permissiontoeditextra = $usercancreate;
109if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
111 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
121$parameters = array(
'context' =>
'warehousecard',
'id' => $id,
'ref' => $ref);
122$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
126if (empty($reshook)) {
127 $backurlforlist = DOL_URL_ROOT.
'/product/stock/list.php';
129 if (empty($backtopage) || ($cancel && empty($id))) {
130 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
131 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
132 $backtopage = $backurlforlist;
134 $backtopage = DOL_URL_ROOT.
'/product/stock/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
140 if (!empty($backtopageforcancel)) {
141 header(
"Location: ".$backtopageforcancel);
143 } elseif (!empty($backtopage)) {
144 header(
"Location: ".$backtopage);
151 if ($action ==
'add' && $user->hasRight(
'stock',
'creer')) {
168 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
179 $categories =
GETPOST(
'categories',
'array');
180 $object->setCategories($categories);
181 if (!empty($backtopage)) {
182 $backtopage = str_replace(
"__ID__", (
string) $id, $backtopage);
183 header(
"Location: ".$backtopage);
186 header(
"Location: card.php?id=".urlencode((
string) ($id)));
195 setEventMessages($langs->trans(
"ErrorWarehouseRefRequired"),
null,
'errors');
201 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'stock',
'supprimer')) {
203 $result =
$object->delete($user);
206 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1');
215 if ($action ==
'update' && !$cancel && $user->hasRight(
'stock',
'creer')) {
231 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
237 $ret =
$object->update($id, $user);
247 $categories =
GETPOST(
'categories',
'array');
248 $object->setCategories($categories);
255 } elseif ($action ==
'update_extras' && $permissiontoeditextra) {
258 $attribute_name =
GETPOST(
'attribute',
'aZ09');
261 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
267 $result =
$object->updateExtraField($attribute_name,
'PRODUCT_MODIFY');
275 $action =
'edit_extras';
277 } elseif ($action ==
'classin' && $usercancreate) {
282 if ($cancel == $langs->trans(
"Cancel")) {
288 $upload_dir =
$conf->stock->dir_output;
289 $permissiontoadd = $user->hasRight(
'stock',
'creer');
290 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
298$productstatic =
new Product($db);
299$form =
new Form($db);
304if (isModEnabled(
'project')) {
308$title = $langs->trans(
"WarehouseCard");
309if ($action ==
'create') {
310 $title = $langs->trans(
"NewWarehouse");
313$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
314llxHeader(
"", $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_card');
317if ($action ==
'create') {
322 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
323 print
'<input type="hidden" name="token" value="'.newToken().
'">';
324 print
'<input type="hidden" name="action" value="add">';
325 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
329 print
'<table class="border centpercent">';
332 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input class="width200" name="libelle" value=""></td></tr>';
334 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" size="40" value="'.(!empty(
$object->lieu) ?
$object->lieu :
'').
'"></td></tr>';
337 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
338 print
img_picto(
'',
'stock').$formproduct->selectWarehouses((GETPOSTISSET(
'fk_parent') ?
GETPOSTINT(
'fk_parent') :
'ifone'),
'fk_parent',
'', 1);
342 if (isModEnabled(
'project') && $formproject !==
null) {
343 $langs->load(
'projects');
344 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
345 print
img_picto(
'',
'project').$formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
346 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>';
351 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
353 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
354 $doleditor =
new DolEditor(
'desc', (!empty(
$object->description) ?
$object->description :
''),
'', 180,
'dolibarr_notes',
'In', false, true, isModEnabled(
'fckeditor'), ROWS_5,
'90%');
355 $doleditor->Create();
358 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
360 print
'</textarea></td></tr>';
363 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
364 print $formcompany->select_ziptown((!empty(
$object->zip) ?
$object->zip :
''),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
366 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
367 print $formcompany->select_ziptown((!empty(
$object->town) ?
$object->town :
''),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
371 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
372 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
373 print $form->select_country((!empty(
$object->country_id) ?
$object->country_id : $mysoc->country_code),
'country_id');
375 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
380 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td><td>';
381 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
382 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
383 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
385 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
386 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
394 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
395 print
'<select id="warehousestatus" name="statut" class="flat minwidth100">';
396 foreach (
$object->labelStatus as $key => $value) {
398 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
400 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
408 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
410 if (isModEnabled(
'category')) {
412 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
413 print $form->selectCategories(Categorie::TYPE_WAREHOUSE,
'categories',
$object);
420 print $form->buttonsSaveCancel(
"Create");
425 if ($id > 0 || $ref) {
427 $result =
$object->fetch($id, $ref);
429 print
'No record found';
434 if ($action !=
'edit' && $action !=
're-edit') {
442 if ($action ==
'delete') {
443 $formquestion = array(
444 array(
'type' =>
'other',
'name' =>
'info',
'label' =>
img_warning(
'').$langs->trans(
"WarningThisWIllAlsoDeleteStock"),
'morecss' =>
'warning')
446 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteAWarehouse"), $langs->trans(
"ConfirmDeleteWarehouse",
$object->label),
"confirm_delete", $formquestion, 0, 2);
450 $parameters = array(
'context' =>
'warehousecard',
'formConfirm' => $formconfirm);
451 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
452 if (empty($reshook)) {
453 $formconfirm .= $hookmanager->resPrint;
454 } elseif ($reshook > 0) {
455 $formconfirm = $hookmanager->resPrint;
462 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
464 $morehtmlref =
'<div class="refidno">';
465 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.
$object->lieu;
468 if (isModEnabled(
'project') && $formproject !==
null) {
469 $langs->load(
"projects");
470 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
471 if ($usercancreate) {
472 if ($action !=
'classify') {
473 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
475 if ($action ==
'classify') {
476 $projectid =
$object->fk_project;
477 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
478 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
479 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
480 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
481 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
482 $morehtmlref .=
'</form>';
484 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, ($socid > 0 ? $socid : -1), (string)
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
487 if (!empty(
$object->fk_project)) {
489 $proj->fetch(
$object->fk_project);
490 $morehtmlref .=
' : '.$proj->getNomUrl(1);
492 $morehtmlref .=
' - '.$proj->title;
499 $morehtmlref .=
'</div>';
502 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
506 dol_banner_tab(
$object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
508 print
'<div class="fichecenter">';
509 print
'<div class="fichehalfleft">';
510 print
'<div class="underbanner clearboth"></div>';
512 print
'<table class="border centpercent tableforfield">';
515 $parentwarehouse =
new Entrepot($db);
516 if (!empty(
$object->fk_parent) && $parentwarehouse->fetch(
$object->fk_parent) > 0) {
517 print
'<tr><td>'.$langs->trans(
"ParentWarehouse").
'</td><td>';
518 print $parentwarehouse->getNomUrl(3);
525 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr(
$object->description).
'</td></tr>';
529 $labelusagestring =
$object->fields[
'warehouse_usage'][
'arrayofkeyval'][empty(
$object->warehouse_usage) ? 1 :
$object->warehouse_usage];
530 $labelusage = $labelusagestring ? $langs->trans($labelusagestring) :
'Unknown';
531 print
'<td class="titlefield tdtop">'.$langs->trans(
"WarehouseUsage").
'</td><td>'.
dol_htmlentitiesbr($labelusage).
'</td></tr>';
534 $calcproductsunique =
$object->nb_different_products();
535 $calcproducts =
$object->nb_products();
538 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
539 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
543 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
544 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
545 print empty($valtoshow) ?
'0' : $valtoshow;
551 print
'<div class="fichehalfright">';
552 print
'<div class="underbanner clearboth"></div>';
554 print
'<table class="border centpercent tableforfield">';
557 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
558 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1,
$conf->currency);
562 if ($user->hasRight(
'stock',
'mouvement',
'lire')) {
563 $sql =
"SELECT max(m.datem) as datem";
564 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
565 $sql .=
" WHERE m.fk_entrepot = ".((int)
$object->id);
566 $lastmovementdate = 0;
567 $resqlbis = $db->query($sql);
569 $obj = $db->fetch_object($resqlbis);
570 $lastmovementdate = $db->jdate($obj->datem);
574 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
575 if ($lastmovementdate) {
577 print
' ';
578 print
img_picto($langs->trans(
'LastMovement'),
'movement',
'class="pictofixedwidth"');
579 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?id='.
$object->id.
'">'.$langs->trans(
"FullList").
'</a>';
581 print $langs->trans(
"None");
587 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
590 if (isModEnabled(
'category')) {
591 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
592 print $form->showCategories(
$object->id, Categorie::TYPE_WAREHOUSE, 1);
601 print
'<div class="clearboth"></div>';
609 print
"<div class=\"tabsAction\">\n";
611 $parameters = array(
'context' =>
'warehousecard');
612 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
613 if (empty($reshook)) {
614 if (empty($action) || $action ==
'classin') {
615 if ($user->hasRight(
'stock',
'creer')) {
616 print
'<a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
618 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Modify").
'</a>';
621 if ($user->hasRight(
'stock',
'supprimer')) {
622 print
'<a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
624 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
'</a>';
643 print
'<div class="div-table-responsive">';
644 print
'<table class="noborder centpercent liste">';
645 print
'<tr class="liste_titre">';
646 $parameters = array(
'context' =>
'warehousecard',
'totalarray' => &
$totalarray);
647 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
648 print $hookmanager->resPrint;
652 print_liste_field_titre(
"NumberOfUnit",
"",
"ps.reel",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
664 print_liste_field_titre($form->textwithpicto($langs->trans(
"AverageUnitPricePMPShort"), $langs->trans(
"AverageUnitPricePMPDesc")),
"",
"p.pmp",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
667 print_liste_field_titre(
"EstimatedStockValueShort",
"",
"svalue",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
674 print_liste_field_titre(
"SellPriceMin",
"",
"p.price",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
678 print_liste_field_titre(
"EstimatedStockValueSellShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
683 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
687 if ($user->hasRight(
'stock',
'creer')) {
692 $parameters = array(
'context' =>
'warehousecard',
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
693 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
694 print $hookmanager->resPrint;
698 $totalvalue = $totalvaluesell = 0;
701 $separatedPMP =
false;
703 $separatedPMP =
true;
706 $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,";
707 $sql .=
"p.tosell, p.tobuy,";
708 $sql .=
"p.accountancy_code_sell,";
709 $sql .=
"p.accountancy_code_sell_intra,";
710 $sql .=
"p.accountancy_code_sell_export,";
711 $sql .=
"p.accountancy_code_buy,";
712 $sql .=
"p.accountancy_code_buy_intra,";
713 $sql .=
"p.accountancy_code_buy_export,";
714 $sql .=
'p.barcode,';
716 $sql .=
" pa.pmp as ppmp,";
718 $sql .=
" p.pmp as ppmp,";
720 $sql .=
" ps.reel as value";
724 $sql .=
", (ps.reel * p.pmp) as svalue";
726 $parameters = array(
'context' =>
'warehousecard');
727 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
731 $sql .= $hookmanager->resPrint;
732 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
735 $sql .=
", ".MAIN_DB_PREFIX.
"product_perentity as pa";
737 $parameters = array(
'context' =>
'warehousecard');
738 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters);
742 $sql .= $hookmanager->resPrint;
744 $sql .=
" WHERE ps.fk_product = p.rowid";
745 $sql .=
" AND ps.reel <> 0";
746 $sql .=
" AND ps.fk_entrepot = ".((int)
$object->id);
749 $sql .=
" AND pa.fk_product = p.rowid AND pa.entity = ".(int)
$conf->entity;
751 $parameters = array(
'context' =>
'warehousecard');
752 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
756 $sql .= $hookmanager->resPrint;
758 $sql .= $db->order($sortfield, $sortorder);
761 $resql = $db->query($sql);
763 $num = $db->num_rows($resql);
769 $objp = $db->fetch_object($resql);
773 $sql =
"SELECT label";
774 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
775 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
776 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
779 $result = $db->query($sql);
781 $objtp = $db->fetch_object($result);
782 if (isset($objtp->label) && $objtp->label !=
'') {
783 $objp->produit = $objtp->label;
789 print
'<tr class="oddeven">';
791 $productstatic->id = $objp->rowid;
792 $productstatic->ref = $objp->ref;
793 $productstatic->label = $objp->produit;
794 $productstatic->type = $objp->type;
795 $productstatic->entity = $objp->entity;
796 $productstatic->status_batch = $objp->tobatch;
798 $productstatic->fk_unit = $objp->fk_unit;
800 $productstatic->status = $objp->tosell;
801 $productstatic->status_buy = $objp->tobuy;
802 $productstatic->barcode = $objp->barcode;
803 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
804 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
805 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
806 $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
807 $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
808 $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
812 print $productstatic->getNomUrl(1,
'stock', 16);
816 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).
'">'.
dol_escape_htmltag($objp->produit).
'</td>';
819 print
'<td class="right">';
821 print empty($valtoshow) ?
'0' : $valtoshow;
823 $totalunit += $objp->value;
827 print
'<td align="left">';
828 if (is_null($productstatic->fk_unit)) {
829 $productstatic->fk_unit = 1;
831 print $productstatic->getLabelOfUnit(
'long', $langs);
836 print
'<td class="right nowraponall">'.price(
price2num($objp->ppmp,
'MU')).
'</td>';
839 print
'<td class="right amount nowraponall">'.price(
price2num($objp->ppmp * $objp->value,
'MT')).
'</td>';
840 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
845 $pricemin = $objp->price;
846 print
'<td class="right">';
850 print
'<td class="right">';
854 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
857 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
858 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.
$object->id.
'&id='.$objp->rowid.
'&action=transfert&token='.
newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
859 print
img_picto($langs->trans(
"TransferStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
860 print $langs->trans(
"TransferStock");
865 if ($user->hasRight(
'stock',
'creer')) {
866 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).
'">';
867 print
img_picto($langs->trans(
"CorrectStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
868 print $langs->trans(
"CorrectStock");
872 $parameters = array(
'context' =>
'warehousecard',
'obj' => $objp,
'totalarray' => &
$totalarray);
873 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
874 print $hookmanager->resPrint;
881 $units = $productstatic->fk_unit;
882 } elseif ($productstatic->fk_unit != $units) {
894 $totalarray[
'val'][
'units'] = $productstatic->getLabelOfUnit(
'long', $langs);
896 $parameters = array(
'context' =>
'warehousecard',
'totalarray' => &
$totalarray);
898 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters,
$object);
904 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
914 if ($action ==
'edit' || $action ==
're-edit') {
915 $langs->trans(
"WarehouseEdit");
917 print
'<form action="card.php" method="POST">';
918 print
'<input type="hidden" name="token" value="'.newToken().
'">';
919 print
'<input type="hidden" name="action" value="update">';
920 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
926 print
'<table class="border centpercent">';
929 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value="'.
$object->label.
'"></td></tr>';
931 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" class="minwidth300" value="'.
$object->lieu.
'"></td></tr>';
934 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
935 print $formproduct->selectWarehouses(
$object->fk_parent,
'fk_parent',
'', 1);
939 if (isModEnabled(
'project') && $formproject !==
null) {
940 $projectid =
$object->fk_project;
941 $langs->load(
'projects');
942 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
943 print
img_picto(
'',
'project').$formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
944 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>';
949 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
951 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
952 $doleditor =
new DolEditor(
'desc',
$object->description,
'', 180,
'dolibarr_notes',
'In',
false,
true, isModEnabled(
'fckeditor'), ROWS_5,
'90%');
953 $doleditor->Create();
956 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
958 print
'</textarea></td></tr>';
961 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
962 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
964 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
965 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
969 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
970 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
971 print $form->select_country(
$object->country_id ?
$object->country_id : $mysoc->country_code,
'country_id');
973 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
978 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td><td>';
979 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
980 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
981 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td><td>';
982 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
983 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
986 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
987 print
'<select id="warehousestatus" name="statut" class="flat">';
988 foreach (
$object->labelStatus as $key => $value) {
990 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
992 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
1001 $parameters = array(
'context' =>
'warehousecard',
'colspan' =>
' colspan="3"',
'cols' =>
'3');
1002 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1003 print $hookmanager->resPrint;
1004 if (empty($reshook)) {
1005 print
$object->showOptionals($extrafields,
'edit', $parameters);
1009 if (isModEnabled(
'category')) {
1010 print
'<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1011 print $form->selectCategories(Categorie::TYPE_WAREHOUSE,
'categories',
$object);
1019 print $form->buttonsSaveCancel();
1030$modulepart =
'stock';
1032if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
1034 print
'<div class="fichecenter"><div class="fichehalfleft">';
1035 print
'<a name="builddoc"></a>';
1039 $relativepath =
$object->ref.
'/'.$objectref.
'.pdf';
1040 $filedir =
$conf->stock->dir_output.
'/'.$objectref;
1041 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1042 $genallowed = $usercanread;
1043 $delallowed = $usercancreate;
1044 $modulepart =
'stock';
1046 print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'',
'',
'',
'',
'',
$object);
1047 $somethingshown = $formfile->numoffiles;
1049 print
'</div><div class="fichehalfright">';
1053 $morehtmlcenter =
'';
1057 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1059 $somethingshown = $formactions->showactions(
$object,
'stock', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1061 print
'</div></div>';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.