mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
acabado actualizar lineas presupuesto
This commit is contained in:
@ -102,6 +102,10 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$sanitizedData['papel_formato_id'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($sanitizedData['is_duplicado']) || $sanitizedData['is_duplicado'] == null) {
|
||||
$sanitizedData['is_duplicado'] = 0;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate($this->model->validationRulesAdd, $this->model->validationMessagesAdd)) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -191,10 +195,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
|
||||
if ($this->request->getPost('is_duplicado') == null) {
|
||||
$sanitizedData['is_duplicado'] = 0;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('retractilado') == null) {
|
||||
$sanitizedData['retractilado'] = false;
|
||||
}
|
||||
@ -351,10 +358,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$this->viewData['presupuestoEntity']->cambios_lineas=true;
|
||||
}
|
||||
// Tarifas
|
||||
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
||||
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
|
||||
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
||||
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
||||
|
||||
[$cambios_en_servicios, $servicios] = $this->getLineasServicios($presupuestoEntity);
|
||||
|
||||
$this->viewData['serviciosEncuadernacionList'] = (new PresupuestoEncuadernacionesModel())->getResource($id)->get()->getResultObject();
|
||||
$this->viewData['serviciosAcabadosList'] = (new PresupuestoAcabadosModel())->getResource($id)->get()->getResultObject();
|
||||
$this->viewData['serviciosManipuladoList'] = (new PresupuestoManipuladosModel())->getResource($id)->get()->getResultObject();
|
||||
@ -380,8 +390,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.edit3');
|
||||
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
||||
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
||||
if($presupuestoEntity->is_duplicado){
|
||||
$this->model->removeIsDuplicado($presupuestoEntity->id);
|
||||
}
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . $this->viewData['pageTitle'] . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
@ -834,6 +849,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$presupuesto = $this->model->find($id);
|
||||
$presupuesto->titulo = $presupuesto->titulo .' - ' . lang('Presupuestos.duplicado');
|
||||
$presupuesto->is_duplicado = 1;
|
||||
$new_id = $this->model->insert($presupuesto);
|
||||
|
||||
$presupuestoAcabadosModel = model('App\Models\Presupuestos\PresupuestoAcabadosModel');
|
||||
@ -1326,4 +1342,41 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
return PresupuestoService::checkLineasPresupuesto($input_data, $lineas);
|
||||
}
|
||||
|
||||
protected function getLineasServicios($presupuestoEntity){
|
||||
|
||||
$serviciosPresupuesto = (object)array();
|
||||
|
||||
$serviciosPresupuesto->serviciosAcabado = (new PresupuestoAcabadosModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||
$serviciosPresupuesto->serviciosPreimpresion = (new PresupuestoPreimpresionesModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||
$serviciosPresupuesto->serviciosEncuadernacion = (new PresupuestoEncuadernacionesModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||
$serviciosPresupuesto->serviciosManipulado = (new PresupuestoManipuladosModel())->getResource($presupuestoEntity->id)->get()->getResultObject();
|
||||
|
||||
$input_data = [];
|
||||
$input_data['presupuesto_id'] = $presupuestoEntity->id;
|
||||
$input_data['tipo_impresion_id'] = $presupuestoEntity->tipo_impresion_id;
|
||||
$input_data['tirada'] = $presupuestoEntity->tirada;
|
||||
$input_data['POD'] = $this->getPOD();
|
||||
$input_data['paginas'] = $presupuestoEntity->paginas;
|
||||
$input_data['is_duplicado'] = $presupuestoEntity->is_duplicado;
|
||||
|
||||
if($presupuestoEntity->papel_formato_personalizado){
|
||||
$input_data['ancho'] = $presupuestoEntity->ancho;
|
||||
$input_data['alto'] = $presupuestoEntity->alto;
|
||||
}
|
||||
else{
|
||||
$model = model("App\Models\Configuracion\PapelFormatoModel");
|
||||
$papel = $model->find($presupuestoEntity->papel_formato_id);
|
||||
if($papel){
|
||||
$input_data['ancho'] = $papel->ancho;
|
||||
$input_data['alto'] = $papel->alto;
|
||||
}
|
||||
else{
|
||||
$input_data['ancho'] = 0;
|
||||
$input_data['alto'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return PresupuestoService::checkLineasServicios($input_data, $serviciosPresupuesto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user