Buongiorno,
innanzitutto volevo fare i complimenti per il gestionale, è una bomba!!
ho un problema persistente da diverse release, in pratica se cerco di cambiare lo stato di una fattura (nel mio caso da bozza a emessa) compare un errore che riporto di seguito:
- Si è verificato un errore [uid: 5520f15]. Se il problema persiste siete pregati di chiedere assistenza tramite il forum apposito (https://forum.openstamanager.com/).
Uncaught Exception TypeError: "number_format(): Argument #1 ($num) must be of type float, string given" at \plugins\exportFE\src\Validator.php line 616
- Si è verificato un errore [uid: 5520f15]. Se il problema persiste siete pregati di chiedere assistenza tramite il forum apposito (https://forum.openstamanager.com/).
number_format(): Argument #1 ($num) must be of type float, string given
il problema lo risolviamo facilmente sostiuendo
// Operazioni di normalizzazione
// Formattazione decimali
if ($info['type'] == 'decimal') {
if (in_array($key, ['PrezzoUnitario'])) {
$output = number_format($output, 6, '.', '');
} elseif (in_array($key, ['Quantita'])) {
// Se i decimali per la quantità sono < 2 li imposto a 2 che è il minimo per lo standard della fatturazione elettronica
if (setting('Cifre decimali per quantità') == 1) {
$output = number_format($output, 2, '.', '');
} else {
$output = number_format($output, setting('Cifre decimali per quantità'), '.', '');
}
} else {
$output = number_format($output, 2, '.', '');
}
}
CON
// Operazioni di normalizzazione
// Formattazione decimali
if ($info['type'] == 'decimal') {
$output = floatval($output); // Converti $output in float
if (in_array($key, ['PrezzoUnitario'])) {
$output = number_format($output, 6, '.', '');
} elseif (in_array($key, ['Quantita'])) {
// Se i decimali per la quantità sono < 2 li imposto a 2 che è il minimo per lo standard della fatturazione elettronica
if (setting('Cifre decimali per quantità') == 1) {
$output = number_format($output, 2, '.', '');
} else {
$output = number_format($output, setting('Cifre decimali per quantità'), '.', '');
}
} else {
$output = number_format($output, 2, '.', '');
}
}
con la sostituzione funziona tutto normalmente fino a quando non riaggiorniamo il gestionale.
potete aiutarmi?
(riporto log errore)
[2024-02-07 10:18:09] Logs.ERROR: Uncaught Exception TypeError: "number_format(): Argument #1 ($num) must be of type float, string given" at C:\wamp64\www\ge\plugins\exportFE\src\Validator.php line 616 {"exception":"[object] (TypeError(code: 0): number_format(): Argument #1 ($num) must be of type float, string given at C:\wamp64\www\ge\plugins\exportFE\src\Validator.php:616)"}
{"url":"/ge/editor.php?id_module=14&id_record=646","ip":"192.168.10.14","http_method":"POST","server":"192.168.10.24","referrer":"http://192.168.10.24:2601/ge/editor.php?id_module=14&id_record=646","uid":"d34b40b"}
[2024-02-07 10:18:09] Logs.ERROR: number_format(): Argument #1 ($num) must be of type float, string given {"code":0,"message":"number_format(): Argument #1 ($num) must be of type float, string given","file":"C:\wamp64\www\ge\plugins\exportFE\src\Validator.php","line":616,"trace":"#0 C:\wamp64\www\ge\plugins\exportFE\src\Validator.php(616): number_format('10.000\xE2\x82\xAC', 2, '.', '')\n#1 C:\wamp64\www\ge\plugins\exportFE\src\Validator.php(595): Plugins\ExportFE\Validator->prepareForXML('10.000\xE2\x82\xAC', 'CapitaleSociale')\n#2 C:\wamp64\www\ge\plugins\exportFE\src\Validator.php(595): Plugins\ExportFE\Validator->prepareForXML(Array, 'CapitaleSociale')\n#3 C:\wamp64\www\ge\plugins\exportFE\src\Validator.php(595): Plugins\ExportFE\Validator->prepareForXML(Array, 'IscrizioneREA')\n#4 C:\wamp64\www\ge\plugins\exportFE\src\Validator.php(595): Plugins\ExportFE\Validator->prepareForXML(Array, 'CedentePrestato...')\n#5 C:\wamp64\www\ge\plugins\exportFE\src\Validator.php(581): Plugins\ExportFE\Validator->prepareForXML(Array)\n#6 C:\wamp64\www\ge\plugins\exportFE\src\FatturaElettronica.php(410): Plugins\ExportFE\Validator->validate()\n#7 C:\wamp64\www\ge\plugins\exportFE\src\FatturaElettronica.php(310): Plugins\ExportFE\FatturaElettronica->toXML()\n#8 C:\wamp64\www\ge\modules\fatture\src\Fattura.php(656): Plugins\ExportFE\FatturaElettronica->save('C:\\wamp64\\www\\g...')\n#9 C:\wamp64\www\ge\modules\fatture\actions.php(196): Modules\Fatture\Fattura->save()\n#10 C:\wamp64\www\ge\actions.php(485): include('C:\\wamp64\\www\\g...')\n#11 C:\wamp64\www\ge\editor.php(65): include_once('C:\\wamp64\\www\\g...')\n#12 {main}"}
{"url":"/ge/editor.php?id_module=14&id_record=646","ip":"192.168.10.14","http_method":"POST","server":"192.168.10.24","referrer":"http://192.168.10.24:2601/ge/editor.php?id_module=14&id_record=646","uid":"d34b40b"}