Fix some PHP8 depreciation

This commit is contained in:
Noizette 2023-04-14 19:48:07 +02:00
parent 8a10dcfab3
commit afedc83193
5 changed files with 45 additions and 40 deletions

View File

@ -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);
}

View File

@ -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('<td><nobr><input type="text" pattern="[0-9]*([.,][0-9]{1,2})?" inputmode="decimal" size="8" class="money" style="width: 60%%" onchange="updateSum();" name="%s" value="%s" /><b>%s</b></nobr></td>', $name, $current_value, $currency);

View File

@ -13,8 +13,8 @@ use stdClass;
$db = DB::getInstance();
$step = $radio = false;
$liste = [];
$step = false;
$radio = $liste = [];
$designations = [];
$prix = [];

View File

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

View File

@ -121,6 +121,9 @@ EOF;
$i = 1;
foreach($f->contenu as $k=>$v)
{
if ( $k == 'prix' ) {
continue;
}
echo '<tr><td>';
echo str_replace("\n", '<br>', $v['designation']);
echo '</td><td>';
@ -201,7 +204,7 @@ EOF;
<!DOCTYPE html>
<html>
<head>
<title>${doc}_${emission}</title>
<title>{$doc}_{$emission}</title>
<style>
@page {
size: A4 portrait;
@ -395,7 +398,7 @@ elseif ($f->type_facture == CERFA)
<!DOCTYPE html>
<html>
<head>
<title>${doc}_${emission}</title>
<title>{$doc}_{$emission}</title>
<style>
@page {
size: A4 portrait;
@ -426,11 +429,11 @@ elseif ($f->type_facture == CERFA)
}
#p1 {
background-image: url('${url}p/facturation/cerfa-1.png');
background-image: url('{$url}p/facturation/cerfa-1.png');
}
#p2 {
background-image: url('${url}p/facturation/cerfa-2.png');
background-image: url('{$url}p/facturation/cerfa-2.png');
position: relative;
}
@ -438,46 +441,46 @@ elseif ($f->type_facture == CERFA)
</head>
<body>
<div class="page" id="p1">
<div style="top: 10mm; left: 170mm;">${t['numero']}</div>
<div style="top: 10mm; left: 170mm;">{$t['numero']}</div>
<div style="top: 35mm; left: 20mm;">${t['nom_asso']}</div>
<div style="top: 46mm; left: 20mm;">${t['n_rue_asso']}</div>
<div style="top: 46mm; left: 40mm;">${t['rue_asso']}</div>
<div style="top: 51.5mm; left: 37mm;">${t['cp_asso']}</div>
<div style="top: 51.5mm; left: 75mm;">${t['ville_asso']}</div>
<div style="top: 35mm; left: 20mm;">{$t['nom_asso']}</div>
<div style="top: 46mm; left: 20mm;">{$t['n_rue_asso']}</div>
<div style="top: 46mm; left: 40mm;">{$t['rue_asso']}</div>
<div style="top: 51.5mm; left: 37mm;">{$t['cp_asso']}</div>
<div style="top: 51.5mm; left: 75mm;">{$t['ville_asso']}</div>
<div style="top: 62mm; left: 18mm;">${t['objet0']}</div>
<div style="top: 66.5mm; left: 18mm;">${t['objet1']}</div>
<div style="top: 70.8mm; left: 18mm;">${t['objet2']}</div>
<div style="top: 62mm; left: 18mm;">{$t['objet0']}</div>
<div style="top: 66.5mm; left: 18mm;">{$t['objet1']}</div>
<div style="top: 70.8mm; left: 18mm;">{$t['objet2']}</div>
<div style="top: 128.5mm; left: 15mm;">X</div>
</div>
<div class="page" id="p2">
<div style="top: 18mm; left: 18mm;">${t['nom']}</div>
<div style="top: 32mm; left: 18mm;">${t['adresse']}</div>
<div style="top: 37mm; left: 40mm;">${t['cp']}</div>
<div style="top: 37mm; left: 80mm;">${t['ville']}</div>
<div style="top: 18mm; left: 18mm;">{$t['nom']}</div>
<div style="top: 32mm; left: 18mm;">{$t['adresse']}</div>
<div style="top: 37mm; left: 40mm;">{$t['cp']}</div>
<div style="top: 37mm; left: 80mm;">{$t['ville']}</div>
<div style="top: 63mm; left: 87mm;">${t['total']}</div>
<div style="top: 73mm; left: 58mm;">${t['total_lettre']}</div>
<div style="top: 63mm; left: 87mm;">{$t['total']}</div>
<div style="top: 73mm; left: 58mm;">{$t['total_lettre']}</div>
<div style="top: 82mm; left: 69mm;">${t['d']}</div>
<div style="top: 82mm; left: 82mm;">${t['m']}</div>
<div style="top: 82mm; left: 99mm;">${t['Y']}</div>
<div style="top: 82mm; left: 69mm;">{$t['d']}</div>
<div style="top: 82mm; left: 82mm;">{$t['m']}</div>
<div style="top: 82mm; left: 99mm;">{$t['Y']}</div>
<div style="top: 96mm; left: 53mm;">${t['art200']}</div>
<div style="top: 96mm; left: 103mm;">${t['art238']}</div>
<div style="top: 96mm; left: 153.0mm;">${t['art885']}</div>
<div style="top: 113mm; ${t['frm']}">X</div>
<div style="top: 136mm; ${t['nat']}">X</div>
<div style="top: 142mm; left: 25mm;">${t['texte']}</div>
<div style="top: 158.2mm; ${t['pos']}">X</div>
<div style="top: 96mm; left: 53mm;">{$t['art200']}</div>
<div style="top: 96mm; left: 103mm;">{$t['art238']}</div>
<div style="top: 96mm; left: 153.0mm;">{$t['art885']}</div>
<div style="top: 113mm; {$t['frm']}">X</div>
<div style="top: 136mm; {$t['nat']}">X</div>
<div style="top: 142mm; left: 25mm;">{$t['texte']}</div>
<div style="top: 158.2mm; {$t['pos']}">X</div>
<div style="top: 239mm; left: 139mm;">${t['d2']}</div>
<div style="top: 239mm; left: 148mm;">${t['m2']}</div>
<div style="top: 239mm; left: 156mm;">${t['Y2']}</div>
<div style="top: 239mm; left: 139mm;">{$t['d2']}</div>
<div style="top: 239mm; left: 148mm;">{$t['m2']}</div>
<div style="top: 239mm; left: 156mm;">{$t['Y2']}</div>
<div style="top: 243mm; left: 137mm;"><img src="${url}plugin/facturation/sign.png" style="width: 50mm;"/></div>
<div style="top: 243mm; left: 137mm;"><img src="{$url}plugin/facturation/sign.png" style="width: 50mm;"/></div>
</div>
</body>
</html>