card.php 38 KB

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