From 32b6d8d1a5d4f37f88693127c3c1a0acec830a15 Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Mon, 18 Sep 2017 18:11:19 +0200 Subject: [PATCH] Bugfix distribuiti --- ajax_select.php | 2 +- .../contratti.pianificazioneinterventi.php | 6 ++- modules/interventi/add.php | 49 ++++++++++--------- .../plugins/my_impianti.interventi.php | 6 +-- modules/ordini/edit.php | 2 +- modules/statistiche/edit.php | 41 +++++++++++----- .../registro_iva/pdfgen.registro_iva.php | 21 ++++---- 7 files changed, 74 insertions(+), 53 deletions(-) diff --git a/ajax_select.php b/ajax_select.php index 6d712b452..c45f7812d 100644 --- a/ajax_select.php +++ b/ajax_select.php @@ -346,7 +346,7 @@ switch ($op) { $query = 'SELECT id, CONCAT(matricola, " - ", nome) AS descrizione FROM my_impianti |where| ORDER BY idsede'; foreach ($elements as $element) { - $filter[] = 'idsede='.prepare($element); + $filter[] = 'id='.prepare($element); } $where[] = 'idanagrafica='.prepare($superselect['idanagrafica']); diff --git a/modules/contratti/plugins/contratti.pianificazioneinterventi.php b/modules/contratti/plugins/contratti.pianificazioneinterventi.php index cf8639661..ec624f14b 100644 --- a/modules/contratti/plugins/contratti.pianificazioneinterventi.php +++ b/modules/contratti/plugins/contratti.pianificazioneinterventi.php @@ -95,8 +95,12 @@ if (count($rsp) != 0) { '; if (empty($rsp[$i]['idintervento'])) { + if($records[0]['stato'] != 'Bozza' && $records[0]['stato'] != 'Rifiutato'){ + echo ' + '; + } + echo ' - '; diff --git a/modules/interventi/add.php b/modules/interventi/add.php index f73515666..366dc13a3 100644 --- a/modules/interventi/add.php +++ b/modules/interventi/add.php @@ -14,6 +14,8 @@ unset($_SESSION['superselect']['idsede']); $idanagrafica = filter('idanagrafica'); $idsede = filter('idsede'); +$impianti = []; + if (!empty($idanagrafica)) { $rs = $dbo->fetchArray('SELECT idtipointervento_default FROM an_anagrafiche WHERE idanagrafica='.prepare($idanagrafica)); $idtipointervento = $rs[0]['idtipointervento_default']; @@ -22,7 +24,7 @@ if (!empty($idanagrafica)) { } // Calcolo orario di inizio e fine di default -if (filter('orario_inizio') !== null && filter('orario_inizio') != '00:00:00') { +if (null !== filter('orario_inizio') && '00:00:00' != filter('orario_inizio')) { $orario_inizio = filter('orario_inizio'); $orario_fine = filter('orario_fine'); } else { @@ -61,17 +63,20 @@ elseif (!empty($idcontratto) && !empty($idcontratto_riga)) { // Info riga pianificata $rs = $dbo->fetchArray('SELECT * FROM co_righe_contratti WHERE idcontratto='.prepare($idcontratto).' AND id='.prepare($idcontratto_riga)); $idtipointervento = $rs[0]['idtipointervento']; - $data = (filter('data') !== null) ? filter('data') : $rs[0]['data_richiesta']; + $data = (null !== filter('data')) ? filter('data') : $rs[0]['data_richiesta']; $richiesta = $rs[0]['richiesta']; $idsede = $rs[0]['idsede']; + $rs = $dbo->fetchArray('SELECT idimpianto FROM my_impianti_contratti WHERE idcontratto='.prepare($idcontratto)); + $idimpianto = implode(',', array_column($rs, 'idimpianto')); + // Seleziono "In programmazione" come stato $rs = $dbo->fetchArray("SELECT * FROM in_statiintervento WHERE descrizione='In programmazione'"); $idstatointervento = $rs[0]['idstatointervento']; } if (empty($data)) { - if (filter('data') !== null) { + if (null !== filter('data')) { $data = filter('data'); } else { $data = date(Translator::getLocaleFormatter()->getDatePattern()); @@ -111,11 +116,11 @@ if (empty($new_codice)) {
- {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente", "data-heavy": 0 ]} + {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "", "ajax-source": "clienti", "icon-after": "add||tipoanagrafica=Cliente", "data-heavy": 0 ]}
- {[ "type": "select", "label": "", "name": "idsede", "value": "", "placheholder": "...", "ajax-source": "sedi" ]} + {[ "type": "select", "label": "", "name": "idsede", "value": "", "placheholder": "...", "ajax-source": "sedi" ]}
@@ -126,21 +131,21 @@ if (empty($new_codice)) {
- {[ "type": "select", "label": "", "name": "idpreventivo", "value": "", "placeholder": "...", "ajax-source": "preventivi" ]} + {[ "type": "select", "label": "", "name": "idpreventivo", "value": "", "placeholder": "...", "ajax-source": "preventivi" ]}
- {[ "type": "select", "label": "", "name": "idcontratto", "value": "", "placeholder": "...", "ajax-source": "contratti" ]} + {[ "type": "select", "label": "", "name": "idcontratto", "value": "", "placeholder": "...", "ajax-source": "contratti" ]}
- {[ "type": "select", "label": "", "multiple": 1, "name": "idimpianti[]", "value": "", "placeholder": "...", "ajax-source": "impianti" ]} + {[ "type": "select", "label": "", "multiple": 1, "name": "idimpianti[]", "value": "", "placeholder": "...", "ajax-source": "impianti" ]}
- {[ "type": "select", "label": "", "multiple": 1, "name": "componenti[]", "value": "", "placeholder": "...", "ajax-source": "componenti" ]} + {[ "type": "select", "label": "", "multiple": 1, "name": "componenti[]", "value": "", "placeholder": "...", "ajax-source": "componenti" ]}
@@ -156,7 +161,7 @@ if (empty($new_codice)) {
@@ -164,41 +169,41 @@ if (empty($new_codice)) {
- {[ "type": "date", "label": "", "name": "data", "required": 1, "value": "" ]} + {[ "type": "date", "label": "", "name": "data", "required": 1, "value": "" ]}
- {[ "type": "select", "label": "", "name": "idzona", "values": "query=SELECT id, nome AS descrizione FROM an_zone ORDER BY nome", "value": "" ]} + {[ "type": "select", "label": "", "name": "idzona", "values": "query=SELECT id, nome AS descrizione FROM an_zone ORDER BY nome", "value": "" ]}
- {[ "type": "select", "label": "", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento", "value": "", "ajax-source": "tipiintervento" ]} + {[ "type": "select", "label": "", "name": "idtipointervento", "required": 1, "values": "query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento", "value": "", "ajax-source": "tipiintervento" ]}
- {[ "type": "select", "label": "", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento", "value": "" ]} + {[ "type": "select", "label": "", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento", "value": "" ]}
- {[ "type": "time", "label": "", "name": "orario_inizio", "required": 1, "value": "" ]} + {[ "type": "time", "label": "", "name": "orario_inizio", "required": 1, "value": "" ]}
- {[ "type": "time", "label": "", "name": "orario_fine", "required": 1, "value": "" ]} + {[ "type": "time", "label": "", "name": "orario_fine", "required": 1, "value": "" ]}
- {[ "type": "select", "label": "", "multiple": "1", "name": "idtecnico[]", "required": 1, "ajax-source": "tecnici", "value": "" ]} + {[ "type": "select", "label": "", "multiple": "1", "name": "idtecnico[]", "required": 1, "ajax-source": "tecnici", "value": "" ]}
- {[ "type": "textarea", "label": "", "name": "richiesta", "required": 1, "value": "", "extra": "style='max-height:80px; ' " ]} + {[ "type": "textarea", "label": "", "name": "richiesta", "required": 1, "value": "", "extra": "style='max-height:80px; ' " ]}
- +