';
@@ -135 +120 @@
- print '
';
+ print '
';
@@ -148 +133 @@
- print dol_get_fiche_end();
+ dol_fiche_end();
@@ -151,2 +136,2 @@
- $permissiontoadd = $user->hasRight('bom', 'write');
- $permtoedit = $user->hasRight('bom', 'write');
+ $permission = $user->rights->bom->write;
+ $permtoedit = $user->rights->bom->write;
@@ -156 +141 @@
- $relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
+ $relativepathwithnofile = 'bom/'.dol_sanitizeFileName($object->ref).'/';
@@ -158,2 +143,4 @@
- include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
-} else {
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
+}
+else
+{
--- /tmp/dsg/dolibarr/htdocs/bom/github_19.0.3_bom_list.php
+++ /tmp/dsg/dolibarr/htdocs/bom/client_bom_list.php
@@ -19,3 +19,3 @@
- * \file htdocs/bom/bom_list.php
- * \ingroup bom
- * \brief List page for BillOfMaterials
+ * \file htdocs/bom/bom_list.php
+ * \ingroup bom
+ * \brief List page for bom
@@ -30 +29,0 @@
-require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -33,5 +32,3 @@
-$langs->loadLangs(array('mrp', 'other'));
-
-// Get Parameters
-$id = GETPOST('id', 'int');
-$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$langs->loadLangs(array("mrp", "other"));
+
+$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
@@ -43,5 +40,5 @@
-$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
-$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
-$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
-$mode = GETPOST('mode', 'aZ'); // mode view (kanban or common)
-
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+
+$id = GETPOST('id', 'int');
@@ -50,8 +47,5 @@
-$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST('sortfield', 'aZ09comma');
-$sortorder = GETPOST('sortorder', 'aZ09comma');
-$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
-if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
- // If $page is not defined, or '' or -1 or if we click on clear filters
- $page = 0;
-}
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST('sortfield', 'alpha');
+$sortorder = GETPOST('sortorder', 'alpha');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
@@ -76,7 +70,12 @@
-if (!$sortfield) {
- reset($object->fields); // Reset is required to avoid key() to return null.
- $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
-}
-if (!$sortorder) {
- $sortorder = "ASC";
-}
+if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
+if (!$sortorder) $sortorder = "ASC";
+
+// Security check
+if (empty($conf->bom->enabled)) accessforbidden('Module not enabled');
+$socid = 0;
+if ($user->socid > 0) // Protection if external user
+{
+ //$socid = $user->socid;
+ accessforbidden();
+}
+//$result = restrictedArea($user, 'bom', $id, '');
@@ -85 +84 @@
-$search_all = trim(GETPOST('search_all', 'alphanohtml'));
+$search_all = trim(GETPOST("search_all", 'alpha'));
@@ -87,10 +86,6 @@
-foreach ($object->fields as $key => $val) {
- if (GETPOST('search_'.$key, 'alpha') !== '') {
- $search[$key] = GETPOST('search_'.$key, 'alpha');
- }
- if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
- $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
- $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
- }
-}
-
+foreach ($object->fields as $key => $val)
+{
+ if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
+}
+
+// List of fields to search into when doing a "search in all"
@@ -98,8 +93,6 @@
-// List of fields to search into when doing a "search in all"
-foreach ($object->fields as $key => $val) {
- if (!empty($val['searchall'])) {
- $fieldstosearchall['t.'.$key] = $val['label'];
- }
-}
-
-// Definition of array of fields for columns
+foreach ($object->fields as $key => $val)
+{
+ if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
+}
+
+// Definition of fields for list
@@ -107 +100,2 @@
-foreach ($object->fields as $key => $val) {
+foreach ($object->fields as $key => $val)
+{
@@ -109,10 +103 @@
- if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
- $arrayfields['t.'.$key] = array(
- 'label'=>$val['label'],
- 'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
- 'position'=>$val['position'],
- 'help'=> isset($val['help']) ? $val['help'] : ''
- );
- }
+ if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
@@ -121,2 +106,14 @@
-include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
-
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
+{
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ {
+ if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
+ $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($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
+ );
+ }
+ }
+}
@@ -126,10 +123,3 @@
-$permissiontoread = $user->hasRight('bom', 'read');
-$permissiontoadd = $user->hasRight('bom', 'write');
-$permissiontodelete = $user->hasRight('bom', 'delete');
-
-// Security check
-if ($user->socid > 0) {
- // Protection if external user
- accessforbidden();
-}
-$result = restrictedArea($user, 'bom');
+$permissiontoread = $user->rights->bom->read;
+$permissiontoadd = $user->rights->bom->write;
+$permissiontodelete = $user->rights->bom->delete;
@@ -142,7 +132,2 @@
-if (GETPOST('cancel', 'alpha')) {
- $action = 'list';
- $massaction = '';
-}
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
- $massaction = '';
-}
+if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
@@ -152,5 +137,4 @@
-if ($reshook < 0) {
- setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-}
-
-if (empty($reshook)) {
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+if (empty($reshook))
+{
@@ -161,2 +145,4 @@
- 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
- foreach ($object->fields as $key => $val) {
+ 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
+ {
+ foreach ($object->fields as $key => $val)
+ {
@@ -164,4 +149,0 @@
- if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
- $search[$key.'_dtstart'] = '';
- $search[$key.'_dtend'] = '';
- }
@@ -169 +151 @@
- $toselect = array();
+ $toselect = '';
@@ -173 +155,2 @@
- || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
+ || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
+ {
@@ -180,2 +163,2 @@
- $permissiontoread = $user->hasRight('bom', 'read');
- $permissiontodelete = $user->hasRight('bom', 'delete');
+ $permissiontoread = $user->rights->bom->read;
+ $permissiontodelete = $user->rights->bom->delete;
@@ -187 +170,2 @@
- if (!$error && $massaction == 'disable' && $permissiontoadd) {
+ if (!$error && $massaction == 'disable' && $permissiontoadd)
+ {
@@ -190 +174,2 @@
- if (!$error) {
+ if (!$error)
+ {
@@ -194 +179,2 @@
- foreach ($toselect as $toselectid) {
+ foreach ($toselect as $toselectid)
+ {
@@ -196,2 +182,4 @@
- if ($result > 0) {
- if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) {
+ if ($result > 0)
+ {
+ if ($objecttmp->status != $objecttmp::STATUS_VALIDATED)
+ {
@@ -206 +194,2 @@
- if ($result < 0) {
+ if ($result < 0)
+ {
@@ -210,2 +198,0 @@
- } else {
- $nbok++;
@@ -213 +200,4 @@
- } else {
+ else $nbok++;
+ }
+ else
+ {
@@ -220,6 +210,4 @@
- if (!$error) {
- if ($nbok > 1) {
- setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
- }
+ if (!$error)
+ {
+ if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
+ else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
@@ -227 +215,3 @@
- } else {
+ }
+ else
+ {
@@ -235 +225,2 @@
- if (!$error && $massaction == 'enable' && $permissiontoadd) {
+ if (!$error && $massaction == 'enable' && $permissiontoadd)
+ {
@@ -238 +229,2 @@
- if (!$error) {
+ if (!$error)
+ {
@@ -242 +234,2 @@
- foreach ($toselect as $toselectid) {
+ foreach ($toselect as $toselectid)
+ {
@@ -244,2 +237,4 @@
- if ($result > 0) {
- if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED) {
+ if ($result > 0)
+ {
+ if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED)
+ {
@@ -254 +249,2 @@
- if ($result < 0) {
+ if ($result < 0)
+ {
@@ -258,2 +253,0 @@
- } else {
- $nbok++;
@@ -261 +255,4 @@
- } else {
+ else $nbok++;
+ }
+ else
+ {
@@ -268,6 +265,4 @@
- if (!$error) {
- if ($nbok > 1) {
- setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
- } else {
- setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
- }
+ if (!$error)
+ {
+ if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
+ else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
@@ -275 +270,3 @@
- } else {
+ }
+ else
+ {
@@ -291,0 +289,2 @@
+//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
+$help_url = '';
@@ -293,3 +291,0 @@
-$help_url = 'EN:Module_BOM';
-$morejs = array();
-$morecss = array();
@@ -301 +297,4 @@
-$sql .= $object->getFieldList('t');
+foreach ($object->fields as $key => $val)
+{
+ $sql .= 't.'.$key.', ';
+}
@@ -304,3 +303 @@
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
- }
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
@@ -310,2 +307,2 @@
-$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
-$sql .= $hookmanager->resPrint;
+$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
@@ -313,3 +309,0 @@
-
-$sqlfields = $sql; // $sql fields to remove for count total
-
@@ -317,46 +311,14 @@
-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.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
-}
-// Add table from hooks
-$parameters = array();
-$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
-$sql .= $hookmanager->resPrint;
-if ($object->ismultientitymanaged == 1) {
- $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOST('search_current_entity', 'int') ? 0 : 1)).")";
-} else {
- $sql .= " WHERE 1 = 1";
-}
-foreach ($search as $key => $val) {
- if (array_key_exists($key, $object->fields)) {
- if ($key == 'status' && $search[$key] == -1) {
- continue;
- }
- $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
- if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
- if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
- $search[$key] = '';
- }
- $mode_search = 2;
- }
- if ($search[$key] != '') {
- $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
- }
- } else {
- if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
- $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
- if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
- if (preg_match('/_dtstart$/', $key)) {
- $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
- }
- if (preg_match('/_dtend$/', $key)) {
- $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
- }
- }
- }
- }
-}
-
-if ($search_all) {
- $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
-}
-//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
+if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
+else $sql .= " WHERE 1 = 1";
+foreach ($search as $key => $val)
+{
+ if ($key == 'status' && $search[$key] == -1) continue;
+ $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
+ if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
+ if ($search[$key] == '-1') $search[$key] = '';
+ $mode_search = 2;
+ }
+ if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
+}
+if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
@@ -367 +329 @@
-$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -371,3 +333,4 @@
-$sql.= " GROUP BY ";
-foreach($object->fields as $key => $val) {
- $sql .= "t.".$db->escape($key).", ";
+$sql.= " GROUP BY "
+foreach($object->fields as $key => $val)
+{
+ $sql.='t.'.$key.', ';
@@ -376,6 +339,4 @@
-if (!empty($extrafields->attributes[$object->table_element]['label'])) {
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
- }
-}
-// Add groupby from hooks
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
+}
+// Add where from hooks
@@ -383 +344 @@
-$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
@@ -387,0 +349,2 @@
+$sql .= $db->order($sortfield, $sortorder);
+
@@ -390,13 +353,6 @@
-if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
- /* The fast and low memory method to get and count full list converts the sql into a sql count */
- $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
- $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
- $resql = $db->query($sqlforcount);
- if ($resql) {
- $objforcount = $db->fetch_object($resql);
- $nbtotalofrecords = $objforcount->nbtotalofrecords;
- } else {
- dol_print_error($db);
- }
-
- if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+{
+ $resql = $db->query($sql);
+ $nbtotalofrecords = $db->num_rows($resql);
+ if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
+ {
@@ -406,16 +362,19 @@
- $db->free($resql);
-}
-
-// Complete request and execute it with limit
-$sql .= $db->order($sortfield, $sortorder);
-if ($limit) {
- $sql .= $db->plimit($limit + 1, $offset);
-}
-
-$resql = $db->query($sql);
-if (!$resql) {
- dol_print_error($db);
- exit;
-}
-
-$num = $db->num_rows($resql);
+}
+// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
+if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
+{
+ $num = $nbtotalofrecords;
+}
+else
+{
+ if ($limit) $sql .= $db->plimit($limit + 1, $offset);
+
+ $resql = $db->query($sql);
+ if (!$resql)
+ {
+ dol_print_error($db);
+ exit;
+ }
+
+ $num = $db->num_rows($resql);
+}
@@ -424 +383,2 @@
-if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
+if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
+{
@@ -427 +387 @@
- header("Location: ".DOL_URL_ROOT.'/bom/bom_card.php?id='.((int) $id));
+ header("Location: ".DOL_URL_ROOT.'/bom/bom_card.php?id='.$id);
@@ -435 +395,16 @@
-llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-bom page-list bodyforlist');
+llxHeader('', $title, $help_url);
+
+// Example : Adding jquery code
+print '';
@@ -440,27 +415,8 @@
-if (!empty($mode)) {
- $param .= '&mode='.urlencode($mode);
-}
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
- $param .= '&contextpage='.urlencode($contextpage);
-}
-if ($limit > 0 && $limit != $conf->liste_limit) {
- $param .= '&limit='.((int) $limit);
-}
-if ($optioncss != '') {
- $param .= '&optioncss='.urlencode($optioncss);
-}
-foreach ($search as $key => $val) {
- if (is_array($search[$key])) {
- foreach ($search[$key] as $skey) {
- if ($skey != '') {
- $param .= '&search_'.$key.'[]='.urlencode($skey);
- }
- }
- } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
- $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
- $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
- $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
- } elseif ($search[$key] != '') {
- $param .= '&search_'.$key.'='.urlencode($search[$key]);
- }
-}
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+foreach ($search as $key => $val)
+{
+ if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
+ else $param .= '&search_'.$key.'='.urlencode($search[$key]);
+}
+if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
@@ -469,4 +424,0 @@
-// Add $param from hooks
-$parameters = array('param' => &$param);
-$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
-$param .= $hookmanager->resPrint;
@@ -476,3 +428,3 @@
- //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
- 'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Enable"),
- 'disable'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Disable"),
+ //'presend'=>$langs->trans("SendByMail"),
+ 'enable'=>$langs->trans("Enable"),
+ 'disable'=>$langs->trans("Disable"),
@@ -480,6 +432,2 @@
-if (!empty($permissiontodelete)) {
- $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
-}
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
- $arrayofmassactions = array();
-}
+if ($permissiontodelete) $arrayofmassactions['predelete'] = '
'.$langs->trans("Delete");
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
@@ -488,4 +436,2 @@
-print '