mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
cambiado POD para cogerlo de la nueva tabla de variables
This commit is contained in:
@ -301,7 +301,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||||
$POD = null;
|
$POD = null;
|
||||||
if($tirada != null){
|
if($tirada != null){
|
||||||
$POD_value = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
if(intval($tirada) <= intval($POD_value)){
|
if(intval($tirada) <= intval($POD_value)){
|
||||||
$POD = true;
|
$POD = true;
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
|||||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||||
$POD = null;
|
$POD = null;
|
||||||
if($tirada != null){
|
if($tirada != null){
|
||||||
$POD_value = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
if(intval($tirada) <= intval($POD_value)){
|
if(intval($tirada) <= intval($POD_value)){
|
||||||
$POD = true;
|
$POD = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1246,8 +1246,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
protected function getPOD()
|
protected function getPOD()
|
||||||
{
|
{
|
||||||
$model = model('App\Models\Configuracion\ConfiguracionSistemaModel');
|
return model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
return $model->getPOD();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLineasPresupuesto($presupuestoEntity){
|
protected function getLineasPresupuesto($presupuestoEntity){
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
|
|
||||||
$this->viewData['breadcrumb'] = [
|
$this->viewData['breadcrumb'] = [
|
||||||
['title' => lang("App.menu_presupuestos"), 'route' => site_url('presupuestocliente/list'), 'active' => false],
|
['title' => lang("App.menu_presupuestos"), 'route' => site_url('presupuestocliente/list'), 'active' => false],
|
||||||
@ -161,7 +161,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||||
|
|
||||||
$this->viewData['clienteId'] = $clienteId;
|
$this->viewData['clienteId'] = $clienteId;
|
||||||
$this->viewData['POD'] = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$this->viewData['POD'] = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
||||||
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
||||||
if ($presupuestoEntity->is_duplicado) {
|
if ($presupuestoEntity->is_duplicado) {
|
||||||
@ -480,7 +480,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
$reqData = $this->request->getPost();
|
$reqData = $this->request->getPost();
|
||||||
$modelPapelGenerico = new PapelGenericoModel();
|
$modelPapelGenerico = new PapelGenericoModel();
|
||||||
|
|
||||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
|
|
||||||
$cliente_id = $reqData['clienteId'] ?? -1;
|
$cliente_id = $reqData['clienteId'] ?? -1;
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$reqData = $this->request->getPost();
|
$reqData = $this->request->getPost();
|
||||||
|
|
||||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
|
|
||||||
$id = $reqData['id'] ?? 0;
|
$id = $reqData['id'] ?? 0;
|
||||||
$id = intval($id);
|
$id = intval($id);
|
||||||
@ -1486,7 +1486,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$coste_servicios = 0.0;
|
$coste_servicios = 0.0;
|
||||||
|
|
||||||
$POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
$POD = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||||
|
|
||||||
$precio_u = [];
|
$precio_u = [];
|
||||||
$peso = [];
|
$peso = [];
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Entities\Configuracion;
|
|
||||||
|
|
||||||
use CodeIgniter\Entity;
|
|
||||||
|
|
||||||
class ConfiguracionSistemaEntity extends \CodeIgniter\Entity\Entity
|
|
||||||
{
|
|
||||||
protected $attributes = [
|
|
||||||
"id" => null,
|
|
||||||
"var_name" => null,
|
|
||||||
"value" => null,
|
|
||||||
"datatype" => null,
|
|
||||||
|
|
||||||
];
|
|
||||||
protected $casts = [
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@ -47,4 +47,13 @@ class ConfigVariableModel extends Model
|
|||||||
protected $afterFind = [];
|
protected $afterFind = [];
|
||||||
protected $beforeDelete = [];
|
protected $beforeDelete = [];
|
||||||
protected $afterDelete = [];
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
public function getVariable($name)
|
||||||
|
{
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->where('name', $name);
|
||||||
|
|
||||||
|
return $builder->get()->getFirstRow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Models\Configuracion;
|
|
||||||
|
|
||||||
class ConfiguracionSistemaModel extends \App\Models\BaseModel
|
|
||||||
{
|
|
||||||
protected $table = "configuracion_sistema";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether primary key uses auto increment.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $useAutoIncrement = true;
|
|
||||||
|
|
||||||
protected $allowedFields = ["var_name", "value", "datatype"];
|
|
||||||
protected $returnType = "App\Entities\Configuracion\ConfiguracionSistemaEntity";
|
|
||||||
|
|
||||||
public static $labelField = "var_name";
|
|
||||||
|
|
||||||
protected $validationRules = [
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $validationMessages = [
|
|
||||||
];
|
|
||||||
|
|
||||||
public function getPOD()
|
|
||||||
{
|
|
||||||
$builder = $this->db
|
|
||||||
->table($this->table . " t1")
|
|
||||||
->select(
|
|
||||||
'(SELECT CAST(t1.value AS INT)) AS POD', false)
|
|
||||||
->where('t1.var_name', 'POD');
|
|
||||||
|
|
||||||
$POD = intval($builder->get()->getFirstRow()->POD);
|
|
||||||
return $POD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user