28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/stock.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
39 $langs->loadLangs(array(
'products',
'stocks',
'companies',
'categories'));
41 $action =
GETPOST(
'action',
'aZ09');
42 $cancel =
GETPOST(
'cancel',
'alpha');
48 $sortfield =
GETPOST(
"sortfield",
'alpha');
49 $sortorder =
GETPOST(
"sortorder",
'alpha');
50 if (!$sortfield) $sortfield =
"p.ref";
51 if (!$sortorder) $sortorder =
"DESC";
53 $backtopage =
GETPOST(
'backtopage',
'alpha');
60 $hookmanager->initHooks(array(
'warehousecard',
'globalcard'));
66 $extrafields->fetch_name_optionals_label($object->table_element);
69 if ($id > 0 || !empty($ref)) {
70 $ret = $object->fetch($id, $ref);
84 $usercanread = (($user->rights->stock->lire));
85 $usercancreate = (($user->rights->stock->creer));
86 $usercandelete = (($user->rights->stock->supprimer));
88 $parameters = array(
'id'=>$id,
'ref'=>$ref);
89 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
90 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
94 if ($action ==
'add' && $user->rights->stock->creer)
96 $object->ref = (string)
GETPOST(
"ref",
"alpha");
97 $object->fk_parent = (int)
GETPOST(
"fk_parent",
"int");
98 $object->label = (string)
GETPOST(
"libelle",
"alpha");
99 $object->description = (string)
GETPOST(
"desc",
"alpha");
100 $object->statut =
GETPOST(
"statut");
101 $object->lieu = (string)
GETPOST(
"lieu",
"alpha");
102 $object->address = (string)
GETPOST(
"address",
"alpha");
103 $object->zip = (string)
GETPOST(
"zipcode",
"alpha");
104 $object->town = (string)
GETPOST(
"town",
"alpha");
105 $object->country_id =
GETPOST(
"country_id");
106 $object->phone = (string)
GETPOST(
"phone",
"alpha");
107 $object->fax = (string)
GETPOST(
"fax",
"alpha");
109 if (!empty($object->label)) {
111 $ret = $extrafields->setOptionalsFromPost(null, $object);
118 $id = $object->create($user);
122 $categories =
GETPOST(
'categories',
'array');
123 $object->setCategories($categories);
124 if (!empty($backtopage)) {
125 header(
"Location: ".$backtopage);
128 header(
"Location: card.php?id=".$id);
137 setEventMessages($langs->trans(
"ErrorWarehouseRefRequired"), null,
'errors');
143 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->stock->supprimer)
145 $object->fetch(
GETPOST(
'id',
'int'));
146 $result = $object->delete($user);
150 header(
"Location: ".DOL_URL_ROOT.
'/product/stock/list.php?restore_lastsearch_values=1');
159 if ($action ==
'update' && $cancel <> $langs->trans(
"Cancel"))
161 if ($object->fetch($id))
163 $object->label =
GETPOST(
"libelle");
164 $object->fk_parent =
GETPOST(
"fk_parent");
165 $object->description =
GETPOST(
"desc");
166 $object->statut =
GETPOST(
"statut");
167 $object->lieu =
GETPOST(
"lieu");
168 $object->address =
GETPOST(
"address");
169 $object->zip =
GETPOST(
"zipcode");
170 $object->town =
GETPOST(
"town");
171 $object->country_id =
GETPOST(
"country_id");
172 $object->phone =
GETPOST(
"phone");
176 $ret = $extrafields->setOptionalsFromPost(null, $object);
177 if ($ret < 0) $error++;
180 $ret = $object->update($id, $user);
181 if ($ret < 0) $error++;
188 $categories =
GETPOST(
'categories',
'array');
189 $object->setCategories($categories);
196 } elseif ($action ==
'update_extras') {
200 $ret = $extrafields->setOptionalsFromPost(null, $object,
GETPOST(
'attribute',
'restricthtml'));
201 if ($ret < 0) $error++;
203 $result = $object->insertExtraFields();
209 if ($error) $action =
'edit_extras';
212 if ($cancel == $langs->trans(
"Cancel"))
219 $upload_dir = $conf->stock->dir_output;
220 $permissiontoadd = $user->rights->stock->creer;
221 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
229 $productstatic =
new Product($db);
230 $form =
new Form($db);
235 $help_url =
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
236 llxHeader(
"", $langs->trans(
"WarehouseCard"), $help_url);
239 if ($action ==
'create')
245 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">'.
"\n";
246 print '<input type="hidden" name="token" value="'.newToken().
'">';
247 print '<input type="hidden" name="action" value="add">';
248 print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
252 print '<table class="border centpercent">';
255 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value=""></td></tr>';
257 print '<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" size="40" value="'.(!empty($object->lieu) ? $object->lieu :
'').
'"></td></tr>';
260 print '<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
265 print '<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
267 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
268 $doleditor =
new DolEditor(
'desc', (!empty($object->description) ? $object->description :
''),
'', 180,
'dolibarr_notes',
'In',
false,
true, $conf->fckeditor->enabled, ROWS_5,
'90%');
269 $doleditor->Create();
272 print '<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
273 print (!empty($object->address) ? $object->address :
'');
274 print '</textarea></td></tr>';
277 print '<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
278 print $formcompany->select_ziptown((!empty($object->zip) ? $object->zip :
''),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
280 print '<tr><td>'.$langs->trans(
'Town').
'</td><td>';
281 print $formcompany->select_ziptown((!empty($object->town) ? $object->town :
''),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
285 print '<tr><td>'.$langs->trans(
'Country').
'</td><td>';
287 print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code),
'country_id');
288 if ($user->admin)
print info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
292 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
293 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
294 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
295 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
297 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
298 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
301 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
302 print
'<select name="statut" class="flat">';
303 foreach ($object->statuts as $key => $value)
307 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
309 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
316 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
318 if ($conf->categorie->enabled) {
320 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
321 $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE,
'',
'parent', 64, 0, 1);
322 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo,
GETPOST(
'categories',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
329 print
'<div class="center">';
330 print
'<input type="submit" class="button" value="'.$langs->trans(
"Create").
'">';
331 print
' ';
332 print
'<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
341 $result = $object->fetch($id, $ref);
344 print
'No record found';
351 if ($action <>
'edit' && $action <>
're-edit')
360 if ($action ==
'delete')
362 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"DeleteAWarehouse"), $langs->trans(
"ConfirmDeleteWarehouse", $object->label),
"confirm_delete",
'', 0, 2);
366 $parameters = array(
'formConfirm' => $formconfirm);
367 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
368 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
369 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
375 $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
377 $morehtmlref = '<div class="refidno">';
378 $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
379 $morehtmlref .= '</div>';
382 if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
384 dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
386 print '<div class="fichecenter">';
387 print '<div class="fichehalfleft">';
388 print '<div class="underbanner clearboth"></div>';
390 print '<table class="border centpercent tableforfield">';
393 $parentwarehouse = new
Entrepot($db);
394 if (!empty($object->fk_parent) && $parentwarehouse->fetch($object->fk_parent) > 0) {
395 print
'<tr><td>'.$langs->trans(
"ParentWarehouse").
'</td><td>';
396 print $parentwarehouse->getNomUrl(3);
401 print
'<tr><td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>'.nl2br($object->description).
'</td></tr>';
403 $calcproductsunique = $object->nb_different_products();
404 $calcproducts = $object->nb_products();
407 print
'<tr><td>'.$langs->trans(
"NumberOfDifferentProducts").
'</td><td>';
408 print empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb'];
412 print
'<tr><td>'.$langs->trans(
"NumberOfProducts").
'</td><td>';
413 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
414 print empty($valtoshow) ?
'0' : $valtoshow;
420 print
'<div class="fichehalfright">';
421 print
'<div class="ficheaddleft">';
422 print
'<div class="underbanner clearboth"></div>';
424 print
'<table class="border centpercent tableforfield">';
427 print
'<tr><td class="titlefield">'.$langs->trans(
"EstimatedStockValueShort").
'</td><td>';
428 print
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency);
432 if (!empty($user->rights->stock->mouvement->lire)) {
433 $sql =
"SELECT max(m.datem) as datem";
434 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
435 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
436 $resqlbis = $db->query($sql);
438 $obj = $db->fetch_object($resqlbis);
439 $lastmovementdate = $db->jdate($obj->datem);
443 print
'<tr><td>'.$langs->trans(
"LastMovement").
'</td><td>';
444 if ($lastmovementdate) {
446 print
'(<a href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php?id='.$object->id.
'">'.$langs->trans(
"FullList").
'</a>)';
448 print $langs->trans(
"None");
454 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
457 if ($conf->categorie->enabled) {
458 print
'<tr><td valign="middle">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
459 print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
469 print
'<div class="clearboth"></div>';
480 print
"<div class=\"tabsAction\">\n";
482 $parameters = array();
483 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
488 if ($user->rights->stock->creer) {
489 print
'<a class="butAction" href="card.php?action=edit&token='.newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
492 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Modify").
'</a>';
495 if ($user->rights->stock->supprimer) {
496 print
'<a class="butActionDelete" href="card.php?action=delete&token='.newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
499 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"Delete").
'</a>';
514 print
'<table class="noborder centpercent">';
515 print
"<tr class=\"liste_titre\">";
519 if (!empty($conf->global->PRODUCT_USE_UNITS))
print_liste_field_titre(
"Unit",
"",
"p.fk_unit",
"&id=".$id,
"",
'align="left"', $sortfield, $sortorder);
520 print_liste_field_titre(
"AverageUnitPricePMPShort",
"",
"p.pmp",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
521 print_liste_field_titre(
"EstimatedStockValueShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
522 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
523 print_liste_field_titre(
"SellPriceMin",
"",
"p.price",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
525 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
526 print_liste_field_titre(
"EstimatedStockValueSellShort",
"",
"",
"&id=".$id,
"",
'', $sortfield, $sortorder,
'right ');
528 if ($user->rights->stock->mouvement->creer) {
531 if ($user->rights->stock->creer) {
537 $totalvalue = $totalvaluesell = 0;
539 $sql =
"SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
540 $sql .=
" ps.reel as value";
541 if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .=
",fk_unit";
542 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
543 $sql .=
" WHERE ps.fk_product = p.rowid";
544 $sql .=
" AND ps.reel <> 0";
545 $sql .=
" AND ps.fk_entrepot = ".$object->id;
546 $sql .= $db->order($sortfield, $sortorder);
549 $resql = $db->query($sql);
552 $num = $db->num_rows(
$resql);
556 $objp = $db->fetch_object(
$resql);
559 if (!empty($conf->global->MAIN_MULTILANGS))
561 $sql =
"SELECT label";
562 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
563 $sql .=
" WHERE fk_product=".$objp->rowid;
564 $sql .=
" AND lang='".$db->escape($langs->getDefaultLang()).
"'";
567 $result = $db->query($sql);
570 $objtp = $db->fetch_object($result);
571 if ($objtp->label !=
'') $objp->produit = $objtp->label;
577 print
'<tr class="oddeven">';
579 $productstatic->id = $objp->rowid;
580 $productstatic->ref = $objp->ref;
581 $productstatic->label = $objp->produit;
582 $productstatic->type = $objp->type;
583 $productstatic->entity = $objp->entity;
584 $productstatic->status_batch = $objp->tobatch;
585 $productstatic->fk_unit = $objp->fk_unit;
586 print $productstatic->getNomUrl(1,
'stock', 16);
590 print
'<td>'.$objp->produit.
'</td>';
592 print
'<td class="right">';
594 print empty($valtoshow) ?
'0' : $valtoshow;
596 $totalunit += $objp->value;
598 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
600 print
'<td align="left">';
601 if (is_null($productstatic->fk_unit))$productstatic->fk_unit = 1;
602 print $langs->trans($productstatic->getLabelOfUnit());
606 print
'<td class="right">'.price(
price2num($objp->ppmp,
'MU')).
'</td>';
609 print
'<td class="right">'.price(
price2num($objp->ppmp * $objp->value,
'MT')).
'</td>';
610 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
613 if (empty($conf->global->PRODUIT_MULTIPRICES))
615 $pricemin = $objp->price;
616 print
'<td class="right">';
620 print
'<td class="right">';
624 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
626 if ($user->rights->stock->mouvement->creer)
628 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.$object->id.
'&id='.$objp->rowid.
'&action=transfert&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
629 print
img_picto($langs->trans(
"StockMovement"),
'uparrow.png',
'class="hideonsmartphone"').
' '.$langs->trans(
"StockMovement");
633 if ($user->rights->stock->creer)
635 print
'<td class="center"><a href="'.DOL_URL_ROOT.
'/product/stock/product.php?dwid='.$object->id.
'&id='.$objp->rowid.
'&action=correction&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?id='.$id).
'">';
636 print $langs->trans(
"StockCorrection");
639 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
640 if ($i == 0) $units = $productstatic->fk_unit;
641 elseif ($productstatic->fk_unit != $units) $sameunits = false;
648 print '<tr class="liste_total"><td class="liste_total" colspan="2">'.$langs->trans("Total").'</td>';
649 print '<td class="liste_total right">';
650 $valtoshow =
price2num($totalunit, 'MS');
651 if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) print empty($valtoshow) ? '0' : $valtoshow;
653 print '<td class="liste_total">';
654 if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) print $langs->trans($productstatic->getLabelOfUnit());
656 print '<td class="liste_total right">'.
price(
price2num($totalvalue, 'MT')).'</td>';
657 if (empty($conf->global->PRODUIT_MULTIPRICES))
659 print
'<td class="liste_total"> </td>';
660 print
'<td class="liste_total right">'.price(
price2num($totalvaluesell,
'MT')).
'</td>';
662 print
'<td class="liste_total"> </td>';
663 print
'<td class="liste_total"> </td>';
675 if ($action ==
'edit' || $action ==
're-edit')
677 $langs->trans(
"WarehouseEdit");
679 print
'<form action="card.php" method="POST">';
680 print
'<input type="hidden" name="token" value="'.newToken().
'">';
681 print
'<input type="hidden" name="action" value="update">';
682 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
688 print
'<table class="border centpercent">';
691 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Ref").
'</td><td><input name="libelle" size="20" value="'.$object->label.
'"></td></tr>';
693 print
'<tr><td>'.$langs->trans(
"LocationSummary").
'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.
'"></td></tr>';
696 print
'<tr><td>'.$langs->trans(
"AddIn").
'</td><td>';
697 print $formproduct->selectWarehouses($object->fk_parent,
'fk_parent',
'', 1);
701 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
703 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
704 $doleditor =
new DolEditor(
'desc', $object->description,
'', 180,
'dolibarr_notes',
'In',
false,
true, $conf->fckeditor->enabled, ROWS_5,
'90%');
705 $doleditor->Create();
708 print
'<tr><td>'.$langs->trans(
'Address').
'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
709 print $object->address;
710 print
'</textarea></td></tr>';
713 print
'<tr><td>'.$langs->trans(
'Zip').
'</td><td>';
714 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
716 print
'<tr><td>'.$langs->trans(
'Town').
'</td><td>';
717 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
721 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
722 print
img_picto(
'',
'globe-americas',
'class="paddingright"');
723 print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code,
'country_id');
724 if ($user->admin) print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
728 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td><td>';
729 print
img_picto(
'',
'object_phoning',
'class="paddingright"');
730 print
'<input name="phone" size="20" value="'.$object->phone.
'"></td></tr>';
731 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td><td>';
732 print
img_picto(
'',
'object_phoning_fax',
'class="paddingright"');
733 print
'<input name="fax" size="20" value="'.$object->fax.
'"></td></tr>';
736 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
737 print
'<select name="statut" class="flat">';
738 foreach ($object->statuts as $key => $value)
740 if ($key == $object->statut)
742 print
'<option value="'.$key.
'" selected>'.$langs->trans($value).
'</option>';
744 print
'<option value="'.$key.
'">'.$langs->trans($value).
'</option>';
751 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3');
752 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
753 print $hookmanager->resPrint;
756 print $object->showOptionals($extrafields,
'edit', $parameters);
760 if ($conf->categorie->enabled)
762 print
'<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td colspan="3">';
763 $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE,
'',
'parent', 64, 0, 1);
765 $cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
766 $arrayselected = array();
767 foreach ($cats as $cat) {
768 $arrayselected[] = $cat->id;
770 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
778 print
'<div class="center">';
779 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
780 print
' ';
781 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
793 $modulepart =
'stock';
795 if ($action !=
'create' && $action !=
'edit' && $action !=
'delete')
798 print
'<div class="fichecenter"><div class="fichehalfleft">';
799 print
'<a name="builddoc"></a>';
803 $relativepath = $object->ref.
'/'.$objectref.
'.pdf';
804 $filedir = $conf->stock->dir_output.
'/'.$objectref;
805 $urlsource =
$_SERVER[
"PHP_SELF"].
"?id=".$object->id;
806 $genallowed = $usercanread;
807 $delallowed = $usercancreate;
808 $modulepart =
'stock';
810 print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0,
'', 0,
'', $object->default_lang,
'', $object);
811 $somethingshown = $formfile->numoffiles;
813 print
'</div><div class="fichehalfright"><div class="ficheaddleft">';
817 $morehtmlright =
'<a href="'.DOL_URL_ROOT.
'/product/agenda.php?id='.$object->id.
'">';
818 $morehtmlright .= $langs->trans(
"SeeAll");
819 $morehtmlright .=
'</a>';
822 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
824 $somethingshown =
$formactions->showactions($object,
'stock', 0, 1,
'', $MAXEVENT,
'', $morehtmlright);
826 print
'</div></div></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
Class to manage products or services.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage categories.
stock_prepare_head($object)
Prepare array with list of tabs.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
Class to manage warehouses.