terminado plantillas

This commit is contained in:
Jaime Jiménez
2024-01-02 21:01:42 +01:00
parent 0abdb7efac
commit a54838d468
12 changed files with 250 additions and 37 deletions

View File

@ -47,6 +47,39 @@ class Clienteplantillaprecioslineas extends \App\Controllers\GoBaseResourceContr
}
public function update($requestedId = null){
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
if ($requestedId == null) :
return;
endif;
$postData = $this->request->getJSON();
$plantilla_id = $postData->plantilla_id ?? -1;
// Se ha actualizado un registro por lo que no es una plantilla
if($plantilla_id == -1){
$this->model->clean_plantilla_id($requestedId);
}
else{
$this->model->copy_from_plantilla($requestedId, $plantilla_id);
}
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
endif; // ($requestMethod === 'post')
}
public function datatable()