Start fix for php8 compatibility

This commit is contained in:
Laurent Destailleur 2020-10-30 05:45:36 +01:00
parent b3333da5c1
commit a24071492e
34 changed files with 68 additions and 55 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

@ -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

@ -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

@ -248,7 +248,7 @@ abstract class DoliDB implements Database
$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

@ -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

@ -1566,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.
@ -1632,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
@ -1651,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
@ -1688,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
@ -1700,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"
@ -1747,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

@ -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]).'">';