mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into 'dev/new_lp'
# Conflicts: # ci4/app/Controllers/Test.php
This commit is contained in:
@ -31,7 +31,6 @@ class Clientedirecciones extends \App\Controllers\GoBaseResourceController
|
||||
$email = $reqData['email'] ?? "";
|
||||
$direccion = $reqData['direccion'] ?? "";
|
||||
$pais_id = $reqData['paisId'] ?? -1;
|
||||
$ccaa_id = $reqData['ccaaId'] ?? -1;
|
||||
$provincia = $reqData['provincia'] ?? "";
|
||||
$municipio = $reqData['municipio'] ?? "";
|
||||
$cp = $reqData['cp'] ?? "";
|
||||
@ -44,7 +43,6 @@ class Clientedirecciones extends \App\Controllers\GoBaseResourceController
|
||||
"email" => $email,
|
||||
"direccion" => $direccion,
|
||||
"pais_id" => $pais_id,
|
||||
"ccaa_id" => $ccaa_id,
|
||||
"provincia" => $provincia,
|
||||
"municipio" => $municipio,
|
||||
"cp" => $cp,
|
||||
@ -208,17 +206,6 @@ class Clientedirecciones extends \App\Controllers\GoBaseResourceController
|
||||
return true;
|
||||
}
|
||||
),
|
||||
Field::inst('ccaa_id')
|
||||
->validator( function ( $val, $data, $field, $host ) {
|
||||
if ($data['pais_id'] == 1) { // Si es españa provincia y CCAA es obligatorio
|
||||
if (strlen( $val ) > 100)
|
||||
lang('ClienteDirecciones.validation.required');
|
||||
else
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
),
|
||||
Field::inst('pais_id')->validator('Validate::notEmpty', array(
|
||||
'message' => lang('ClienteDirecciones.validation.required'))),
|
||||
Field::inst('cliente_id'),
|
||||
|
||||
@ -18,19 +18,58 @@ class Test extends BaseController
|
||||
public function index()
|
||||
{
|
||||
|
||||
echo '<pre>';
|
||||
$this->getPapelesCubierta();
|
||||
echo '</pre>';
|
||||
/*
|
||||
echo '<pre>';
|
||||
$model = model('App\Models\Clientes\ClientePreciosModel');
|
||||
$configuracion = (object)[
|
||||
'tipo' => 'interior',
|
||||
'tipo_maquina' => 'inkjet',
|
||||
'tipo_impresion' => 'color'
|
||||
];
|
||||
var_dump($model->get_precio_hora(999,$configuracion, 1.5));
|
||||
echo '</pre>';*/
|
||||
$this->asignar_tarifa_defecto_todos_usuarios();
|
||||
|
||||
}
|
||||
|
||||
private function asignar_tarifa_defecto_todos_usuarios()
|
||||
{
|
||||
|
||||
// Previo a ejecutar, vaciar la tabla clientes_precios (ojo si hay customizaciones)
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$builder = $db->table('cliente_precios');
|
||||
|
||||
$plantillaDefectoId = 5;
|
||||
$clienteModel = model('App\Models\Clientes\ClienteModel');
|
||||
$platillaModel = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
|
||||
|
||||
$plantillaDefecto = $platillaModel->getResource($plantillaDefectoId)->get()->getResultObject();
|
||||
|
||||
$clientes = $clienteModel->getResource()->get()->getResultObject();
|
||||
|
||||
foreach ($clientes as $cliente){
|
||||
|
||||
foreach ($plantillaDefecto as $plantillaDefectoLinea){
|
||||
|
||||
$data = [
|
||||
'plantilla_id' => $plantillaDefectoId,
|
||||
'cliente_id' => $cliente->id,
|
||||
'tipo' => $plantillaDefectoLinea->tipo,
|
||||
'tipo_maquina' => $plantillaDefectoLinea->tipo_maquina,
|
||||
'tipo_impresion' => $plantillaDefectoLinea->tipo_impresion,
|
||||
'tiempo_min' => $plantillaDefectoLinea->tiempo_min,
|
||||
'tiempo_max' => $plantillaDefectoLinea->tiempo_max,
|
||||
'precio_hora' => $plantillaDefectoLinea->precio_hora,
|
||||
'margen' => $plantillaDefectoLinea->margen,
|
||||
'user_created_id' => 2,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
/*echo '<pre>';
|
||||
var_dump($data);
|
||||
echo '</pre>';*/
|
||||
|
||||
$builder->insert($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user