From 9fdd1357d0b8ea29965c012202a09a0e92a7bc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Dec 2019 20:21:06 +0100 Subject: [PATCH 1/4] The variable $num does not seem to be defined for all execution paths --- htdocs/core/boxes/box_activity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 4864bcad371..40bfe965c60 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2015 Laurent Destailleur - * Copyright (C) 2014-2015 Frederic France + * Copyright (C) 2014-2019 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -431,7 +431,7 @@ class box_activity extends ModeleBoxes $line++; $j++; } - if ($num==0) { + if (count($data)==0) { $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', 'text'=>$langs->trans("NoRecordedInvoices"), From 05f1a556343df7b076b8f57c900e99fb1f7de049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Dec 2019 20:27:41 +0100 Subject: [PATCH 2/4] doxygen --- htdocs/datapolicy/class/actions_datapolicy.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 82b6d829544..7d467729841 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -384,7 +384,7 @@ class ActionsDatapolicy * @param Object $object Object * @param string $action Actions * @param HookManager $hookmanager Hook manager - * @return void + * @return int */ public function printCommonFooter($parameters, &$object, &$action, $hookmanager) { From ab1b5cfab50e5b46f4a26d97580956b3dea60c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 Dec 2019 20:30:24 +0100 Subject: [PATCH 3/4] The variable $i seems to be never defined. --- htdocs/ticket/class/api_tickets.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index c95b092cf2e..707fe403c6c 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -291,6 +291,7 @@ class Tickets extends DolibarrApi $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); + $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); $ticket_static = new Ticket($db); From 404ae0c20988e9fc7d9318d758456bbc26469d9a Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 17 Dec 2019 02:00:52 +0000 Subject: [PATCH 4/4] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/expensereport/lines.php | 132 +-- htdocs/accountancy/supplier/lines.php | 2 +- .../core/class/html.formaccounting.class.php | 94 +- htdocs/cron/class/cronjob.class.php | 820 +++++++++--------- htdocs/public/ticket/create_ticket.php | 80 +- htdocs/societe/class/societeaccount.class.php | 84 +- htdocs/theme/eldy/badges.inc.php | 38 +- htdocs/theme/eldy/theme_vars.inc.php | 10 +- htdocs/theme/md/badges.inc.php | 40 +- htdocs/theme/md/theme_vars.inc.php | 8 +- 11 files changed, 655 insertions(+), 655 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 4a20d6e3764..6a9ba9d84f2 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // Load translation files required by the page $langs->loadLangs(array("bills", "compta", "accountancy", "productbatch")); -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index f77ee12071d..1bedd8b871d 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -26,17 +26,17 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("compta","bills","other","accountancy","trips","productbatch")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch")); -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $account_parent = GETPOST('account_parent', 'int'); $changeaccount = GETPOST('changeaccount'); @@ -47,12 +47,12 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day=GETPOST("search_day", "int"); -$search_month=GETPOST("search_month", "int"); -$search_year=GETPOST("search_year", "int"); +$search_day = GETPOST("search_day", "int"); +$search_month = GETPOST("search_month", "int"); +$search_year = GETPOST("search_year", "int"); // Load variable for pagination -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); @@ -60,9 +60,9 @@ if (empty($page) || $page < 0) $page = 0; $pageprev = $page - 1; $pagenext = $page + 1; $offset = $limit * $page; -if (! $sortfield) +if (!$sortfield) $sortfield = "erd.date, erd.rowid"; -if (! $sortorder) { +if (!$sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { $sortorder = "DESC"; } @@ -71,7 +71,7 @@ if (! $sortorder) { // Security check if ($user->socid > 0) accessforbidden(); -if (! $user->rights->accounting->bind->write) +if (!$user->rights->accounting->bind->write) accessforbidden(); $formaccounting = new FormAccounting($db); @@ -98,27 +98,27 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; - if (! (GETPOST('account_parent', 'int') >= 0)) + if (!(GETPOST('account_parent', 'int') >= 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); } - if (! $error) + if (!$error) { $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sql1 .= " SET erd.fk_code_ventilation=" . (GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd"; + $sql1 .= " SET erd.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE erd.rowid IN ('.implode(',', $changeaccount).')'; - dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1); + dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; + if (!$resql1) { + $error++; setEventMessages($db->lasterror(), null, 'errors'); } - if (! $error) { + if (!$error) { $db->commit(); setEventMessages($langs->trans('Save'), null, 'mesgs'); } else { @@ -126,7 +126,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { setEventMessages($db->lasterror(), null, 'errors'); } - $account_parent = ''; // Protection to avoid to mass apply it a second time + $account_parent = ''; // Protection to avoid to mass apply it a second time } } @@ -138,7 +138,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { $form = new Form($db); $formother = new FormOther($db); -llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched")); +llxHeader('', $langs->trans("ExpenseReportsVentilation").' - '.$langs->trans("Dispatched")); print '