diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 2c6739e96dd..55b2052936c 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -99,7 +99,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -549,6 +549,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php
index 44982fc3ece..e27c48b0416 100644
--- a/htdocs/admin/mails_senderprofile_list.php
+++ b/htdocs/admin/mails_senderprofile_list.php
@@ -609,6 +609,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php
index 1e906677e7d..056a73328dc 100644
--- a/htdocs/asset/list.php
+++ b/htdocs/asset/list.php
@@ -103,7 +103,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -542,6 +542,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php
index 2fa59d8d6ef..e8511ab6e5c 100644
--- a/htdocs/bom/bom_list.php
+++ b/htdocs/bom/bom_list.php
@@ -88,7 +88,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -623,6 +623,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 34264649ead..876fd6703d3 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -115,7 +115,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -582,6 +582,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 8c2e55df7bc..14eb0faa353 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6625,6 +6625,7 @@ abstract class CommonObject
} else {
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
+
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
@@ -6971,11 +6972,12 @@ abstract class CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($this->db);
}
-var_dump($val);
- $objectid = $this->id;
- $label = $val['label'];
- $type = $val['type'];
- $size = $val['css'];
+
+ $objectid = $this->id; // Not used ???
+
+ $label = empty($val['label']) ? '' : $val['label'];
+ $type = empty($val['type']) ? '' : $val['type'];
+ $size = empty($val['css']) ? '' : $val['css'];
$reg = array();
// Convert var to be able to share same code than showOutputField of extrafields
@@ -6992,10 +6994,10 @@ var_dump($val);
$type = 'link';
}
- $default = $val['default'];
- $computed = $val['computed'];
- $unique = $val['unique'];
- $required = $val['required'];
+ $default = empty($val['default']) ? '' : $val['default'];
+ $computed = empty($val['computed']) ? '' : $val['computed'];
+ $unique = empty($val['unique']) ? '' : $val['unique'];
+ $required = empty($val['required']) ? '' : $val['required'];
$param = array();
$param['options'] = array();
@@ -7016,8 +7018,8 @@ var_dump($val);
$type = 'sellist';
}
- $langfile = $val['langfile'];
- $list = $val['list'];
+ $langfile = empty($val['langfile']) ? '' : $val['langfile'];
+ $list = (empty($val['list']) ? '' : $val['list']);
$help = (empty($val['help']) ? '' : $val['help']);
$hidden = (($val['visible'] == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php
index f53f88e3362..7d547d52dea 100644
--- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php
+++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php
@@ -66,6 +66,12 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = $extrafieldsobjectprefix.$tmpkey;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val'][$extrafieldsobjectprefix.$tmpkey])) {
+ $totalarray['val'][$extrafieldsobjectprefix.$tmpkey] = 0;
+ }
$totalarray['val'][$extrafieldsobjectprefix.$tmpkey] += $obj->$tmpkey;
}
}
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 15664896700..b51823242f8 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -103,7 +103,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -802,6 +802,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index 6ece0bc115e..97748640f17 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -112,7 +112,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -788,6 +788,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index c886d6931a0..87be91f51f6 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -570,6 +570,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index e2c817c12cc..59af3c6b383 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -149,7 +149,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -274,7 +274,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+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
@@ -516,11 +516,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '
';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
- print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+ print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
- print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
+ print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
- print ' ';
+ print ' ';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@@ -578,7 +578,7 @@ print ''."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
-if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
+if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@@ -591,6 +591,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
+$totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
@@ -636,6 +637,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php
index 4597f265f80..7786bf9eca6 100644
--- a/htdocs/mrp/mo_list.php
+++ b/htdocs/mrp/mo_list.php
@@ -94,7 +94,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -545,6 +545,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php
index 457d0345c31..c8bb93ccb7d 100644
--- a/htdocs/partnership/partnership_list.php
+++ b/htdocs/partnership/partnership_list.php
@@ -110,7 +110,7 @@ if ($filter) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -670,6 +670,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 1c1e09e3162..84f9bc137b6 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -96,7 +96,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -522,6 +522,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index ae8b13c776f..1d54244d4f0 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -106,7 +106,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -628,6 +628,12 @@ if ($num) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $warehouse->$key;
}
}
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 04682a84322..58e5bd055f1 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -93,7 +93,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -541,6 +541,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php
index 8f8ac25c577..1caeb05095f 100644
--- a/htdocs/recruitment/recruitmentcandidature_list.php
+++ b/htdocs/recruitment/recruitmentcandidature_list.php
@@ -83,7 +83,7 @@ require_once __DIR__.'/class/recruitmentcandidature.class.php';
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
-$langs->loadLangs(array("recruitment@recruitment", "other"));
+$langs->loadLangs(array("recruitment", "other"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@@ -141,7 +141,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -161,18 +161,8 @@ foreach ($object->fields as $key => $val) {
}
}
// Extra fields
-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])
- );
- }
- }
-}
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
+
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
@@ -262,7 +252,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+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)";
}
if ($object->ismultientitymanaged == 1) {
@@ -304,7 +294,9 @@ foreach ($object->fields as $key => $val)
}
// Add fields from extrafields
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.', ' : '');
+ 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
$parameters=array();
@@ -430,7 +422,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
$topicmail = "SendRecruitmentCandidatureRef";
$modelmail = "recruitmentcandidature";
$objecttmp = new RecruitmentCandidature($db);
-$trackid = 'xxxx'.$object->id;
+$trackid = 'recruitmentapplication'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {
@@ -484,11 +476,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '
';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
- print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+ print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
- print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
+ print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
- print ' ';
+ print ' ';
}
print ' ';
}
@@ -539,7 +531,7 @@ print ''."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
-if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
+if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@@ -552,6 +544,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
+$totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
@@ -564,7 +557,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result
print '';
foreach ($object->fields as $key => $val) {
- $cssforfield = (empty($val['css']) ? '' : $val['css']);
+ $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
@@ -597,6 +590,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php
index 99b2e5ade4e..6475a60a8ed 100644
--- a/htdocs/recruitment/recruitmentjobposition_list.php
+++ b/htdocs/recruitment/recruitmentjobposition_list.php
@@ -141,7 +141,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -161,18 +161,8 @@ foreach ($object->fields as $key => $val) {
}
}
// Extra fields
-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])
- );
- }
- }
-}
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
+
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields['nbapplications'] = array('label'=>'Applications', 'checked'=>1, 'enabled'=>1, 'position'=>90);
$arrayfields = dol_sort_array($arrayfields, 'position');
@@ -265,7 +255,7 @@ $sql = preg_replace('/,\s*$/', '', $sql);
$sql .= ", COUNT(rc.rowid) as nbapplications";
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = t.rowid";
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+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)";
}
if ($object->ismultientitymanaged == 1) {
@@ -487,11 +477,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
- print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+ print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
- print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
+ print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
- print ' ';
+ print ' ';
}
print ' ';
}
@@ -547,7 +537,7 @@ print ' '."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
-if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
+if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@@ -560,6 +550,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
+$totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
@@ -605,6 +596,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}
diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php
index b4abbb04a26..690f8df4c8c 100644
--- a/htdocs/salaries/list.php
+++ b/htdocs/salaries/list.php
@@ -124,7 +124,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php
index 7af7fa4d986..8b0c774cc6a 100644
--- a/htdocs/salaries/payments.php
+++ b/htdocs/salaries/payments.php
@@ -107,7 +107,9 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
- if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
+ if (!empty($val['searchall'])) {
+ $fieldstosearchall['t.'.$key] = $val['label'];
+ }
}
$permissiontoread = $user->rights->salaries->read;
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index e34672bfd1d..0740200867d 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -95,7 +95,7 @@ foreach ($objectwebsiteaccount->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($objectwebsiteaccount->fields as $key => $val) {
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@@ -530,6 +530,12 @@ while ($i < min($num, $limit)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 3ba138bb99e..7e5c1aa968f 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -998,6 +998,12 @@ while ($i < min($num, $limit)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $obj->$key;
}
}
diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php
index 8058ec2793d..fda05400421 100755
--- a/htdocs/workstation/workstation_list.php
+++ b/htdocs/workstation/workstation_list.php
@@ -620,6 +620,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
+ if (!isset($totalarray['val'])) {
+ $totalarray['val'] = array();
+ }
+ if (!isset($totalarray['val']['t.'.$key])) {
+ $totalarray['val']['t.'.$key] = 0;
+ }
$totalarray['val']['t.'.$key] += $object->$key;
}
}