mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadidos roles facturacion
This commit is contained in:
@ -103,6 +103,8 @@ class Facturas extends \App\Controllers\BaseResourceController
|
||||
|
||||
public function add()
|
||||
{
|
||||
if(!auth()->user()->can('facturas.create'))
|
||||
return $this->failForbidden(lang('Basic.global.noPermission'), 403);
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
@ -201,6 +203,9 @@ class Facturas extends \App\Controllers\BaseResourceController
|
||||
public function edit($id = null)
|
||||
{
|
||||
|
||||
if(!auth()->user()->can('facturas.edit'))
|
||||
return $this->failForbidden(lang('Basic.global.noPermission'), 403);
|
||||
|
||||
if ($id == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
@ -328,26 +333,29 @@ class Facturas extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
)
|
||||
->add("action", callback: function ($q) {
|
||||
if ($q->estado == 'borrador') {
|
||||
return '
|
||||
if (auth()->user()->can('facturas.edit')) {
|
||||
if ($q->estado == 'borrador') {
|
||||
return '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>
|
||||
';
|
||||
} else {
|
||||
return '
|
||||
} else {
|
||||
return '
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
}
|
||||
} else
|
||||
return '';
|
||||
});
|
||||
if ($clienteId != -1) {
|
||||
$result->hide('cliente');
|
||||
$result->hide('creditoAsegurado');
|
||||
if(!$dataForClienteForm){
|
||||
if (!$dataForClienteForm) {
|
||||
$result->hide('estado');
|
||||
$result->hide('estado_pago');
|
||||
$result->hide('estado_pago');
|
||||
}
|
||||
$result->hide('forma_pago');
|
||||
$result->hide('vencimiento');
|
||||
@ -357,7 +365,8 @@ class Facturas extends \App\Controllers\BaseResourceController
|
||||
return $result->toJson(returnAsObject: true);
|
||||
}
|
||||
|
||||
public function getDatosFacturacionClienteForm($cliente_id){
|
||||
public function getDatosFacturacionClienteForm($cliente_id)
|
||||
{
|
||||
|
||||
return $this->respond($this->model->getSumatoriosFacturacionCliente($cliente_id));
|
||||
}
|
||||
@ -498,7 +507,7 @@ class Facturas extends \App\Controllers\BaseResourceController
|
||||
->update();
|
||||
|
||||
$this->model->db->query('DELETE FROM facturas_pedidos_lineas WHERE factura_id=' . $id);
|
||||
|
||||
|
||||
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||
|
||||
Reference in New Issue
Block a user