Merge branch 'dev/duplicar_presupuesto' into 'main'

Dev/duplicar presupuesto

See merge request jjimenez/safekat!184
This commit is contained in:
2024-03-09 18:01:14 +00:00
14 changed files with 290 additions and 69 deletions

View File

@ -47,7 +47,7 @@ class PresupuestoDireccionesModel extends \App\Models\GoBaseModel
"entregaPieCalle",
];
protected $returnType = "App\Entities\Clientes\ClienteDireccionesEntity";
protected $returnType = "App\Entities\Presupuestos\PresupuestoDireccionesEntity";
public static $labelField = "id";

View File

@ -411,6 +411,21 @@ class PresupuestoLineaModel extends \App\Models\GoBaseModel
return $builder;
}
public function duplicateLineasPresupuesto($presupuesto_id, $new_presupuesto_id)
{
$lineas = $this->getLineasPresupuesto($presupuesto_id);
$lineas = json_decode(json_encode($lineas), true);
foreach ($lineas as $linea) {
$linea['presupuesto_id'] = $new_presupuesto_id;
unset($linea['id']);
$this->db
->table($this->table . " t1")
->insert($linea);
}
}
}