arreglados varios fallos de la comprobación del editor (JJO)

This commit is contained in:
Jaime Jiménez
2023-06-16 12:25:09 +02:00
parent 51552bc594
commit 39c69ddd03
7 changed files with 89 additions and 62 deletions

View File

@ -22,8 +22,8 @@ CI_ENVIRONMENT = development
# APP
#--------------------------------------------------------------------
# app.baseURL = 'https://sk-jjo.imnavajas.es'
app.baseURL = 'https://sk-imn.imnavajas.es'
app.baseURL = 'https://sk-jjo.imnavajas.es'
# app.baseURL = 'https://sk-imn.imnavajas.es'
# app.baseURL = "http://safekat.test/"
# app.forceGlobalSecureRequests = false
@ -41,22 +41,22 @@ app.baseURL = 'https://sk-imn.imnavajas.es'
# DATABASE
#--------------------------------------------------------------------
# database.default.hostname = localhost
# database.default.database = sk_jjo
# database.default.username = sk_jjo
# database.default.password = 61tv&G1Zf^XY
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.dump =
database.default.hostname = localhost
database.default.database = sk_imn
database.default.username = sk_imn
database.default.password = Uyia19_87
database.default.database = sk_jjo
database.default.username = sk_jjo
database.default.password = 61tv&G1Zf^XY
database.default.DBDriver = MySQLi
database.default.DBPrefix =
database.default.dump =
# database.default.hostname = localhost
# database.default.database = sk_imn
# database.default.username = sk_imn
# database.default.password = Uyia19_87
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.dump =
# database.tests.hostname = localhost
# database.tests.database = ci4
# database.tests.username = root

View File

@ -105,7 +105,8 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController {
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
return redirect()->to(route_to('tarifas/tarifaacabado/edit/'.$id))->with('sweet-success', $message);
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;

View File

@ -295,12 +295,20 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
foreach ($data['data'] as $pkey => $values ){
$count = $this->model->select('*')
->where(array('tirada_min'=> $values['tirada_min'], 'tirada_max'=> $values['tirada_max'], 'is_deleted'=> 0))
->countAllResults();
if ($count >= 1){
return lang('TarifaAcabadoLineas.validation.duplicated_tirada');
}
// Si no se quiere borrar...
if($data['data'][$pkey]['is_deleted'] != 1)
{
$count = $this->model->select('*')
->where(array( 'tarifa_acabado_id'=> $values['tarifa_acabado_id'],
'tirada_min'=> $values['tirada_min'],
'tirada_max'=> $values['tirada_max'],
'is_deleted'=> 0
))
->countAllResults();
if ($count >= 1){
return lang('TarifaAcabadoLineas.validation.duplicated_tirada');
}
}
}
}
})
@ -329,12 +337,12 @@ class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
->data();
// if unique key is set in DB
if(isset($response['error'])){
/*if(isset($response['error'])){
if(str_contains($response['error'], "tirada_min_tirada_max") &&
str_contains($response['error'], "Duplicate entry ")){
$response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
}
}
}*/
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();

View File

@ -2,7 +2,7 @@
namespace App\Controllers;
use App\Controllers\Configuracion\Papelesimpresion;
use App\Models\Tarifas\TarifaAcabadoLineaModel;
class Test extends BaseController
{
@ -15,8 +15,14 @@ class Test extends BaseController
public function index()
{
$papel = new Papelesimpresion();
var_dump($papel->datatablePG());
$t_model = new TarifaAcabadoLineaModel();
$count = $t_model->select('*')
->where(array( 'tarifa_acabado_id'=> 13,
'tirada_min'=> 1,
'tirada_max'=> 1,
'is_deleted'=> 0))
->countAllResults();
var_dump($count);
}
}

View File

@ -138,16 +138,13 @@ class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
"t1.id AS id, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.precio_unidad AS precio_unidad, t1.user_created_id AS user_created_id, t1.user_updated_id AS user_updated_id, t1.is_deleted AS is_deleted, t1.created_at AS created_at, t1.updated_at AS updated_at, t2.id AS tarifa_acabado"
);
if($tarifa_acabado_id>=0)
{
$builder->where('tarifa_acabado_id', $tarifa_acabado_id);
}
//JJO
$builder->where('tarifa_acabado_id', $tarifa_acabado_id);
$builder->where("t1.is_deleted", 0);
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_acabado_id = t2.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder

View File

@ -9,6 +9,7 @@ ini_set('display_errors', '1');
* Database user / pass
*/
$sql_details = array(
/*
"type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
"user" => "sk_imn", // Database user name
"pass" => "Uyia19_87", // Database password
@ -17,6 +18,15 @@ $sql_details = array(
"db" => "sk_imn", // Database name
"dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
"pdoAttr" => array() // PHP PDO attributes array. See the PHP documentation for all options
*/
"type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
"user" => "sk_jjo", // Database user name
"pass" => "61tv&G1Zf^XY", // Database password
"host" => "localhost", // Database host
"port" => "", // Database connection port (can be left empty for default)
"db" => "sk_jjo", // Database name
"dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
"pdoAttr" => array() // PHP PDO attributes array. See the PHP documentation for all options
);

View File

@ -28,37 +28,42 @@
</div><!-- //.card -->
</div><!--//.col -->
<div class="accordion mt-3" id="accordionAcabadoLineas">
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
<p><?= lang("TarifaAcabadoLineas.moduleTitle") ?></p>
</button>
</h2>
<?php if($formAction == route_to('createTarifaAcabado')): ?>
<div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:hidden" >
<?php else: ?>
<div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:visible" >
<?php endif; ?>
<div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
<p><?= lang("TarifaAcabadoLineas.moduleTitle") ?></p>
</button>
</h2>
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionAcabadoLineas">
<div class="accordion-body">
<table id="tableOfTarifaacabadolineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioUnidad') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionAcabadoLineas">
<div class="accordion-body">
<table id="tableOfTarifaacabadolineas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioUnidad') ?></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- //.accordion -->
</div><!--//.row -->