From 7ec10822607ff548a73e1040791460d8997efd8e Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 26 May 2022 16:44:51 +0200 Subject: [PATCH 1/5] Fix aggiungi intervento al preventivo --- modules/preventivi/init.php | 1 + .../plugins/preventivi.consuntivo.php | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/preventivi/init.php b/modules/preventivi/init.php index b0ab05c5e..109c2c087 100755 --- a/modules/preventivi/init.php +++ b/modules/preventivi/init.php @@ -25,6 +25,7 @@ if (isset($id_record)) { $record = $dbo->fetchOne('SELECT co_preventivi.*, (SELECT tipo FROM an_anagrafiche WHERE idanagrafica = co_preventivi.idanagrafica) AS tipo_anagrafica, co_statipreventivi.is_fatturabile, + co_statipreventivi.is_pianificabile, co_statipreventivi.is_completato, co_statipreventivi.is_revisionabile, co_statipreventivi.descrizione AS stato diff --git a/modules/preventivi/plugins/preventivi.consuntivo.php b/modules/preventivi/plugins/preventivi.consuntivo.php index 574230765..2f3df6e06 100755 --- a/modules/preventivi/plugins/preventivi.consuntivo.php +++ b/modules/preventivi/plugins/preventivi.consuntivo.php @@ -411,25 +411,27 @@ echo ' '; // Aggiunta interventi se il preventivo é aperto o in attesa o pagato (non si possono inserire interventi collegati ad altri preventivi) -if (in_array($record['stato'], ['Accettato', 'In lavorazione', 'Pagato'])) { - echo ' -
+$query = 'SELECT id, CONCAT(\'Intervento \', codice, \' del \', DATE_FORMAT(IFNULL((SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento=in_interventi.id), data_richiesta), \'%d/%m/%Y\')) AS descrizione FROM in_interventi WHERE id_preventivo IS NULL AND id_contratto IS NULL AND id_ordine IS NULL AND id NOT IN( SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND id NOT IN( SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL) AND idanagrafica='.prepare($record['idanagrafica']); + +$count = $dbo->fetchNum($query); + + echo '
+
-
- {[ "type": "select", "label": "'.tr('Aggiungi un altro intervento a questo preventivo').'", "name": "idintervento", "values": "query=SELECT id, CONCAT(\'Intervento \', codice, \' del \', DATE_FORMAT(IFNULL((SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE in_interventi_tecnici.idintervento=in_interventi.id), data_richiesta), \'%d/%m/%Y\')) AS descrizione FROM in_interventi WHERE id_preventivo IS NULL AND id NOT IN( SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND id NOT IN( SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL) AND idanagrafica='.prepare($record['idanagrafica']).'" ]} +
+ {[ "type": "select", "label": "'.tr('Aggiungi un intervento a questo preventivo').' ('.$count.')", "name": "idintervento", "values": "query='.$query.'", "required":"1" ]}
-
-
-
-
'; -} + From 8c87e238a3dedb5df0791244ea4a535544459168 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 26 May 2022 17:08:26 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Aggiunta=20creazione=20al=20volo=20del=20pr?= =?UTF-8?q?eventivo=20dall'attivit=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/contratti/add.php | 2 +- modules/interventi/edit.php | 2 +- modules/preventivi/actions.php | 8 ++++++++ modules/preventivi/add.php | 23 +++++++++++++++++------ 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/modules/contratti/add.php b/modules/contratti/add.php index b42fde314..933d28dbf 100755 --- a/modules/contratti/add.php +++ b/modules/contratti/add.php @@ -37,7 +37,7 @@ echo '
- {[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1" ]} + {[ "type": "select", "label": "'.tr('Cliente').'", "name": "idanagrafica", "required": 1, "value": "'.$id_anagrafica.'", "ajax-source": "clienti", "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "'.((empty($id_anagrafica)) ? 0 : 1).'" ]}
diff --git a/modules/interventi/edit.php b/modules/interventi/edit.php index e57fe4f0a..baea68048 100755 --- a/modules/interventi/edit.php +++ b/modules/interventi/edit.php @@ -88,7 +88,7 @@ if (!empty($record['idpreventivo'])) { '.Modules::link('Preventivi', $record['idpreventivo'], null, null, 'class="pull-right"'); } echo ' - {[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'" ]} + {[ "type": "select", "label": "'.tr('Preventivo').'", "name": "idpreventivo", "value": "'.$record['id_preventivo'].'", "ajax-source": "preventivi", "select-options": '.json_encode(['idanagrafica' => $record['idanagrafica']]).', "readonly": "'.$record['flag_completato'].'", "icon-after": "add|'.Modules::get('Preventivi')['id'].'|pianificabile=1&idanagrafica='.$record['idanagrafica'].'" ]}
'; diff --git a/modules/preventivi/actions.php b/modules/preventivi/actions.php index a4f66757a..1f2061469 100755 --- a/modules/preventivi/actions.php +++ b/modules/preventivi/actions.php @@ -42,8 +42,16 @@ switch (post('op')) { $tipo = TipoSessione::find($idtipointervento); $preventivo = Preventivo::build($anagrafica, $tipo, $nome, $data_bozza, $id_sede); + + $preventivo->idstato = post('idstato'); + $preventivo->save(); + $id_record = $preventivo->id; + if (isAjaxRequest()) { + echo json_encode(['id' => $id_record, 'text' => 'Contratto '.$preventivo->numero.' del '.dateFormat($preventivo->data_bozza).' - '.$preventivo->nome]); + } + flash()->info(tr('Aggiunto preventivo numero _NUM_!', [ '_NUM_' => $preventivo['numero'], ])); diff --git a/modules/preventivi/add.php b/modules/preventivi/add.php index 4d4d26dc9..62e4b0536 100755 --- a/modules/preventivi/add.php +++ b/modules/preventivi/add.php @@ -21,6 +21,8 @@ include_once __DIR__.'/../../core.php'; $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idanagrafica']; +$stati = get('pianificabile') ? 'SELECT id, descrizione FROM co_statipreventivi WHERE is_pianificabile=1' : 'SELECT id, descrizione FROM co_statipreventivi'; + ?>
@@ -29,26 +31,35 @@ $id_anagrafica = !empty(get('idanagrafica')) ? get('idanagrafica') : $user['idan
+
- {[ "type": "date", "label": "", "name": "data_bozza", "value": "", "required": 1 ]} -
+ {[ "type": "text", "label": "", "name": "nome", "required": 1 ]} +
+
- {[ "type": "text", "label": "", "name": "nome", "required": 1 ]} + {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente&readonly_tipo=1", "readonly": "" ]}
-
- {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente&readonly_tipo=1" ]} -
{[ "type": "select", "label": "", "name": "idsede", "ajax-source": "sedi", "placeholder": "Sede legale" ]}
+ +
+ {[ "type": "date", "label": "", "name": "data_bozza", "value": "", "required": 1 ]} +
+ +
{[ "type": "select", "label": "", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento" ]}
+ +
+ {[ "type": "select", "label": "", "name": "idstato", "required": 1, "values": "query=" ]} +
From 8694f95cffedac80f3850c3ce9b2a4f7ce661203 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 26 May 2022 17:25:19 +0200 Subject: [PATCH 3/5] Aliq. IVA stampe con 2 decimali --- templates/ddt/body.php | 2 +- templates/fatture/body.php | 2 +- templates/fatture/footer.php | 2 +- templates/ordini/body.php | 2 +- templates/preventivi/body.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/ddt/body.php b/templates/ddt/body.php index db52c1ead..b9d7bf499 100755 --- a/templates/ddt/body.php +++ b/templates/ddt/body.php @@ -165,7 +165,7 @@ foreach ($righe as $riga) { // Iva echo ' - '.Translator::numberToLocale($riga->aliquota->percentuale, 0).' + '.Translator::numberToLocale($riga->aliquota->percentuale, 2).' '; } } else { diff --git a/templates/fatture/body.php b/templates/fatture/body.php index c34251207..aaa57ce66 100755 --- a/templates/fatture/body.php +++ b/templates/fatture/body.php @@ -201,7 +201,7 @@ foreach ($righe as $riga) { // Iva echo ' - '.Translator::numberToLocale($riga->aliquota->percentuale, 0).' + '.Translator::numberToLocale($riga->aliquota->percentuale, 2).' '; } else { echo ' diff --git a/templates/fatture/footer.php b/templates/fatture/footer.php index e64042a29..7a401f2a2 100755 --- a/templates/fatture/footer.php +++ b/templates/fatture/footer.php @@ -271,7 +271,7 @@ if ($has_ritenuta) { '_PRC_' => Translator::numberToLocale($documento->ritenutaContributi->percentuale, 2), ]); $acconto = tr('acconto: _PRC_%', [ - '_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 0), + '_PRC_' => Translator::numberToLocale($rs2[0]['percentuale'], 2), ]); $ritenuta_totale = abs($documento->ritenuta_acconto) + abs($documento->totale_ritenuta_contributi); diff --git a/templates/ordini/body.php b/templates/ordini/body.php index d686b9a67..464d624d2 100755 --- a/templates/ordini/body.php +++ b/templates/ordini/body.php @@ -192,7 +192,7 @@ foreach ($righe as $riga) { // Iva echo ' - '.Translator::numberToLocale($riga->aliquota->percentuale, 0).' + '.Translator::numberToLocale($riga->aliquota->percentuale, 2).' '; } diff --git a/templates/preventivi/body.php b/templates/preventivi/body.php index a243394d0..7d06ff1b0 100755 --- a/templates/preventivi/body.php +++ b/templates/preventivi/body.php @@ -258,7 +258,7 @@ foreach ($righe as $riga) { // Iva echo ' - '.Translator::numberToLocale($riga->aliquota->percentuale, 0).' + '.Translator::numberToLocale($riga->aliquota->percentuale, 2).' '; } } else { From 71fe85a93a67500a04f005327a8da3411990615c Mon Sep 17 00:00:00 2001 From: FabioL <1647128+loviuz@users.noreply.github.com> Date: Thu, 26 May 2022 17:32:28 +0200 Subject: [PATCH 4/5] Creazione file per bot autochiusura issues --- .github/stale.yml | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..48de326a9 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,59 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: [bugfix] + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +#exemptLabels: +# - pinned +# - security +# - "[Status] Maybe Later" + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: false + +# Label to use when marking as stale +staleLabel: in chiusura + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + Issue chiusa automaticamente in assenza di attività. + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +# closeComment: > +# Your comment here. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +# Limit to only `issues` or `pulls` +only: issues + +# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': +# pulls: +# daysUntilStale: 30 +# markComment: > +# This pull request has been automatically marked as stale because it has not had +# recent activity. It will be closed if no further activity occurs. Thank you +# for your contributions. + +# issues: +# exemptLabels: +# - confirmed From 99269cab1a12c01386ac8ea7b2b424aea521d7cf Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 26 May 2022 17:45:53 +0200 Subject: [PATCH 5/5] Revert "Fix filtro iva" This reverts commit d8626ba2d3abec6d58477457e652b0ce8ec3fc53. --- modules/iva/ajax/select.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/iva/ajax/select.php b/modules/iva/ajax/select.php index 9e0909398..100707daf 100755 --- a/modules/iva/ajax/select.php +++ b/modules/iva/ajax/select.php @@ -28,7 +28,7 @@ switch ($resource) { $query = 'SELECT id, IF( codice_natura_fe IS NULL, IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)), CONCAT( IF(codice IS NULL, descrizione, CONCAT(codice, " - ", descrizione)), " (", codice_natura_fe, ")" ) ) AS descrizione, percentuale FROM co_iva |where| ORDER BY descrizione ASC'; foreach ($elements as $element) { - $filter[] = '(deleted_at IS NULL OR id='.prepare($element).')'; + $filter[] = 'id='.prepare($element); } if (!empty($search)) {