34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
59$langs->loadLangs(array(
'products',
'stocks',
'companies',
'categories'));
61$action =
GETPOST(
'action',
'aZ09');
62$cancel =
GETPOST(
'cancel',
'alpha');
64$backtopage =
GETPOST(
'backtopage',
'alpha');
65$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
75$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
76$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
85$hookmanager->initHooks(array(
'warehousecard',
'stocklist',
'globalcard'));
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:int');
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:int');
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")) {
287 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
290 $upload_dir = $conf->stock->dir_output;
291 $permissiontoadd = $user->hasRight(
'stock',
'creer');
292 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
300$productstatic =
new Product($db);
301$form =
new Form($db);
310$title = $langs->trans(
"WarehouseCard");
311if ($action ==
'create') {
312 $title = $langs->trans(
"NewWarehouse");
315$help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
316llxHeader(
"", $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-product page-stock_card');
319if ($action ==
'create') {
324 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
325 print
'<input type="hidden" name="token" value="'.newToken().
'">';
326 print
'<input type="hidden" name="action" value="add">';
327 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
331 print
'<table class="border centpercent">';
334 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input class="width200" name="libelle" value=""></td></tr>';
336 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" size="40" value="'.(!empty(
$object->lieu) ?
$object->lieu :
'').
'"></td></tr>';
339 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
340 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET(
'fk_parent') ?
GETPOSTINT(
'fk_parent') :
'ifone'),
'fk_parent',
'', 1);
345 $langs->load(
'projects');
346 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
347 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
348 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>';
353 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
355 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
356 $doleditor =
new DolEditor(
'desc', (!empty(
$object->description) ?
$object->description :
''),
'', 180,
'dolibarr_notes',
'In', false, true,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
357 $doleditor->Create();
360 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
362 print
'</textarea></td></tr>';
365 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
366 print $formcompany->select_ziptown((!empty(
$object->zip) ?
$object->zip :
''),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
368 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
369 print $formcompany->select_ziptown((!empty(
$object->town) ?
$object->town :
''),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
373 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
374 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
375 print $form->select_country((!empty(
$object->country_id) ?
$object->country_id :
$mysoc->country_code),
'country_id');
377 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
382 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
383 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
384 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
385 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
387 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
388 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
396 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
397 print
'<select id="warehousestatus" name="statut" class="flat minwidth100">';
398 foreach (
$object->labelStatus as $key => $value) {
400 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
402 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
410 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
414 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
415 print $form->selectCategories(Categorie::TYPE_WAREHOUSE,
'categories', $object);
422 print $form->buttonsSaveCancel(
"Create");
427 if ($id > 0 || $ref) {
429 $result =
$object->fetch($id, $ref);
431 print
'No record found';
436 if ($action !=
'edit' && $action !=
're-edit') {
444 if ($action ==
'delete') {
445 $formquestion = array(
446 array(
'type' =>
'other',
'name' =>
'info',
'label' =>
img_warning(
'').$langs->trans(
"WarningThisWIllAlsoDeleteStock"),
'morecss' =>
'warning')
448 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"DeleteAWarehouse"), $langs->trans(
"ConfirmDeleteWarehouse",
$object->label),
"confirm_delete", $formquestion, 0, 2);
452 $parameters = array(
'context' =>
'warehousecard',
'formConfirm' => $formconfirm);
453 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
454 if (empty($reshook)) {
455 $formconfirm .= $hookmanager->resPrint;
456 } elseif ($reshook > 0) {
457 $formconfirm = $hookmanager->resPrint;
464 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
466 $morehtmlref =
'<div class="refidno">';
467 $morehtmlref .= $langs->trans(
"LocationSummary").
' : '.
$object->lieu;
471 $langs->load(
"projects");
472 $morehtmlref .=
'<br>'.img_picto(
'',
'project',
'class="pictofixedwidth"').
' '.$langs->trans(
'Project').
' ';
473 if ($usercancreate) {
474 if ($action !=
'classify') {
475 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
477 if ($action ==
'classify') {
478 $projectid =
$object->fk_project;
479 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
480 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
481 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
482 $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
483 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
484 $morehtmlref .=
'</form>';
486 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, ($socid > 0 ? $socid : -1), (string)
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
489 if (!empty(
$object->fk_project)) {
491 $proj->fetch(
$object->fk_project);
492 $morehtmlref .=
' : '.$proj->getNomUrl(1);
494 $morehtmlref .=
' - '.$proj->title;
501 $morehtmlref .=
'</div>';
504 if ($user->socid && !in_array(
'stock', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
508 dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref',
'ref', $morehtmlref);
510 print
'<div class="fichecenter">';
511 print
'<div class="fichehalfleft">';
512 print
'<div class="underbanner clearboth"></div>';
514 print
'<table class="border centpercent tableforfield">';
517 $parentwarehouse =
new Entrepot($db);
518 if (!empty(
$object->fk_parent) && $parentwarehouse->fetch(
$object->fk_parent) > 0) {
519 print
'<tr><td>'.$langs->trans(
"ParentWarehouse").
'</td><td>';
520 print $parentwarehouse->getNomUrl(3);
527 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.
dol_htmlentitiesbr(
$object->description).
'</td></tr>';
531 $labelusagestring =
$object->fields[
'warehouse_usage'][
'arrayofkeyval'][empty(
$object->warehouse_usage) ? 1 :
$object->warehouse_usage];
532 $labelusage = $labelusagestring ? $langs->trans($labelusagestring) :
'Unknown';
533 print
'<td class="titlefield tdtop">'.$langs->trans(
"WarehouseUsage").
'</td><td>'.
dol_htmlentitiesbr($labelusage).
'</td></tr>';
536 $calcproductsunique =
$object->nb_different_products();
537 $calcproducts =
$object->nb_products();
540 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
541 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
545 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
546 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
547 print empty($valtoshow) ?
'0' : $valtoshow;
553 print
'<div class="fichehalfright">';
554 print
'<div class="underbanner clearboth"></div>';
556 print
'<table class="border centpercent tableforfield">';
559 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
560 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
564 if ($user->hasRight(
'stock',
'mouvement',
'lire')) {
565 $sql =
"SELECT max(m.datem) as datem";
566 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
567 $sql .=
" WHERE m.fk_entrepot = ".((int)
$object->id);
568 $lastmovementdate = 0;
569 $resqlbis = $db->query($sql);
571 $obj = $db->fetch_object($resqlbis);
572 $lastmovementdate = $db->jdate($obj->datem);
576 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
577 if ($lastmovementdate) {
579 print
' ';
580 print
img_picto($langs->trans(
'LastMovement'),
'movement',
'class="pictofixedwidth"');
581 print
'<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?id='.
$object->id.
'">'.$langs->trans(
"FullList").
'</a>';
583 print $langs->trans(
"None");
589 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
593 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
594 print $form->showCategories(
$object->id, Categorie::TYPE_WAREHOUSE, 1);
603 print
'<div class="clearboth"></div>';
611 print
"<div class=\"tabsAction\">\n";
613 $parameters = array(
'context' =>
'warehousecard');
614 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
615 if (empty($reshook)) {
616 if (empty($action) || $action ==
'classin') {
617 if ($user->hasRight(
'stock',
'creer')) {
618 print
'<a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
620 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Modify").
'</a>';
623 if ($user->hasRight(
'stock',
'supprimer')) {
624 print
'<a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
626 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
'</a>';
645 print
'<div class="div-table-responsive">';
646 print
'<table class="noborder centpercent liste">';
647 print
'<tr class="liste_titre">';
648 $parameters = array(
'context' =>
'warehousecard',
'totalarray' => &
$totalarray);
649 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
650 print $hookmanager->resPrint;
665 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'read');
666 if ($usercancreadsupplierprice) {
667 print_liste_field_titre($form->textwithpicto($langs->trans(
"AverageUnitPricePMPShort"), $langs->trans(
"AverageUnitPricePMPDesc")),
"",
"p.pmp",
"",
"&id=".$object->id,
'', $sortfield, $sortorder,
'right ');
686 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
690 if ($user->hasRight(
'stock',
'creer')) {
695 $parameters = array(
'context' =>
'warehousecard',
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
696 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
697 print $hookmanager->resPrint;
701 $totalvalue = $totalvaluesell = 0;
704 $separatedPMP =
false;
706 $separatedPMP =
true;
709 $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,";
710 $sql .=
"p.tosell, p.tobuy,";
711 $sql .=
"p.accountancy_code_sell,";
712 $sql .=
"p.accountancy_code_sell_intra,";
713 $sql .=
"p.accountancy_code_sell_export,";
714 $sql .=
"p.accountancy_code_buy,";
715 $sql .=
"p.accountancy_code_buy_intra,";
716 $sql .=
"p.accountancy_code_buy_export,";
717 $sql .=
'p.barcode,';
719 $sql .=
" pa.pmp as ppmp,";
721 $sql .=
" p.pmp as ppmp,";
723 $sql .=
" ps.reel as value";
727 $sql .=
", (ps.reel * p.pmp) as svalue";
729 $parameters = array(
'context' =>
'warehousecard');
730 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
734 $sql .= $hookmanager->resPrint;
735 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
738 $sql .=
", ".MAIN_DB_PREFIX.
"product_perentity as pa";
740 $parameters = array(
'context' =>
'warehousecard');
741 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters);
745 $sql .= $hookmanager->resPrint;
747 $sql .=
" WHERE ps.fk_product = p.rowid";
748 $sql .=
" AND ps.reel <> 0";
749 $sql .=
" AND ps.fk_entrepot = ".((int)
$object->id);
752 $sql .=
" AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
754 $parameters = array(
'context' =>
'warehousecard');
755 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
759 $sql .= $hookmanager->resPrint;
761 $sql .= $db->order($sortfield, $sortorder);
764 $resql = $db->query($sql);
766 $num = $db->num_rows($resql);
772 $objp = $db->fetch_object($resql);
776 $sql =
"SELECT label";
777 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
778 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
779 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
782 $result = $db->query($sql);
784 $objtp = $db->fetch_object($result);
785 if (isset($objtp->label) && $objtp->label !=
'') {
786 $objp->produit = $objtp->label;
792 print
'<tr class="oddeven">';
794 $productstatic->id = $objp->rowid;
795 $productstatic->ref = $objp->ref;
796 $productstatic->label = $objp->produit;
797 $productstatic->type = $objp->type;
798 $productstatic->entity = $objp->entity;
799 $productstatic->status_batch = $objp->tobatch;
801 $productstatic->fk_unit = $objp->fk_unit;
803 $productstatic->status = $objp->tosell;
804 $productstatic->status_buy = $objp->tobuy;
805 $productstatic->barcode = $objp->barcode;
806 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
807 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
808 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
809 $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
810 $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
811 $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
815 print $productstatic->getNomUrl(1,
'stock', 16);
819 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).
'">'.
dol_escape_htmltag($objp->produit).
'</td>';
822 print
'<td class="right">';
824 print empty($valtoshow) ?
'0' : $valtoshow;
826 $totalunit += $objp->value;
830 print
'<td align="left">';
831 if (is_null($productstatic->fk_unit)) {
832 $productstatic->fk_unit = 1;
834 print $productstatic->getLabelOfUnit(
'long', $langs);
837 if ($usercancreadsupplierprice) {
839 print
'<td class="right nowraponall">'.price(
price2num($objp->ppmp,
'MU')).
'</td>';
842 print
'<td class="right amount nowraponall">'.price(
price2num($objp->ppmp * $objp->value,
'MT')).
'</td>';
843 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
848 $pricemin = $objp->price;
849 print
'<td class="right">';
853 print
'<td class="right">';
857 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
860 if ($user->hasRight(
'stock',
'mouvement',
'creer')) {
861 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.
$object->id.
'&id='.$objp->rowid.
'&action=transfer&token='.
newToken().
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
862 print
img_picto($langs->trans(
"TransferStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
863 print $langs->trans(
"TransferStock");
868 if ($user->hasRight(
'stock',
'creer')) {
869 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).
'">';
870 print
img_picto($langs->trans(
"CorrectStock"),
'add',
'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
871 print $langs->trans(
"CorrectStock");
875 $parameters = array(
'context' =>
'warehousecard',
'obj' => $objp,
'totalarray' => &
$totalarray);
876 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
877 print $hookmanager->resPrint;
884 $units = $productstatic->fk_unit;
885 } elseif ($productstatic->fk_unit != $units) {
897 $totalarray[
'val'][
'units'] = $productstatic->getLabelOfUnit(
'long', $langs);
899 $parameters = array(
'context' =>
'warehousecard',
'totalarray' => &
$totalarray);
901 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters, $object);
907 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
917 if ($action ==
'edit' || $action ==
're-edit') {
918 $langs->trans(
"WarehouseEdit");
920 print
'<form action="card.php" method="POST">';
921 print
'<input type="hidden" name="token" value="'.newToken().
'">';
922 print
'<input type="hidden" name="action" value="update">';
923 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
929 print
'<table class="border centpercent">';
932 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value="'.
$object->label.
'"></td></tr>';
934 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" class="minwidth300" value="'.
$object->lieu.
'"></td></tr>';
937 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
938 print $formproduct->selectWarehouses(
$object->fk_parent,
'fk_parent',
'', 1);
943 $projectid =
$object->fk_project;
944 $langs->load(
'projects');
945 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td colspan="2">';
946 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), (string) $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
947 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>';
952 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
954 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
955 $doleditor =
new DolEditor(
'desc',
$object->description,
'', 180,
'dolibarr_notes',
'In',
false,
true,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
956 $doleditor->Create();
959 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
961 print
'</textarea></td></tr>';
964 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
965 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
967 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
968 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
972 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
973 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
974 print $form->select_country(
$object->country_id ?
$object->country_id :
$mysoc->country_code,
'country_id');
976 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
981 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
982 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
983 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
984 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td><td>';
985 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
986 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
989 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
990 print
'<select id="warehousestatus" name="statut" class="flat">';
991 foreach (
$object->labelStatus as $key => $value) {
993 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
995 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
1004 $parameters = array(
'context' =>
'warehousecard',
'colspan' =>
' colspan="3"',
'cols' =>
'3');
1005 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1006 print $hookmanager->resPrint;
1007 if (empty($reshook)) {
1008 print
$object->showOptionals($extrafields,
'edit', $parameters);
1013 print
'<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1014 print $form->selectCategories(Categorie::TYPE_WAREHOUSE,
'categories', $object);
1022 print $form->buttonsSaveCancel();
1033$modulepart =
'stock';
1035if ($action !=
'create' && $action !=
'edit' && $action !=
'delete') {
1037 print
'<div class="fichecenter"><div class="fichehalfleft">';
1038 print
'<a name="builddoc"></a>';
1042 $relativepath =
$object->ref.
'/'.$objectref.
'.pdf';
1043 $filedir = $conf->stock->dir_output.
'/'.$objectref;
1044 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
1045 $genallowed = $usercanread;
1046 $delallowed = $usercancreate;
1047 $modulepart =
'stock';
1049 print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'',
'',
'',
'',
'', $object);
1050 $somethingshown = $formfile->numoffiles;
1052 print
'</div><div class="fichehalfright">';
1056 $morehtmlcenter =
'';
1060 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1062 $somethingshown = $formactions->showactions($object,
'stock', 0, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1064 print
'</div></div>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage products or services.
Class to manage projects.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
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($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.