diff --git a/modules/fatture/actions.php b/modules/fatture/actions.php index e1129cf97..17714003f 100755 --- a/modules/fatture/actions.php +++ b/modules/fatture/actions.php @@ -223,9 +223,10 @@ switch (post('op')) { $new = $fattura->replicate(); $new->numero = Fattura::getNextNumero($new->data, $new->direzione, $new->id_segment); - if ($new->direzione == 'entrata') { + if (!empty($fattura->numero_esterno)) { $new->numero_esterno = Fattura::getNextNumeroSecondario($new->data, $new->direzione, $new->id_segment); } + $new->stato()->associate($stato); $new->save();