diff --git a/modules/contratti/bulk.php b/modules/contratti/bulk.php index 50c55dd5a..2ac693b98 100755 --- a/modules/contratti/bulk.php +++ b/modules/contratti/bulk.php @@ -53,7 +53,7 @@ switch (post('op')) { // Informazioni della fattura $tipo_documento = Tipo::where('id', post('idtipodocumento'))->first(); - $stato_documenti_accodabili = Stato::where('name', 'Bozza')->first()->id; + $stato_documenti_accodabili = Stato::where('name', 'Bozza')->first(); $accodare = post('accodare'); $data = date('Y-m-d'); @@ -89,12 +89,12 @@ switch (post('op')) { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) ->where('idtipodocumento', $tipo_documento->id) + ->where('idsede', $id_sede) ->first(); } else { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) - ->where('idtipodocumento', $tipo_standard->id) - ->where('idsede', $id_sede) + ->where('idtipodocumento', $tipo_documento->id) ->first(); } diff --git a/modules/ddt/bulk.php b/modules/ddt/bulk.php index 2b592769c..6a482a35f 100755 --- a/modules/ddt/bulk.php +++ b/modules/ddt/bulk.php @@ -56,7 +56,7 @@ switch (post('op')) { // Informazioni della fattura $tipo_documento = Tipo::where('id', post('idtipodocumento'))->first(); - $stato_documenti_accodabili = Stato::where('name', 'Bozza')->first()->id; + $stato_documenti_accodabili = Stato::where('name', 'Bozza')->first(); $accodare = post('accodare'); $data = date('Y-m-d'); @@ -94,7 +94,7 @@ switch (post('op')) { } else { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) - ->where('idtipodocumento', $tipo_standard->id) + ->where('idtipodocumento', $tipo_documento->id) ->first(); } diff --git a/modules/ordini/bulk.php b/modules/ordini/bulk.php index 2ef4e19d7..20515daaf 100644 --- a/modules/ordini/bulk.php +++ b/modules/ordini/bulk.php @@ -50,7 +50,7 @@ switch (post('op')) { $tipo_documento = TipoFattura::where('id', post('idtipodocumento'))->first(); - $stato_documenti_accodabili = Stato::where('name', 'Bozza')->first()->id; + $stato_documenti_accodabili = Stato::where('name', 'Bozza')->first(); $accodare = post('accodare'); $data = date('Y-m-d'); @@ -84,12 +84,12 @@ switch (post('op')) { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) ->where('idtipodocumento', $tipo_documento->id) + ->where('idsede', $id_sede) ->first(); } else { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) - ->where('idtipodocumento', $tipo_standard->id) - ->where('idsede', $id_sede) + ->where('idtipodocumento', $tipo_documento->id) ->first(); } diff --git a/modules/preventivi/bulk.php b/modules/preventivi/bulk.php index d28371bf4..0ff72578a 100755 --- a/modules/preventivi/bulk.php +++ b/modules/preventivi/bulk.php @@ -48,7 +48,7 @@ switch (post('op')) { // Informazioni della fattura $tipo_documento = Tipo::where('id', post('idtipodocumento'))->first(); - $stato_documenti_accodabili = StatoFattura::where('name', 'Bozza')->first()->id; + $stato_documenti_accodabili = StatoFattura::where('name', 'Bozza')->first(); $accodare = post('accodare'); $data = date('Y-m-d'); @@ -85,12 +85,12 @@ switch (post('op')) { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) ->where('idtipodocumento', $tipo_documento->id) + ->where('idsede', $id_sede) ->first(); } else { $fattura = Fattura::where('idanagrafica', $id_anagrafica) ->where('idstatodocumento', $stato_documenti_accodabili->id) - ->where('idtipodocumento', $tipo_standard->id) - ->where('idsede', $id_sede) + ->where('idtipodocumento', $tipo_documento->id) ->first(); }