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

View File

@ -105,7 +105,8 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController {
if ($thenRedirect) : if ($thenRedirect) :
if (!empty($this->indexRoute)) : 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: else:
return $this->redirect2listView('sweet-success', $message); return $this->redirect2listView('sweet-success', $message);
endif; endif;

View File

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

View File

@ -2,7 +2,7 @@
namespace App\Controllers; namespace App\Controllers;
use App\Controllers\Configuracion\Papelesimpresion; use App\Models\Tarifas\TarifaAcabadoLineaModel;
class Test extends BaseController class Test extends BaseController
{ {
@ -15,8 +15,14 @@ class Test extends BaseController
public function index() public function index()
{ {
$papel = new Papelesimpresion(); $t_model = new TarifaAcabadoLineaModel();
var_dump($papel->datatablePG()); $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" "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) //JJO
{ $builder->where('tarifa_acabado_id', $tarifa_acabado_id);
$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"); $builder->join("lg_tarifa_acabado t2", "t1.tarifa_acabado_id = t2.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search) return empty($search)
? $builder ? $builder
: $builder : $builder

View File

@ -9,6 +9,7 @@ ini_set('display_errors', '1');
* Database user / pass * Database user / pass
*/ */
$sql_details = array( $sql_details = array(
/*
"type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle" "type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
"user" => "sk_imn", // Database user name "user" => "sk_imn", // Database user name
"pass" => "Uyia19_87", // Database password "pass" => "Uyia19_87", // Database password
@ -17,6 +18,15 @@ $sql_details = array(
"db" => "sk_imn", // Database name "db" => "sk_imn", // Database name
"dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL "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 "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><!-- //.card -->
</div><!--//.col --> </div><!--//.col -->
<div class="accordion mt-3" id="accordionAcabadoLineas"> <?php if($formAction == route_to('createTarifaAcabado')): ?>
<div class="card accordion-item active"> <div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:hidden" >
<h2 class="accordion-header" id="headingOne"> <?php else: ?>
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1"> <div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:visible" >
<p><?= lang("TarifaAcabadoLineas.moduleTitle") ?></p> <?php endif; ?>
</button> <div class="card accordion-item active">
<h2 class="accordion-header" id="headingOne">
</h2> <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 id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionAcabadoLineas">
<div class="accordion-body"> <div class="accordion-body">
<table id="tableOfTarifaacabadolineas" class="table table-striped table-hover" style="width: 100%;"> <table id="tableOfTarifaacabadolineas" class="table table-striped table-hover" style="width: 100%;">
<thead> <thead>
<tr> <tr>
<th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th> <th><?= lang('TarifaAcabadoLineas.tiradaMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th> <th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th> <th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioMax') ?></th> <th><?= lang('TarifaAcabadoLineas.precioMax') ?></th>
<th><?= lang('TarifaAcabadoLineas.precioUnidad') ?></th> <th><?= lang('TarifaAcabadoLineas.precioUnidad') ?></th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> <!-- //.accordion --> </div> <!-- //.accordion -->
</div><!--//.row --> </div><!--//.row -->