Merge remote-tracking branch 'upstream/develop' into zapieruser

This commit is contained in:
Frédéric FRANCE 2020-10-30 08:17:53 +01:00
commit e4af61a587
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
42 changed files with 100 additions and 82 deletions

View File

@ -393,7 +393,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -474,7 +474,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -281,7 +281,7 @@ if ($action == 'set' && $user->admin)
$form = new Form($db);
//$morejs = array("/admin/dolistore/js/dolistore.js.php");
$morejs = array();
$morecss = array("/admin/dolistore/css/dolistore.css");
// Set dir where external modules are installed
@ -402,7 +402,7 @@ foreach ($modulesdir as $dir)
$arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
}
$familyposition = $familyinfo[$familykey]['position'];
$familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
$listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
if ($external && ! in_array($familykey, $listOfOfficialModuleGroups))
{

View File

@ -386,7 +386,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -486,7 +486,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -204,7 +204,7 @@ class BOM extends CommonObject
// Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{
@ -1145,7 +1145,7 @@ class BOMLine extends CommonObjectLine
// Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -390,7 +390,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>';
}

View File

@ -281,7 +281,7 @@ class Contact extends CommonObject
{
foreach($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -131,7 +131,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.$_SESSION['auto_check_events_not_before']);
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.(empty($_SESSION['auto_check_events_not_before']) ? '' : $_SESSION['auto_check_events_not_before']));
$sql = 'SELECT a.id as id_agenda, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder';
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';

View File

@ -6410,7 +6410,7 @@ abstract class CommonObject
$type = 'varchar'; // convert varchar(xx) int varchar
$size = $reg[1];
} elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar
if (is_array($val['arrayofkeyval'])) $type = 'select';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) $type = 'select';
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type = 'link';
$default = $val['default'];
@ -6420,7 +6420,7 @@ abstract class CommonObject
$param = array();
$param['options'] = array();
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
{
$type = 'link';

View File

@ -105,7 +105,7 @@ class HookManager
if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) // We instantiate action class only if initialized hook is handled by module
{
// Include actions class overwriting hooks
if (!is_object($this->hooks[$context][$module])) // If set, class was already loaded
if (empty($this->hooks[$context][$module]) || !is_object($this->hooks[$context][$module])) // If set to an object value, class was already loaded
{
$path = '/'.$module.'/class/';
$actionfile = 'actions_'.$module.'.class.php';
@ -167,6 +167,7 @@ class HookManager
'doActions',
'doMassActions',
'formatEvent',
'formConfirm',
'formCreateThirdpartyOptions',
'formObjectOptions',
'formattachOptions',

View File

@ -509,7 +509,6 @@ class Form
* @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
* @return string Code html du tooltip (texte+picto)
* @see textwithpicto() Use thisfunction if you can.
* TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip
*/
public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
{

View File

@ -1152,6 +1152,7 @@ class FormOther
}
// Define boxlista and boxlistb
$boxlista = ''; $boxlistb = '';
$nbboxactivated = count($boxidactivatedforuser);
if ($nbboxactivated)

View File

@ -242,14 +242,13 @@ abstract class DoliDB implements Database
$fields=explode(',', $sortfield);
$orders=explode(',', $sortorder);
$i=0;
foreach ($fields as $val)
{
foreach ($fields as $val) {
if (!$return) $return .= ' ORDER BY ';
else $return .= ', ';
$return .= preg_replace('/[^0-9a-z_\.]/i', '', $val); // Add field
$tmpsortorder = trim($orders[$i]);
$tmpsortorder = (empty($orders[$i]) ? '' : trim($orders[$i]));
// Only ASC and DESC values are valid SQL
if (strtoupper($tmpsortorder) === 'ASC') {

View File

@ -60,8 +60,6 @@ print '<body>'."\n";
print '<div style="padding: 20px;">';
//print '<br>';
$nbofsearch = 0;
// Define link to login card
$appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE))
@ -117,6 +115,11 @@ if (is_numeric($result))
else $toprightmenu = $hookmanager->resPrint; // replace
} else $toprightmenu .= $result; // For backward compatibility
if (!isset($form) || !is_object($form)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($db);
}
// Link to module builder
if (!empty($conf->modulebuilder->enabled))
{
@ -124,7 +127,7 @@ if (!empty($conf->modulebuilder->enabled))
//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
$text .= '<span class="fa fa-bug atoplogin"></span>';
$text .= '</a>';
$toprightmenu .= @Form::textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
$toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
}
// Link to print main content area
@ -144,7 +147,7 @@ if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OP
//$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
$text.='<span class="fa fa-print atoplogin"></span>';
$text.='</a>';
$toprightmenu.=@Form::textwithtooltip('',$langs->trans("PrintContentArea"),2,1,$text,'login_block_elem',2);
$toprightmenu .= $form->textwithtooltip('',$langs->trans("PrintContentArea"),2,1,$text,'login_block_elem',2);
}
*/
@ -183,13 +186,13 @@ if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPT
//if ($mode == 'wiki') $text.=' ('.dol_trunc(strtr($helppage,'_',' '),8).')';
$text.='</a>';
//$toprightmenu.='</div>'."\n";
$toprightmenu.=@Form::textwithtooltip('',$title,2,1,$text,'login_block_elem',2);
$toprightmenu .= $form->textwithtooltip('',$title,2,1,$text,'login_block_elem',2);
}
}
*/
// Logout link
if (GETPOST('withlogout', 'int')) $toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2);
if (GETPOST('withlogout', 'int')) $toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2);
$toprightmenu .= '</div>';

