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';
50$langs->loadLangs(array(
'products',
'stocks',
'companies',
'categories'));
52$action =
GETPOST(
'action',
'aZ09');
53$cancel =
GETPOST(
'cancel',
'alpha');
55$backtopage =
GETPOST(
'backtopage',
'alpha');
56$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
66$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
67$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
79$hookmanager->initHooks(array(
'warehousecard',
'stocklist',
'globalcard'));
85$extrafields->fetch_name_optionals_label(
$object->table_element);
88if ($id > 0 || !empty($ref)) {
89 $ret =
$object->fetch($id, $ref);
96$usercanread = $user->hasRight(
'stock',
'lire');
97$usercancreate = $user->hasRight(
'stock',
'creer');
98$usercandelete = $user->hasRight(
'stock',
'supprimer');
107$parameters = array(
'id' => $id,
'ref' => $ref);
108$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
112if (empty($reshook)) {
113 $backurlforlist = DOL_URL_ROOT.
'/product/stock/list.php';
115 if (empty($backtopage) || ($cancel && empty($id))) {
116 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
117 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
118 $backtopage = $backurlforlist;
120 $backtopage = DOL_URL_ROOT.
'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
126 if (!empty($backtopageforcancel)) {
127 header(
"Location: ".$backtopageforcancel);
129 } elseif (!empty($backtopage)) {
130 header(
"Location: ".$backtopage);
137 if ($action ==
'add' && $user->hasRight(
'stock',
'creer')) {
154 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
165 $categories =
GETPOST(
'categories',
'array');
166 $object->setCategories($categories);
167 if (!empty($backtopage)) {
168 $backtopage = str_replace(
"__ID__", (
string) $id, $backtopage);
169 header(
"Location: ".$backtopage);
172 header(
"Location: card.php?id=".urlencode((
string) ($id)));
181 setEventMessages($langs->trans(
"ErrorWarehouseRefRequired"),
null,
'errors');
187 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'stock',
'supprimer')) {
189 $result =
$object->delete($user);
192 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1');
201 if ($action ==
'update' && !$cancel && $user->hasRight(
'stock',
'creer')) {
217 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
223 $ret =
$object->update($id, $user);
233 $categories =
GETPOST(
'categories',
'array');
234 $object->setCategories($categories);
241 } elseif ($action ==
'update_extras' && $user->hasRight(
'stock',
'creer')) {
245 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
250 $result =
$object->insertExtraFields();
257 $action =
'edit_extras';
259 } elseif ($action ==
'classin' && $usercancreate) {
264 if ($cancel == $langs->trans(
"Cancel")) {
270 $upload_dir = $conf->stock->dir_output;
271 $permissiontoadd = $user->hasRight(
'stock',
'creer');
272 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
280$productstatic =
new Product($db);
281$form =
new Form($db);
285if (isModEnabled(
'project')) {
289$title = $langs->trans(
"WarehouseCard");
290if ($action ==
'create') {
291 $title = $langs->trans(
"NewWarehouse");
294$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
295llxHeader(
"", $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_card');
298if ($action ==
'create') {
303 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
304 print
'<input type="hidden" name="token" value="'.newToken().
'">';
305 print
'<input type="hidden" name="action" value="add">';
306 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
310 print
'<table class="border centpercent">';
313 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input class="width200" name="libelle" value=""></td></tr>';
315 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" size="40" value="'.(!empty(
$object->lieu) ?
$object->lieu :
'').
'"></td></tr>';
318 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
319 print
img_picto(
'',
'stock').$formproduct->selectWarehouses((GETPOSTISSET(
'fk_parent') ?
GETPOSTINT(
'fk_parent') :
'ifone'),
'fk_parent',
'', 1);
323 if (isModEnabled(
'project')) {
324 $langs->load(
'projects');
325 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
326 print
img_picto(
'',
'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
327 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>';
332 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
334 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
335 $doleditor =
new DolEditor(
'desc', (!empty(
$object->description) ?
$object->description :
''),
'', 180,
'dolibarr_notes',
'In', false, true, isModEnabled(
'fckeditor'), ROWS_5,
'90%');
336 $doleditor->Create();
339 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
341 print
'</textarea></td></tr>';
344 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
345 print $formcompany->select_ziptown((!empty(
$object->zip) ?
$object->zip :
''),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
347 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
348 print $formcompany->select_ziptown((!empty(
$object->town) ?
$object->town :
''),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
352 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
353 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
354 print $form->select_country((!empty(
$object->country_id) ?
$object->country_id : $mysoc->country_code),
'country_id');
356 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
361 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td><td>';
362 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
363 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
364 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
366 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
367 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
375 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
376 print
'<select id="warehousestatus" name="statut" class="flat minwidth100">';
377 foreach (
$object->labelStatus as $key => $value) {
379 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
381 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
389 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
391 if (isModEnabled(
'category')) {
393 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
394 $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE,
'',
'parent', 64, 0, 3);
395 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo,
GETPOST(
'categories',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
402 print $form->buttonsSaveCancel(
"Create");
407 if ($id > 0 || $ref) {
409 $result =
$object->fetch($id, $ref);
411 print
'No record found';
416 if ($action !=
'edit' && $action !=
're-edit') {
424 if ($action ==
'delete') {
425 $formquestion = array(
426 array(
'type' =>
'other',
'name' =>
'info',
'label' =>
img_warning(
'').$langs->trans(
"WarningThisWIllAlsoDeleteStock"),
'morecss' =>
'warning')
428 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteAWarehouse"), $langs->trans(
"ConfirmDeleteWarehouse",
$object->label),
"confirm_delete", $formquestion, 0, 2);
432 $parameters = array(
'formConfirm' => $formconfirm);
433 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
434 if (empty($reshook)) {
435 $formconfirm .= $hookmanager->resPrint;
436 } elseif ($reshook > 0) {
437 $formconfirm = $hookmanager->resPrint;
444 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
446 $morehtmlref =
'<div class="refidno">';
447 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.
$object->lieu;
450 if (isModEnabled(
'project')) {
451 $langs->load(
"projects");
452 $morehtmlref .=
'<br>'.img_picto(
'',
'project').
' '.$langs->trans(
'Project').
' ';
453 if ($usercancreate) {
454 if ($action !=
'classify') {
455 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
457 if ($action ==
'classify') {
458 $projectid =
$object->fk_project;
459 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
460 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
461 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
462 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
463 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
464 $morehtmlref .=
'</form>';
466 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, ($socid > 0 ? $socid : -1),
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
469 if (!empty(
$object->fk_project)) {
471 $proj->fetch(
$object->fk_project);
472 $morehtmlref .=
' : '.$proj->getNomUrl(1);
474 $morehtmlref .=
' - '.$proj->title;
481 $morehtmlref .=
'</div>';
484 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
488 dol_banner_tab(
$object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
490 print
'<div class="fichecenter">';
491 print
'<div class="fichehalfleft">';
492 print
'<div class="underbanner clearboth"></div>';
494 print
'<table class="border centpercent tableforfield">';
497 $parentwarehouse =
new Entrepot($db);
498 if (!empty(
$object->fk_parent) && $parentwarehouse->fetch(
$object->fk_parent) > 0) {
499 print
'<tr><td>'.$langs->trans(
"ParentWarehouse").
'</td><td>';
500 print $parentwarehouse->getNomUrl(3);
507 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr(
$object->description).
'</td></tr>';
511 $labelusagestring =
$object->fields[
'warehouse_usage'][
'arrayofkeyval'][empty(
$object->warehouse_usage) ? 1 :
$object->warehouse_usage];
512 $labelusage = $labelusagestring ? $langs->trans($labelusagestring) :
'Unknown';
513 print
'<td class="titlefield tdtop">'.$langs->trans(
"WarehouseUsage").
'</td><td>'.
dol_htmlentitiesbr($labelusage).
'</td></tr>';
516 $calcproductsunique =
$object->nb_different_products();
517 $calcproducts =
$object->nb_products();
520 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
521 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
525 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
526 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
527 print empty($valtoshow) ?
'0' : $valtoshow;
533 print
'<div class="fichehalfright">';
534 print
'<div class="underbanner clearboth"></div>';
536 print
'<table class="border centpercent tableforfield">';
539 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
540 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
544 if ($user->hasRight(
'stock',
'mouvement',
'lire')) {
545 $sql =
"SELECT max(m.datem) as datem";
546 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
547 $sql .=
" WHERE m.fk_entrepot = ".((int)
$object->id);
548 $resqlbis = $db->query($sql);
550 $obj = $db->fetch_object($resqlbis);
551 $lastmovementdate = $db->jdate($obj->datem);
555 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
556 if ($lastmovementdate) {
558 print
' ';
559 print
img_picto($langs->trans(
'LastMovement'),
'movement',
'class="pictofixedwidth"');
560 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?id='.
$object->id.
'">'.$langs->trans(
"FullList").
'</a>';
562 print $langs->trans(
"None");
568 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
571 if (isModEnabled(
'category')) {
572 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
573 print $form->showCategories(
$object->id, Categorie::TYPE_WAREHOUSE, 1);
582 print
'<div class="clearboth"></div>';
590 print
"<div class=\"tabsAction\">\n";
592 $parameters = array();
593 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
594 if (empty($reshook)) {
595 if (empty($action) || $action ==
'classin') {
596 if ($user->hasRight(
'stock',
'creer')) {
597 print
'<a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
599 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Modify").
'</a>';
602 if ($user->hasRight(
'stock',
'supprimer')) {
603 print
'<a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
605 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
'</a>';
616 $totalarray = array();
617 $totalarray[
'val'] = array();
618 $totalarray[
'pos'] = array();
619 $totalarray[
'type'] = array();
620 $totalarray[
'nbfield'] = 0;
626 print
'<div class="div-table-responsive">';
627 print
'<table class="noborder centpercent liste">';
628 print
'<tr class="liste_titre">';
629 $parameters = array(
'totalarray' => &$totalarray);
630 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
631 print $hookmanager->resPrint;
635 print_liste_field_titre(
"NumberOfUnit",
"",
"ps.reel",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
636 $totalarray[
'nbfield'] += 3;
637 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalunit';
638 $totalarray[
'type'][$totalarray[
'nbfield']] =
'stock';
642 $totalarray[
'nbfield']++;
643 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'units';
644 $totalarray[
'type'][$totalarray[
'nbfield']] =
'string';
647 print_liste_field_titre($form->textwithpicto($langs->trans(
"AverageUnitPricePMPShort"), $langs->trans(
"AverageUnitPricePMPDesc")),
"",
"p.pmp",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
648 $totalarray[
'nbfield']++;
650 print_liste_field_titre(
"EstimatedStockValueShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
651 $totalarray[
'nbfield']++;
652 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalvalue';
653 $totalarray[
'type'][$totalarray[
'nbfield']] =
'';
657 print_liste_field_titre(
"SellPriceMin",
"",
"p.price",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
658 $totalarray[
'nbfield']++;
661 print_liste_field_titre(
"EstimatedStockValueSellShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
662 $totalarray[
'nbfield']++;
663 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalvaluesell';
664 $totalarray[
'type'][$totalarray[
'nbfield']] =
'';
666 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
668 $totalarray[
'nbfield']++;
670 if ($user->hasRight(
'stock',
'creer')) {
672 $totalarray[
'nbfield']++;
675 $parameters = array(
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
676 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
677 print $hookmanager->resPrint;
681 $totalvalue = $totalvaluesell = 0;
684 $separatedPMP =
false;
686 $separatedPMP =
true;
689 $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,";
690 $sql .=
"p.tosell, p.tobuy,";
691 $sql .=
"p.accountancy_code_sell,";
692 $sql .=
"p.accountancy_code_sell_intra,";
693 $sql .=
"p.accountancy_code_sell_export,";
694 $sql .=
"p.accountancy_code_buy,";
695 $sql .=
"p.accountancy_code_buy_intra,";
696 $sql .=
"p.accountancy_code_buy_export,";
697 $sql .=
'p.barcode,';
699 $sql .=
" pa.pmp as ppmp,";
701 $sql .=
" p.pmp as ppmp,";
703 $sql .=
" ps.reel as value";
708 $parameters = array();
709 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
713 $sql .= $hookmanager->resPrint;
714 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
717 $sql .=
", ".MAIN_DB_PREFIX.
"product_perentity as pa";
720 $sql .=
" WHERE ps.fk_product = p.rowid";
721 $sql .=
" AND ps.reel <> 0";
722 $sql .=
" AND ps.fk_entrepot = ".((int)
$object->id);
725 $sql .=
" AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
728 $sql .= $db->order($sortfield, $sortorder);
731 $resql = $db->query($sql);
733 $num = $db->num_rows($resql);
738 $objp = $db->fetch_object($resql);
742 $sql =
"SELECT label";
743 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
744 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
745 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
748 $result = $db->query($sql);
750 $objtp = $db->fetch_object($result);
751 if (isset($objtp->label) && $objtp->label !=
'') {
752 $objp->produit = $objtp->label;
758 print
'<tr class="oddeven">';
760 $productstatic->id = $objp->rowid;
761 $productstatic->ref = $objp->ref;
762 $productstatic->label = $objp->produit;
763 $productstatic->type = $objp->type;
764 $productstatic->entity = $objp->entity;
765 $productstatic->status_batch = $objp->tobatch;
767 $productstatic->fk_unit = $objp->fk_unit;
769 $productstatic->status = $objp->tosell;
770 $productstatic->status_buy = $objp->tobuy;
771 $productstatic->barcode = $objp->barcode;
772 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
773 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
774 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
775 $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
776 $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
777 $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
781 print $productstatic->getNomUrl(1,
'stock', 16);
785 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).
'">'.
dol_escape_htmltag($objp->produit).
'</td>';
788 print
'<td class="right">';
790 print empty($valtoshow) ?
'0' : $valtoshow;
792 $totalunit += $objp->value;
796 print
'<td align="left">';
797 if (is_null($productstatic->fk_unit)) {
798 $productstatic->fk_unit = 1;
800 print $langs->trans($productstatic->getLabelOfUnit());
805 print
'<td class="right nowraponall">'.price(
price2num($objp->ppmp,
'MU')).
'</td>';
808 print
'<td class="right amount nowraponall">'.price(
price2num($objp->ppmp * $objp->value,
'MT')).
'</td>';
809 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
813 $pricemin = $objp->price;
814 print
'<td class="right">';
818 print
'<td class="right">';
822 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
825 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
826 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).
'">';
827 print
img_picto($langs->trans(
"TransferStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
828 print $langs->trans(
"TransferStock");
833 if ($user->hasRight(
'stock',
'creer')) {
834 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).
'">';
835 print
img_picto($langs->trans(
"CorrectStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
836 print $langs->trans(
"CorrectStock");
840 $parameters = array(
'obj' => $objp,
'totalarray' => &$totalarray);
841 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
842 print $hookmanager->resPrint;
851 $units = $productstatic->fk_unit;
852 } elseif ($productstatic->fk_unit != $units) {
859 $totalarray[
'val'][
'totalunit'] = $totalunit;
860 $totalarray[
'val'][
'totalvalue'] =
price2num($totalvalue,
'MT');
861 $totalarray[
'val'][
'totalvaluesell'] =
price2num($totalvaluesell,
'MT');
862 $totalarray[
'val'][
'units'] = $langs->trans($productstatic->getLabelOfUnit());
864 $parameters = array(
'totalarray' => &$totalarray);
866 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters,
$object);
872 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
882 if ($action ==
'edit' || $action ==
're-edit') {
883 $langs->trans(
"WarehouseEdit");
885 print
'<form action="card.php" method="POST">';
886 print
'<input type="hidden" name="token" value="'.newToken().
'">';
887 print
'<input type="hidden" name="action" value="update">';
888 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
894 print
'<table class="border centpercent">';
897 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value="'.
$object->label.
'"></td></tr>';
899 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" class="minwidth300" value="'.
$object->lieu.
'"></td></tr>';
902 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
903 print $formproduct->selectWarehouses(
$object->fk_parent,
'fk_parent',
'', 1);
907 if (isModEnabled(
'project')) {
908 $projectid =
$object->fk_project;
909 $langs->load(
'projects');
910 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
911 print
img_picto(
'',
'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
912 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>';
917 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
919 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
920 $doleditor =
new DolEditor(
'desc',
$object->description,
'', 180,
'dolibarr_notes',
'In',
false,
true, isModEnabled(
'fckeditor'), ROWS_5,
'90%');
921 $doleditor->Create();
924 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
926 print
'</textarea></td></tr>';
929 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
930 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
932 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
933 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
937 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
938 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
939 print $form->select_country(
$object->country_id ?
$object->country_id : $mysoc->country_code,
'country_id');
941 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
946 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td><td>';
947 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
948 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
949 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td><td>';
950 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
951 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
954 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
955 print
'<select id="warehousestatus" name="statut" class="flat">';
956 foreach (
$object->labelStatus as $key => $value) {
958 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
960 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
969 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
970 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
971 print $hookmanager->resPrint;
972 if (empty($reshook)) {
973 print
$object->showOptionals($extrafields,
'edit', $parameters);
977 if (isModEnabled(
'category')) {
978 print
'<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
979 $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE,
'',
'parent', 64, 0, 3);
981 $cats = $c->containing(
$object->id, Categorie::TYPE_WAREHOUSE);
982 $arrayselected = array();
983 foreach ($cats as $cat) {
984 $arrayselected[] = $cat->id;
986 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
994 print $form->buttonsSaveCancel();
1005$modulepart =
'stock';
1007if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
1009 print
'<div class="fichecenter"><div class="fichehalfleft">';
1010 print
'<a name="builddoc"></a>';
1014 $relativepath =
$object->ref.
'/'.$objectref.
'.pdf';
1015 $filedir = $conf->stock->dir_output.
'/'.$objectref;
1016 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1017 $genallowed = $usercanread;
1018 $delallowed = $usercancreate;
1019 $modulepart =
'stock';
1021 print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'', 0,
'',
'',
'',
$object);
1022 $somethingshown = $formfile->numoffiles;
1024 print
'</div><div class="fichehalfright">';
1028 $morehtmlcenter =
'';
1032 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1034 $somethingshown = $formactions->showactions(
$object,
'stock', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1036 print
'</div></div>';
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.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
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.
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'.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
getDolGlobalString($key, $default='')
Return 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...
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.