mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 08:56:48 +01:00
Miglioramento gestione stati FE
This commit is contained in:
parent
b15950c887
commit
2ae5738408
@ -27,6 +27,11 @@ switch (filter('op')) {
|
|||||||
case 'send':
|
case 'send':
|
||||||
$result = Interaction::sendXML($id_record);
|
$result = Interaction::sendXML($id_record);
|
||||||
|
|
||||||
|
// Aggiornamento dello stato
|
||||||
|
database()->update('co_documenti', [
|
||||||
|
'codice_stato_fe' => 'WAIT',
|
||||||
|
], ['id' => $id_record]);
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'sent' => $result,
|
'sent' => $result,
|
||||||
]);
|
]);
|
||||||
|
@ -149,13 +149,49 @@ echo '
|
|||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
if (Interaction::isEnabled()) {
|
if (Interaction::isEnabled()) {
|
||||||
|
$send = $generated && $record['codice_stato_fe'] == 'GEN';
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
|
||||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||||
|
|
||||||
<button onclick="send(this)" class="btn btn-success btn-lg '.($generated ? '' : 'disabled').'" target="_blank" '.($generated ? '' : 'disabled').'>
|
<button onclick="send(this)" class="btn btn-success btn-lg '.($send ? '' : 'disabled').'" target="_blank" '.($send ? '' : 'disabled').'>
|
||||||
<i class="fa fa-paper-plane"></i> '.tr('Invia').'
|
<i class="fa fa-paper-plane"></i> '.tr('Invia').'
|
||||||
</button>';
|
</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
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);
|
||||||
|
buttonRestore(btn, restore);
|
||||||
|
|
||||||
|
if (data.sent) {
|
||||||
|
swal("'.tr('Fattura inviata!').'", "'.tr('Fattura inoltrata con successo').'", "success");
|
||||||
|
|
||||||
|
$(btn).attr("disabled", true).addClass("disabled");
|
||||||
|
} else {
|
||||||
|
swal("'.tr('Invio fallito').'", "'.tr("L'invio della fattura è fallito").'", "error");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
swal("'.tr('Errore').'", "'.tr('Errore durante il salvataggio').'", "error");
|
||||||
|
|
||||||
|
buttonRestore(btn, restore);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
@ -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 `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';
|
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user