diff --git a/plugins/exportFE/actions.php b/plugins/exportFE/actions.php
index 2e1c348a5..75ddac123 100644
--- a/plugins/exportFE/actions.php
+++ b/plugins/exportFE/actions.php
@@ -27,6 +27,11 @@ switch (filter('op')) {
case 'send':
$result = Interaction::sendXML($id_record);
+ // Aggiornamento dello stato
+ database()->update('co_documenti', [
+ 'codice_stato_fe' => 'WAIT',
+ ], ['id' => $id_record]);
+
echo json_encode([
'sent' => $result,
]);
diff --git a/plugins/exportFE/edit.php b/plugins/exportFE/edit.php
index 16d66dabc..a3e171f3d 100644
--- a/plugins/exportFE/edit.php
+++ b/plugins/exportFE/edit.php
@@ -149,13 +149,49 @@ echo '
';
if (Interaction::isEnabled()) {
+ $send = $generated && $record['codice_stato_fe'] == 'GEN';
+
echo '
-
+
+ ';
}
echo '
@@ -182,36 +218,5 @@ if ($generated) {
}
});
});
-
- function send(btn) {
- var restore = buttonLoading(btn);
-
- $.ajax({
- url: globals.rootdir + "/actions.php",
- type: "post",
- data: {
- op: "send",
- id_module: "'.$id_module.'",
- id_plugin: "'.$id_plugin.'",
- id_record: "'.$id_record.'",
- },
- success: function(data) {
- data = JSON.parse(data);
-
- if (data.sent) {
- swal("'.tr('Fattura inviata!').'", "'.tr('Fattura inoltrata con successo').'", "success");
- } else {
- swal("'.tr('Invio fallito').'", "'.tr("L'invio della fattura è fallito").'", "error");
- }
-
- buttonRestore(btn, restore);
- },
- error: function(data) {
- swal("'.tr('Errore').'", "'.tr('Errore durante il salvataggio').'", "error");
-
- buttonRestore(btn, restore);
- }
- });
- }
';
}
diff --git a/update/2_4_4.sql b/update/2_4_4.sql
index a8f718097..827f7a08e 100644
--- a/update/2_4_4.sql
+++ b/update/2_4_4.sql
@@ -19,3 +19,6 @@ ALTER TABLE `co_documenti` DROP `xml_generated_at`;
UPDATE `zz_views` SET `query` = '(SELECT `icon` FROM `fe_stati_documento` WHERE `codice` = `codice_stato_fe`)' WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita') AND `name` = 'icon_FE';
UPDATE `zz_views` SET `query` = '(SELECT `descrizione` FROM `fe_stati_documento` WHERE `codice` = `codice_stato_fe`)' WHERE `id_module` = (SELECT `id` FROM `zz_modules` WHERE `name` = 'Fatture di vendita') AND `name` = 'icon_title_FE';
+
+INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES
+(NULL, 'OSMCloud Services API Token', '', 'string', 1, 'Fatturazione Elettronica', 11);