|
@@ -31,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
|
dol_include_once('/emailcollector/class/emailcollector.class.php');
|
|
|
|
|
|
-if (!$user->admin) accessforbidden();
|
|
|
-if (empty($conf->emailcollector->enabled)) accessforbidden();
|
|
|
-
|
|
|
-// Load traductions files required by page
|
|
|
+// Load translation files required by page
|
|
|
$langs->loadLangs(array("admin", "other"));
|
|
|
|
|
|
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
|
@@ -54,7 +51,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
|
$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
|
|
|
+if (empty($page) || $page < 0 || 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
|
|
|
$offset = $limit * $page;
|
|
|
$pageprev = $page - 1;
|
|
|
$pagenext = $page + 1;
|
|
@@ -86,11 +83,11 @@ if ($user->socid > 0) // Protection if external user
|
|
|
//$result = restrictedArea($user, 'emailcollector', $id, '');
|
|
|
|
|
|
// Initialize array of search criterias
|
|
|
-$search_all = GETPOST("search_all", 'alpha');
|
|
|
+$search_all = GETPOST("search_all", 'alphanohtml');
|
|
|
$search = array();
|
|
|
foreach ($object->fields as $key => $val)
|
|
|
{
|
|
|
- if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
|
|
+ if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
|
|
}
|
|
|
|
|
|
// List of fields to search into when doing a "search in all"
|
|
@@ -100,25 +97,47 @@ foreach ($object->fields as $key => $val)
|
|
|
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
|
|
}
|
|
|
|
|
|
-// Definition of fields for list
|
|
|
+// Definition of array of fields for columns
|
|
|
$arrayfields = array();
|
|
|
foreach ($object->fields as $key => $val)
|
|
|
{
|
|
|
// If $val['visible']==0, then we never show the field
|
|
|
- if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
|
|
+ if (!empty($val['visible'])) {
|
|
|
+ $visible = dol_eval($val['visible'], 1);
|
|
|
+ $arrayfields['t.'.$key] = array(
|
|
|
+ 'label'=>$val['label'],
|
|
|
+ 'checked'=>(($visible < 0) ? 0 : 1),
|
|
|
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
|
|
+ 'position'=>$val['position']
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
// 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]));
|
|
|
+ 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]),
|
|
|
+ 'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key]
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
$object->fields = dol_sort_array($object->fields, 'position');
|
|
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
|
|
|
|
|
+$permissiontoread = $user->rights->emailcollector->read;
|
|
|
+$permissiontoadd = $user->rights->emailcollector->write;
|
|
|
+$permissiontodelete = $user->rights->emailcollector->delete;
|
|
|
+
|
|
|
+if (!$user->admin) accessforbidden();
|
|
|
+if (empty($conf->emailcollector->enabled)) accessforbidden('Module not enabled');
|
|
|
+
|
|
|
|
|
|
|
|
|
/*
|
|
@@ -182,13 +201,14 @@ foreach ($object->fields as $key => $val)
|
|
|
$sql .= 't.'.$key.', ';
|
|
|
}
|
|
|
// Add fields from extrafields
|
|
|
-if (!empty($extrafields->attributes[$object->table_element]['label']))
|
|
|
+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.' as options_'.$key.', ' : '');
|
|
|
+}
|
|
|
// Add fields from hooks
|
|
|
$parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
-$sql .= $hookmanager->resPrint;
|
|
|
-$sql = preg_replace('/, $/', '', $sql);
|
|
|
+$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'])) $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).")";
|
|
@@ -197,6 +217,10 @@ 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);
|
|
@@ -208,7 +232,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
|
|
|
$sql .= $hookmanager->resPrint;
|
|
|
|
|
|
/* If a group by is required
|
|
|
-$sql.= " GROUP BY "
|
|
|
+$sql.= " GROUP BY ";
|
|
|
foreach ($object->fields as $key => $val)
|
|
|
{
|
|
|
$sql.='t.'.$key.', ';
|
|
@@ -216,6 +240,7 @@ 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.', ' : '');
|
|
|
+}
|
|
|
// Add where from hooks
|
|
|
$parameters=array();
|
|
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
|
@@ -238,11 +263,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
}
|
|
|
}
|
|
|
// 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)
|
|
|
+if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
|
|
{
|
|
|
$num = $nbtotalofrecords;
|
|
|
} else {
|
|
|
- $sql .= $db->plimit($limit + 1, $offset);
|
|
|
+ if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
if (!$resql)
|
|
@@ -255,7 +280,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
|
|
}
|
|
|
|
|
|
// Direct jump if only one record found
|
|
|
-if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
|
|
+if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
$id = $obj->rowid;
|
|
@@ -291,7 +316,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&co
|
|
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
|
|
foreach ($search as $key => $val)
|
|
|
{
|
|
|
- $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
|
|
+ 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);
|
|
|
// Add $param from extra fields
|
|
@@ -302,7 +328,7 @@ $arrayofmassactions = array(
|
|
|
//'presend'=>$langs->trans("SendByMail"),
|
|
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
|
|
);
|
|
|
-if ($user->rights->emailcollector->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
+if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
|
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|
|
|
|
@@ -318,13 +344,9 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
|
|
|
|
|
-$newcardbutton = '';
|
|
|
-//if ($user->rights->emailcollector->creer)
|
|
|
-//{
|
|
|
-$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
|
|
|
-//}
|
|
|
+$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
|
|
|
|
|
-print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit);
|
|
|
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit, 0, 0, 1);
|
|
|
|
|
|
// Add code for pre mass action (confirmation or email presend form)
|
|
|
/*$topicmail="";
|
|
@@ -355,7 +377,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
|
|
|
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
|
|
|
|
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
|
|
-print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
+print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
|
|
|
|
|
|
// Fields title search
|
|
@@ -363,11 +385,20 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
|
|
print '<tr class="liste_titre">';
|
|
|
foreach ($object->fields as $key => $val)
|
|
|
{
|
|
|
- $cssforfield = '';
|
|
|
- if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
- if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
|
|
+ $cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
+ if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ if (!empty($arrayfields['t.'.$key]['checked']))
|
|
|
+ {
|
|
|
+ print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
|
|
+ if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
|
|
+ elseif (strpos($val['type'], 'integer:') === 0) {
|
|
|
+ print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
|
|
+ } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
}
|
|
|
// Extra fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
|
@@ -389,11 +420,12 @@ print '</tr>'."\n";
|
|
|
print '<tr class="liste_titre">';
|
|
|
foreach ($object->fields as $key => $val)
|
|
|
{
|
|
|
- $cssforfield = '';
|
|
|
- if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
- if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- if (!empty($arrayfields['t.'.$key]['checked']))
|
|
|
+ $cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
+ if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ if (!empty($arrayfields['t.'.$key]['checked']))
|
|
|
{
|
|
|
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
|
|
}
|
|
@@ -404,6 +436,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
|
|
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
+// Action column
|
|
|
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
|
|
print '</tr>'."\n";
|
|
|
|
|
@@ -423,52 +456,46 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
|
|
// --------------------------------------------------------------------
|
|
|
$i = 0;
|
|
|
$totalarray = array();
|
|
|
-while ($i < min($num, $limit))
|
|
|
+while ($i < ($limit ? min($num, $limit) : $num))
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
if (empty($obj)) break; // Should not happen
|
|
|
|
|
|
// Store properties in $object
|
|
|
- $object->id = $obj->rowid;
|
|
|
- foreach ($object->fields as $key => $val)
|
|
|
- {
|
|
|
- if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
|
|
- }
|
|
|
+ $object->setVarsFromFetchObj($obj);
|
|
|
|
|
|
// Show here line of result
|
|
|
print '<tr class="oddeven">';
|
|
|
foreach ($object->fields as $key => $val)
|
|
|
{
|
|
|
- $cssforfield = '';
|
|
|
- if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ $cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
+ if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
|
|
|
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
|
|
|
+ if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
|
|
+
|
|
|
if (!empty($arrayfields['t.'.$key]['checked']))
|
|
|
{
|
|
|
- print '<td';
|
|
|
- if ($cssforfield || $val['css']) print ' class="';
|
|
|
- print $cssforfield;
|
|
|
- if ($cssforfield && $val['css']) print ' ';
|
|
|
- print $val['css'];
|
|
|
- if ($cssforfield || $val['css']) print '"';
|
|
|
- print '>';
|
|
|
- print $object->showOutputField($val, $key, $obj->$key, '');
|
|
|
- print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
- if (!empty($val['isameasure']))
|
|
|
- {
|
|
|
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
|
|
- $totalarray['val']['t.'.$key] += $obj->$key;
|
|
|
- }
|
|
|
+ print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
|
|
+ if ($key == 'status') print $object->getLibStatut(5);
|
|
|
+ else print $object->showOutputField($val, $key, $object->$key, '');
|
|
|
+ print '</td>';
|
|
|
+ if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!empty($val['isameasure']))
|
|
|
+ {
|
|
|
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
|
|
+ $totalarray['val']['t.'.$key] += $object->$key;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// Extra fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
|
|
// Fields from hook
|
|
|
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
|
|
+ $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// Action column
|
|
@@ -476,13 +503,13 @@ while ($i < min($num, $limit))
|
|
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
{
|
|
|
$selected = 0;
|
|
|
- if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
|
|
- print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
+ if (in_array($object->id, $arrayofselected)) $selected = 1;
|
|
|
+ print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
}
|
|
|
print '</td>';
|
|
|
if (!$i) $totalarray['nbfield']++;
|
|
|
|
|
|
- print '</tr>';
|
|
|
+ print '</tr>'."\n";
|
|
|
|
|
|
$i++;
|
|
|
}
|
|
@@ -524,8 +551,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
|
|
|
$urlsource .= str_replace('&', '&', $param);
|
|
|
|
|
|
$filedir = $diroutputmassaction;
|
|
|
- $genallowed = $user->rights->emailcollector->read;
|
|
|
- $delallowed = $user->rights->emailcollector->create;
|
|
|
+ $genallowed = $permissiontoread;
|
|
|
+ $delallowed = $permissiontoadd;
|
|
|
|
|
|
print $formfile->showdocuments('massfilesarea_emailcollector', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
|
|
}
|