From 8cb8217aaddaaf643eaf4aeba8c8f18b09935ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Garc=C3=ADa?= Date: Sun, 16 Aug 2026 17:58:46 +0200 Subject: [PATCH 1/4] feat: unified module css file --- core/modules/modAutoverifactu.class.php | 52 +++++---- css/admin.css.php | 100 ------------------ ...r_status.css.php => autoverifactu.css.php} | 84 +++++++++++++-- 3 files changed, 105 insertions(+), 131 deletions(-) delete mode 100644 css/admin.css.php rename css/{selector_status.css.php => autoverifactu.css.php} (58%) diff --git a/core/modules/modAutoverifactu.class.php b/core/modules/modAutoverifactu.class.php index df5732f..89d85ec 100644 --- a/core/modules/modAutoverifactu.class.php +++ b/core/modules/modAutoverifactu.class.php @@ -113,7 +113,7 @@ public function __construct($db) 'theme' => 0, // Set this to relative path of css file if module has its own css file 'css' => array( - '/autoverifactu/css/admin.css.php', + '/autoverifactu/css/autoverifactuu.css.php', ), // Set this to relative path of js file if module must load a js on all pages 'js' => array( @@ -281,18 +281,19 @@ public function init($options = '') // Create extrafields during init include_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); + //----------------------------------------Invoice ---------------------------------------- // Tipo de rectificación en caso de que la factura sea rectificativa. $extrafields->addExtraField( - 'verifactu_rectification_type', - 'VerifactuRectificationType', - 'select', - 1, - 2, - 'facture', - 0, - 0, - '', + 'verifactu_rectification_type', // name + 'VerifactuRectificationType', // label + 'select', // type + 1, // position + 2, // size + 'facture', // element + 0, // unique + 0, // required + '', // default array( 'options' => array( 'R1' => $langs->trans('VerifactuRectificationTypeR1'), @@ -301,16 +302,17 @@ public function init($options = '') 'R4' => $langs->trans('VerifactuRectificationTypeR4'), // 'R5' => $langs->trans('VerifactuRectificationTypeR5') ), - ), - 0, - '', - '3', - $langs->trans('VerifactuRectificationTypeDescription'), - '', - '', - 'autoverifactu@autoverifactu', - 'isModEnabled("autoverifactu")', + ), // parameters + 0, // always editable + '', // permissions + '3', // Visibility (0=never, 1=all, 2=list 3=form) + $langs->trans('VerifactuRectificationTypeDescription'), // help + '', // computed + '', // entity + 'autoverifactu@autoverifactu', // lang file + 'isModEnabled("autoverifactu")', // enabled ); + // Fecha de operación $extrafields->addExtraField( 'verifactu_date_operation', @@ -332,6 +334,7 @@ public function init($options = '') 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + // Campo para el almacenamiento de los textos legales para el pdf // de la factura por el usuario. $extrafields->addExtraField( @@ -354,6 +357,7 @@ public function init($options = '') 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + // Estado de los envios a verifactu en funcion de si esta permitio o no hacer una peticion a la API $extrafields->addExtraField( 'verifactu_status', @@ -380,13 +384,14 @@ public function init($options = '') ), 0, '', - '1', + 0, $langs->trans('verifactuStatusDescription'), '', '', 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + // campo para el almacenamiento de errores de validación de la factura. $extrafields->addExtraField( 'verifactu_error', @@ -401,13 +406,14 @@ public function init($options = '') '', 0, '', - 3, + 0, '', '', '', 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + //campo para el almacenamiento de los codigos de errores de validación de la factura. $extrafields->addExtraField( 'verifactu_error_code', @@ -429,6 +435,7 @@ public function init($options = '') 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + // hash verifactu $extrafields->addExtraField( 'verifactu_hash', @@ -450,6 +457,7 @@ public function init($options = '') 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + // Campo para el almacenamiento de los textos legales para el pdf de la factura. $extrafields->addExtraField( 'verifactu_pdfLegalText', @@ -471,6 +479,7 @@ public function init($options = '') 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + // Timestamp de validación de la factura. $extrafields->addExtraField( 'verifactu_tms', @@ -492,6 +501,7 @@ public function init($options = '') 'autoverifactu@autoverifactu', 'isModEnabled("autoverifactu")', ); + //----------------------------------------line ---------------------------------------- // regimen de facturación de la línea de factura $extrafields->addExtraField( diff --git a/css/admin.css.php b/css/admin.css.php deleted file mode 100644 index 428b665..0000000 --- a/css/admin.css.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/custom/verifactu/css/mymodule.css.php - * \ingroup verifactu - * \brief CSS file for module verifactu setup page. - */ - -if (!defined('NOREQUIRESOC')) { - define('NOREQUIRESOC', '1'); -} - -if (!defined('NOTOKENRENEWAL')) { - define('NOTOKENRENEWAL', 1); -} - -if (!defined('NOLOGIN')) { - define('NOLOGIN', 1); -} - -if (!defined('NOREQUIREHTML')) { - define('NOREQUIREHTML', 1); -} - -if (!defined('NOREQUIREAJAX')) { - define('NOREQUIREAJAX', '1'); -} - -/** - * \file htdocs/autoverifactu/css/autoverifactu.css.php - * \ingroup autoverifactu - * \brief Cascading Style Sheet file for module Auto-Veri*Factu. - */ - -require_once dirname(__DIR__) . '/env.php'; - -header('Content-type: text/css'); - -if (empty($dolibarr_nocache)) { - header('Cache-Control: max-age=10800, public, must-revalidate'); -} else { - header('Cache-Control: no-cache'); -} - -?> - -#autoverifactuSetupForm input[error="1"] { - border: indianred 1px solid; - color: indianred; -} - -.autodeclaration-preview { - position: relative; - max-width: 65rem; - padding: 6rem 4.5rem 4.5rem; - border: 1px solid; - box-sizing: border-box; -} - -.autodeclaration-preview h1, -.autodeclaration-preview h2 { - line-height: 1.2; -} - -.autodeclaration-preview h1 { - margin-bottom: 1.5em; -} - -.autodeclaration-preview ol, -.autodeclaration-preview ul { - padding-left: 1rem; -} - -.autodeclaration-watermark { - position: absolute; - z-index: 10; - font-weight: 800; - font-size: 8rem; - color: red; - top: 15%; - left: 50%; - transform: translate(-50%, -50%) rotate(45deg); - opacity: 0.3; - text-transform: uppercase; -} diff --git a/css/selector_status.css.php b/css/autoverifactu.css.php similarity index 58% rename from css/selector_status.css.php rename to css/autoverifactu.css.php index 1180f5a..bdf9b7a 100644 --- a/css/selector_status.css.php +++ b/css/autoverifactu.css.php @@ -1,4 +1,26 @@ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/custom/verifactu/css/admin.css.php + * \ingroup verifactu + * \brief CSS file for module verifactu setup page. + */ + if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } @@ -7,6 +29,10 @@ define('NOTOKENRENEWAL', 1); } +if (!defined('NOLOGIN')) { + define('NOLOGIN', 1); +} + if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', 1); } @@ -15,6 +41,8 @@ define('NOREQUIREAJAX', '1'); } +require_once dirname(__DIR__) . '/env.php'; + header('Content-type: text/css'); if (empty($dolibarr_nocache)) { @@ -23,21 +51,53 @@ header('Cache-Control: no-cache'); } -$res = 0; -if (!$res && file_exists('../../../main.inc.php')) { - $res = @include '../../../main.inc.php'; +global $langs; +$langs->load('autoverifactu@autoverifactu'); + +?> + +/* SETUP FORM */ +#autoverifactuSetupForm input[error="1"] { + border: indianred 1px solid; + color: indianred; } -if (!$res && file_exists('../../../../main.inc.php')) { - $res = @include '../../../../main.inc.php'; + +.autodeclaration-preview { + position: relative; + max-width: 65rem; + padding: 6rem 4.5rem 4.5rem; + border: 1px solid; + box-sizing: border-box; } -if (!$res) { - die('Error: No se pudo encontrar el archivo main.inc.php de Dolibarr.'); + +.autodeclaration-preview h1, +.autodeclaration-preview h2 { + line-height: 1.2; } -$langs->load('autoverifactu@autoverifactu'); +.autodeclaration-preview h1 { + margin-bottom: 1.5em; +} -?> +.autodeclaration-preview ol, +.autodeclaration-preview ul { + padding-left: 1rem; +} + +.autodeclaration-watermark { + position: absolute; + z-index: 10; + font-weight: 800; + font-size: 8rem; + color: red; + top: 15%; + left: 50%; + transform: translate(-50%, -50%) rotate(45deg); + opacity: 0.3; + text-transform: uppercase; +} +/* SELECTOR STATUS */ td[data-key="facture.verifactu_status"] { font-family: sans-serif; font-size: 0.85em; @@ -61,28 +121,32 @@ border-color: #1f617a !important; color: #ffffff !important; } + /* Registrado Correctamente */ td[data-key="facture.verifactu_status"][title="transnoentitiesnoconv('verifactuStatusSelect1'), ENT_QUOTES, 'UTF-8');?>"] { background-color: #28a745 !important; border-color: #1e7e34 !important; color: #ffffff !important; } + /* Rechazado */ td[data-key="facture.verifactu_status"][title="transnoentitiesnoconv('verifactuStatusSelect2'), ENT_QUOTES, 'UTF-8');?>"] { background-color: #dc3545 !important; border-color: #bd2130 !important; color: #ffffff !important; } + /* En cola (Espera Temporal) */ td[data-key="facture.verifactu_status"][title="transnoentitiesnoconv('verifactuStatusSelect3'), ENT_QUOTES, 'UTF-8');?>"] { background-color: #ffc107 !important; border-color: #d39e00 !important; color: #212529 !important; } + /* Registrado Correctamente pero con Errores */ td[data-key="facture.verifactu_status"][title="transnoentitiesnoconv('verifactuStatusSelect4'), ENT_QUOTES, 'UTF-8');?>"] { background-color: #fd7e14 !important; /* Naranja corporativo de advertencia */ border-color: #cf6206 !important; color: #ffffff !important; -} \ No newline at end of file +} From 2e593f80d840deafd091c7cede5ccc028af1caac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Garc=C3=ADa?= Date: Sun, 16 Aug 2026 17:59:26 +0200 Subject: [PATCH 2/4] fix: remove unused and non standard injected css stylesheets --- class/actions_autoverifactu.class.php | 284 ++++++++++++-------------- 1 file changed, 134 insertions(+), 150 deletions(-) diff --git a/class/actions_autoverifactu.class.php b/class/actions_autoverifactu.class.php index 7b01ced..fa1de76 100644 --- a/class/actions_autoverifactu.class.php +++ b/class/actions_autoverifactu.class.php @@ -129,11 +129,11 @@ public function doActions($parameters, &$object, &$action) //en caso de tener IRPF hay que quitarselo ya que en verifactu no hay que tenerlo en cuenta // por ello le sumo el irpf al total $query = http_build_query(array( - 'nif' => $mysoc->idprof1, - 'numserie' => $object->ref, - 'fecha' => date('d-m-Y', $object->date), - 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), - 'formato' => 'json', + 'nif' => $mysoc->idprof1, + 'numserie' => $object->ref, + 'fecha' => date('d-m-Y', $object->date), + 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), + 'formato' => 'json', )); $ch = curl_init(); echo $base_url . $endpoint . '?' . $query; @@ -173,15 +173,15 @@ public function doActions($parameters, &$object, &$action) $attribute = GETPOST('attribute', 'alpha'); //evito que se editen estos campos if ( - $attribute === 'verifactu_status' || - $attribute === 'verifactu_hash' || - $attribute === 'verifactu_error' || - $attribute === 'verifactu_error_code' || - $attribute === 'verifactu_pdfLegalText' || - $attribute === 'VerifactuTimeStamp' - ) { - $this->errors[] = $langs->trans('NotEdit'); - $action = ''; + $attribute === 'verifactu_status' || + $attribute === 'verifactu_hash' || + $attribute === 'verifactu_error' || + $attribute === 'verifactu_error_code' || + $attribute === 'verifactu_pdfLegalText' || + $attribute === 'VerifactuTimeStamp' + ) { + $this->errors[] = $langs->trans('NotEdit'); + $action = ''; } break; case 'add': @@ -221,7 +221,7 @@ public function doActions($parameters, &$object, &$action) } elseif ($parameters['currentcontext'] === 'admincompany') { if ($action === 'update' && autoverifactuEnabled()) { $forbidden = $mysoc->nom !== GETPOST('name') - || $mysoc->idprof1 !== GETPOST('siren'); + || $mysoc->idprof1 !== GETPOST('siren'); if ($forbidden) { $_POST['name'] = $mysoc->nom; $_POST['siren'] = $mysoc->idprof1; @@ -254,24 +254,24 @@ public function beforePDFCreation($parameters, &$object, &$action) //?No entiendo por que regeneras el archivo xml. Una vez enviado y guardado es mejor no volver a generar. /* if ( - $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() ) { - $result = autoverifactuCheckInvoiceImmutableXML($object, 'alta'); + $result = autoverifactuCheckInvoiceImmutableXML($object, 'alta'); - if ($result < 0) { - return $result; - } + if ($result < 0) { + return $result; + } - if ($object->status >= Facture::STATUS_CLOSED) { - $result = autoverifactuCheckInvoiceImmutableXML($object, 'anulacion'); + if ($object->status >= Facture::STATUS_CLOSED) { + $result = autoverifactuCheckInvoiceImmutableXML($object, 'anulacion'); - if (!$result < 0) { - return $result; - } + if (!$result < 0) { + return $result; } + } }*/ return 0; @@ -293,11 +293,11 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler) $object = $parameters['object']; $modelpdf = $object->model_pdf; if ( - $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && $modelpdf !== 'Autoverifactu' //en caso de que no tenga la plantilla autoverifactu que ya incluye el QR + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && $modelpdf !== 'Autoverifactu' //en caso de que no tenga la plantilla autoverifactu que ya incluye el QR ) { $pdf = &$parameters['pdf']; @@ -306,10 +306,10 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler) $base_url = $testMode ? VERIFACTU_TEST_COLLATION_BASE_URL : VERIFACTU_COLLATION_BASE_URL; $endpoint = '/wlpl/TIKE-CONT/ValidarQR'; $query = http_build_query(array( - 'nif' => $mysoc->idprof1, - 'numserie' => $object->ref, - 'fecha' => date('d-m-Y', $object->date), - 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), + 'nif' => $mysoc->idprof1, + 'numserie' => $object->ref, + 'fecha' => date('d-m-Y', $object->date), + 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), )); //El código «QR» deberá tener un tamaño entre 30x30 y 40x40 milímetros y seguir las especificaciones de la norma ISO/IEC 18004:2015 //A este respecto, se deben mantener como mínimo 2 milímetros de espacio vacío (en blanco) alrededor de los cuatro lados del código «QR», recomendándose que sean 6 milímetros. @@ -326,14 +326,14 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler) 32, 32, array( - 'border' => false, - 'padding' => 2, - 'fgcolor' => array(25, 25, 25), - 'bgcolor' => array(255, 255, 255), //margen color blanco con padding 2mm - 'module_width' => 1, - 'module_height' => 1, - ), - 30, + 'border' => false, + 'padding' => 2, + 'fgcolor' => array(25, 25, 25), + 'bgcolor' => array(255, 255, 255), //margen color blanco con padding 2mm + 'module_width' => 1, + 'module_height' => 1, + ), + 30, ); $pdf->setTopMargin($pdfhandler->tab_top + 32); $pdf->MultiCell(30, 10, 'VERI*FACTU', 0, 'C', 0, 1); @@ -360,69 +360,69 @@ public function addMoreActionsButtons($parameters, &$object, $action) { global $langs; if ( - $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && $object->array_options['options_verifactu_status'] === '1' + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && $object->array_options['options_verifactu_status'] === '1' ) { echo dolGetButtonAction( - $langs->trans('CheckIntegrity'), - 'Veri*Factu', - 'default', - $_SERVER['PHP_SELF'] . '?action=verifactu&token=' . newToken() . '&id=' . $object->id, - '', - 1, - array( - 'attr' => array( - 'class' => 'classfortooltip', - 'title' => '' - ), - ) + $langs->trans('CheckIntegrity'), + 'Veri*Factu', + 'default', + $_SERVER['PHP_SELF'] . '?action=verifactu&token=' . newToken() . '&id=' . $object->id, + '', + 1, + array( + 'attr' => array( + 'class' => 'classfortooltip', + 'title' => '' + ), + ) ); } //Boton para mostrar los errores de factura if ( $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && $object->array_options['options_verifactu_status'] === '4' - ) { - echo dolGetButtonAction( - $langs->trans('fixErrors'), - $langs->trans('fixErrors'), - 'default', - $_SERVER['PHP_SELF'] . '?action=fixErrors&token=' . newToken() . '&id=' . $object->id, - '', - 1, - array( - 'attr' => array( - 'class' => 'classfortooltip', - 'title' => '' - ), - ) + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && $object->array_options['options_verifactu_status'] === '4' + ) { + echo dolGetButtonAction( + $langs->trans('fixErrors'), + $langs->trans('fixErrors'), + 'default', + $_SERVER['PHP_SELF'] . '?action=fixErrors&token=' . newToken() . '&id=' . $object->id, + '', + 1, + array( + 'attr' => array( + 'class' => 'classfortooltip', + 'title' => '' + ), + ) ); } //permitir reenviar la facturas con errores if ( $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && in_array($object->array_options['options_verifactu_status'], array('2','4','5'), true) - ) { - echo dolGetButtonAction( - $langs->trans('VerifactuResend'), - $langs->trans('VerifactuResend'), - 'default', - $_SERVER['PHP_SELF'] . '?action=verifactuResend&token=' . newToken() . '&id=' . $object->id, - '', - 1, - array( - 'attr' => array( - 'class' => 'classfortooltip', - 'title' => '' - ), - ) + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && in_array($object->array_options['options_verifactu_status'], array('2','4','5'), true) + ) { + echo dolGetButtonAction( + $langs->trans('VerifactuResend'), + $langs->trans('VerifactuResend'), + 'default', + $_SERVER['PHP_SELF'] . '?action=verifactuResend&token=' . newToken() . '&id=' . $object->id, + '', + 1, + array( + 'attr' => array( + 'class' => 'classfortooltip', + 'title' => '' + ), + ) ); } } @@ -445,9 +445,9 @@ public function dolGetButtonAction(&$parameters, $object, $action) global $langs; if ( - $object->element === 'facture' - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() + $object->element === 'facture' + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() ) { $url = parse_url($parameters['url']); parse_str($url['query'] ?? '', $query); @@ -455,20 +455,20 @@ public function dolGetButtonAction(&$parameters, $object, $action) $action = $query['action'] ?? null; if ( - $object->status > Facture::STATUS_DRAFT - && in_array($action, array('modif', 'reopen', 'delete'), true) - && !empty($parameters['userRight']) + $object->status > Facture::STATUS_DRAFT + && in_array($action, array('modif', 'reopen', 'delete'), true) + && !empty($parameters['userRight']) ) { $label = $langs->trans('DisabledBy'); $button = dolGetButtonAction( - $label, - $parameters['html'], - $parameters['actionType'], - '', - $parameters['id'], - 0, - $parameters['params'] + $label, + $parameters['html'], + $parameters['actionType'], + '', + $parameters['id'], + 0, + $parameters['params'] ); $this->resprints = $button; @@ -479,21 +479,21 @@ public function dolGetButtonAction(&$parameters, $object, $action) $valid_id = $thirdparty->idprof1 && $thirdparty->id_prof_check(1, $thirdparty); if ( - !$valid_id - && !$thirdparty->tva_intra - && !autoverifactuIsPosInvoice($object) - && !empty($parameters['userRight']) + !$valid_id + && !$thirdparty->tva_intra + && !autoverifactuIsPosInvoice($object) + && !empty($parameters['userRight']) ) { $label = $langs->trans('ThirdpartyIdProfRequired'); $button = dolGetButtonAction( - $label, - $parameters['html'], - $parameters['actionType'], - '', - $parameters['id'], - 0, - $parameters['params'] + $label, + $parameters['html'], + $parameters['actionType'], + '', + $parameters['id'], + 0, + $parameters['params'] ); $this->resprints = $button; @@ -506,19 +506,19 @@ public function dolGetButtonAction(&$parameters, $object, $action) las lineas con las mismas tipos de taxas se deben de sumar if (count($object->lines) > 12 && !empty($parameters['userRight'])) { - $label = $langs->trans('MaxInvoiceLines'); - $button = dolGetButtonAction( - $label, - $parameters['html'], - $parameters['actionType'], - '', - $parameters['id'], - 0, - $parameters['params'] - ); + $label = $langs->trans('MaxInvoiceLines'); + $button = dolGetButtonAction( + $label, + $parameters['html'], + $parameters['actionType'], + '', + $parameters['id'], + 0, + $parameters['params'] + ); - $this->resprints = $button; - return 1; + $this->resprints = $button; + return 1; } */ } } @@ -577,22 +577,6 @@ public function formObjectOptions($parameters, $object, $action) } else { echo ''; } - - echo ' - '; } /** From 440777caef0980999a3344947e6c001642cdac41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Garc=C3=ADa?= Date: Sun, 16 Aug 2026 18:10:01 +0200 Subject: [PATCH 3/4] fix: broken styles and spaces --- class/actions_autoverifactu.class.php | 238 +++++++++++++------------- 1 file changed, 121 insertions(+), 117 deletions(-) diff --git a/class/actions_autoverifactu.class.php b/class/actions_autoverifactu.class.php index fa1de76..0355c04 100644 --- a/class/actions_autoverifactu.class.php +++ b/class/actions_autoverifactu.class.php @@ -129,11 +129,11 @@ public function doActions($parameters, &$object, &$action) //en caso de tener IRPF hay que quitarselo ya que en verifactu no hay que tenerlo en cuenta // por ello le sumo el irpf al total $query = http_build_query(array( - 'nif' => $mysoc->idprof1, - 'numserie' => $object->ref, - 'fecha' => date('d-m-Y', $object->date), - 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), - 'formato' => 'json', + 'nif' => $mysoc->idprof1, + 'numserie' => $object->ref, + 'fecha' => date('d-m-Y', $object->date), + 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), + 'formato' => 'json', )); $ch = curl_init(); echo $base_url . $endpoint . '?' . $query; @@ -173,12 +173,12 @@ public function doActions($parameters, &$object, &$action) $attribute = GETPOST('attribute', 'alpha'); //evito que se editen estos campos if ( - $attribute === 'verifactu_status' || - $attribute === 'verifactu_hash' || - $attribute === 'verifactu_error' || - $attribute === 'verifactu_error_code' || - $attribute === 'verifactu_pdfLegalText' || - $attribute === 'VerifactuTimeStamp' + $attribute === 'verifactu_status' || + $attribute === 'verifactu_hash' || + $attribute === 'verifactu_error' || + $attribute === 'verifactu_error_code' || + $attribute === 'verifactu_pdfLegalText' || + $attribute === 'VerifactuTimeStamp' ) { $this->errors[] = $langs->trans('NotEdit'); $action = ''; @@ -221,7 +221,8 @@ public function doActions($parameters, &$object, &$action) } elseif ($parameters['currentcontext'] === 'admincompany') { if ($action === 'update' && autoverifactuEnabled()) { $forbidden = $mysoc->nom !== GETPOST('name') - || $mysoc->idprof1 !== GETPOST('siren'); + || $mysoc->idprof1 !== GETPOST('siren'); + if ($forbidden) { $_POST['name'] = $mysoc->nom; $_POST['siren'] = $mysoc->idprof1; @@ -254,23 +255,23 @@ public function beforePDFCreation($parameters, &$object, &$action) //?No entiendo por que regeneras el archivo xml. Una vez enviado y guardado es mejor no volver a generar. /* if ( - $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() ) { - $result = autoverifactuCheckInvoiceImmutableXML($object, 'alta'); - - if ($result < 0) { - return $result; - } + $result = autoverifactuCheckInvoiceImmutableXML($object, 'alta'); - if ($object->status >= Facture::STATUS_CLOSED) { - $result = autoverifactuCheckInvoiceImmutableXML($object, 'anulacion'); - - if (!$result < 0) { + if ($result < 0) { return $result; } + + if ($object->status >= Facture::STATUS_CLOSED) { + $result = autoverifactuCheckInvoiceImmutableXML($object, 'anulacion'); + + if (!$result < 0) { + return $result; + } } }*/ @@ -293,11 +294,11 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler) $object = $parameters['object']; $modelpdf = $object->model_pdf; if ( - $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && $modelpdf !== 'Autoverifactu' //en caso de que no tenga la plantilla autoverifactu que ya incluye el QR + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && $modelpdf !== 'Autoverifactu' //en caso de que no tenga la plantilla autoverifactu que ya incluye el QR ) { $pdf = &$parameters['pdf']; @@ -306,10 +307,10 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler) $base_url = $testMode ? VERIFACTU_TEST_COLLATION_BASE_URL : VERIFACTU_COLLATION_BASE_URL; $endpoint = '/wlpl/TIKE-CONT/ValidarQR'; $query = http_build_query(array( - 'nif' => $mysoc->idprof1, - 'numserie' => $object->ref, - 'fecha' => date('d-m-Y', $object->date), - 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), + 'nif' => $mysoc->idprof1, + 'numserie' => $object->ref, + 'fecha' => date('d-m-Y', $object->date), + 'importe' => number_format($object->total_ttc - $object->total_localtax2, 2, '.', ''), )); //El código «QR» deberá tener un tamaño entre 30x30 y 40x40 milímetros y seguir las especificaciones de la norma ISO/IEC 18004:2015 //A este respecto, se deben mantener como mínimo 2 milímetros de espacio vacío (en blanco) alrededor de los cuatro lados del código «QR», recomendándose que sean 6 milímetros. @@ -326,14 +327,14 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler) 32, 32, array( - 'border' => false, - 'padding' => 2, - 'fgcolor' => array(25, 25, 25), - 'bgcolor' => array(255, 255, 255), //margen color blanco con padding 2mm - 'module_width' => 1, - 'module_height' => 1, - ), - 30, + 'border' => false, + 'padding' => 2, + 'fgcolor' => array(25, 25, 25), + 'bgcolor' => array(255, 255, 255), //margen color blanco con padding 2mm + 'module_width' => 1, + 'module_height' => 1, + ), + 30, ); $pdf->setTopMargin($pdfhandler->tab_top + 32); $pdf->MultiCell(30, 10, 'VERI*FACTU', 0, 'C', 0, 1); @@ -360,69 +361,72 @@ public function addMoreActionsButtons($parameters, &$object, $action) { global $langs; if ( - $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && $object->array_options['options_verifactu_status'] === '1' + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && $object->array_options['options_verifactu_status'] === '1' ) { echo dolGetButtonAction( - $langs->trans('CheckIntegrity'), - 'Veri*Factu', - 'default', - $_SERVER['PHP_SELF'] . '?action=verifactu&token=' . newToken() . '&id=' . $object->id, - '', - 1, - array( - 'attr' => array( - 'class' => 'classfortooltip', - 'title' => '' - ), - ) + $langs->trans('CheckIntegrity'), + 'Veri*Factu', + 'default', + $_SERVER['PHP_SELF'] . '?action=verifactu&token=' . newToken() . '&id=' . $object->id, + '', + 1, + array( + 'attr' => array( + 'class' => 'classfortooltip', + 'title' => '' + ), + ) ); } + //Boton para mostrar los errores de factura if ( $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && $object->array_options['options_verifactu_status'] === '4' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && $object->array_options['options_verifactu_status'] === '4' ) { - echo dolGetButtonAction( - $langs->trans('fixErrors'), - $langs->trans('fixErrors'), - 'default', - $_SERVER['PHP_SELF'] . '?action=fixErrors&token=' . newToken() . '&id=' . $object->id, - '', - 1, - array( - 'attr' => array( - 'class' => 'classfortooltip', - 'title' => '' + echo dolGetButtonAction( + $langs->trans('fixErrors'), + $langs->trans('fixErrors'), + 'default', + $_SERVER['PHP_SELF'] . '?action=fixErrors&token=' . newToken() . '&id=' . $object->id, + '', + 1, + array( + 'attr' => array( + 'class' => 'classfortooltip', + 'title' => '' + ), ), - ) ); } + //permitir reenviar la facturas con errores - if ( $object->element === 'facture' - && $object->status > Facture::STATUS_DRAFT - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() - && in_array($object->array_options['options_verifactu_status'], array('2','4','5'), true) + if ( + $object->element === 'facture' + && $object->status > Facture::STATUS_DRAFT + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() + && in_array($object->array_options['options_verifactu_status'], array('2','4','5'), true) ) { echo dolGetButtonAction( - $langs->trans('VerifactuResend'), - $langs->trans('VerifactuResend'), - 'default', - $_SERVER['PHP_SELF'] . '?action=verifactuResend&token=' . newToken() . '&id=' . $object->id, - '', - 1, - array( - 'attr' => array( - 'class' => 'classfortooltip', - 'title' => '' + $langs->trans('VerifactuResend'), + $langs->trans('VerifactuResend'), + 'default', + $_SERVER['PHP_SELF'] . '?action=verifactuResend&token=' . newToken() . '&id=' . $object->id, + '', + 1, + array( + 'attr' => array( + 'class' => 'classfortooltip', + 'title' => '' + ), ), - ) ); } } @@ -445,9 +449,9 @@ public function dolGetButtonAction(&$parameters, $object, $action) global $langs; if ( - $object->element === 'facture' - && $object->type <= Facture::TYPE_DEPOSIT - && autoverifactuEnabled() + $object->element === 'facture' + && $object->type <= Facture::TYPE_DEPOSIT + && autoverifactuEnabled() ) { $url = parse_url($parameters['url']); parse_str($url['query'] ?? '', $query); @@ -455,45 +459,45 @@ public function dolGetButtonAction(&$parameters, $object, $action) $action = $query['action'] ?? null; if ( - $object->status > Facture::STATUS_DRAFT - && in_array($action, array('modif', 'reopen', 'delete'), true) - && !empty($parameters['userRight']) + $object->status > Facture::STATUS_DRAFT + && in_array($action, array('modif', 'reopen', 'delete'), true) + && !empty($parameters['userRight']) ) { $label = $langs->trans('DisabledBy'); $button = dolGetButtonAction( - $label, - $parameters['html'], - $parameters['actionType'], - '', - $parameters['id'], - 0, - $parameters['params'] + $label, + $parameters['html'], + $parameters['actionType'], + '', + $parameters['id'], + 0, + $parameters['params'] ); - $this->resprints = $button; - return 1; + $this->resprints = $button; + return 1; } elseif ($object->status == Facture::STATUS_DRAFT && $action === 'valid') { $object->fetch_thirdparty(); $thirdparty = $object->thirdparty; $valid_id = $thirdparty->idprof1 && $thirdparty->id_prof_check(1, $thirdparty); if ( - !$valid_id - && !$thirdparty->tva_intra - && !autoverifactuIsPosInvoice($object) - && !empty($parameters['userRight']) + !$valid_id + && !$thirdparty->tva_intra + && !autoverifactuIsPosInvoice($object) + && !empty($parameters['userRight']) ) { $label = $langs->trans('ThirdpartyIdProfRequired'); $button = dolGetButtonAction( - $label, - $parameters['html'], - $parameters['actionType'], - '', - $parameters['id'], - 0, - $parameters['params'] + $label, + $parameters['html'], + $parameters['actionType'], + '', + $parameters['id'], + 0, + $parameters['params'] ); $this->resprints = $button; From 897a49df4d06d591c9c8d772b3378adde6759788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Garc=C3=ADa?= Date: Sun, 16 Aug 2026 18:12:05 +0200 Subject: [PATCH 4/4] fix: broken styles and spaces --- class/actions_autoverifactu.class.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/class/actions_autoverifactu.class.php b/class/actions_autoverifactu.class.php index 0355c04..45b7496 100644 --- a/class/actions_autoverifactu.class.php +++ b/class/actions_autoverifactu.class.php @@ -171,6 +171,7 @@ public function doActions($parameters, &$object, &$action) break; case 'edit_extras': $attribute = GETPOST('attribute', 'alpha'); + //evito que se editen estos campos if ( $attribute === 'verifactu_status' || @@ -272,7 +273,7 @@ public function beforePDFCreation($parameters, &$object, &$action) if (!$result < 0) { return $result; } - } + } }*/ return 0; @@ -510,19 +511,19 @@ public function dolGetButtonAction(&$parameters, $object, $action) las lineas con las mismas tipos de taxas se deben de sumar if (count($object->lines) > 12 && !empty($parameters['userRight'])) { - $label = $langs->trans('MaxInvoiceLines'); - $button = dolGetButtonAction( - $label, - $parameters['html'], - $parameters['actionType'], - '', - $parameters['id'], - 0, - $parameters['params'] - ); + $label = $langs->trans('MaxInvoiceLines'); + $button = dolGetButtonAction( + $label, + $parameters['html'], + $parameters['actionType'], + '', + $parameters['id'], + 0, + $parameters['params'] + ); - $this->resprints = $button; - return 1; + $this->resprints = $button; + return 1; } */ } }