From 984e302813d013f8b36522644d067d66f3d56e94 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 2 May 2023 16:05:28 +0200 Subject: [PATCH 1/2] FIX avoid warnings php8 --- htdocs/compta/cashcontrol/cashcontrol_card.php | 4 ++-- htdocs/compta/facture/list.php | 3 ++- htdocs/takepos/freezone.php | 2 +- htdocs/takepos/index.php | 2 +- htdocs/takepos/split.php | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index dfc8564b34c..5f481da2ba5 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -295,7 +295,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { } } - if ($terminalid != '') { + if (isset($terminalid) && $terminalid != '') { // Calculate $initialbalanceforterminal for terminal 0 foreach ($arrayofpaymentmode as $key => $val) { if ($key != 'cash') { @@ -305,7 +305,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { // Get the bank account dedicated to this point of sale module/terminal $vartouse = 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse; - $bankid = $conf->global->$vartouse; + $bankid = getDolGlobalInt($vartouse); if ($bankid > 0) { $sql = "SELECT SUM(amount) as total FROM ".MAIN_DB_PREFIX."bank"; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3de67f73acf..335330cd8e2 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1185,6 +1185,7 @@ if ($resql) { $massactionbutton = $form->selectMassAction('', $arrayofmassactions); // Show the new button only when this page is not opend from the Extended POS + $newcardbutton = ''; if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; if (!empty($socid)) { @@ -2548,7 +2549,7 @@ if ($resql) { } // Use correct digits number for totals - $totalarray['val']['total_margin'] = price2num($totalarray['val']['total_margin'], 'MT'); + $totalarray['val']['total_margin'] = (isset($totalarray['val']['total_margin']) ? price2num($totalarray['val']['total_margin'], 'MT') : null); // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index e1b24ec286d..6d540f30aa8 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -84,7 +84,7 @@ $vatRateDefault = get_default_tva($mysoc, $soc); $arrayofcss = array('/takepos/css/pos.css.php'); $arrayofjs = array(); -top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); +top_htmlhead('', '', 0, 0, $arrayofjs, $arrayofcss); ?> diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dc2bd8b684a..4ae532010e5 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -936,7 +936,7 @@ $( document ).ready(function() { if ($resql) { $obj = $db->fetch_object($resql); // If there is no cash control from today open it - if ($obj->rowid == null) { + if (!isset($obj->rowid) || is_null($obj->rowid)) { print "ControlCashOpening();"; } } diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php index 0391e911ba5..239b23f389d 100644 --- a/htdocs/takepos/split.php +++ b/htdocs/takepos/split.php @@ -125,7 +125,7 @@ if ($action=="split") { */ $invoice = new Facture($db); -if ($invoiceid > 0) { +if (isset($invoiceid) && $invoiceid > 0) { $invoice->fetch($invoiceid); } else { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; @@ -134,7 +134,7 @@ if ($invoiceid > 0) { if ($obj) { $invoiceid = $obj->rowid; } - if (!$invoiceid) { + if (!isset($invoiceid)) { $invoiceid = 0; // Invoice does not exist yet } else { $invoice->fetch($invoiceid); From 77e52007e490ddede00e9d2ea53b8dc60955c473 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 5 May 2023 19:09:28 +0200 Subject: [PATCH 2/2] fix: add field in sql the is use in line 1463 and remove undeclare varible --- htdocs/comm/card.php | 1 + htdocs/comm/propal/card.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index b64673f0670..f20a70f87dd 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1419,6 +1419,7 @@ if ($object->id > 0) { $sql .= ', f.total_tva'; $sql .= ', f.total_ttc'; $sql .= ', f.entity'; + $sql .= ', f.date_lim_reglement as dl'; $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status'; $sql .= ', s.nom, s.rowid as socid'; $sql .= ', SUM(pf.amount) as am'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index facb021d7e6..d76c28ed813 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2251,9 +2251,9 @@ if ($action == 'create') { } if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), '', 'confirm_closeas', $formquestion, '', 1, 250); } else { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), '', 'confirm_closeas', $formquestion, '', 1, 250); } } elseif ($action == 'delete') { // Confirm delete