mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
1 Commits
mod/permis
...
a1aaa095d4
| Author | SHA1 | Date | |
|---|---|---|---|
| a1aaa095d4 |
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Config;
|
|
||||||
|
|
||||||
use CodeIgniter\Config\BaseConfig;
|
|
||||||
|
|
||||||
class PedidoXML extends BaseConfig
|
|
||||||
{
|
|
||||||
|
|
||||||
public string $host;
|
|
||||||
public int $port;
|
|
||||||
public string $username;
|
|
||||||
public string $password;
|
|
||||||
public string $base_dir; # FTP server directory
|
|
||||||
public bool $xml_enabled;
|
|
||||||
public int $id_offset;
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
$this->host = env("HIDRIVE_HOST","10.5.0.6");
|
|
||||||
$this->port = env("HIDRIVE_PORT",21);
|
|
||||||
$this->username = env("HIDRIVE_USER","admin");
|
|
||||||
$this->password = env("HIDRIVE_PASS","A77h3b0X4OA2rOYAf4w2");
|
|
||||||
$this->base_dir = env("HIDRIVE_PATH_ROOT","/home/admin/safekat"); # FTP server directory
|
|
||||||
$this->xml_enabled = env("FTP_XML_ENABLED",false);
|
|
||||||
$this->id_offset = env("XML_OFFSET_CUSTOMER_ID",1000000);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
26
ci4/app/Config/PresupuestoSFTP.php
Normal file
26
ci4/app/Config/PresupuestoSFTP.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class PresupuestoSFTP extends BaseConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
public string $host;
|
||||||
|
public int $port;
|
||||||
|
public string $username;
|
||||||
|
public string $password;
|
||||||
|
public string $base_dir; # FTP server directory
|
||||||
|
public int $id_offset;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
$this->host = env("HIDRIVE_FILES_HOST","sftp.hidrive.ionos.com");
|
||||||
|
$this->port = env("HIDRIVE_FILES_PORT",22);
|
||||||
|
$this->username = env("HIDRIVE_FILES_USER");
|
||||||
|
$this->password = env("HIDRIVE_FILES_PASS");
|
||||||
|
$this->base_dir = env("HIDRIVE_FILES_PATH_ROOT"); # FTP server directory
|
||||||
|
$this->id_offset = env("BUDGET_FILES_OFFSET_ID",1000000);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -500,7 +500,6 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
|
|||||||
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
||||||
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
||||||
$routes->post('insertfactura', 'Pedido::addFactura');
|
$routes->post('insertfactura', 'Pedido::addFactura');
|
||||||
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
|
|
||||||
$routes->post('produccion/(:num)', 'Pedido::to_produccion/$1', ['as' => 'toProduccion']);
|
$routes->post('produccion/(:num)', 'Pedido::to_produccion/$1', ['as' => 'toProduccion']);
|
||||||
$routes->get('pedidosCliente', 'Pedido::tablaClienteForm');
|
$routes->get('pedidosCliente', 'Pedido::tablaClienteForm');
|
||||||
$routes->get('getSumCliente/(:num)', 'Pedido::obtenerTotalPedidosCliente/$1');
|
$routes->get('getSumCliente/(:num)', 'Pedido::obtenerTotalPedidosCliente/$1');
|
||||||
|
|||||||
@ -38,7 +38,6 @@ class ConfigVariables extends BaseResourceController
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
checkPermission('variables-sistema.menu');
|
|
||||||
|
|
||||||
$viewData = [
|
$viewData = [
|
||||||
'currentModule' => static::$controllerSlug,
|
'currentModule' => static::$controllerSlug,
|
||||||
@ -61,8 +60,6 @@ class ConfigVariables extends BaseResourceController
|
|||||||
}
|
}
|
||||||
public function updateVariable(int $config_variable_id)
|
public function updateVariable(int $config_variable_id)
|
||||||
{
|
{
|
||||||
checkPermission('variables-sistema.edit');
|
|
||||||
|
|
||||||
$reqData = [];
|
$reqData = [];
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
$reqData = $this->request->getPost();
|
$reqData = $this->request->getPost();
|
||||||
|
|||||||
@ -42,16 +42,11 @@ class FestivoController extends BaseController
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
checkPermission('festivos.menu');
|
|
||||||
|
|
||||||
return view($this->viewPath . $this->indexRoute);
|
return view($this->viewPath . $this->indexRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store_festivo_date()
|
public function store_festivo_date()
|
||||||
{
|
{
|
||||||
checkPermission('festivos.edit');
|
|
||||||
|
|
||||||
$bodyData = $this->request->getPost();
|
$bodyData = $this->request->getPost();
|
||||||
$date = $bodyData['date'];
|
$date = $bodyData['date'];
|
||||||
$count = $this->model->where('date',$date)->countAllResults();
|
$count = $this->model->where('date',$date)->countAllResults();
|
||||||
|
|||||||
@ -6,7 +6,6 @@ use App\Controllers\Facturacion\Facturas;
|
|||||||
use App\Entities\Pedidos\PedidoEntity;
|
use App\Entities\Pedidos\PedidoEntity;
|
||||||
use App\Models\Collection;
|
use App\Models\Collection;
|
||||||
use App\Models\Pedidos\PedidoModel;
|
use App\Models\Pedidos\PedidoModel;
|
||||||
use App\Services\PedidoXMLService;
|
|
||||||
use App\Services\ProductionService;
|
use App\Services\ProductionService;
|
||||||
use Hermawan\DataTables\DataTable;
|
use Hermawan\DataTables\DataTable;
|
||||||
use CodeIgniter\I18n\Time;
|
use CodeIgniter\I18n\Time;
|
||||||
@ -614,12 +613,7 @@ class Pedido extends \App\Controllers\BaseResourceController
|
|||||||
$pedidoEntity->created_at_footer = $pedidoEntity->created_at ? date(' H:i d/m/Y', strtotime($pedidoEntity->created_at)) : '';
|
$pedidoEntity->created_at_footer = $pedidoEntity->created_at ? date(' H:i d/m/Y', strtotime($pedidoEntity->created_at)) : '';
|
||||||
$pedidoEntity->updated_at_footer = $pedidoEntity->updated_at ? date(' H:i d/m/Y', strtotime($pedidoEntity->updated_at)) : '';
|
$pedidoEntity->updated_at_footer = $pedidoEntity->updated_at ? date(' H:i d/m/Y', strtotime($pedidoEntity->updated_at)) : '';
|
||||||
}
|
}
|
||||||
public function get_xml_pedido($pedido_id)
|
|
||||||
{
|
|
||||||
$data = PedidoXMLService::generate_xml($pedido_id);
|
|
||||||
// $xml_service = new PedidoXMLService($this->model);
|
|
||||||
return $this->respond($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function to_produccion($pedido_id)
|
public function to_produccion($pedido_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -58,12 +58,8 @@ return [
|
|||||||
'papelImpresionSection' => 'Papel impresión',
|
'papelImpresionSection' => 'Papel impresión',
|
||||||
'usuariosSection' => 'Usuarios',
|
'usuariosSection' => 'Usuarios',
|
||||||
'rolesPermisosSection' => 'Roles y permisos',
|
'rolesPermisosSection' => 'Roles y permisos',
|
||||||
'tareasMaquinaSection' => 'Tareas de Máquina',
|
|
||||||
'imposicionesSection' => 'Imposiciones',
|
|
||||||
'ubicacionesSection' => 'Ubicaciones',
|
'ubicacionesSection' => 'Ubicaciones',
|
||||||
'seriesFacturasSection' => 'Series facturas',
|
'seriesFacturasSection' => 'Series facturas',
|
||||||
'variablesSistemaSection' => 'Variables de sistema',
|
|
||||||
'festivosSection' => 'Días Festivos',
|
|
||||||
'ajustesSection' => 'Ajustes',
|
'ajustesSection' => 'Ajustes',
|
||||||
'actividadSection' => 'Accesos',
|
'actividadSection' => 'Accesos',
|
||||||
'backupSection' => 'Backups',
|
'backupSection' => 'Backups',
|
||||||
|
|||||||
@ -15,52 +15,23 @@ class SafekatFtpClient
|
|||||||
protected string $username;
|
protected string $username;
|
||||||
protected string $password;
|
protected string $password;
|
||||||
protected string $base_dir;
|
protected string $base_dir;
|
||||||
protected bool $xml_enabled;
|
|
||||||
protected object $pedido_xml_config;
|
protected object $pedido_xml_config;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->pedido_xml_config = config("PedidoXML");
|
$this->pedido_xml_config = config("PresupuestoSFTP");
|
||||||
$this->host = $this->pedido_xml_config->host;
|
$this->host = $this->pedido_xml_config->host;
|
||||||
$this->username = $this->pedido_xml_config->username;
|
$this->username = $this->pedido_xml_config->username;
|
||||||
$this->password = $this->pedido_xml_config->password;
|
$this->password = $this->pedido_xml_config->password;
|
||||||
$this->port = $this->pedido_xml_config->port;
|
$this->port = $this->pedido_xml_config->port;
|
||||||
$this->base_dir = $this->pedido_xml_config->base_dir;
|
$this->base_dir = $this->pedido_xml_config->base_dir;
|
||||||
$this->xml_enabled = $this->pedido_xml_config->xml_enabled;
|
|
||||||
$this->ftp = new SFTP($this->host);
|
$this->ftp = new SFTP($this->host);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Upload the content of $filename to the base directory declared in App\Config\FTP.php
|
|
||||||
*
|
|
||||||
* @param string $content
|
|
||||||
* @param string $filename
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function uploadXML(string $content, string $filename): bool
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
if ($this->xml_enabled == false)
|
|
||||||
return false;
|
|
||||||
$remotePath = implode("/", [$this->base_dir, 'pedidos', 'xml_nuevos']);
|
|
||||||
$this->ftp->login(username: $this->username, password: $this->password);
|
|
||||||
if (!$this->ftp->is_dir($remotePath)) {
|
|
||||||
$this->ftp->mkdir($remotePath, recursive: true);
|
|
||||||
}
|
|
||||||
$this->ftp->put($remotePath . '/' . $filename, $content);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
throw $th;
|
|
||||||
log_message('error', $th->getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public function uploadFilePresupuesto(int $presupuesto_id)
|
public function uploadFilePresupuesto(int $presupuesto_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->xml_enabled == false)
|
|
||||||
return false;
|
|
||||||
$model = model(PresupuestoFicheroModel::class);
|
$model = model(PresupuestoFicheroModel::class);
|
||||||
$modelPedidoLinea = model(PedidoLineaModel::class);
|
$modelPedidoLinea = model(PedidoLineaModel::class);
|
||||||
$pedidoLinea = $modelPedidoLinea->findByPresupuesto($presupuesto_id);
|
$pedidoLinea = $modelPedidoLinea->findByPresupuesto($presupuesto_id);
|
||||||
@ -86,7 +57,6 @@ class SafekatFtpClient
|
|||||||
public function removeFiles(int $presupuesto_id)
|
public function removeFiles(int $presupuesto_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// if ($this->xml_enabled == false) return false;
|
|
||||||
$model = model(PresupuestoFicheroModel::class);
|
$model = model(PresupuestoFicheroModel::class);
|
||||||
$modelPedidoLinea = model(PedidoLineaModel::class);
|
$modelPedidoLinea = model(PedidoLineaModel::class);
|
||||||
$pedidoLinea = $modelPedidoLinea->findByPresupuesto($presupuesto_id);
|
$pedidoLinea = $modelPedidoLinea->findByPresupuesto($presupuesto_id);
|
||||||
|
|||||||
@ -1,222 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Services;
|
|
||||||
|
|
||||||
use DOMDocument;
|
|
||||||
use App\Libraries\SafekatFtpClient;
|
|
||||||
use CodeIgniter\Config\BaseService;
|
|
||||||
use App\Models\Pedidos\PedidoModel;
|
|
||||||
use App\Models\Presupuestos\PresupuestoModel;
|
|
||||||
|
|
||||||
class PedidoXMLService extends BaseService
|
|
||||||
{
|
|
||||||
|
|
||||||
public static function get_pedido_presupuesto(int $pedido_id)
|
|
||||||
{
|
|
||||||
$data_xml = [];
|
|
||||||
$pedidoModel = model(PedidoModel::class);
|
|
||||||
$presupuestoModel = model(PresupuestoModel::class);
|
|
||||||
$data_xml['pedido_cliente_presupuesto'] = $pedidoModel->getPedidoClientePresupuesto($pedido_id);
|
|
||||||
$data_xml['pedido_presupuesto_direcciones'] = $pedidoModel->getPedidoPresupuestoDirecciones($pedido_id);
|
|
||||||
$data_xml['pedido_presupuesto_lineas'] = $pedidoModel->getPedidoPresupuestoLineas($pedido_id);
|
|
||||||
$servicios = $presupuestoModel->getServiciosPresupuesto($data_xml['pedido_cliente_presupuesto']->presupuestoId);
|
|
||||||
$data_xml['servicios'] = $servicios;
|
|
||||||
$data_xml['preimpresion'] = PedidoXMLService::parse_servicio_preimpresion($servicios['preimpresion']);
|
|
||||||
$data_xml["acabado"] = PedidoXMLService::parse_servicio_acabado($servicios['acabado']);
|
|
||||||
$data_xml["binding"] = PedidoXMLService::get_binding_code($data_xml['pedido_cliente_presupuesto']->codigoTipoImpresion,$data_xml['pedido_cliente_presupuesto']->solapas);
|
|
||||||
return $data_xml;
|
|
||||||
|
|
||||||
}
|
|
||||||
protected static function parse_servicio_acabado(array $data_xml_servicios_acabado)
|
|
||||||
{
|
|
||||||
$xml_element = [];
|
|
||||||
$service_xml_key_value = [
|
|
||||||
"ShrinkWrapping" => fn($nombre) => str_contains($nombre,"retractilado"),
|
|
||||||
"Finish" => fn($nombre) => str_contains($nombre,"brillo"),
|
|
||||||
"PlakeneT" =>fn($nombre) => str_contains($nombre,"plakene traslúcido"),];
|
|
||||||
foreach($data_xml_servicios_acabado as $servicio_acabado)
|
|
||||||
{
|
|
||||||
$service_name = strtolower($servicio_acabado->nombre);
|
|
||||||
foreach ($service_xml_key_value as $key => $value) {
|
|
||||||
$xml_element[$key] = $value($service_name) ? 1 : 0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return $xml_element;
|
|
||||||
}
|
|
||||||
protected static function parse_servicio_preimpresion(array $data_xml_servicios_preimpresion)
|
|
||||||
{
|
|
||||||
$xml_element = [];
|
|
||||||
$service_xml_key_value = [
|
|
||||||
"Urgent" => fn($nombre) => str_contains($nombre,"Pedido urgente"),
|
|
||||||
"Prototype" => fn($nombre) => str_contains($nombre,"Prototipo"),
|
|
||||||
"Layout" =>fn($nombre) => str_contains($nombre,"Maquetación"),
|
|
||||||
"Correction" =>fn($nombre) => str_contains($nombre,"Corrección ortográfica"),
|
|
||||||
// "Review" =>fn($nombre) => str_contains($nombre,"Revisión Profesional de archivo"),
|
|
||||||
"Design" =>fn($nombre) => str_contains($nombre,'Diseño de Cubierta'),
|
|
||||||
];
|
|
||||||
foreach($data_xml_servicios_preimpresion as $servicio_pre)
|
|
||||||
{
|
|
||||||
$service_name = $servicio_pre->nombre;
|
|
||||||
foreach ($service_xml_key_value as $key => $value) {
|
|
||||||
$value_service = $value($service_name) ? 1 : 0 ;
|
|
||||||
if( $value_service){
|
|
||||||
$xml_element[$key] = $servicio_pre->precio ;
|
|
||||||
}else if(!isset($xml_element[$key])){
|
|
||||||
$xml_element[$key] = $value_service;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $xml_element;
|
|
||||||
}
|
|
||||||
public static function generate_xml($pedido_id)
|
|
||||||
{
|
|
||||||
$papel_formato_ancho = 0;
|
|
||||||
$papel_formato_alto = 0;
|
|
||||||
$data = PedidoXMLService::get_pedido_presupuesto($pedido_id);
|
|
||||||
$xml = new DOMDocument('1.0', 'utf-8');
|
|
||||||
$xml_order_el = $xml->createElement('Order');
|
|
||||||
$xml_header_el = $xml->createElement('Header');
|
|
||||||
$offset_pedido_id = env('XML_OFFSET_CUSTOMER_ID',1000000) + $data["pedido_cliente_presupuesto"]->pedidoId;
|
|
||||||
$xml_header_el->appendChild($xml->createElement('CustomerCode', $data["pedido_cliente_presupuesto"]->presupuestoClienteId));
|
|
||||||
$xml_header_el->appendChild($xml->createElement('CodeNode', env('NODE_CODE_XML','SFK')));
|
|
||||||
$xml_header_el->appendChild($xml->createElement('ExternId', $offset_pedido_id));
|
|
||||||
$xml_header_el->appendChild($xml->createElement('NumProducts', 1));
|
|
||||||
$xml_header_el->appendChild($xml->createElement('Date', now_db()));
|
|
||||||
$xml_order_el->appendChild($xml_header_el);
|
|
||||||
$xml_products_el = $xml->createElement('Products');
|
|
||||||
$xml_product_el = $xml->createElement('Product');
|
|
||||||
$xml_product_el->appendChild($xml->createElement('ItemId', $offset_pedido_id));
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Quantity', $data["pedido_cliente_presupuesto"]->tirada));
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Title', $data["pedido_cliente_presupuesto"]->titulo));
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Pages', $data["pedido_cliente_presupuesto"]->paginas));
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Reprint', $data["pedido_cliente_presupuesto"]->inc_rei ?? 0));
|
|
||||||
|
|
||||||
if ($data["pedido_cliente_presupuesto"]->papel_formato_personalizado) {
|
|
||||||
$papel_formato_ancho = $data["pedido_cliente_presupuesto"]->papelAnchoPersonalidado;
|
|
||||||
$papel_formato_alto = $data["pedido_cliente_presupuesto"]->papelAltoPersonalidado;
|
|
||||||
} else {
|
|
||||||
$papel_formato_ancho = $data["pedido_cliente_presupuesto"]->lgPapelFormatoAncho;
|
|
||||||
$papel_formato_alto = $data["pedido_cliente_presupuesto"]->lgPapelFormatoAlto;
|
|
||||||
}
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Width', $papel_formato_ancho));
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Height', $papel_formato_alto));
|
|
||||||
$presupuestoLineaTipoCubierta = null;
|
|
||||||
$xml_presupuesto_lineas_el = $xml->createElement('Lines');
|
|
||||||
## Iterate throught presupuesto_lineas
|
|
||||||
foreach ($data["pedido_presupuesto_lineas"] as $row) {
|
|
||||||
|
|
||||||
if (str_contains($row->tipo, "rot") || str_contains($row->tipo, "bn") || str_contains($row->tipo, "color")) {
|
|
||||||
$colorInterior = PedidoXMLService::get_color_interior($row);
|
|
||||||
$xmlInside = $xml->createElement('Inside');
|
|
||||||
$xmlInside->appendChild($xml->createElement('TypeOfPrint', $colorInterior));
|
|
||||||
$xmlInside->appendChild($xml->createElement('HQ', str_contains($row->tipo, 'hq') ? 1 : 0));
|
|
||||||
$xmlInside->appendChild($xml->createElement('Pages', $row->paginas));
|
|
||||||
$xmlInside->appendChild($xml->createElement('Paper', $row->papelCode));
|
|
||||||
$xmlInside->appendChild($xml->createElement('Weight', $row->gramaje));
|
|
||||||
$xml_presupuesto_lineas_el->appendChild($xmlInside);
|
|
||||||
} else if (str_contains($row->tipo, "lp_cubierta") ) {//|| str_contains($row->tipo, "sobrecubierta")
|
|
||||||
//? If both exists presupuestoLineaTipoCubierta is override by sobreCubierta making null and not adding
|
|
||||||
$papelCubiertaCode = $row->papelCode;
|
|
||||||
$papelCubiertaGramaje = $row->gramaje;
|
|
||||||
$presupuestoLineaTipoCubierta = $row->tipo == "lp_cubierta" ? $row : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$xml_product_el->appendChild($xml_presupuesto_lineas_el);
|
|
||||||
if ($presupuestoLineaTipoCubierta) {
|
|
||||||
$containsTarifaAcabadoBrillo = isset($data['acabado']['Finish']) ? true : false;
|
|
||||||
if ($containsTarifaAcabadoBrillo) {
|
|
||||||
$acabado = "brillo";
|
|
||||||
} else {
|
|
||||||
$acabado = "mate";
|
|
||||||
}
|
|
||||||
$xmlCover = $xml->createElement('Cover');
|
|
||||||
$xmlCover->appendChild($xml->createElement('Sides', $presupuestoLineaTipoCubierta->paginas / 2));
|
|
||||||
$xmlCover->appendChild($xml->createElement('Paper', $presupuestoLineaTipoCubierta->papelCode));
|
|
||||||
$xmlCover->appendChild($xml->createElement('Weight', $presupuestoLineaTipoCubierta->gramaje));
|
|
||||||
$xmlCover->appendChild($xml->createElement('Flaps', $data["pedido_cliente_presupuesto"]->solapas));
|
|
||||||
$xmlCover->appendChild($xml->createElement('WidthFlaps', $data["pedido_cliente_presupuesto"]->solapas_ancho));
|
|
||||||
$xmlCover->appendChild($xml->createElement('Finish', $acabado));
|
|
||||||
$xml_product_el->appendChild($xmlCover);
|
|
||||||
}
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Binding', $data['binding']));
|
|
||||||
$xml_services_el = $xml->createElement('Services');
|
|
||||||
$xml_services_el->appendChild($xml->createElement('Bookmark', $data["pedido_cliente_presupuesto"]->marcapaginas));
|
|
||||||
foreach ($data['preimpresion'] as $key => $value) {
|
|
||||||
$xml_services_el->appendChild($xml->createElement($key, $value));
|
|
||||||
}
|
|
||||||
foreach ($data['acabado'] as $key => $value) {
|
|
||||||
$xml_services_el->appendChild($xml->createElement($key, $value));
|
|
||||||
}
|
|
||||||
|
|
||||||
$xml_product_el->appendChild($xml_services_el);
|
|
||||||
|
|
||||||
$xml_envios_el = $xml->createElement('Shipments');
|
|
||||||
foreach ($data["pedido_presupuesto_direcciones"] as $pedido_presupuesto_direccion) {
|
|
||||||
$xml_envio_el = $xml->createElement('Shipment');
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Qty', $pedido_presupuesto_direccion->cantidad));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Price', $pedido_presupuesto_direccion->precio));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Attention', $pedido_presupuesto_direccion->att));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Email', $pedido_presupuesto_direccion->email));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Address', $pedido_presupuesto_direccion->direccion));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Province', $pedido_presupuesto_direccion->provincia));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('City', $pedido_presupuesto_direccion->municipio));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Zip', $pedido_presupuesto_direccion->cp));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('CountryCode', $pedido_presupuesto_direccion->paisCode3));
|
|
||||||
$xml_envio_el->appendChild($xml->createElement('Telephone', $pedido_presupuesto_direccion->telefono));
|
|
||||||
$xml_envios_el->appendChild($xml_envio_el);
|
|
||||||
}
|
|
||||||
$xml_product_el->appendChild($xml_envios_el);
|
|
||||||
$xml_product_el->appendChild($xml->createElement('Comments', $data["pedido_cliente_presupuesto"]->comentarios_safekat));
|
|
||||||
$xml_product_el->appendChild($xml->createElement('CommentsClient', $data["pedido_cliente_presupuesto"]->comentarios_cliente));
|
|
||||||
$xml_products_el->appendChild($xml_product_el);
|
|
||||||
$xml_order_el->appendChild($xml_products_el);
|
|
||||||
$xml->appendChild($xml_order_el);
|
|
||||||
$file_has_suffix = hash('sha512',$offset_pedido_id);
|
|
||||||
$file_name = PedidoXMLService::generate_xml_file_name($file_has_suffix);
|
|
||||||
$ftp = new SafekatFtpClient();
|
|
||||||
$ftp->uploadXML($xml->saveXML(),$file_name);
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
protected static function generate_xml_file_name(string $hash) : string
|
|
||||||
{
|
|
||||||
return implode("",["SafekatNew_",$hash,".xml"]);
|
|
||||||
}
|
|
||||||
protected static function get_binding_code(string $tipo_impresion_nombre,bool $solapas) : ?string
|
|
||||||
{
|
|
||||||
$solapa = $solapas ? '1' : '0';
|
|
||||||
$key = implode("_",[$tipo_impresion_nombre,$solapa]);
|
|
||||||
$xml_mapping_binding =
|
|
||||||
[
|
|
||||||
"libroFresadoTapaBlanda_0" => 'RF',
|
|
||||||
"libroFresadoTapaBlanda_1" => 'RFS',
|
|
||||||
"libroCosidoTapaBlanda_0" => 'RCHV',
|
|
||||||
"libroCosidoTapaBlanda_1" => 'RCHVS',
|
|
||||||
"libroGrapado_0" => 'CC2',
|
|
||||||
"libroGrapado_1" => 'CC2S',
|
|
||||||
"libroCosidoTapaDura_0" => 'TDC',
|
|
||||||
"libroCosidoTapaDura_1" => 'TDC',
|
|
||||||
"libroFresadoTapaDura_0" => 'RDF',
|
|
||||||
"libroFresadoTapaDura_1" => 'RDF',
|
|
||||||
"libroEspiralTapaBlanda_0" => 'ESP',
|
|
||||||
"libroEspiralTapaBlanda_1" => 'ESP',
|
|
||||||
"libroWireoTapaBlanda_0" => 'WIO',
|
|
||||||
"libroWireoTapaBlanda_1" => 'WIO',
|
|
||||||
];
|
|
||||||
return $xml_mapping_binding[$key] ?? null;
|
|
||||||
}
|
|
||||||
protected static function get_color_interior($pre_linea): ?string
|
|
||||||
{
|
|
||||||
$color_interior = null;
|
|
||||||
$bn_tipo_array = ['lp_bn', 'lp_bnhq', 'lp_rot_bn'];
|
|
||||||
$color_tipo_array = ['lp_color', 'lp_color_hq', 'lp_rot_color'];
|
|
||||||
|
|
||||||
if (in_array($pre_linea->tipo, $bn_tipo_array)) {
|
|
||||||
$color_interior = "bn";
|
|
||||||
};
|
|
||||||
if (in_array($pre_linea->tipo, $color_tipo_array)) {
|
|
||||||
$color_interior = "color";
|
|
||||||
};
|
|
||||||
return $color_interior;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1903,7 +1903,6 @@ class PresupuestoService extends BaseService
|
|||||||
"user_updated_id" => auth()->user()->id,
|
"user_updated_id" => auth()->user()->id,
|
||||||
];
|
];
|
||||||
$id_linea = $model_pedido_linea->insert($data_pedido_linea);
|
$id_linea = $model_pedido_linea->insert($data_pedido_linea);
|
||||||
//PedidoXMLService::generate_xml($pedido_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_linea != 0 && $pedido_id != 0) {
|
if ($id_linea != 0 && $pedido_id != 0) {
|
||||||
|
|||||||
@ -113,7 +113,6 @@
|
|||||||
</div><!-- //.card -->
|
</div><!-- //.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section('additionalInlineJs') ?>
|
<?= $this->section('additionalInlineJs') ?>
|
||||||
|
|||||||
@ -11,29 +11,27 @@
|
|||||||
<div class="container-xxl flex-grow-1 container-p-y">
|
<div class="container-xxl flex-grow-1 container-p-y">
|
||||||
<!-- Role cards -->
|
<!-- Role cards -->
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
<?php if (auth()->user()->can('roles-permisos.create')): ?>
|
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
<div class="card h-100">
|
||||||
<div class="card h-100">
|
<div class="row h-100">
|
||||||
<div class="row h-100">
|
<div class="col-sm-5">
|
||||||
<div class="col-sm-5">
|
<div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
|
||||||
<div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
|
<img src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
|
||||||
<img src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
|
class="img-fluid mt-sm-4 mt-md-0" alt="add-new-roles" width="83" />
|
||||||
class="img-fluid mt-sm-4 mt-md-0" alt="add-new-roles" width="83" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-7">
|
</div>
|
||||||
<div class="card-body text-sm-end text-center ps-sm-0">
|
<div class="col-sm-7">
|
||||||
<button onclick="window.location='<?= route_to('newGroup') ?>'"
|
<div class="card-body text-sm-end text-center ps-sm-0">
|
||||||
class="btn btn-primary mb-2 text-nowrap add-new-role">
|
<button onclick="window.location='<?= route_to('newGroup') ?>'"
|
||||||
<?= lang('Basic.global.addNew') ?>
|
class="btn btn-primary mb-2 text-nowrap add-new-role">
|
||||||
</button>
|
<?= lang('Basic.global.addNew') ?>
|
||||||
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
</button>
|
||||||
</div>
|
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
|
|
||||||
<?php foreach ($userGroupList as $item): ?>
|
<?php foreach ($userGroupList as $item): ?>
|
||||||
<?php $item->users = $model->getUsersByRol($item->keyword); ?>
|
<?php $item->users = $model->getUsersByRol($item->keyword); ?>
|
||||||
@ -46,29 +44,25 @@
|
|||||||
<?= lang("RolesPermisos.totalUsers") ?>
|
<?= lang("RolesPermisos.totalUsers") ?>
|
||||||
</h6>
|
</h6>
|
||||||
<ul class="list-unstyled d-flex align-items-center avatar-group mb-0">
|
<ul class="list-unstyled d-flex align-items-center avatar-group mb-0">
|
||||||
<?php foreach ($item->users as $user): ?>
|
<?php foreach ($item->users as $user): ?>
|
||||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom"
|
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top"
|
||||||
data-bs-placement="top"
|
title="<?= esc($user->first_name . ' ' . $user->last_name) ?>"
|
||||||
title="<?= esc($user->first_name . ' ' . $user->last_name) ?>"
|
class="avatar avatar-sm pull-up">
|
||||||
class="avatar avatar-sm pull-up">
|
<img class="rounded-circle" src="<?= gravatar_url($user->email, 30) ?>"
|
||||||
<img class="rounded-circle" src="<?= gravatar_url($user->email, 30) ?>"
|
alt="<?= esc($user->email) ?>" />
|
||||||
alt="<?= esc($user->email) ?>" />
|
</li>
|
||||||
</li>
|
<?php endforeach; ?>
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between align-items-end mt-1">
|
<div class="d-flex justify-content-between align-items-end mt-1">
|
||||||
<div class="role-heading">
|
<div class="role-heading">
|
||||||
<h4 class="mb-1"><?= esc($item->title) ?></h4>
|
<h4 class="mb-1"><?= esc($item->title) ?></h4>
|
||||||
<?php if (auth()->user()->can('roles-permisos.edit')): ?>
|
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
<span><?= lang('Basic.global.edit') ?></span>
|
||||||
<span><?= lang('Basic.global.edit') ?></span>
|
</a>
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?=
|
||||||
if (auth()->user()->can('roles-permisos.delete')) {
|
anchor(
|
||||||
echo anchor(
|
|
||||||
'#confirm2delete',
|
'#confirm2delete',
|
||||||
"<i class='ti ti-trash ti-md'></i>",
|
"<i class='ti ti-trash ti-md'></i>",
|
||||||
[
|
[
|
||||||
@ -78,7 +72,6 @@
|
|||||||
'data-bs-target' => '#confirm2delete'
|
'data-bs-target' => '#confirm2delete'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -14,10 +14,7 @@ if (
|
|||||||
auth()->user()->can('roles-permisos.menu') ||
|
auth()->user()->can('roles-permisos.menu') ||
|
||||||
auth()->user()->can('proveedores.menu') ||
|
auth()->user()->can('proveedores.menu') ||
|
||||||
auth()->user()->can('ubicaciones.menu') ||
|
auth()->user()->can('ubicaciones.menu') ||
|
||||||
auth()->user()->can('series-facturas.menu') ||
|
auth()->user()->can('series-facturas.menu')
|
||||||
auth()->user()->can('tareas-maquina.menu') ||
|
|
||||||
auth()->user()->can('festivos.menu') ||
|
|
||||||
auth()->user()->can('variables-sistema.menu')
|
|
||||||
) {
|
) {
|
||||||
?>
|
?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
@ -69,14 +66,14 @@ if (
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('tareas-maquina.menu')) { ?>
|
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to("maquinaTareaList") ?>" class="menu-link">
|
<a href="<?= route_to("maquinaTareaList") ?>" class="menu-link">
|
||||||
<div> <?= lang("App.menu_maquina_tareas") ?></div>
|
<div> <?= lang("App.menu_maquina_tareas") ?></div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('imposiciones.menu')) { ?>
|
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to("imposicionList") ?>" class="menu-link">
|
<a href="<?= route_to("imposicionList") ?>" class="menu-link">
|
||||||
<div> <?= lang("App.menu_imposiciones") ?></div>
|
<div> <?= lang("App.menu_imposiciones") ?></div>
|
||||||
@ -125,7 +122,7 @@ if (
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('variables-sistema.menu')) { ?>
|
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
||||||
<div> <?= lang("App.menu_variables") ?></div>
|
<div> <?= lang("App.menu_variables") ?></div>
|
||||||
@ -139,7 +136,7 @@ if (
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('festivos.menu')) { ?>
|
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('festivosList') ?>" class="menu-link">
|
<a href="<?= route_to('festivosList') ?>" class="menu-link">
|
||||||
<div> <?= lang("App.menu_config_holidays") ?></div>
|
<div> <?= lang("App.menu_config_holidays") ?></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user