diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 17663bf411b..8f9d300d893 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -157,7 +157,7 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc $sql .= $db->plimit(1); $res = $db->query($sql); - if ($res->num_rows > 0) { + if ($res !== false && $db->num_rows($res) > 0) { $fiscalYear = $db->fetch_object($res); $search_date_start = strtotime($fiscalYear->date_start); $search_date_end = strtotime($fiscalYear->date_end); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index fb88ad3ac40..21131a25177 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -253,22 +253,24 @@ if ($result) { } // Load all unbound lines -$sql = "SELECT fk_expensereport, COUNT(erd.rowid) as nb"; -$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; -$sql .= " WHERE erd.fk_code_ventilation <= 0"; -$sql .= " AND erd.total_ttc <> 0"; -$sql .= " AND fk_expensereport IN (".$db->sanitize(implode(",", array_keys($taber))).")"; -$sql .= " GROUP BY fk_expensereport"; -$resql = $db->query($sql); +if (!empty($taber)) { + $sql = "SELECT fk_expensereport, COUNT(erd.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; + $sql .= " WHERE erd.fk_code_ventilation <= 0"; + $sql .= " AND erd.total_ttc <> 0"; + $sql .= " AND fk_expensereport IN (".$db->sanitize(implode(",", array_keys($taber))).")"; + $sql .= " GROUP BY fk_expensereport"; + $resql = $db->query($sql); -$num = $db->num_rows($resql); -$i = 0; -while ($i < $num) { - $obj = $db->fetch_object($resql); - if ($obj->nb > 0) { - $errorforinvoice[$obj->fk_expensereport] = 'somelinesarenotbound'; + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + if ($obj->nb > 0) { + $errorforinvoice[$obj->fk_expensereport] = 'somelinesarenotbound'; + } + $i++; } - $i++; } // Bookkeeping Write diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 1c64cc8934a..437b436b733 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -399,34 +399,34 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice } } */ + // New way, single query, load all unbound lines -$sql = " -SELECT - fk_facture_fourn, - COUNT(fd.rowid) as nb -FROM - " . MAIN_DB_PREFIX . "facture_fourn_det as fd -WHERE - fd.product_type <= 2 - AND fd.fk_code_ventilation <= 0 - AND fd.total_ttc <> 0 - AND fk_facture_fourn IN (".$db->sanitize(implode(",", array_keys($tabfac))).") -GROUP BY fk_facture_fourn -"; -$resql = $db->query($sql); +if (!empty($tabfac)) { + $sql = " + SELECT + fk_facture_fourn, + COUNT(fd.rowid) as nb + FROM + " . MAIN_DB_PREFIX . "facture_fourn_det as fd + WHERE + fd.product_type <= 2 + AND fd.fk_code_ventilation <= 0 + AND fd.total_ttc <> 0 + AND fk_facture_fourn IN (".$db->sanitize(implode(",", array_keys($tabfac))).") + GROUP BY fk_facture_fourn + "; + $resql = $db->query($sql); -$num = $db->num_rows($resql); -$i = 0; -while ($i < $num) { - $obj = $db->fetch_object($resql); - if ($obj->nb > 0) { - $errorforinvoice[$obj->fk_facture_fourn] = 'somelinesarenotbound'; + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + if ($obj->nb > 0) { + $errorforinvoice[$obj->fk_facture_fourn] = 'somelinesarenotbound'; + } + $i++; } - $i++; } -//var_dump($errorforinvoice);exit; - - // Bookkeeping Write if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'bind', 'write')) { diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 3ebd9607449..09b6e73ba2a 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -83,7 +83,7 @@ print "
\n"; print '
'; print ''.$langs->trans("XDebug").'
'; print '
'; -$test = !function_exists('xdebug_is_enabled'); +$test = !function_exists('xdebug_is_debugger_active'); if ($test) { print img_picto('', 'tick.png', 'class="pictofixedwidth"').' '.$langs->trans("NotInstalled").' '.$langs->trans("NotSlowedDownByThis").''; } else { diff --git a/htdocs/admin/system/xdebug.php b/htdocs/admin/system/xdebug.php index 3151234ea2a..7150c5d0647 100644 --- a/htdocs/admin/system/xdebug.php +++ b/htdocs/admin/system/xdebug.php @@ -48,7 +48,7 @@ llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_xdebug'); print load_fiche_titre("XDebug", '', 'title_setup'); -if (!function_exists('xdebug_is_enabled')) { +if (!function_exists('xdebug_is_debugger_active')) { print "
\n"; print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.'; llxFooter(); @@ -62,8 +62,8 @@ print ''; print '

'; if (function_exists('socket_create')) { - $address = ini_get('xdebug.remote_host') ? ini_get('xdebug.remote_host') : '127.0.0.1'; - $port = ini_get('xdebug.remote_port') ? ini_get('xdebug.remote_port') : 9000; + $address = ini_get('xdebug.client_host') ? ini_get('xdebug.client_host') : '127.0.0.1'; + $port = ini_get('xdebug.client_port') ? (int) ini_get('xdebug.client_port') : 9000; print "Current xdebug setup:
\n"; print "* Remote debug setup:
\n"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a23db2adf8a..83dbfbc5979 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -11663,7 +11663,7 @@ class Form foreach ($buttons as $button) { $addclass = empty($button['addclass']) ? '' : $button['addclass']; - $retstring .= ''; + $retstring .= ''; } $retstring .= $withoutdiv ? '' : '
'; diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 6b1ab1cb007..ce549b8f52f 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -906,8 +906,8 @@ class FormSetupItem } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { $input = $this->fieldParams['input'] ?? array(); - $revertonoff = $this->fieldParams['revertonoff'] ? 1 : 0; - $forcereload = $this->fieldParams['forcereload'] ? 1 : 0; + $revertonoff = isset($this->fieldParams['revertonoff']) ? 1 : 0; + $forcereload = isset($this->fieldParams['forcereload']) ? 1 : 0; $out .= ajax_constantonoff($this->confKey, $input, $this->entity, $revertonoff, 0, $forcereload); } else { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8bfe214c523..a3d10ee3d14 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2222,7 +2222,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme // Receptions if (isModEnabled('reception')) { $langs->load("receptions"); - $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->hasRight('reception', 'lire'), '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->hasRight('reception', 'lire'), '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth", style="text-align: right;"')); $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->hasRight('reception', 'creer')); $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->hasRight('reception', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { diff --git a/htdocs/public/webportal/tpl/header_login.tpl.php b/htdocs/public/webportal/tpl/header_login.tpl.php index 813c6a15b6c..b0c9d1402f0 100644 --- a/htdocs/public/webportal/tpl/header_login.tpl.php +++ b/htdocs/public/webportal/tpl/header_login.tpl.php @@ -28,17 +28,17 @@ global $langs; rootUrl.'includes/jquery/plugins/jnotify/jquery.jnotify.css'; $jNotifyCSSUrl = dol_buildpath('/includes/jquery/plugins/jnotify/jquery.jnotify.min.css', 2); - print ''; + print ''."\n"; // JQuery //$jQueryJSUrl = $context->rootUrl.'includes/jquery/js/jquery.js'; $jQueryJSUrl = dol_buildpath('/includes/jquery/js/jquery.js', 2); - print ''; + print ''."\n"; // JNotify //$jNotifyJSUrl = $context->rootUrl.'includes/jquery/plugins/jnotify/jquery.jnotify.js'; $jNotifyJSUrl = dol_buildpath('/includes/jquery/plugins/jnotify/jquery.jnotify.min.js', 2); - print ''; + print ''."\n"; ?> diff --git a/htdocs/webportal/controllers/document.controller.class.php b/htdocs/webportal/controllers/document.controller.class.php index 2efd83fd953..3a0d338c917 100644 --- a/htdocs/webportal/controllers/document.controller.class.php +++ b/htdocs/webportal/controllers/document.controller.class.php @@ -212,8 +212,8 @@ class DocumentController extends Controller exit; } - $fileSize = dol_filesize($fullpath_original_file); - $fileSizeMaxDefault = 20 * 1024; // 20 Mo by default + $fileSize = dol_filesize($fullpath_original_file); // the returned value is in byte + $fileSizeMaxDefault = 20 * 1024 * 1024; // 20 Mo by default $fileSizeMax = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', $fileSizeMaxDefault); if ($fileSize > $fileSizeMax) { dol_syslog('ErrorFileSizeTooLarge: ' . $fileSize); diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 846b1e57d44..858ac1ead2a 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -93,7 +93,7 @@ if ($object->id > 0) { $permissiontocreate = isModEnabled('website') && $user->hasRight('website', 'write'); $permissiontodelete = isModEnabled('website') && $user->hasRight('website', 'delete'); } elseif ($object->site == 'dolibarr_portal') { - $permissiontocreate = isModEnabled('webportal') && $user->hasRight('webportal', 'write'); + $permissiontocreate = $permissiontodelete = isModEnabled('webportal') && $user->hasRight('webportal', 'write'); } } else { $permissiontocreate = isModEnabled('website') && $user->hasRight('website', 'write') || isModEnabled('webportal') && $user->hasRight('webportal', 'write');