Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 18 additions & 29 deletions class/actions_autoverifactu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ||
Expand All @@ -179,9 +180,9 @@ public function doActions($parameters, &$object, &$action)
$attribute === 'verifactu_error_code' ||
$attribute === 'verifactu_pdfLegalText' ||
$attribute === 'VerifactuTimeStamp'
) {
$this->errors[] = $langs->trans('NotEdit');
$action = '';
) {
$this->errors[] = $langs->trans('NotEdit');
$action = '';
}
break;
case 'add':
Expand Down Expand Up @@ -222,6 +223,7 @@ public function doActions($parameters, &$object, &$action)
if ($action === 'update' && autoverifactuEnabled()) {
$forbidden = $mysoc->nom !== GETPOST('name')
|| $mysoc->idprof1 !== GETPOST('siren');

if ($forbidden) {
$_POST['name'] = $mysoc->nom;
$_POST['siren'] = $mysoc->idprof1;
Expand Down Expand Up @@ -329,7 +331,7 @@ public function printUnderHeaderPDFline($parameters, &$pdfhandler)
'border' => false,
'padding' => 2,
'fgcolor' => array(25, 25, 25),
'bgcolor' => array(255, 255, 255), //margen color blanco con padding 2mm
'bgcolor' => array(255, 255, 255), //margen color blanco con padding 2mm
'module_width' => 1,
'module_height' => 1,
),
Expand Down Expand Up @@ -381,14 +383,15 @@ public function addMoreActionsButtons($parameters, &$object, $action)
)
);
}

//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(
) {
echo dolGetButtonAction(
$langs->trans('fixErrors'),
$langs->trans('fixErrors'),
'default',
Expand All @@ -400,17 +403,19 @@ public function addMoreActionsButtons($parameters, &$object, $action)
'class' => 'classfortooltip',
'title' => ''
),
)
),
);
}

//permitir reenviar la facturas con errores
if ( $object->element === 'facture'
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(
) {
echo dolGetButtonAction(
$langs->trans('VerifactuResend'),
$langs->trans('VerifactuResend'),
'default',
Expand All @@ -422,7 +427,7 @@ public function addMoreActionsButtons($parameters, &$object, $action)
'class' => 'classfortooltip',
'title' => ''
),
)
),
);
}
}
Expand Down Expand Up @@ -471,8 +476,8 @@ public function dolGetButtonAction(&$parameters, $object, $action)
$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;
Expand Down Expand Up @@ -577,22 +582,6 @@ public function formObjectOptions($parameters, $object, $action)
} else {
echo '<style>.field_options_verifactu_rectification_type span.valignmiddle{font-weight:bold}</style>';
}

echo '
<style>
tr:has(#facture_extras_verifactu_error_' . $object->id . ') .editfielda {
display: none !important;
}
tr:has(#facture_extras_verifactu_hash_' . $object->id . ') .editfielda {
display: none !important;
}
tr:has(#facture_extras_verifactu_status_' . $object->id . ') .editfielda {
display: none !important;
}
.field_options_verifactu_rectification_type span.valignmiddle{
font-weight: bold;
}
</style>';
}

/**
Expand Down
52 changes: 31 additions & 21 deletions core/modules/modAutoverifactu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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'),
Expand All @@ -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',
Expand All @@ -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(
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -429,6 +435,7 @@ public function init($options = '')
'autoverifactu@autoverifactu',
'isModEnabled("autoverifactu")',
);

// hash verifactu
$extrafields->addExtraField(
'verifactu_hash',
Expand All @@ -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',
Expand All @@ -471,6 +479,7 @@ public function init($options = '')
'autoverifactu@autoverifactu',
'isModEnabled("autoverifactu")',
);

// Timestamp de validación de la factura.
$extrafields->addExtraField(
'verifactu_tms',
Expand All @@ -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(
Expand Down
100 changes: 0 additions & 100 deletions css/admin.css.php

This file was deleted.

Loading
Loading