From afedc83193df268d95a3e337c2467d0532ef9edc Mon Sep 17 00:00:00 2001 From: Noizette Date: Fri, 14 Apr 2023 19:48:07 +0200 Subject: [PATCH] Fix some PHP8 depreciation --- lib/Facture.php | 4 +- www/admin/_inc.php | 4 +- www/admin/facture_ajouter.php | 4 +- www/admin/facture_modifier.php | 4 +- www/admin/pdf.php | 69 ++++++++++++++++++---------------- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/lib/Facture.php b/lib/Facture.php index e1ecae7..7adf08e 100644 --- a/lib/Facture.php +++ b/lib/Facture.php @@ -249,8 +249,8 @@ class Facture $data = compact('type', 't', 'year', 'y', 'ynumber', 'id'); return preg_replace_callback('/%(\d+)?\{([a-z]+)\}/', function ($match) use ($data) { - $v = $data[$match[2]]; - $type = ctype_digit($data[$match[2]]) ? 'd' : 's'; + $v = (string) $data[$match[2]]; + $type = ctype_digit($v) ? 'd' : 's'; return sprintf('%' . $match[1] . $type, $v); }, $pattern); } diff --git a/www/admin/_inc.php b/www/admin/_inc.php index b052a36..5db92d0 100644 --- a/www/admin/_inc.php +++ b/www/admin/_inc.php @@ -59,7 +59,9 @@ $tpl->register_function('money_fac', function (array $params) $current_value = Utils::money_format($current_value, ',', ''); } - $current_value = htmlspecialchars($current_value, ENT_QUOTES, 'UTF-8'); + if (null !== $current_value) { + $current_value = htmlspecialchars($current_value, ENT_QUOTES, 'UTF-8'); + } $currency = Config::getInstance()->get('monnaie'); return sprintf('%s', $name, $current_value, $currency); diff --git a/www/admin/facture_ajouter.php b/www/admin/facture_ajouter.php index 10e6bf4..6cfca93 100644 --- a/www/admin/facture_ajouter.php +++ b/www/admin/facture_ajouter.php @@ -13,8 +13,8 @@ use stdClass; $db = DB::getInstance(); -$step = $radio = false; -$liste = []; +$step = false; +$radio = $liste = []; $designations = []; $prix = []; diff --git a/www/admin/facture_modifier.php b/www/admin/facture_modifier.php index 1ba0d3d..ddd6c01 100644 --- a/www/admin/facture_modifier.php +++ b/www/admin/facture_modifier.php @@ -223,8 +223,8 @@ $doc['base_receveur'] = $f->receveur_membre?'membre':'client'; $doc['client'] = $f->receveur_id; $doc['membre'] = $f->receveur_id; -$doc['date_emission'] = strtotime(f('date_emission')) ?: $f->date_emission; -$doc['date_echeance'] = strtotime(f('date_echeance')) ?: $f->date_echeance; // Smarty m'a saoulé pour utiliser form_field|date_fr:--- +$doc['date_emission'] = f('date_emission') ?: $f->date_emission; +$doc['date_echeance'] = f('date_echeance')?: $f->date_echeance; // Smarty m'a saoulé pour utiliser form_field|date_fr:--- /* modif DD -- CERFA -------------------------------------- */ if ( $f->type_facture == CERFA ) { $doc['total'] = $f->total; diff --git a/www/admin/pdf.php b/www/admin/pdf.php index 65ad3f5..980bffe 100644 --- a/www/admin/pdf.php +++ b/www/admin/pdf.php @@ -121,6 +121,9 @@ EOF; $i = 1; foreach($f->contenu as $k=>$v) { + if ( $k == 'prix' ) { + continue; + } echo ''; echo str_replace("\n", '
', $v['designation']); echo ''; @@ -201,7 +204,7 @@ EOF; - ${doc}_${emission} + {$doc}_{$emission}