mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Finalizadas las tareas de modificacion
This commit is contained in:
@ -8,6 +8,7 @@ use App\Models\Collection;
|
||||
use App\Entities\Tarifas\TarifaEncuadernacionTirada;
|
||||
|
||||
use App\Models\Tarifas\TarifaEncuadernacionTiradaModel;
|
||||
use App\Models\Tarifas\TarifaEncuadernacionLineaModel;
|
||||
use App\Models\Compras\ProveedorModel;
|
||||
use App\Models\Compras\ProveedorTipoModel;
|
||||
|
||||
@ -47,6 +48,45 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceControl
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
if (!empty(static::$pluralObjectNameCc) && !empty(static::$singularObjectNameCc)) {
|
||||
$objName = mb_strtolower(lang(ucfirst(static::$pluralObjectNameCc).'.'.static::$singularObjectNameCc));
|
||||
} else {
|
||||
$objName = lang('Basic.global.record');
|
||||
}
|
||||
|
||||
if (!$this->soft_delete){
|
||||
|
||||
if (!$this->model->delete($id)) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
}
|
||||
else{
|
||||
$datetime = (new \CodeIgniter\I18n\Time("now"));
|
||||
|
||||
$lineaModel = new TarifaEncuadernacionLineaModel();
|
||||
$lineaResult = $lineaModel->removeAllEncuadernacionLineas($id, $datetime, $this->delete_flag);
|
||||
|
||||
$rawResult = $this->model->where('id',$id)
|
||||
->set(['deleted_at' => $datetime->format('Y-m-d H:i:s'),
|
||||
'is_deleted' => $this->delete_flag])
|
||||
->update();
|
||||
|
||||
if (!$rawResult && !$lineaResult) {
|
||||
return $this->failNotFound(lang('Basic.global.deleteError', [$objName]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function datatable_editor()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
Reference in New Issue
Block a user