mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-03 01:08:08 +01:00
cambio stato agli interventi solo se sto fatturando il preventivo
This commit is contained in:
parent
25cfa23ebc
commit
f02d44ce76
@ -277,12 +277,15 @@ class Preventivo extends Document
|
||||
$this->stato()->associate($stato);
|
||||
$this->save();
|
||||
|
||||
// Trasferimento degli interventi collegati
|
||||
$interventi = $this->interventi;
|
||||
$stato_intervento = \Modules\Interventi\Stato::where('codice', $codice_intervento)->first();
|
||||
foreach ($interventi as $intervento) {
|
||||
$intervento->stato()->associate($stato_intervento);
|
||||
$intervento->save();
|
||||
//cambio stato agli interventi solo se sto fatturando il preventivo
|
||||
if ($trigger->getDocument() instanceof Fattura){
|
||||
// Trasferimento degli interventi collegati
|
||||
$interventi = $this->interventi;
|
||||
$stato_intervento = \Modules\Interventi\Stato::where('codice', $codice_intervento)->first();
|
||||
foreach ($interventi as $intervento) {
|
||||
$intervento->stato()->associate($stato_intervento);
|
||||
$intervento->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user