From ee265117426f9f28f484e27f9cbb85070b33e2c1 Mon Sep 17 00:00:00 2001 From: valentina Date: Wed, 23 Oct 2024 12:43:08 +0200 Subject: [PATCH] fix: creazione nota di debito --- modules/fatture/actions.php | 5 ++--- modules/fatture/buttons.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/fatture/actions.php b/modules/fatture/actions.php index b76953fbc..9662ba760 100755 --- a/modules/fatture/actions.php +++ b/modules/fatture/actions.php @@ -1190,7 +1190,7 @@ switch ($op) { // Nota di debito if (get('op') == 'nota_addebito') { - $rs_segment = $dbo->fetchArray('SELECT * FROM `zz_segments` LEFT JOIN `zz_segments_lang` ON (`zz_segments`.`id` = `zz_segments_lang`.`id_record` AND `zz_segments_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).") WHERE `predefined_addebito`='1'"); + $rs_segment = $dbo->fetchArray('SELECT `zz_segments`.* FROM `zz_segments` LEFT JOIN `zz_segments_lang` ON (`zz_segments`.`id` = `zz_segments_lang`.`id_record` AND `zz_segments_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).") WHERE `predefined_addebito`='1'"); if (!empty($rs_segment)) { $id_segment = $rs_segment[0]['id']; } else { @@ -1198,8 +1198,7 @@ if (get('op') == 'nota_addebito') { } $anagrafica = $fattura->anagrafica; - $id_tipo = database()->fetchOne('SELECT `co_tipidocumento`.`id` FROM `co_tipidocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `title` = "Nota di debito" AND `dir` = "entrata"')['id']; - $tipo = Tipo::find($id_tipo); + $tipo = Tipo::where('name', 'Nota di debito')->where('dir', 'entrata')->first(); $data = $fattura->data; $nota = Fattura::build($anagrafica, $tipo, $data, $id_segment); diff --git a/modules/fatture/buttons.php b/modules/fatture/buttons.php index 6d61d88fc..d775b3d4b 100755 --- a/modules/fatture/buttons.php +++ b/modules/fatture/buttons.php @@ -39,10 +39,10 @@ if ($dir == 'entrata' || !empty($abilita_autofattura)) { if ($dir == 'entrata') { echo '