From 508ab0c7e90f0be201b15b857bd8d841fd1cbdd4 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 8 Oct 2022 17:05:14 +0200 Subject: [PATCH 1/4] Fix statistica 'Ore di lavoro per tecnico' se ancora nessuna sessione inserita Rimozione variabili inutilizzate --- modules/statistiche/edit.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/statistiche/edit.php b/modules/statistiche/edit.php index 57f990b5a..13a6a502b 100755 --- a/modules/statistiche/edit.php +++ b/modules/statistiche/edit.php @@ -446,7 +446,7 @@ $(document).ready(function() { data: { labels: months, datasets: [ - '.$dataset.' + '.($dataset? :'{ label: "", backgroundColor: "transparent", data: [ 0,0,0,0,0,0,0,0,0,0,0,0 ] }').' ] }, options: { @@ -521,7 +521,6 @@ INNER JOIN an_tipianagrafiche_anagrafiche ON an_anagrafiche.idanagrafica=an_tipi INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica WHERE an_tipianagrafiche.descrizione = "Cliente" AND co_tipidocumento.dir = "entrata" AND an_anagrafiche.created_at BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(an_anagrafiche.created_at), MONTH(an_anagrafiche.created_at) ORDER BY YEAR(an_anagrafiche.created_at) ASC, MONTH(an_anagrafiche.created_at) ASC'); -$clienti = Stats::monthly($clienti, $start, $end); //Random color $background = '#'.dechex(rand(256, 16777215)); From 0bdadffd2aa831c05dfb87946d0f175edf8c9723 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 8 Oct 2022 17:28:43 +0200 Subject: [PATCH 2/4] Introdotto build per referenti --- modules/anagrafiche/src/Referente.php | 25 ++++++++++++++++++++++++ plugins/referenti/actions.php | 28 +++++++++++++++------------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/modules/anagrafiche/src/Referente.php b/modules/anagrafiche/src/Referente.php index 5bb83c7b7..22fec8706 100644 --- a/modules/anagrafiche/src/Referente.php +++ b/modules/anagrafiche/src/Referente.php @@ -27,6 +27,31 @@ class Referente extends Model use SimpleModelTrait; protected $table = 'an_referenti'; + + /** + * Crea un nuovo referente. + * + * @param string $nome + * + * @return self + */ + public static function build($idanagrafica, $nome, $idmansione, $idsede) + { + $model = new static(); + + + $model->idanagrafica = $idanagrafica; + + $model->nome = $nome; + + $model->idmansione = $idmansione; + $model->idsede = $idsede; + + $model->save(); + + return $model; + } + /** * The attributes that aren't mass assignable. diff --git a/plugins/referenti/actions.php b/plugins/referenti/actions.php index 17befdf59..5736c9cf0 100755 --- a/plugins/referenti/actions.php +++ b/plugins/referenti/actions.php @@ -19,26 +19,30 @@ include_once __DIR__.'/../../core.php'; +use Modules\Anagrafiche\Referente; + $operazione = filter('op'); switch ($operazione) { case 'addreferente': if (!empty(post('nome'))) { - $opt_out_newsletter = post('disable_newsletter'); - $dbo->insert('an_referenti', [ - 'idanagrafica' => $id_parent, - 'nome' => post('nome'), - 'idmansione' => post('idmansione'), - 'telefono' => post('telefono'), - 'email' => post('email'), - 'idsede' => post('idsede'), - 'enable_newsletter' => empty($opt_out_newsletter), - ]); - $id_record = $dbo->lastInsertedID(); + $nome = post('nome'); + $idmansione = post('idmansione'); + $idsede = post('idsede'); + $opt_out_newsletter = post('disable_newsletter'); + + $referente = Referente::build($id_parent, $nome, $idmansione, $idsede); + $id_record = $referente->id; + + $referente->telefono = post('telefono'); + $referente->email = post('email'); + $referente->enable_newsletter = empty($opt_out_newsletter); + + $referente->save(); if (isAjaxRequest() && !empty($id_record)) { - echo json_encode(['id' => $id_record, 'text' => post('nome')]); + echo json_encode(['id' => $id_record, 'text' => $referente->nome]); } flash()->info(tr('Aggiunto nuovo referente!')); From 75c13d9ad86f050e13764b3df2b042e98a2b29d5 Mon Sep 17 00:00:00 2001 From: loviuz Date: Mon, 10 Oct 2022 09:32:21 +0200 Subject: [PATCH 3/4] Fix link note di credito --- modules/fatture/edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/fatture/edit.php b/modules/fatture/edit.php index 5b5f0dbc3..6d21d9d19 100755 --- a/modules/fatture/edit.php +++ b/modules/fatture/edit.php @@ -135,7 +135,7 @@ if (!empty($note_accredito)) { ]); echo ' -
'.Modules::link('Fatture di vendita', $nota['id'], $text, $text); +
'.Modules::link( ($dir == 'entrata' ? 'Fatture di vendita' : 'Fatture di acquisto' ), $nota['id'], $text, $text); } echo ' '; From 3bfad8f6cbd2a0bfbc7ef9460093884256894213 Mon Sep 17 00:00:00 2001 From: MatteoPistorello Date: Mon, 10 Oct 2022 11:23:17 +0200 Subject: [PATCH 4/4] Fix aggiunta scadenza --- modules/scadenzario/actions.php | 2 ++ modules/scadenzario/edit.php | 1 + 2 files changed, 3 insertions(+) diff --git a/modules/scadenzario/actions.php b/modules/scadenzario/actions.php index c09857e4c..71f8571ef 100755 --- a/modules/scadenzario/actions.php +++ b/modules/scadenzario/actions.php @@ -34,6 +34,7 @@ switch (post('op')) { break; case 'update': + $idanagrafica = post('idanagrafica'); $tipo = post('tipo'); $descrizione = post('descrizione'); $iddocumento = post('iddocumento') ?: 0; @@ -79,6 +80,7 @@ switch (post('op')) { $id_scadenza = post('id_scadenza')[$id]; if (!empty($id_scadenza)) { $database->update('co_scadenziario', [ + 'idanagrafica' => $idanagrafica, 'descrizione' => $descrizione, 'da_pagare' => $da_pagare, 'pagato' => $pagato, diff --git a/modules/scadenzario/edit.php b/modules/scadenzario/edit.php index edfd4122c..93dda4598 100755 --- a/modules/scadenzario/edit.php +++ b/modules/scadenzario/edit.php @@ -31,6 +31,7 @@ echo ' +