mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado plantillas
This commit is contained in:
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user