View File

@ -51,7 +51,7 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP
/* Launch timer */
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
//var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds
var time_first_execution = <?php echo max(3, $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>;
var time_first_execution = <?php echo max(3, empty($conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>;
if (login != '') {
setTimeout(first_execution, time_first_execution * 1000);
time_js_next_test = nowtime + time_first_execution;

View File

@ -185,6 +185,7 @@ function getBrowserInfo($user_agent)
if (preg_match('/linux/i', $user_agent)) { $os = 'linux'; } elseif (preg_match('/macintosh/i', $user_agent)) { $os = 'macintosh'; } elseif (preg_match('/windows/i', $user_agent)) { $os = 'windows'; }
// Name
$reg = array();
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'firefox'; $version = $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'edge'; $version = $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { $name = 'chrome'; $version = $reg[2]; } // we can have 'chrome (Mozilla...) chrome x.y' in one string
elseif (preg_match('/chrome/i', $user_agent, $reg)) { $name = 'chrome'; } elseif (preg_match('/iceweasel/i', $user_agent)) { $name = 'iceweasel'; } elseif (preg_match('/epiphany/i', $user_agent)) { $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'safari'; $version = $reg[2]; } // Safari is often present in string for mobile but its not.
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'opera'; $version = $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); } // MS products at end
@ -3344,13 +3345,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// This snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only.
// class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes.
$morestyle = '';
$reg = array();
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
$morecss .= ($morecss ? ' ' : '').$reg[1];
$moreatt = str_replace('class="'.$reg[1].'"', '', $moreatt);
}
if (preg_match('/style="([^"]+)"/', $moreatt, $reg)) {
$morestyle = ' '.$reg[1];
$morestyle = $reg[1];
$moreatt = str_replace('style="'.$reg[1].'"', '', $moreatt);
}
$moreatt = trim($moreatt);
@ -6484,11 +6486,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$tmp4 = dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']);
$tmp5 = dol_get_next_month($tmp['mon'], $tmp['year']);
$daytext = $outputlangs->trans('Day'.$tmp['wday']);
$substitutionarray = array_merge($substitutionarray, array(
'__DAY__' => (string) $tmp['mday'],
'__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday
'__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon
'__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M
'__DAY_TEXT__' => $daytext, // Monday
'__DAY_TEXT_SHORT__' => dol_trunc($daytext, 3, 'right', 'UTF-8', 1), // Mon
'__DAY_TEXT_MIN__' => dol_trunc($daytext, 1, 'right', 'UTF-8', 1), // M
'__MONTH__' => (string) $tmp['mon'],
'__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])),
'__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])),
@ -7198,8 +7202,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1)
global $soc; // For backward compatibility
//print $s."<br>\n";
if ($returnvalue)
{
if ($returnvalue) {
if ($hideerrors) return @eval('return '.$s.';');
else return eval('return '.$s.';');
} else {
@ -7602,7 +7605,7 @@ function printCommonFooter($zone = 'private')
// A div to store page_y POST parameter so we can read it using javascript
print "\n<!-- A div to store page_y POST parameter -->\n";
print '<div id="page_y" style="display: none;">'.$_POST['page_y'].'</div>'."\n";
print '<div id="page_y" style="display: none;">'.(empty($_POST['page_y']) ? '' : $_POST['page_y']).'</div>'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks

View File

@ -450,15 +450,18 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{
$max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $lowercase[random_int(0, $max)];
$tmp = random_int(0, $max);
$randomCode .= $lowercase[$tmp];
}
$max = strlen($uppercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $uppercase[random_int(0, $max)];
$tmp = random_int(0, $max);
$randomCode .= $uppercase[$tmp];
}
$max = strlen($numbers) - 1;
for ($x = 0; $x < $nbofcharlast; $x++) {
$randomCode .= $numbers[random_int(0, $max)];
$tmp = random_int(0, $max);
$randomCode .= $numbers[$tmp];
}
$generated_password = str_shuffle($randomCode);
@ -466,15 +469,18 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{
$max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $lowercase[mt_rand(0, $max)];
$tmp = mt_rand(0, $max);
$randomCode .= $lowercase[$tmp];
}
$max = strlen($uppercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $uppercase[mt_rand(0, $max)];
$tmp = mt_rand(0, $max);
$randomCode .= $uppercase[$tmp];
}
$max = strlen($numbers) - 1;
for ($x = 0; $x < $nbofcharlast; $x++) {
$randomCode .= $numbers[mt_rand(0, $max)];
$tmp = mt_rand(0, $max);
$randomCode .= $numbers[$tmp];
}
$generated_password = str_shuffle($randomCode);
@ -495,11 +501,12 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{
$numbers = "ABCDEF";
$max = strlen($numbers) - 1;
if (function_exists('random_int')) // Cryptographic random
{
$generated_password = str_replace($replaceambiguouschars, $numbers[random_int(0, $max)], $generated_password);
if (function_exists('random_int')) { // Cryptographic random
$tmp = random_int(0, $max);
$generated_password = str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
} else {
$generated_password = str_replace($replaceambiguouschars, $numbers[mt_rand(0, $max)], $generated_password);
$tmp = mt_rand(0, $max);
$generated_password = str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
}
}

View File

@ -519,14 +519,11 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']);
print '</td><td>' . "\n";
} else {
print '<table class="nobordernopadding"><tr>';
print '<td></td><td>';
if (is_array($array_query['options_' . $key . '_cnct'])) {
print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct');
} else {
print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct');
}
print '</td></tr></table>';
print '</td><td>' . "\n";
}
print '</td></tr>' . "\n";

View File

@ -91,8 +91,8 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
$info .= $langs->trans('Port').': <strong>'.$conf->global->MAIN_MAIL_SMTP_PORT.'</strong><br>';
$info .= $langs->trans('ID').': <strong>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</strong><br>';
$info .= $langs->trans('Pwd').': <strong>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</strong><br>';
$info .= $langs->trans('TLS/STARTTLS').': <strong>'.$conf->global->MAIN_MAIL_EMAIL_TLS.'</strong> / <strong>'.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.'</strong><br>';
$info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': <strong>'.($conf->global->MAIN_DISABLE_ALL_MAILS ? $langs->trans('Yes') : $langs->trans('No')).'</strong><br>';
$info .= $langs->trans('TLS/STARTTLS').': <strong>'.(empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_TLS).'</strong> / <strong>'.(empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_STARTTLS).'</strong><br>';
$info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': <strong>'.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).'</strong><br>';
$info .= 'dolibarr_mailing_limit_sendbyweb = <strong>'.$dolibarr_mailing_limit_sendbyweb.'</strong><br>';
return $info;

View File

@ -227,7 +227,7 @@ class EmailCollector extends CommonObject
// Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -170,7 +170,7 @@ class EmailCollectorAction extends CommonObject
// Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -139,7 +139,7 @@ class EmailCollectorFilter extends CommonObject
// Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -68,7 +68,7 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
* View
*/
if (!is_object($form)) $form = new Form($db);
if (!isset($form) || !is_object($form)) $form = new Form($db);
// Title
$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;

View File

@ -255,6 +255,7 @@ if (!empty($conf->debugbar->enabled) && !GETPOST('dol_use_jmobile') && empty($_S
include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php';
$debugbar = new DolibarrDebugBar();
$renderer = $debugbar->getRenderer();
if (empty($conf->global->MAIN_HTML_HEADER)) $conf->global->MAIN_HTML_HEADER = '';
$conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
$debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)');
@ -925,7 +926,7 @@ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAI
}
// set MAIN_OPTIMIZEFORCOLORBLIND for user
$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? '' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
// Set terminal output option according to conf->browser.
if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu = 1;
@ -1162,8 +1163,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
// // A default security policy that keep usage of js external component like ckeditor, stripe, google, working
// $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';";
//}
//else $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
$contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
//else
$contentsecuritypolicy = empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY) ? '': $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
if (!is_object($hookmanager)) $hookmanager = new HookManager($db);
$hookmanager->initHooks(array("main"));
@ -1565,6 +1566,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
*/
if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU')))
{
if (!isset($form) || !is_object($form)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($db);
}
print "\n".'<!-- Start top horizontal -->'."\n";
print '<div class="side-nav-vert'.(GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '').'"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
@ -1631,7 +1637,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
$text .= '<span class="fa fa-bug atoplogin valignmiddle"></span>';
$text .= '</a>';
$toprightmenu .= @Form::textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
$toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
}
// Link to print main content area
@ -1650,7 +1656,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
//$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
$text .= '<span class="fa fa-print atoplogin valignmiddle"></span>';
$text .= '</a>';
$toprightmenu .= @Form::textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2);
$toprightmenu .= $form->textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2);
}
// Link to Dolibarr wiki pages
@ -1687,7 +1693,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
$text .= '">';
$text .= '<span class="fa fa-question-circle atoplogin valignmiddle'.($helppresent ? ' '.$helppresent : '').'"></span>';
$text .= '</a>';
$toprightmenu .= @Form::textwithtooltip('', $title, 2, 1, $text, 'login_block_elem', 2);
$toprightmenu .= $form->textwithtooltip('', $title, 2, 1, $text, 'login_block_elem', 2);
}
// Version
@ -1699,11 +1705,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$text = '<span href="#" class="aversion"><span class="hideonsmartphone small">'.DOL_VERSION.'</span></span>';
$toprightmenu .= @Form::textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2);
$toprightmenu .= $form->textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2);
}
// Logout link
$toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2);
$toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2);
$toprightmenu .= '</div>'; // end div class="login_block_other"
@ -1746,7 +1752,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
print "<!-- End top horizontal menu -->\n\n";
}
if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">';
if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '<!-- Begin div id-container --><div id="id-container" class="id-container">';
}

