list.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <?php
  2. /* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
  3. * Copyright (C) 2019-2020 Open-DSI <support@open-dsi.fr>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/intracommreport/list.php
  20. * \ingroup Intracomm Report
  21. * \brief Page to list intracomm report
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  27. // Load translation files required by the page
  28. $langs->loadLangs(array('intracommreport'));
  29. $action = GETPOST('action', 'alpha');
  30. $massaction = GETPOST('massaction', 'alpha');
  31. $show_files = GETPOST('show_files', 'int');
  32. $confirm = GETPOST('confirm', 'alpha');
  33. $toselect = GETPOST('toselect', 'array');
  34. $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
  35. $search_ref = GETPOST("search_ref", 'alpha');
  36. $search_type = GETPOST("search_type", 'int');
  37. $optioncss = GETPOST('optioncss', 'alpha');
  38. $type = GETPOST("type", "int");
  39. $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
  40. $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
  41. $sortfield = GETPOST('sortfield', 'aZ09comma');
  42. $sortorder = GETPOST('sortorder', 'aZ09comma');
  43. $page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
  44. if (empty($page) || $page == -1) {
  45. $page = 0;
  46. } // If $page is not defined, or '' or -1
  47. $offset = $limit * $page;
  48. $pageprev = $page - 1;
  49. $pagenext = $page + 1;
  50. if (!$sortfield) {
  51. $sortfield = "i.ref";
  52. }
  53. if (!$sortorder) {
  54. $sortorder = "ASC";
  55. }
  56. // Initialize context for list
  57. $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'intracommreportlist';
  58. if ((string) $type == '1') {
  59. $contextpage = 'DESlist'; if ($search_type == '') {
  60. $search_type = '1';
  61. }
  62. }
  63. if ((string) $type == '0') {
  64. $contextpage = 'DEBlist'; if ($search_type == '') {
  65. $search_type = '0';
  66. }
  67. }
  68. // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
  69. $object = new IntracommReport($db);
  70. $hookmanager->initHooks(array('intracommreportlist'));
  71. $extrafields = new ExtraFields($db);
  72. $form = new Form($db);
  73. /*
  74. // fetch optionals attributes and labels
  75. $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
  76. $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
  77. */
  78. if (empty($action)) {
  79. $action = 'list';
  80. }
  81. // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
  82. $canvas = GETPOST("canvas");
  83. $objcanvas = null;
  84. if (!empty($canvas)) {
  85. require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
  86. $objcanvas = new Canvas($db, $action);
  87. $objcanvas->getCanvas('product', 'list', $canvas);
  88. }
  89. // Security check
  90. /*
  91. if ($search_type=='0') $result=restrictedArea($user, 'produit', '', '', '', '', '', $objcanvas);
  92. elseif ($search_type=='1') $result=restrictedArea($user, 'service', '', '', '', '', '', $objcanvas);
  93. else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objcanvas);
  94. */
  95. // List of fields to search into when doing a "search in all"
  96. $fieldstosearchall = array(
  97. 'i.ref'=>"Ref",
  98. 'pfi.ref_fourn'=>"RefSupplier",
  99. 'i.label'=>"ProductLabel",
  100. 'i.description'=>"Description",
  101. "i.note"=>"Note",
  102. );
  103. $isInEEC = isInEEC($mysoc);
  104. // Definition of fields for lists
  105. $arrayfields = array(
  106. 'i.ref' => array('label'=>$langs->trans("Ref"), 'checked'=>1),
  107. 'i.label' => array('label'=>$langs->trans("Label"), 'checked'=>1),
  108. 'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(!empty($conf->produit->enabled) && !empty($conf->service->enabled))),
  109. );
  110. /*
  111. // Extra fields
  112. if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
  113. {
  114. foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
  115. {
  116. if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
  117. $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
  118. }
  119. }
  120. */
  121. $object->fields = dol_sort_array($object->fields, 'position');
  122. $arrayfields = dol_sort_array($arrayfields, 'position');
  123. // Security check
  124. if ($search_type == '0') {
  125. $result = restrictedArea($user, 'produit', '', '', '', '', '', 0);
  126. } elseif ($search_type == '1') {
  127. $result = restrictedArea($user, 'service', '', '', '', '', '', 0);
  128. } else {
  129. $result = restrictedArea($user, 'produit|service', '', '', '', '', '', 0);
  130. }
  131. /*
  132. * Actions
  133. */
  134. if (GETPOST('cancel', 'alpha')) {
  135. $action = 'list'; $massaction = '';
  136. }
  137. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
  138. $massaction = '';
  139. }
  140. $parameters = array();
  141. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  142. if ($reshook < 0) {
  143. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  144. }
  145. if (empty($reshook)) {
  146. // Selection of new fields
  147. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  148. // Purge search criteria
  149. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
  150. $sall = "";
  151. $search_ref = "";
  152. $search_label = "";
  153. //$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
  154. $show_childproducts = '';
  155. $search_array_options = array();
  156. }
  157. // Mass actions
  158. $objectclass = 'Product';
  159. if ((string) $search_type == '1') {
  160. $objectlabel = 'Services';
  161. }
  162. if ((string) $search_type == '0') {
  163. $objectlabel = 'Products';
  164. }
  165. $permtoread = $user->rights->produit->lire;
  166. $permtodelete = $user->rights->produit->supprimer;
  167. $uploaddir = $conf->product->dir_output;
  168. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  169. }
  170. /*
  171. * View
  172. */
  173. $formother = new FormOther($db);
  174. $title = $langs->trans('IntracommReportList'.$type);
  175. $sql = 'SELECT DISTINCT i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity';
  176. /*
  177. // Add fields from extrafields
  178. if (! empty($extrafields->attributes[$object->table_element]['label'])) {
  179. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
  180. }
  181. */
  182. // Add fields from hooks
  183. $parameters = array();
  184. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
  185. $sql .= $hookmanager->resPrint;
  186. $sql .= ' FROM '.MAIN_DB_PREFIX.'intracommreport as i';
  187. // if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."intracommreport_extrafields as ef on (i.rowid = ef.fk_object)";
  188. $sql .= ' WHERE i.entity IN ('.getEntity('intracommreport').')';
  189. if ($sall) {
  190. $sql .= natural_search(array_keys($fieldstosearchall), $sall);
  191. }
  192. // if the type is not 1, we show all products (type = 0,2,3)
  193. if (dol_strlen($search_type) && $search_type != '-1') {
  194. if ($search_type == 1) {
  195. $sql .= " AND i.type = 1";
  196. } else {
  197. $sql .= " AND i.type = 0";
  198. }
  199. }
  200. /*
  201. if ($search_ref) $sql .= natural_search('i.ref', $search_ref);
  202. if ($search_label) $sql .= natural_search('i.label', $search_label);
  203. if ($search_barcode) $sql .= natural_search('i.barcode', $search_barcode);
  204. if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND i.tosell = ".((int) $search_tosell);
  205. if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND i.tobuy = ".((int) $search_tobuy);
  206. if (dol_strlen($canvas) > 0) $sql.= " AND i.canvas = '".$db->escape($canvas)."'";
  207. */
  208. /*
  209. // Add where from extra fields
  210. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  211. */
  212. // Add where from hooks
  213. $parameters = array();
  214. $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
  215. $sql .= $hookmanager->resPrint;
  216. $sql .= " GROUP BY i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity";
  217. /*
  218. // Add fields from extrafields
  219. if (! empty($extrafields->attributes[$object->table_element]['label'])) {
  220. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
  221. }
  222. */
  223. // Add fields from hooks
  224. $parameters = array();
  225. $reshook = $hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
  226. $sql .= $hookmanager->resPrint;
  227. $sql .= $db->order($sortfield, $sortorder);
  228. $nbtotalofrecords = '';
  229. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
  230. $result = $db->query($sql);
  231. $nbtotalofrecords = $db->num_rows($result);
  232. if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
  233. $page = 0;
  234. $offset = 0;
  235. }
  236. }
  237. $sql .= $db->plimit($limit + 1, $offset);
  238. $resql = $db->query($sql);
  239. if ($resql) {
  240. $num = $db->num_rows($resql);
  241. $arrayofselected = is_array($toselect) ? $toselect : array();
  242. $helpurl = 'EN:Module_IntracommReport|FR:Module_ProDouane';
  243. llxHeader('', $title, $helpurl, '');
  244. // Displays product removal confirmation
  245. if (GETPOST('delreport')) {
  246. setEventMessages($langs->trans("IntracommReportDeleted", GETPOST('delreport')), null, 'mesgs');
  247. }
  248. $param = '';
  249. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  250. $param .= '&contextpage='.urlencode($contextpage);
  251. }
  252. if ($limit > 0 && $limit != $conf->liste_limit) {
  253. $param .= '&limit='.urlencode($limit);
  254. }
  255. if ($sall) {
  256. $param .= "&sall=".urlencode($sall);
  257. }
  258. if ($search_ref) {
  259. $param = "&search_ref=".urlencode($search_ref);
  260. }
  261. if ($search_label) {
  262. $param .= "&search_label=".urlencode($search_label);
  263. }
  264. // Add $param from extra fields
  265. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  266. // List of mass actions available
  267. $arrayofmassactions = array(
  268. 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
  269. //'builddoc'=>$langs->trans("PDFMerge"),
  270. //'presend'=>$langs->trans("SendByMail"),
  271. );
  272. if ($user->rights->intracommreport->delete) {
  273. $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
  274. }
  275. if (in_array($massaction, array('presend', 'predelete'))) {
  276. $arrayofmassactions = array();
  277. }
  278. $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
  279. $newcardbutton = '';
  280. if ($user->rights->intracommreport->write) {
  281. $newcardbutton .= dolGetButtonTitle($langs->trans("NewDeclaration"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&amp;type='.$type);
  282. }
  283. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
  284. if ($optioncss != '') {
  285. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  286. }
  287. print '<input type="hidden" name="token" value="'.newToken().'">';
  288. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  289. print '<input type="hidden" name="action" value="list">';
  290. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  291. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  292. print '<input type="hidden" name="page" value="'.$page.'">';
  293. print '<input type="hidden" name="type" value="'.$type.'">';
  294. if (empty($arrayfields['i.fk_product_type']['checked'])) {
  295. print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
  296. }
  297. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'intracommreport', 0, $newcardbutton, '', $limit);
  298. $topicmail = "Information";
  299. $modelmail = "product";
  300. $objecttmp = new IntracommReport($db);
  301. $trackid = 'prod'.$object->id;
  302. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  303. if ($sall) {
  304. foreach ($fieldstosearchall as $key => $val) {
  305. $fieldstosearchall[$key] = $langs->trans($val);
  306. }
  307. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
  308. }
  309. $parameters = array();
  310. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
  311. if (empty($reshook)) {
  312. $moreforfilter .= $hookmanager->resPrint;
  313. } else {
  314. $moreforfilter = $hookmanager->resPrint;
  315. }
  316. if ($moreforfilter) {
  317. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  318. print $moreforfilter;
  319. print '</div>';
  320. }
  321. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  322. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  323. if ($massactionbutton) {
  324. $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
  325. }
  326. print '<div class="div-table-responsive">';
  327. print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  328. // Lines with input filters
  329. print '<tr class="liste_titre_filter">';
  330. if (!empty($arrayfields['i.ref']['checked'])) {
  331. print '<td class="liste_titre left">';
  332. print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
  333. print '</td>';
  334. }
  335. if (!empty($arrayfields['i.label']['checked'])) {
  336. print '<td class="liste_titre left">';
  337. print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
  338. print '</td>';
  339. }
  340. // Type
  341. // Type (customer/prospect/supplier)
  342. if (!empty($arrayfields['customerorsupplier']['checked'])) {
  343. print '<td class="liste_titre maxwidthonsmartphone center">';
  344. if ($type != '') {
  345. print '<input type="hidden" name="type" value="'.$type.'">';
  346. }
  347. print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
  348. print '</select></td>';
  349. }
  350. if (!empty($arrayfields['i.fk_product_type']['checked'])) {
  351. print '<td class="liste_titre left">';
  352. $array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
  353. print $form->selectarray('search_type', $array, $search_type);
  354. print '</td>';
  355. }
  356. /*
  357. // Extra fields
  358. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  359. */
  360. // Fields from hook
  361. $parameters = array('arrayfields'=>$arrayfields);
  362. $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
  363. print $hookmanager->resPrint;
  364. // Date creation
  365. if (!empty($arrayfields['i.datec']['checked'])) {
  366. print '<td class="liste_titre">';
  367. print '</td>';
  368. }
  369. // Date modification
  370. if (!empty($arrayfields['i.tms']['checked'])) {
  371. print '<td class="liste_titre">';
  372. print '</td>';
  373. }
  374. print '<td class="liste_titre center maxwidthsearch">';
  375. $searchpicto = $form->showFilterButtons();
  376. print $searchpicto;
  377. print '</td>';
  378. print '</tr>';
  379. print '<tr class="liste_titre">';
  380. if (!empty($arrayfields['i.ref']['checked'])) {
  381. print_liste_field_titre($arrayfields['i.ref']['label'], $_SERVER["PHP_SELF"], "i.ref", "", $param, "", $sortfield, $sortorder);
  382. }
  383. if (!empty($arrayfields['i.label']['checked'])) {
  384. print_liste_field_titre($arrayfields['i.label']['label'], $_SERVER["PHP_SELF"], "i.label", "", $param, "", $sortfield, $sortorder);
  385. }
  386. if (!empty($arrayfields['i.fk_product_type']['checked'])) {
  387. print_liste_field_titre($arrayfields['i.fk_product_type']['label'], $_SERVER["PHP_SELF"], "i.fk_product_type", "", $param, "", $sortfield, $sortorder);
  388. }
  389. /*
  390. // Extra fields
  391. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  392. */
  393. // Hook fields
  394. $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
  395. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
  396. print $hookmanager->resPrint;
  397. if (!empty($arrayfields['i.datec']['checked'])) {
  398. print_liste_field_titre($arrayfields['i.datec']['label'], $_SERVER["PHP_SELF"], "i.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
  399. }
  400. if (!empty($arrayfields['i.tms']['checked'])) {
  401. print_liste_field_titre($arrayfields['i.tms']['label'], $_SERVER["PHP_SELF"], "i.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
  402. }
  403. print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
  404. print "</tr>\n";
  405. $intracommreport_static = new IntracommReport($db);
  406. $i = 0;
  407. $totalarray = array();
  408. while ($i < min($num, $limit)) {
  409. $obj = $db->fetch_object($resql);
  410. $intracommreport_static->id = $obj->rowid;
  411. $intracommreport_static->ref = $obj->ref;
  412. $intracommreport_static->ref_fourn = $obj->ref_supplier;
  413. $intracommreport_static->label = $obj->label;
  414. $intracommreport_static->type = $obj->fk_product_type;
  415. $intracommreport_static->status_buy = $obj->tobuy;
  416. $intracommreport_static->status = $obj->tosell;
  417. $intracommreport_static->status_batch = $obj->tobatch;
  418. $intracommreport_static->entity = $obj->entity;
  419. print '<tr class="oddeven">';
  420. // Ref
  421. if (!empty($arrayfields['i.ref']['checked'])) {
  422. print '<td class="tdoverflowmax200">';
  423. print $intracommreport_static->getNomUrl(1);
  424. print "</td>\n";
  425. if (!$i) {
  426. $totalarray['nbfield']++;
  427. }
  428. }
  429. // Label
  430. if (!empty($arrayfields['i.label']['checked'])) {
  431. print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
  432. if (!$i) {
  433. $totalarray['nbfield']++;
  434. }
  435. }
  436. // Type
  437. if (!empty($arrayfields['i.fk_product_type']['checked'])) {
  438. print '<td>'.$obj->fk_product_type.'</td>';
  439. if (!$i) {
  440. $totalarray['nbfield']++;
  441. }
  442. }
  443. // Action
  444. print '<td class="nowrap center">';
  445. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  446. $selected = 0;
  447. if (in_array($obj->rowid, $arrayofselected)) {
  448. $selected = 1;
  449. }
  450. print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
  451. }
  452. print '</td>';
  453. if (!$i) {
  454. $totalarray['nbfield']++;
  455. }
  456. print "</tr>\n";
  457. $i++;
  458. }
  459. $db->free($resql);
  460. print "</table>";
  461. print "</div>";
  462. print '</form>';
  463. } else {
  464. dol_print_error($db);
  465. }
  466. // End of page
  467. llxFooter();
  468. $db->close();