card.php 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  1. <?php
  2. /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
  5. * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
  6. * Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
  7. * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
  8. * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
  9. * Copyright (C) 2022-2023 Charlene Benke <charlene@patas-monkey.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  23. */
  24. /**
  25. * \file htdocs/product/stock/card.php
  26. * \ingroup stock
  27. * \brief Page fiche entrepot
  28. */
  29. // Load Dolibarr environment
  30. require '../../main.inc.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  32. require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
  33. require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
  34. require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
  36. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  37. require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
  38. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  39. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  40. if (isModEnabled('project')) {
  41. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  42. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  43. }
  44. // Load translation files required by the page
  45. $langs->loadLangs(array('products', 'stocks', 'companies', 'categories'));
  46. $action = GETPOST('action', 'aZ09');
  47. $cancel = GETPOST('cancel', 'alpha');
  48. $confirm = GETPOST('confirm');
  49. $projectid = GETPOST('projectid', 'int');
  50. $id = GETPOST('id', 'int');
  51. $socid = GETPOST('socid', 'int');
  52. $ref = GETPOST('ref', 'alpha');
  53. // Load variable for pagination
  54. $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
  55. $sortfield = GETPOST('sortfield', 'aZ09comma');
  56. $sortorder = GETPOST('sortorder', 'aZ09comma');
  57. if (!$sortfield) {
  58. $sortfield = "p.ref";
  59. }
  60. if (!$sortorder) {
  61. $sortorder = "DESC";
  62. }
  63. $backtopage = GETPOST('backtopage', 'alpha');
  64. // Security check
  65. //$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
  66. $result = restrictedArea($user, 'stock');
  67. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  68. $hookmanager->initHooks(array('warehousecard', 'globalcard'));
  69. $object = new Entrepot($db);
  70. $extrafields = new ExtraFields($db);
  71. // fetch optionals attributes and labels
  72. $extrafields->fetch_name_optionals_label($object->table_element);
  73. // Load object
  74. if ($id > 0 || !empty($ref)) {
  75. $ret = $object->fetch($id, $ref);
  76. if ($ret <= 0) {
  77. setEventMessages($object->error, $object->errors, 'errors');
  78. $action = '';
  79. }
  80. }
  81. $usercanread = (($user->rights->stock->lire));
  82. $usercancreate = (($user->rights->stock->creer));
  83. $usercandelete = (($user->rights->stock->supprimer));
  84. /*
  85. * Actions
  86. */
  87. $error = 0;
  88. $parameters = array('id'=>$id, 'ref'=>$ref);
  89. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  90. if ($reshook < 0) {
  91. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  92. }
  93. if (empty($reshook)) {
  94. $backurlforlist = DOL_URL_ROOT.'/product/stock/list.php';
  95. if (empty($backtopage) || ($cancel && empty($id))) {
  96. if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
  97. if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
  98. $backtopage = $backurlforlist;
  99. } else {
  100. $backtopage = DOL_URL_ROOT.'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
  101. }
  102. }
  103. }
  104. if ($cancel) {
  105. if (!empty($backtopageforcancel)) {
  106. header("Location: ".$backtopageforcancel);
  107. exit;
  108. } elseif (!empty($backtopage)) {
  109. header("Location: ".$backtopage);
  110. exit;
  111. }
  112. $action = '';
  113. }
  114. // Ajout entrepot
  115. if ($action == 'add' && $user->rights->stock->creer) {
  116. $object->ref = (string) GETPOST("ref", "alpha");
  117. $object->fk_parent = (int) GETPOST("fk_parent", "int");
  118. $object->fk_project = GETPOST('projectid', 'int');
  119. $object->label = (string) GETPOST("libelle", "alpha");
  120. $object->description = (string) GETPOST("desc", "alpha");
  121. $object->statut = GETPOST("statut", "int");
  122. $object->lieu = (string) GETPOST("lieu", "alpha");
  123. $object->address = (string) GETPOST("address", "alpha");
  124. $object->zip = (string) GETPOST("zipcode", "alpha");
  125. $object->town = (string) GETPOST("town", "alpha");
  126. $object->country_id = GETPOST("country_id");
  127. $object->phone = (string) GETPOST("phone", "alpha");
  128. $object->fax = (string) GETPOST("fax", "alpha");
  129. if (!empty($object->label)) {
  130. // Fill array 'array_options' with data from add form
  131. $ret = $extrafields->setOptionalsFromPost(null, $object);
  132. if ($ret < 0) {
  133. $error++;
  134. $action = 'create';
  135. }
  136. if (!$error) {
  137. $id = $object->create($user);
  138. if ($id > 0) {
  139. setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
  140. $categories = GETPOST('categories', 'array');
  141. $object->setCategories($categories);
  142. if (!empty($backtopage)) {
  143. $backtopage = str_replace("__ID__", $id, $backtopage);
  144. header("Location: ".$backtopage);
  145. exit;
  146. } else {
  147. header("Location: card.php?id=".urlencode($id));
  148. exit;
  149. }
  150. } else {
  151. $action = 'create';
  152. setEventMessages($object->error, $object->errors, 'errors');
  153. }
  154. }
  155. } else {
  156. setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
  157. $action = "create"; // Force retour sur page creation
  158. }
  159. }
  160. // Delete warehouse
  161. if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer) {
  162. $object->fetch(GETPOST('id', 'int'));
  163. $result = $object->delete($user);
  164. if ($result > 0) {
  165. setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
  166. header("Location: ".DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1');
  167. exit;
  168. } else {
  169. setEventMessages($object->error, $object->errors, 'errors');
  170. $action = '';
  171. }
  172. }
  173. // Modification entrepot
  174. if ($action == 'update' && !$cancel) {
  175. if ($object->fetch($id)) {
  176. $object->label = GETPOST("libelle");
  177. $object->fk_parent = GETPOST("fk_parent");
  178. $object->fk_project = GETPOST('projectid');
  179. $object->description = GETPOST("desc");
  180. $object->statut = GETPOST("statut");
  181. $object->lieu = GETPOST("lieu");
  182. $object->address = GETPOST("address");
  183. $object->zip = GETPOST("zipcode");
  184. $object->town = GETPOST("town");
  185. $object->country_id = GETPOST("country_id");
  186. $object->phone = GETPOST("phone");
  187. $object->fax = GETPOST("fax");
  188. // Fill array 'array_options' with data from add form
  189. $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
  190. if ($ret < 0) {
  191. $error++;
  192. }
  193. if (!$error) {
  194. $ret = $object->update($id, $user);
  195. if ($ret < 0) {
  196. $error++;
  197. }
  198. }
  199. if ($error) {
  200. $action = 'edit';
  201. setEventMessages($object->error, $object->errors, 'errors');
  202. } else {
  203. $categories = GETPOST('categories', 'array');
  204. $object->setCategories($categories);
  205. $action = '';
  206. }
  207. } else {
  208. $action = 'edit';
  209. setEventMessages($object->error, $object->errors, 'errors');
  210. }
  211. } elseif ($action == 'update_extras') {
  212. $object->oldcopy = dol_clone($object);
  213. // Fill array 'array_options' with data from update form
  214. $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
  215. if ($ret < 0) {
  216. $error++;
  217. }
  218. if (!$error) {
  219. $result = $object->insertExtraFields();
  220. if ($result < 0) {
  221. setEventMessages($object->error, $object->errors, 'errors');
  222. $error++;
  223. }
  224. }
  225. if ($error) {
  226. $action = 'edit_extras';
  227. }
  228. } elseif ($action == 'classin' && $usercancreate) {
  229. // Link to a project
  230. $object->setProject(GETPOST('projectid', 'int'));
  231. }
  232. if ($cancel == $langs->trans("Cancel")) {
  233. $action = '';
  234. }
  235. // Actions to build doc
  236. $upload_dir = $conf->stock->dir_output;
  237. $permissiontoadd = $user->rights->stock->creer;
  238. include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
  239. }
  240. /*
  241. * View
  242. */
  243. $productstatic = new Product($db);
  244. $form = new Form($db);
  245. $formproduct = new FormProduct($db);
  246. $formcompany = new FormCompany($db);
  247. $formfile = new FormFile($db);
  248. if (isModEnabled('project')) {
  249. $formproject = new FormProjets($db);
  250. }
  251. $title = $langs->trans("WarehouseCard");
  252. if ($action == 'create') {
  253. $title = $langs->trans("NewWarehouse");
  254. }
  255. $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
  256. llxHeader("", $title, $help_url);
  257. if ($action == 'create') {
  258. print load_fiche_titre($langs->trans("NewWarehouse"), '', 'stock');
  259. dol_set_focus('input[name="libelle"]');
  260. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
  261. print '<input type="hidden" name="token" value="'.newToken().'">';
  262. print '<input type="hidden" name="action" value="add">';
  263. print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
  264. print dol_get_fiche_head();
  265. print '<table class="border centpercent">';
  266. // Ref
  267. print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value=""></td></tr>';
  268. print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.(!empty($object->lieu) ? $object->lieu : '').'"></td></tr>';
  269. // Parent entrepot
  270. print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
  271. print img_picto('', 'stock').$formproduct->selectWarehouses((GETPOSTISSET('fk_parent') ? GETPOST('fk_parent', 'int') : 'ifone'), 'fk_parent', '', 1);
  272. print '</td></tr>';
  273. // Project
  274. if (isModEnabled('project')) {
  275. $langs->load('projects');
  276. print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
  277. print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
  278. 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>';
  279. print '</td></tr>';
  280. }
  281. // Description
  282. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  283. // Editeur wysiwyg
  284. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  285. $doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, isModEnabled('fckeditor'), ROWS_5, '90%');
  286. $doleditor->Create();
  287. print '</td></tr>';
  288. print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
  289. print (!empty($object->address) ? $object->address : '');
  290. print '</textarea></td></tr>';
  291. // Zip / Town
  292. print '<tr><td>'.$langs->trans('Zip').'</td><td>';
  293. print $formcompany->select_ziptown((!empty($object->zip) ? $object->zip : ''), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
  294. print '</td></tr>';
  295. print '<tr><td>'.$langs->trans('Town').'</td><td>';
  296. print $formcompany->select_ziptown((!empty($object->town) ? $object->town : ''), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
  297. print '</td></tr>';
  298. // Country
  299. print '<tr><td>'.$langs->trans('Country').'</td><td>';
  300. print img_picto('', 'globe-americas', 'class="paddingright"');
  301. print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
  302. if ($user->admin) {
  303. print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
  304. }
  305. print '</td></tr>';
  306. // Phone / Fax
  307. print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
  308. print img_picto('', 'object_phoning', 'class="paddingright"');
  309. print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
  310. print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
  311. print '<td>';
  312. print img_picto('', 'object_phoning_fax', 'class="paddingright"');
  313. print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
  314. // Status
  315. print '<tr><td>'.$langs->trans("Status").'</td><td>';
  316. print '<select id="warehousestatus" name="statut" class="flat minwidth100">';
  317. foreach ($object->statuts as $key => $value) {
  318. if ($key == 1) {
  319. print '<option value="'.$key.'" selected>'.$langs->trans($value).'</option>';
  320. } else {
  321. print '<option value="'.$key.'">'.$langs->trans($value).'</option>';
  322. }
  323. }
  324. print '</select>';
  325. print ajax_combobox('warehousestatus');
  326. print '</td></tr>';
  327. // Other attributes
  328. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
  329. if (isModEnabled('categorie')) {
  330. // Categories
  331. print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
  332. $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
  333. print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
  334. print "</td></tr>";
  335. }
  336. print '</table>';
  337. print dol_get_fiche_end();
  338. print $form->buttonsSaveCancel("Create");
  339. print '</form>';
  340. } else {
  341. $id = GETPOST("id", 'int');
  342. if ($id > 0 || $ref) {
  343. $object = new Entrepot($db);
  344. $result = $object->fetch($id, $ref);
  345. if ($result <= 0) {
  346. print 'No record found';
  347. exit;
  348. }
  349. // View mode
  350. if ($action <> 'edit' && $action <> 're-edit') {
  351. $head = stock_prepare_head($object);
  352. print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), -1, 'stock');
  353. $formconfirm = '';
  354. // Confirm delete warehouse
  355. if ($action == 'delete') {
  356. $formquestion = array(
  357. array('type' => 'other', 'name' => 'info', 'label' => img_warning('').$langs->trans("WarningThisWIllAlsoDeleteStock"), 'morecss'=>'warning')
  358. );
  359. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAWarehouse"), $langs->trans("ConfirmDeleteWarehouse", $object->label), "confirm_delete", $formquestion, 0, 2);
  360. }
  361. // Call Hook formConfirm
  362. $parameters = array('formConfirm' => $formconfirm);
  363. $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  364. if (empty($reshook)) {
  365. $formconfirm .= $hookmanager->resPrint;
  366. } elseif ($reshook > 0) {
  367. $formconfirm = $hookmanager->resPrint;
  368. }
  369. // Print form confirm
  370. print $formconfirm;
  371. // Warehouse card
  372. $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  373. $morehtmlref = '<div class="refidno">';
  374. $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
  375. // Project
  376. if (isModEnabled('project')) {
  377. $langs->load("projects");
  378. $morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
  379. if ($usercancreate) {
  380. if ($action != 'classify') {
  381. $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
  382. }
  383. if ($action == 'classify') {
  384. $projectid = $object->fk_project;
  385. $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
  386. $morehtmlref .= '<input type="hidden" name="action" value="classin">';
  387. $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
  388. $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
  389. $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
  390. $morehtmlref .= '</form>';
  391. } else {
  392. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, ($socid > 0 ? $socid : -1), $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
  393. }
  394. } else {
  395. if (!empty($object->fk_project)) {
  396. $proj = new Project($db);
  397. $proj->fetch($object->fk_project);
  398. $morehtmlref .= ' : '.$proj->getNomUrl(1);
  399. if ($proj->title) {
  400. $morehtmlref .= ' - '.$proj->title;
  401. }
  402. } else {
  403. $morehtmlref .= '';
  404. }
  405. }
  406. }
  407. $morehtmlref .= '</div>';
  408. $shownav = 1;
  409. if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
  410. $shownav = 0;
  411. }
  412. dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
  413. print '<div class="fichecenter">';
  414. print '<div class="fichehalfleft">';
  415. print '<div class="underbanner clearboth"></div>';
  416. print '<table class="border centpercent tableforfield">';
  417. // Parent entrepot
  418. $parentwarehouse = new Entrepot($db);
  419. if (!empty($object->fk_parent) && $parentwarehouse->fetch($object->fk_parent) > 0) {
  420. print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>';
  421. print $parentwarehouse->getNomUrl(3);
  422. print '</td></tr>';
  423. }
  424. print '<tr>';
  425. // Description
  426. print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.dol_htmlentitiesbr($object->description).'</td></tr>';
  427. $calcproductsunique = $object->nb_different_products();
  428. $calcproducts = $object->nb_products();
  429. // Total nb of different products
  430. print '<tr><td>'.$langs->trans("NumberOfDifferentProducts").'</td><td>';
  431. print empty($calcproductsunique['nb']) ? '0' : $calcproductsunique['nb'];
  432. print "</td></tr>";
  433. // Nb of products
  434. print '<tr><td>'.$langs->trans("NumberOfProducts").'</td><td>';
  435. $valtoshow = price2num($calcproducts['nb'], 'MS');
  436. print empty($valtoshow) ? '0' : $valtoshow;
  437. print "</td></tr>";
  438. print '</table>';
  439. print '</div>';
  440. print '<div class="fichehalfright">';
  441. print '<div class="underbanner clearboth"></div>';
  442. print '<table class="border centpercent tableforfield">';
  443. // Value
  444. print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
  445. print price((empty($calcproducts['value']) ? '0' : price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
  446. print "</td></tr>";
  447. // Last movement
  448. if (!empty($user->rights->stock->mouvement->lire)) {
  449. $sql = "SELECT max(m.datem) as datem";
  450. $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
  451. $sql .= " WHERE m.fk_entrepot = ".((int) $object->id);
  452. $resqlbis = $db->query($sql);
  453. if ($resqlbis) {
  454. $obj = $db->fetch_object($resqlbis);
  455. $lastmovementdate = $db->jdate($obj->datem);
  456. } else {
  457. dol_print_error($db);
  458. }
  459. print '<tr><td>'.$langs->trans("LastMovement").'</td><td>';
  460. if ($lastmovementdate) {
  461. print dol_print_date($lastmovementdate, 'dayhour');
  462. print ' &nbsp; &nbsp; ';
  463. print img_picto($langs->trans('LastMovement'), 'movement', 'class="pictofixedwidth"');
  464. print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id.'">'.$langs->trans("FullList").'</a>';
  465. } else {
  466. print $langs->trans("None");
  467. }
  468. print "</td></tr>";
  469. }
  470. // Other attributes
  471. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
  472. // Categories
  473. if (isModEnabled('categorie')) {
  474. print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
  475. print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
  476. print "</td></tr>";
  477. }
  478. print "</table>";
  479. print '</div>';
  480. print '</div>';
  481. print '<div class="clearboth"></div>';
  482. print dol_get_fiche_end();
  483. /*
  484. * Action bar
  485. */
  486. print "<div class=\"tabsAction\">\n";
  487. $parameters = array();
  488. $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  489. if (empty($reshook)) {
  490. if (empty($action) || $action == 'classin') {
  491. if ($user->rights->stock->creer) {
  492. print '<a class="butAction" href="card.php?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
  493. } else {
  494. print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Modify").'</a>';
  495. }
  496. if ($user->rights->stock->supprimer) {
  497. print '<a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
  498. } else {
  499. print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete").'</a>';
  500. }
  501. }
  502. }
  503. print "</div>";
  504. // Show list of products into warehouse
  505. print '<br>';
  506. $totalarray = array();
  507. $totalarray['val'] = array ();
  508. $totalarray['pos'] = array ();
  509. $totalarray['type'] = array ();
  510. $totalarray['nbfield'] = 0;
  511. // TODO Create $arrayfields with all fields to show
  512. print '<table class="noborder centpercent">';
  513. print "<tr class=\"liste_titre\">";
  514. $parameters = array('totalarray' => &$totalarray);
  515. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
  516. print $hookmanager->resPrint;
  517. print_liste_field_titre("Product", "", "p.ref", "&amp;id=".$id, "", "", $sortfield, $sortorder);
  518. print_liste_field_titre("Label", "", "p.label", "&amp;id=".$id, "", "", $sortfield, $sortorder);
  519. print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
  520. $totalarray['nbfield'] += 3;
  521. $totalarray['pos'][$totalarray['nbfield']] = 'totalunit';
  522. $totalarray['type'][$totalarray['nbfield']] = 'stock';
  523. if (!empty($conf->global->PRODUCT_USE_UNITS)) {
  524. print_liste_field_titre("Unit", "", "p.fk_unit", "&amp;id=".$id, "", 'align="left"', $sortfield, $sortorder);
  525. $totalarray['nbfield']++;
  526. $totalarray['pos'][$totalarray['nbfield']] = 'units';
  527. $totalarray['type'][$totalarray['nbfield']] = 'string';
  528. }
  529. print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
  530. $totalarray['nbfield']++;
  531. print_liste_field_titre("EstimatedStockValueShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
  532. $totalarray['nbfield']++;
  533. $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue';
  534. $totalarray['type'][$totalarray['nbfield']] = '';
  535. if (empty($conf->global->PRODUIT_MULTIPRICES)) {
  536. print_liste_field_titre("SellPriceMin", "", "p.price", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
  537. $totalarray['nbfield']++;
  538. }
  539. if (empty($conf->global->PRODUIT_MULTIPRICES)) {
  540. print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
  541. $totalarray['nbfield']++;
  542. $totalarray['pos'][$totalarray['nbfield']] = 'totalvaluesell';
  543. $totalarray['type'][$totalarray['nbfield']] = '';
  544. }
  545. if ($user->rights->stock->mouvement->creer) {
  546. print_liste_field_titre('');
  547. $totalarray['nbfield']++;
  548. }
  549. if ($user->rights->stock->creer) {
  550. print_liste_field_titre('');
  551. $totalarray['nbfield']++;
  552. }
  553. // Hook fields
  554. $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray' => &$totalarray);
  555. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
  556. print $hookmanager->resPrint;
  557. print "</tr>\n";
  558. $totalunit = 0;
  559. $totalvalue = $totalvaluesell = 0;
  560. //For MultiCompany PMP per entity
  561. $separatedPMP = false;
  562. if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
  563. $separatedPMP = true;
  564. }
  565. $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,";
  566. $sql .= "p.tosell, p.tobuy,";
  567. $sql .= "p.accountancy_code_sell,";
  568. $sql .= "p.accountancy_code_sell_intra,";
  569. $sql .= "p.accountancy_code_sell_export,";
  570. $sql .= "p.accountancy_code_buy,";
  571. $sql .= "p.accountancy_code_buy_intra,";
  572. $sql .= "p.accountancy_code_buy_export,";
  573. $sql .= 'p.barcode,';
  574. if ($separatedPMP) {
  575. $sql .= " pa.pmp as ppmp,";
  576. } else {
  577. $sql .= " p.pmp as ppmp,";
  578. }
  579. $sql .= " ps.reel as value";
  580. if (!empty($conf->global->PRODUCT_USE_UNITS)) {
  581. $sql .= ",fk_unit";
  582. }
  583. // Add fields from hooks
  584. $parameters = array();
  585. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
  586. if ($reshook > 0) { //Note that $sql is replaced if reshook > 0
  587. $sql = "";
  588. }
  589. $sql .= $hookmanager->resPrint;
  590. $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
  591. if ($separatedPMP) {
  592. $sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa";
  593. }
  594. $sql .= " WHERE ps.fk_product = p.rowid";
  595. $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
  596. $sql .= " AND ps.fk_entrepot = ".((int) $object->id);
  597. if ($separatedPMP) {
  598. $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
  599. }
  600. $sql .= $db->order($sortfield, $sortorder);
  601. dol_syslog('List products', LOG_DEBUG);
  602. $resql = $db->query($sql);
  603. if ($resql) {
  604. $num = $db->num_rows($resql);
  605. $i = 0;
  606. $sameunits = true;
  607. while ($i < $num) {
  608. $objp = $db->fetch_object($resql);
  609. // Multilangs
  610. if (getDolGlobalInt('MAIN_MULTILANGS')) { // si l'option est active
  611. $sql = "SELECT label";
  612. $sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
  613. $sql .= " WHERE fk_product = ".((int) $objp->rowid);
  614. $sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
  615. $sql .= " LIMIT 1";
  616. $result = $db->query($sql);
  617. if ($result) {
  618. $objtp = $db->fetch_object($result);
  619. if ($objtp->label != '') {
  620. $objp->produit = $objtp->label;
  621. }
  622. }
  623. }
  624. //print '<td>'.dol_print_date($objp->datem).'</td>';
  625. print '<tr class="oddeven">';
  626. $parameters = array('obj'=>$objp, 'totalarray' => &$totalarray);
  627. $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
  628. print $hookmanager->resPrint;
  629. $productstatic->id = $objp->rowid;
  630. $productstatic->ref = $objp->ref;
  631. $productstatic->label = $objp->produit;
  632. $productstatic->type = $objp->type;
  633. $productstatic->entity = $objp->entity;
  634. $productstatic->status_batch = $objp->tobatch;
  635. if (!empty($conf->global->PRODUCT_USE_UNITS)) {
  636. $productstatic->fk_unit = $objp->fk_unit;
  637. }
  638. $productstatic->status = $objp->tosell;
  639. $productstatic->status_buy = $objp->tobuy;
  640. $productstatic->barcode = $objp->barcode;
  641. $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
  642. $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
  643. $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
  644. $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
  645. $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
  646. $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
  647. // Ref
  648. print "<td>";
  649. print $productstatic->getNomUrl(1, 'stock', 16);
  650. print '</td>';
  651. // Label
  652. print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).'">'.dol_escape_htmltag($objp->produit).'</td>';
  653. // Value
  654. print '<td class="right">';
  655. $valtoshow = price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
  656. print empty($valtoshow) ? '0' : $valtoshow;
  657. print '</td>';
  658. $totalunit += $objp->value;
  659. if (!empty($conf->global->PRODUCT_USE_UNITS)) {
  660. // Units
  661. print '<td align="left">';
  662. if (is_null($productstatic->fk_unit)) {
  663. $productstatic->fk_unit = 1;
  664. }
  665. print $langs->trans($productstatic->getLabelOfUnit());
  666. print '</td>';
  667. }
  668. // Price buy PMP
  669. print '<td class="right nowraponall">'.price(price2num($objp->ppmp, 'MU')).'</td>';
  670. // Total PMP
  671. print '<td class="right amount nowraponall">'.price(price2num($objp->ppmp * $objp->value, 'MT')).'</td>';
  672. $totalvalue += price2num($objp->ppmp * $objp->value, 'MT');
  673. // Price sell min
  674. if (empty($conf->global->PRODUIT_MULTIPRICES)) {
  675. $pricemin = $objp->price;
  676. print '<td class="right">';
  677. print price(price2num($pricemin, 'MU'), 1);
  678. print '</td>';
  679. // Total sell min
  680. print '<td class="right">';
  681. print price(price2num($pricemin * $objp->value, 'MT'), 1);
  682. print '</td>';
  683. }
  684. $totalvaluesell += price2num($pricemin * $objp->value, 'MT');
  685. // Link to transfer
  686. if ($user->rights->stock->mouvement->creer) {
  687. 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).'">';
  688. print img_picto($langs->trans("TransferStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
  689. print $langs->trans("TransferStock");
  690. print "</a></td>";
  691. }
  692. // Link to stock
  693. if ($user->rights->stock->creer) {
  694. 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).'">';
  695. print img_picto($langs->trans("CorrectStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
  696. print $langs->trans("CorrectStock");
  697. print "</a></td>";
  698. }
  699. print "</tr>";
  700. $i++;
  701. // Define $unit and $sameunits
  702. if (!empty($conf->global->PRODUCT_USE_UNITS)) {
  703. if ($i == 0) {
  704. $units = $productstatic->fk_unit;
  705. } elseif ($productstatic->fk_unit != $units) {
  706. $sameunits = false;
  707. }
  708. }
  709. }
  710. $db->free($resql);
  711. $totalarray['val']['totalunit'] = $totalunit;
  712. $totalarray['val']['totalvalue'] = price2num($totalvalue, 'MT');
  713. $totalarray['val']['totalvaluesell'] = price2num($totalvaluesell, 'MT');
  714. $totalarray['val']['units'] = $langs->trans($productstatic->getLabelOfUnit());
  715. $parameters = array('totalarray' => &$totalarray);
  716. // Note that $action and $object may have been modified by hook
  717. $reshook = $hookmanager->executeHooks('printFieldListTotal', $parameters, $object);
  718. if ($reshook < 0) {
  719. setEventMessages($hookmanager->error, $hookmanager->errors);
  720. }
  721. // Show total line
  722. include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
  723. } else {
  724. dol_print_error($db);
  725. }
  726. print "</table>\n";
  727. }
  728. // Edit mode
  729. if ($action == 'edit' || $action == 're-edit') {
  730. $langs->trans("WarehouseEdit");
  731. print '<form action="card.php" method="POST">';
  732. print '<input type="hidden" name="token" value="'.newToken().'">';
  733. print '<input type="hidden" name="action" value="update">';
  734. print '<input type="hidden" name="id" value="'.$object->id.'">';
  735. $head = stock_prepare_head($object);
  736. print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
  737. print '<table class="border centpercent">';
  738. // Ref
  739. print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->label.'"></td></tr>';
  740. print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.'"></td></tr>';
  741. // Parent entrepot
  742. print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
  743. print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1);
  744. print '</td></tr>';
  745. // Project
  746. if (isModEnabled('project')) {
  747. $projectid = $object->fk_project;
  748. $langs->load('projects');
  749. print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
  750. print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
  751. 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>';
  752. print '</td></tr>';
  753. }
  754. // Description
  755. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  756. // Editeur wysiwyg
  757. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  758. $doleditor = new DolEditor('desc', $object->description, '', 180, 'dolibarr_notes', 'In', false, true, isModEnabled('fckeditor'), ROWS_5, '90%');
  759. $doleditor->Create();
  760. print '</td></tr>';
  761. print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
  762. print $object->address;
  763. print '</textarea></td></tr>';
  764. // Zip / Town
  765. print '<tr><td>'.$langs->trans('Zip').'</td><td>';
  766. print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
  767. print '</td></tr>';
  768. print '<tr><td>'.$langs->trans('Town').'</td><td>';
  769. print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
  770. print '</td></tr>';
  771. // Country
  772. print '<tr><td>'.$langs->trans('Country').'</td><td>';
  773. print img_picto('', 'globe-americas', 'class="paddingright"');
  774. print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
  775. if ($user->admin) {
  776. print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
  777. }
  778. print '</td></tr>';
  779. // Phone / Fax
  780. print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
  781. print img_picto('', 'object_phoning', 'class="paddingright"');
  782. print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
  783. print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td>';
  784. print img_picto('', 'object_phoning_fax', 'class="paddingright"');
  785. print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
  786. // Status
  787. print '<tr><td>'.$langs->trans("Status").'</td><td>';
  788. print '<select id="warehousestatus" name="statut" class="flat">';
  789. foreach ($object->statuts as $key => $value) {
  790. if ($key == $object->statut) {
  791. print '<option value="'.$key.'" selected>'.$langs->trans($value).'</option>';
  792. } else {
  793. print '<option value="'.$key.'">'.$langs->trans($value).'</option>';
  794. }
  795. }
  796. print '</select>';
  797. print ajax_combobox('warehousestatus');
  798. print '</td></tr>';
  799. // Other attributes
  800. $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
  801. $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  802. print $hookmanager->resPrint;
  803. if (empty($reshook)) {
  804. print $object->showOptionals($extrafields, 'edit', $parameters);
  805. }
  806. // Tags-Categories
  807. if (isModEnabled('categorie')) {
  808. print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
  809. $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
  810. $c = new Categorie($db);
  811. $cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
  812. $arrayselected = array();
  813. foreach ($cats as $cat) {
  814. $arrayselected[] = $cat->id;
  815. }
  816. print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
  817. print "</td></tr>";
  818. }
  819. print '</table>';
  820. print dol_get_fiche_end();
  821. print $form->buttonsSaveCancel();
  822. print '</form>';
  823. }
  824. }
  825. }
  826. /*
  827. * Documents generated
  828. */
  829. $modulepart = 'stock';
  830. if ($action != 'create' && $action != 'edit' && $action != 'delete') {
  831. print '<br>';
  832. print '<div class="fichecenter"><div class="fichehalfleft">';
  833. print '<a name="builddoc"></a>'; // ancre
  834. // Documents
  835. $objectref = dol_sanitizeFileName($object->ref);
  836. $relativepath = $object->ref.'/'.$objectref.'.pdf';
  837. $filedir = $conf->stock->dir_output.'/'.$objectref;
  838. $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
  839. $genallowed = $usercanread;
  840. $delallowed = $usercancreate;
  841. $modulepart = 'stock';
  842. print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', '', '', $object);
  843. $somethingshown = $formfile->numoffiles;
  844. print '</div><div class="fichehalfright">';
  845. $MAXEVENT = 10;
  846. $morehtmlcenter = '';
  847. //$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/product/stock/agenda.php?id='.$object->id);
  848. // List of actions on element
  849. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
  850. $formactions = new FormActions($db);
  851. $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product
  852. print '</div></div>';
  853. }
  854. // End of page
  855. llxFooter();
  856. $db->close();