View File

@ -254,7 +254,7 @@ class MyObject extends CommonObject
{
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -445,7 +445,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -223,7 +223,7 @@ class Mo extends CommonObject
// Translate some data of arrayofkeyval
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{
@ -1436,7 +1436,7 @@ class MoLine extends CommonObjectLine
{
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -392,7 +392,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -371,7 +371,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -419,7 +419,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
elseif (strpos($val['type'], 'integer:') === 0 || strpos($val['type'], 'sellist:') === 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]).'">';

View File

@ -377,7 +377,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -222,7 +222,7 @@ class RecruitmentCandidature extends CommonObject
{
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -236,7 +236,7 @@ class RecruitmentJobPosition extends CommonObject
{
foreach ($this->fields as $key => $val)
{
if (is_array($val['arrayofkeyval']))
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
{
foreach ($val['arrayofkeyval'] as $key2 => $val2)
{

View File

@ -433,7 +433,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -433,7 +433,7 @@ foreach ($object->fields as $key => $val)
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -1509,8 +1509,10 @@ class Societe extends CommonObject
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.webservices_url, s.webservices_key';
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj';
$sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.logo_squarred';
$sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.transport_mode';
$sql .= ', s.fk_account, s.tva_assuj';
$sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.transport_mod_supplier';
$sql .= ', s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.logo_squarred';
$sql .= ', s.fk_shipping_method';
$sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms';
$sql .= ', s.order_min_amount, s.supplier_order_min_amount';

View File

@ -34,12 +34,12 @@ global $stripearrayofkeysbyenv;
$stripearrayofkeysbyenv = array(
0=>array(
"secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY,
"publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
"secret_key" => empty($conf->global->STRIPE_TEST_SECRET_KEY) ? '' : $conf->global->STRIPE_TEST_SECRET_KEY,
"publishable_key" => empty($conf->global->STRIPE_TEST_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
),
1=>array(
"secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY,
"publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
"secret_key" => empty($conf->global->STRIPE_LIVE_SECRET_KEY) ? '' : $conf->global->STRIPE_LIVE_SECRET_KEY,
"publishable_key" => empty($conf->global->STRIPE_LIVE_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
)
);

View File

@ -239,7 +239,7 @@ print 'fontsizesmaller='.$fontsizesmaller."\n";
print 'topMenuFontSize='.$topMenuFontSize."\n";
print 'toolTipBgColor='.$toolTipBgColor."\n";
print 'toolTipFontColor='.$toolTipFontColor."\n";
print 'conf->global->THEME_SATURATE_RATIO='.$conf->global->THEME_SATURATE_RATIO." (must be between 0 and 1)\n";
print 'conf->global->THEME_SATURATE_RATIO='.(empty($conf->global->THEME_SATURATE_RATIO) ? '' : $conf->global->THEME_SATURATE_RATIO)." (must be between 0 and 1)\n";
print '*/'."\n";

View File

@ -112,7 +112,7 @@ a.timeline-btn:hover
{
background-color: #e7e7e7;
color: #333;
border-color: #adadad;;
border-color: #adadad;
}

View File

@ -663,7 +663,7 @@ foreach ($object->fields as $key => $val)
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
} else {
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, '', 'maxwidth100', 1);
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);
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]).'">';

View File

@ -681,7 +681,7 @@ class User extends CommonObject
} else {
$wherefordel = "module='".$this->db->escape($allmodule)."'";
if (!empty($allperms)) {
$whereforadd .= " AND perms='".$this->db->escape($allperms)."'";
$wherefordel .= " AND perms='".$this->db->escape($allperms)."'";
}
}
}