|
@@ -64,47 +64,6 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|
|
|
|
|
$filter = array();
|
|
|
|
|
|
-$param = '';
|
|
|
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
- $param .= '&contextpage='.urlencode($contextpage);
|
|
|
-}
|
|
|
-if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
- $param .= '&limit='.urlencode($limit);
|
|
|
-}
|
|
|
-
|
|
|
-if ($search_ref != '') {
|
|
|
- $param .= '&search_ref='.urlencode($search_ref);
|
|
|
- $filter['t.ref'] = $search_ref;
|
|
|
-}
|
|
|
-if ($search_type != '') {
|
|
|
- $param .= '&search_type='.urlencode($search_type);
|
|
|
- $filter['ty.label'] = $search_type;
|
|
|
-}
|
|
|
-
|
|
|
-// Add $param from extra fields
|
|
|
-foreach ($search_array_options as $key => $val) {
|
|
|
- $crit = $val;
|
|
|
- $tmpkey = preg_replace('/search_options_/', '', $key);
|
|
|
- $typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey];
|
|
|
- if ($val != '') {
|
|
|
- $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
|
|
|
- }
|
|
|
- $mode_search = 0;
|
|
|
- if (in_array($typ, array('int', 'double', 'real'))) {
|
|
|
- $mode_search = 1; // Search on a numeric
|
|
|
- }
|
|
|
- if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') {
|
|
|
- $mode_search = 2; // Search on a foreign key int
|
|
|
- }
|
|
|
- if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) {
|
|
|
- $filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
|
|
- }
|
|
|
-}
|
|
|
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
- $param .= '&contextpage='.urlencode($contextpage);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
$hookmanager->initHooks(array('resourcelist'));
|
|
|
|
|
|
if (empty($sortorder)) {
|
|
@@ -158,9 +117,17 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|
|
|
|
|
|
|
|
/*
|
|
|
- * Action
|
|
|
+ * Actions
|
|
|
*/
|
|
|
|
|
|
+if (GETPOST('cancel', 'alpha')) {
|
|
|
+ $action = 'list';
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
+
|
|
|
$parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
|
if ($reshook < 0) {
|
|
@@ -174,8 +141,42 @@ if ($reshook < 0) {
|
|
|
|
|
|
$form = new Form($db);
|
|
|
|
|
|
+//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
|
|
|
+$help_url = '';
|
|
|
$pagetitle = $langs->trans('ResourcePageIndex');
|
|
|
-llxHeader('', $pagetitle, '');
|
|
|
+llxHeader('', $pagetitle, $help_url);
|
|
|
+
|
|
|
+
|
|
|
+$sql = '';
|
|
|
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
|
|
+
|
|
|
+$param = '';
|
|
|
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
+ $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+}
|
|
|
+if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
+ $param .= '&limit='.urlencode($limit);
|
|
|
+}
|
|
|
+
|
|
|
+if ($search_ref != '') {
|
|
|
+ $param .= '&search_ref='.urlencode($search_ref);
|
|
|
+ $filter['t.ref'] = $search_ref;
|
|
|
+}
|
|
|
+if ($search_type != '') {
|
|
|
+ $param .= '&search_type='.urlencode($search_type);
|
|
|
+ $filter['ty.label'] = $search_type;
|
|
|
+}
|
|
|
+
|
|
|
+// Including the previous script generate the correct SQL filter for all the extrafields
|
|
|
+// we are playing with the behaviour of the Dolresource::fetch_all() by generating a fake
|
|
|
+// extrafields filter key to make it works
|
|
|
+$filter['ef.resource'] = $sql;
|
|
|
+
|
|
|
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+
|
|
|
+// Add $param from extra fields
|
|
|
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|
|
+
|
|
|
|
|
|
// Confirmation suppression resource line
|
|
|
if ($action == 'delete_resource') {
|
|
@@ -185,6 +186,7 @@ if ($action == 'delete_resource') {
|
|
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
|
|
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
|
|
|
|
|
|
+
|
|
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
if ($optioncss != '') {
|
|
|
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|