mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/fixes' into 'dev/presupuestos3'
Dev/fixes See merge request jjimenez/safekat!66
This commit is contained in:
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Clientes;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class Tarifacliente extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$uri = service('uri');
|
||||
$data['page_name'] = "Tarifa Cliente";
|
||||
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
|
||||
echo view(getenv('theme.path').'main/demo_view', $data);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$uri = service('uri');
|
||||
$data['page_name'] = "Tarifa Cliente";
|
||||
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
|
||||
echo view(getenv('theme.path').'main/demo_view', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$uri = service('uri');
|
||||
$data['page_name'] = "Tarifa Cliente";
|
||||
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
|
||||
echo view(getenv('theme.path').'main/demo_view', $data);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$uri = service('uri');
|
||||
$data['page_name'] = "Tarifa Cliente";
|
||||
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
|
||||
echo view(getenv('theme.path').'main/demo_view', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,232 +0,0 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Entities\Configuracion\FormasPagoEntity;
|
||||
|
||||
class Formaspago extends \App\Controllers\GoBaseController
|
||||
{
|
||||
|
||||
use \CodeIgniter\API\ResponseTrait;
|
||||
|
||||
protected static $primaryModelName = 'App\Models\Configuracion\FormasPagoModel';
|
||||
|
||||
protected static $singularObjectNameCc = 'formaPago';
|
||||
protected static $singularObjectName = 'Forma Pago';
|
||||
protected static $pluralObjectName = 'Formas Pago';
|
||||
protected static $controllerSlug = 'formaspago';
|
||||
|
||||
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/formas-pago/';
|
||||
|
||||
protected $indexRoute = 'formaPagoList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
|
||||
if (session('errorMessage')) {
|
||||
$this->session->setFlashData('sweet-error', session('errorMessage'));
|
||||
}
|
||||
if (session('successMessage')) {
|
||||
$this->session->setFlashData('sweet-success', session('successMessage'));
|
||||
}
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->viewData['usingClientSideDataTable'] = true;
|
||||
|
||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaPago')]);
|
||||
parent::index();
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
endif;
|
||||
|
||||
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['formasPagoEntity'] = isset($sanitizedData) ? new FormasPagoEntity($sanitizedData) : new FormasPagoEntity();
|
||||
|
||||
$this->viewData['formAction'] = route_to('createFormaPago');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('FormasPagoes.formaPago') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
|
||||
if ($requestedId == null) :
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$formasPagoEntity = $this->model->find($id);
|
||||
|
||||
if ($formasPagoEntity == false) :
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaPago')), $id]);
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('FormasPagoes.formaPago'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$formasPagoEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $formasPagoEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['formasPagoEntity'] = $formasPagoEntity;
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateFormaPago', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('FormasPagoes.formaPago') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
} // end function edit(...)
|
||||
|
||||
|
||||
public function allItemsSelect()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$onlyActiveOnes = true;
|
||||
$reqVal = $this->request->getPost('val') ?? 'id';
|
||||
$menu = $this->model->getAllForMenu($reqVal . ', nombre', 'nombre', $onlyActiveOnes, false);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->nombre = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
|
||||
$reqId = goSanitize($this->request->getPost('id'))[0];
|
||||
$reqText = goSanitize($this->request->getPost('text'))[0];
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -376,7 +376,6 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
|
||||
$search = $reqData['search']['value'];
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
@ -406,6 +405,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
if (isset($item->comentarios_tarifa) && strlen($item->comentarios_tarifa) > 100) :
|
||||
$item->comentarios_tarifa = character_limiter($item->comentarios_tarifa, 100);
|
||||
endif;
|
||||
if (isset($item->comentarios_produccion) && strlen($item->comentarios_produccion) > 100) :
|
||||
$item->comentarios_produccion = character_limiter($item->comentarios_produccion, 100);
|
||||
endif;
|
||||
if (isset($item->tirada_alternativa_json_data) && strlen($item->tirada_alternativa_json_data) > 100) :
|
||||
$item->tirada_alternativa_json_data = character_limiter($item->tirada_alternativa_json_data, 100);
|
||||
endif;
|
||||
|
||||
@ -5,22 +5,12 @@ use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Clientes\ClienteContactoEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoAcabadosModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
use function App\Controllers\Clientes\csrf_hash;
|
||||
use function App\Controllers\Clientes\csrf_token;
|
||||
use function App\Controllers\Clientes\lang;
|
||||
use function App\Controllers\Clientes\model;
|
||||
use function App\Controllers\Clientes\redirect;
|
||||
use function App\Controllers\Clientes\route_to;
|
||||
use function App\Controllers\Clientes\view;
|
||||
use const App\Controllers\Clientes\APPPATH;
|
||||
|
||||
|
||||
class PresupuestoAcabados extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
@ -5,22 +5,10 @@ use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Clientes\ClienteContactoEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
|
||||
use App\Models\Presupuestos\PresupuestoEncuadernacionesModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
use function App\Controllers\Clientes\csrf_hash;
|
||||
use function App\Controllers\Clientes\csrf_token;
|
||||
use function App\Controllers\Clientes\lang;
|
||||
use function App\Controllers\Clientes\model;
|
||||
use function App\Controllers\Clientes\redirect;
|
||||
use function App\Controllers\Clientes\route_to;
|
||||
use function App\Controllers\Clientes\view;
|
||||
use const App\Controllers\Clientes\APPPATH;
|
||||
|
||||
class PresupuestoEncuadernaciones extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
@ -13,14 +13,6 @@ use App\Models\Presupuestos\PresupuestoManipuladosModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
use function App\Controllers\Clientes\csrf_hash;
|
||||
use function App\Controllers\Clientes\csrf_token;
|
||||
use function App\Controllers\Clientes\lang;
|
||||
use function App\Controllers\Clientes\model;
|
||||
use function App\Controllers\Clientes\redirect;
|
||||
use function App\Controllers\Clientes\route_to;
|
||||
use function App\Controllers\Clientes\view;
|
||||
use const App\Controllers\Clientes\APPPATH;
|
||||
|
||||
class PresupuestoManipulados extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
@ -7,14 +7,6 @@ use App\Models\Presupuestos\PresupuestoPreimpresionesModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
use function App\Controllers\Clientes\csrf_hash;
|
||||
use function App\Controllers\Clientes\csrf_token;
|
||||
use function App\Controllers\Clientes\lang;
|
||||
use function App\Controllers\Clientes\model;
|
||||
use function App\Controllers\Clientes\redirect;
|
||||
use function App\Controllers\Clientes\route_to;
|
||||
use function App\Controllers\Clientes\view;
|
||||
use const App\Controllers\Clientes\APPPATH;
|
||||
|
||||
class PresupuestoPreimpresiones extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
@ -215,19 +215,19 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
|
||||
// Build our Editor instance and process the data coming from _POST
|
||||
$response = Editor::inst($db, 'tarifa_encuadernacion_lineas')
|
||||
->fields(
|
||||
Field::inst('paginas_min')
|
||||
Field::inst('paginas_libro_min')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_min.required'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_min.required'))
|
||||
),
|
||||
Field::inst('paginas_max')
|
||||
Field::inst('paginas_libro_max')
|
||||
->validator('Validate::numeric', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.decimal'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_max.required'))
|
||||
'message' => lang('TarifaAcabadoLineas.validation.paginas_libro_max.required'))
|
||||
),
|
||||
Field::inst('precio_min')
|
||||
->validator('Validate::numeric', array(
|
||||
@ -264,8 +264,8 @@ class Tarifaencuadernacionlineas extends \App\Controllers\GoBaseResourceControll
|
||||
foreach ($data['data'] as $pkey => $values) {
|
||||
// Si no se quiere borrar...
|
||||
if ($data['data'][$pkey]['is_deleted'] != 1) {
|
||||
$process_data['paginas_min'] = $data['data'][$pkey]['paginas_min'];
|
||||
$process_data['paginas_max'] = $data['data'][$pkey]['paginas_max'];
|
||||
$process_data['paginas_libro_min'] = $data['data'][$pkey]['paginas_libro_min'];
|
||||
$process_data['paginas_libro_max'] = $data['data'][$pkey]['paginas_libro_max'];
|
||||
$response = $this->model->checkIntervals($process_data, $pkey, $data['data'][$pkey]['tirada_encuadernacion_id']);
|
||||
// No se pueden duplicar valores al crear o al editar
|
||||
if (!empty($response)) {
|
||||
|
||||
Reference in New Issue
Block a user