diff --git a/modules/contratti/bulk.php b/modules/contratti/bulk.php index cd3c5c290..2e2c5884a 100755 --- a/modules/contratti/bulk.php +++ b/modules/contratti/bulk.php @@ -104,7 +104,7 @@ switch (post('op')) { if ($copia->isArticolo()) { $copia->serials = $riga->serials; } - + $copia->save(); } } diff --git a/templates/preventivi/body.php b/templates/preventivi/body.php index 95a809470..db7f1f0f2 100755 --- a/templates/preventivi/body.php +++ b/templates/preventivi/body.php @@ -22,17 +22,6 @@ use Modules\Anagrafiche\Anagrafica; include_once __DIR__.'/../../core.php'; -$has_images = null; - -// Righe documento -$righe = $documento->getRighe(); - -foreach ($righe as $riga) { - if ($riga->articolo->immagine) { - $has_images = 1; - } -} - $anagrafica = Anagrafica::find($documento['idanagrafica']); $pagamento = $dbo->fetchOne('SELECT * FROM co_pagamenti WHERE id = '.prepare($documento['idpagamento'])); @@ -44,8 +33,22 @@ if (!empty($anagrafica->idbanca_vendite)) { $banca = $dbo->fetchOne('SELECT co_banche.nome, co_banche.iban, co_banche.bic FROM co_banche INNER JOIN co_pianodeiconti3 ON co_banche.id_pianodeiconti3 = co_pianodeiconti3.id WHERE co_pianodeiconti3.id = '.prepare($pagamento['idconto_vendite']).' AND co_banche.deleted_at IS NULL'); } +// Righe documento +$righe = $documento->getRighe(); + +$has_image = $righe->search(function ($item) { + return !empty($item->articolo->immagine); +}) !== false; + +$columns = 6; +if ($has_image) { + ++$columns; +} + +$columns = $options['pricing'] ? $columns : 3; + // Creazione righe fantasma -$autofill = new \Util\Autofill($options['pricing'] ? (($has_images) ? 7 : 6) : 3); +$autofill = new \Util\Autofill($columns); $autofill->setRows(20, 10); echo ' @@ -138,7 +141,7 @@ echo "