'.$langs->trans("JuridicalStatus").' ';
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index cb48336e72c..9d5dcbc32e3 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -45,7 +45,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'emailcollectorcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$operationid = GETPOST('operationid', 'int');
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 2ed95ce91b9..d44f96e0877 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -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'] = ' '.$langs->trans("Delete");
+if ($permissiontodelete) $arrayofmassactions['predelete'] = ' '.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@@ -318,13 +344,9 @@ print ' ';
$linkback = ''.$langs->trans("BackToModuleList").' ';
-$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 ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
-print '
'."\n";
+print ''."\n";
// Fields title search
@@ -363,11 +385,20 @@ print '';
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 ' ';
+ $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 '';
+ 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 ' ';
+ print ' ';
+ }
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -389,11 +420,12 @@ print ''."\n";
print '';
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 ' '."\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 '';
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 '';
- print $object->showOutputField($val, $key, $obj->$key, '');
- print ' ';
- if (!$i) $totalarray['nbfield']++;
- if (!empty($val['isameasure']))
- {
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
- $totalarray['val']['t.'.$key] += $obj->$key;
- }
+ print '';
+ if ($key == 'status') print $object->getLibStatut(5);
+ else print $object->showOutputField($val, $key, $object->$key, '');
+ print ' ';
+ 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 ' ';
+ if (in_array($object->id, $arrayofselected)) $selected = 1;
+ print ' ';
}
print '';
if (!$i) $totalarray['nbfield']++;
- print ' ';
+ print ''."\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);
}
diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php
index 931cefb2992..37d1a795428 100644
--- a/htdocs/admin/events.php
+++ b/htdocs/admin/events.php
@@ -36,7 +36,7 @@ if (!$user->admin) {
$langs->loadLangs(array("users", "admin", "other"));
$action = GETPOST('action', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'auditeventslist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Load variable for pagination
diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php
index d066197b580..ae7faafa937 100644
--- a/htdocs/admin/export.php
+++ b/htdocs/admin/export.php
@@ -95,7 +95,7 @@ print '';
print '';
print ''.$langs->trans("ExportCsvSeparator").' ';
-print ''." global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\"> ";
+print ' ';
print ' ';
print ' ';
diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php
index 0a118dfe065..6b8fe0ab3b7 100644
--- a/htdocs/admin/geoipmaxmind.php
+++ b/htdocs/admin/geoipmaxmind.php
@@ -47,7 +47,12 @@ if ($action == 'set')
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
- if (!$gimcdf && !file_exists($gimcdf))
+ if (!$error && $gimcdf && ! preg_match('/\.(dat|mmdb)$/', $gimcdf)) {
+ setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors');
+ $error++;
+ }
+
+ if (!$error && $gimcdf && !file_exists($gimcdf))
{
setEventMessages($langs->trans("ErrorFileNotFound", $gimcdf), null, 'errors');
$error++;
@@ -126,7 +131,7 @@ if ($conf->global->GEOIP_VERSION == 'php')
{
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb ';
}
-print ' ';
+print ' ';
print '';
print '
';
@@ -148,7 +153,7 @@ print $langs->trans("YouCanDownloadAdvancedDatFileTo", ' ';
- print ' '.$langs->trans("TestGeoIPResult", $ip).':';
+ print ''.$langs->trans("TestGeoIPResult", $ip).': ';
$ip = '24.24.24.24';
print ' '.$ip.' -> ';
diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php
index 0662a571cc9..cd9d290b828 100644
--- a/htdocs/admin/perms.php
+++ b/htdocs/admin/perms.php
@@ -128,9 +128,10 @@ print '';
print '';
print ''.$langs->trans("Module").' ';
-print ' ';
print ''.$langs->trans("Default").' ';
+print ' ';
print ''.$langs->trans("Permissions").' ';
+if ($user->admin) print ''.$langs->trans("ID").' ';
print ' '."\n";
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
@@ -178,7 +179,6 @@ if ($result)
$found = false;
foreach ($modules[$obj->module]->rights as $key => $val)
{
- $rights_class = $objMod->rights_class;
if ($val[4] == $obj->perms && (empty($val[5]) || $val[5] == $obj->subperms))
{
$found = true;
@@ -209,6 +209,8 @@ if ($result)
print ' ';
print ' ';
print ' ';
+ // Permission id
+ if ($user->admin) print ' ';
print ''."\n";
}
@@ -223,15 +225,21 @@ if ($result)
// Tick
if ($obj->bydefault == 1)
{
- print '';
- print ''.img_edit_remove().' ';
+ print ' ';
+ print '';
+ //print img_edit_remove();
+ print img_picto('', 'switch_on');
+ print ' ';
print ' ';
print '';
- print img_picto($langs->trans("Active"), 'tick');
+ //print img_picto($langs->trans("Active"), 'tick');
print ' ';
} else {
- print '';
- print ''.img_edit_add().' ';
+ print ' ';
+ print '';
+ //print img_edit_add();
+ print img_picto('', 'switch_off');
+ print ' ';
print ' ';
print '';
print ' ';
@@ -241,6 +249,9 @@ if ($result)
// Permission and tick
print ' '.$perm_libelle.' ';
+ // Permission id
+ if ($user->admin) print ''.$obj->id.' ';
+
print ''."\n";
$i++;
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index c7508e996ad..6983c228007 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -23,7 +23,7 @@
/**
* \file htdocs/admin/stock.php
* \ingroup stock
- * \brief Page d'administration/configuration du module gestion de stock
+ * \brief Page to setup module stock
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php
index 84fe534f473..32567f14074 100644
--- a/htdocs/admin/tools/listevents.php
+++ b/htdocs/admin/tools/listevents.php
@@ -226,6 +226,7 @@ if ($result)
}
print '
";
print '';
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index b9f630872ae..59aaf0ecc2c 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -31,8 +31,8 @@ if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
-if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
+if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login.
+//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We load menu manager class (note that object loaded may have wrong content because NOLOGIN is set and some values depends on login)
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
@@ -55,6 +55,10 @@ if (empty($user->id) && !empty($_SESSION['dol_login']))
{
$user->fetch('', $_SESSION['dol_login'], '', 1);
$user->getrights();
+
+ // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct.
+ $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
+ $menumanager->loadMenu();
}
@@ -190,6 +194,7 @@ $colortext = join(',', colorStringToArray($colortext));
$colortextlink = join(',', colorStringToArray($colortextlink));
$nbtopmenuentries = $menumanager->showmenu('topnb');
+
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index d468eccf87d..dcfbc402927 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -56,6 +56,10 @@ if (empty($user->id) && !empty($_SESSION['dol_login']))
{
$user->fetch('', $_SESSION['dol_login'], '', 1);
$user->getrights();
+
+ // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct.
+ $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
+ $menumanager->loadMenu();
}
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index f7813066a4c..2264fb3d9ee 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -482,7 +482,7 @@ class Ticket extends CommonObject
global $langs;
// Check parameters
- if (!$id && !$track_id && !$ref) {
+ if (!$id && !$track_id && !$ref && !$email_msgid) {
$this->error = 'ErrorWrongParameters';
dol_print_error(get_class($this)."::fetch ".$this->error);
return -1;
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 12dd4c37058..91d84270a30 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -659,11 +659,15 @@ foreach ($object->fields as $key => $val)
if ($search[$key]) $selectedarray = array_values($search[$key]);
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', '');
print '';
- } elseif ($key == "fk_soc")
- {
+ } elseif ($key == "fk_soc") {
print ' ';
} else {
- print ' ';
+ print '';
+ 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 ' ';
+ print ' ';
}
}
}
diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php
index af81542d99a..82e268a6300 100644
--- a/htdocs/user/group/perms.php
+++ b/htdocs/user/group/perms.php
@@ -302,8 +302,8 @@ if ($object->id > 0)
}
print ' ';
- // Module id
- if ($user->admin) print ''.$objMod->numero.' ';
+ // Permission id
+ if ($user->admin) print ' ';
print '';
}
@@ -323,7 +323,10 @@ if ($object->id > 0)
// Own permission by group
if ($caneditperms)
{
- print 'id.'&action=delrights&entity='.$entity.'&rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).' ';
+ print 'id.'&action=delrights&entity='.$entity.'&rights='.$obj->id.'">';
+ //print img_edit_remove($langs->trans("Remove"));
+ print img_picto($langs->trans("Remove"), 'switch_on');
+ print ' ';
}
print '';
print img_picto($langs->trans("Active"), 'tick');
@@ -332,7 +335,10 @@ if ($object->id > 0)
// Do not own permission
if ($caneditperms)
{
- print ' id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).' ';
+ print 'id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'">';
+ //print img_edit_add($langs->trans("Add"));
+ print img_picto($langs->trans("Add"), 'switch_off');
+ print ' ';
}
print '  ';
}
@@ -340,7 +346,10 @@ if ($object->id > 0)
// Do not own permission
if ($caneditperms)
{
- print 'id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).' ';
+ print 'id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'">';
+ //print img_edit_add($langs->trans("Add"));
+ print img_picto($langs->trans("Add"), 'switch_off');
+ print ' ';
}
print '  ';
}
@@ -349,7 +358,7 @@ if ($object->id > 0)
print ''.$permlabel.' ';
// Permission id
- if ($user->admin) print ''.$obj->id.' ';
+ if ($user->admin) print ''.$obj->id.' ';
print ''."\n";
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index 97cf6007327..7672a3d8dbb 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -366,8 +366,8 @@ if ($result)
}
print ' ';
- // Module Id
- print ' ';
+ // Permission id
+ if ($user->admin) print ' ';
print ''."\n";
}
@@ -394,7 +394,10 @@ if ($result)
{
if ($caneditperms)
{
- print 'id.'&action=delrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">'.img_edit_remove($langs->trans("Remove")).' ';
+ print 'id.'&action=delrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">';
+ //print img_edit_remove($langs->trans("Remove"));
+ print img_picto($langs->trans("Remove"), 'switch_on');
+ print ' ';
}
print '';
print img_picto($langs->trans("Active"), 'tick');
@@ -416,7 +419,10 @@ if ($result)
// Do not own permission
if ($caneditperms)
{
- print ' id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">'.img_edit_add($langs->trans("Add")).' ';
+ print 'id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">';
+ //print img_edit_add($langs->trans("Add"));
+ print img_picto($langs->trans("Add"), 'switch_off');
+ print ' ';
}
print '  ';
}
@@ -424,7 +430,10 @@ if ($result)
// Do not own permission
if ($caneditperms)
{
- print 'id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">'.img_edit_add($langs->trans("Add")).' ';
+ print 'id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">';
+ //print img_edit_add($langs->trans("Add"));
+ print img_picto($langs->trans("Add"), 'switch_off');
+ print ' ';
}
print '  ';
}
@@ -434,7 +443,7 @@ if ($result)
print ''.$permlabel.' ';
// Permission id
- if ($user->admin) print ''.$obj->id.' ';
+ if ($user->admin) print ''.$obj->id.' ';
print ''."\n";
diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php
index 86342664c35..d97211d46bf 100644
--- a/htdocs/variants/admin/admin.php
+++ b/htdocs/variants/admin/admin.php
@@ -50,7 +50,9 @@ print load_fiche_titre($title, $linkback, 'title_setup');
dol_fiche_head(array(), 'general', $tab, 0, 'product');
-print '';
+print ' ';
+print ' ';
+
print '';
print '';
print ''.$langs->trans("Parameters").''."\n";
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index e62887407d6..ce3f41676a0 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -59,7 +59,7 @@ $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choi
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // 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')
diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php
index 9d33a9801b0..efb02395e7b 100644
--- a/htdocs/zapier/hook_card.php
+++ b/htdocs/zapier/hook_card.php
@@ -38,7 +38,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'zapiercard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects
diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php
index ac90713f13c..d36d909b399 100644
--- a/htdocs/zapier/hook_list.php
+++ b/htdocs/zapier/hook_list.php
@@ -41,7 +41,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
-$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'hooklist'; // To manage different context of search
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'zapierlist'; // 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')
diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php
index cf1cafe74b1..2a3cb079baf 100644
--- a/test/phpunit/ExportTest.php
+++ b/test/phpunit/ExportTest.php
@@ -141,6 +141,9 @@ class ExportTest extends PHPUnit\Framework\TestCase
$model='csv';
+ $conf->global->EXPORT_CSV_SEPARATOR_TO_USE = ',';
+ print 'EXPORT_CSV_SEPARATOR_TO_USE = '.$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
+
// Creation of class to export using model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
$file = "export_".$model.".modules.php";
@@ -161,7 +164,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
print __METHOD__." valtotest=".$valtotest."\n";
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
print __METHOD__." result=".$result."\n";
- $this->assertEquals($result, '"A string with , and ; inside"');
+ $this->assertEquals($result, '"A string with , and ; inside"', 'Error in csvClean for '.$file);
$valtotest='A string with " inside';
print __METHOD__." valtotest=".$valtotest."\n";
@@ -182,7 +185,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
$this->assertEquals($result, '"A string with html content inside"');
// Same tests with strict mode
- $conf->global->USE_STRICT_CSV_RULES=1;
+ $conf->global->USE_STRICT_CSV_RULES = 1;
$valtotest='A simple string';
print __METHOD__." valtotest=".$valtotest."\n";
@@ -245,7 +248,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Build export file
print "Process build_file for model = ".$model."\n";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
- $expectedresult=1;
+ $expectedresult = 1;
$this->assertEquals($expectedresult, $result, 'Error in CSV export');
$model='tsv';
@@ -360,7 +363,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Build export file
$sql = "";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
- $expectedresult=1;
+ $expectedresult = 1;
$this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed');
$result=dol_is_file($exportfile);
$this->assertTrue($result, 'File '.$exportfile.' not found');
diff --git a/test/sqlmap/README b/test/sqlmap/README
index da3a1ae6daf..c07730a48b6 100644
--- a/test/sqlmap/README
+++ b/test/sqlmap/README
@@ -43,7 +43,9 @@ Add, into file ~/git/sqlmap/data/xml/payloads/boolean_blind.xml, the custom rule
Introduce a vulnerability by changing the GETPOST on parameter search_status into GETPOST('search_status', 'none') and removing $db->sanitize when parameter is used;
-./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/comm/propal/list.php?search_status=*" --dbms=mysql --os=linux --technique=B --batch --skip-waf \
+./sqlmap.py --fresh-queries -u "http://localhostdev/comm/propal/list.php?search_status=*"
+
+./sqlmap.py -A "securitytest" --threads=4 -u "http://localhostdev/comm/propal/list.php?search_status=*" --dbms=mysql --os=linux --technique=B --batch --skip-waf \
--cookie="DOLSESSID_xxxxxx=yyyyyyyy;" --prefix='1' -v 4 > sqlmap.txt
Check vulnerability is found into sqlmap.txt. Scanner is working.