diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php
index b0d20702..90dce5cd 100755
--- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php
+++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php
@@ -99,10 +99,16 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
-
+
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
+ if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
+ if ($clienteId === false || $clienteId === null) {
+ return $this->failNotFound('Su usuario no tiene asociado un cliente de Safekat. Póngase en contacto con el administrador.');
+ }
+ }
+
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
$this->viewData['breadcrumb'] = [
@@ -140,6 +146,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$user = $model_user->find(auth()->user()->id);
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
$clienteId = $user->cliente_id;
+ if ($clienteId === false || $clienteId === null) {
+ return $this->failNotFound('Su usuario no tiene asociado un cliente de Safekat. Póngase en contacto con el administrador.');
+ }
} else {
$clienteId = $presupuestoEntity->cliente_id;
}
@@ -375,7 +384,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
if (array_key_exists('exception', $return_data)) {
return $this->failServerError(
$return_data['exception'] . ' - ' .
- $return_data['file'] . ' - ' . $return_data['line']
+ $return_data['file'] . ' - ' . $return_data['line']
);
}
@@ -2135,7 +2144,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
$color = 'negro';
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
- $data = $model->where('presupuesto_id', $presupuestoId)->findAll();;
+ $data = $model->where('presupuesto_id', $presupuestoId)->findAll();
+ ;
foreach ($data as $linea) {
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php
index aff8e501..d3e013f8 100644
--- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php
+++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/items/_datosGenerales.php
@@ -67,8 +67,8 @@
user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))? " hidden" : "" ?>
- class="calcular-presupuesto form-check-input" type="checkbox" id="excluirPortada"
- name="excluir_portada" value="1">
+ class="calcular-presupuesto form-check-input" type="checkbox" id="excluirRotativa"
+ name="excluir_rotativa" value="1">
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js
index 99a0b0cd..9549212d 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js
@@ -64,7 +64,7 @@ class DatosGenerales {
// Selects
this.formatoLibro.init();
- if (this.excluirRotativa.length != 0) {
+ if (!$(this.excluirRotativa).prop('hidden')){
this.cliente.init();
}
@@ -102,7 +102,7 @@ class DatosGenerales {
message: window.translations["validation"].cliente,
callback: function (input) {
// Get the selected options
- if(this.excluirRotativa.length == 0)
+ if (!$(this.excluirRotativa).prop('hidden'))
return true;
const options = $("#clienteId").select2('data');
const hasValidOption = options.some(option => parseInt(option.id) > 0);
@@ -386,7 +386,7 @@ class DatosGenerales {
this.coleccion.val(datos.coleccion);
this.referenciaCliente.val(datos.referenciaCliente);
- if (this.excluirRotativa.length != 0) {
+ if (!$(this.excluirRotativa).prop('hidden')){
this.cliente.setOption(datos.clienteId, datos.clienteNombre);
this.cliente.setVal(datos.clienteId);
$(this.cliente).trigger('change');
@@ -441,7 +441,7 @@ class DatosGenerales {
}
getCliente(){
- if (this.excluirRotativa.length == 0)
+ if ($(this.excluirRotativa).prop('hidden'))
return $('#clienteId').val();
return this.cliente.getVal();
}
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
index f1941b80..005511e0 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
@@ -599,7 +599,7 @@ class PresupuestoCliente {
this.calcularPresupuesto = false;
this.datosGenerales.cargarDatos(response.data.datosGenerales);
- if (this.datosGenerales.excluirRotativa.length !== 0) {
+ if (!$(this.datosGenerales.excluirRotativa).prop("hidden")) {
this.direcciones.handleChangeCliente();
}
this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);