mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 17:07:01 +01:00
Aggiunto cron per importazione ricevute FE ogni 4 ore
This commit is contained in:
parent
6b2c4b2825
commit
6b2dd0f11a
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
$skip_permissions = true;
|
||||
|
||||
include_once __DIR__.'/../core.php';
|
||||
|
||||
use Plugins\ReceiptFE\Interaction;
|
||||
use Plugins\ReceiptFE\ReceiptHook;
|
||||
use Plugins\ReceiptFE\Ricevuta;
|
||||
|
||||
$list = Interaction::getReceiptList();
|
||||
|
||||
if( count($list) == 0){
|
||||
echo 'Nessuna ricevuta da importare';
|
||||
} else {
|
||||
echo count($list)." ricevute da importare:\n";
|
||||
|
||||
foreach ($list as $element) {
|
||||
$name = $element['name'];
|
||||
echo '[*] '.$name."...";
|
||||
Interaction::getReceipt($name);
|
||||
|
||||
$fattura = null;
|
||||
try {
|
||||
$receipt = new Ricevuta($name, $content);
|
||||
$receipt->save();
|
||||
|
||||
$fattura = $receipt->getFattura()->numero_esterno;
|
||||
|
||||
$receipt->delete();
|
||||
|
||||
Interaction::processReceipt($name);
|
||||
echo "OK\n";
|
||||
} catch (UnexpectedValueException $e) {
|
||||
echo "ERRORE\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
41
plugins/receiptFE/src/ReceiptTask.php
Normal file
41
plugins/receiptFE/src/ReceiptTask.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||
* Copyright (C) DevCode s.n.c.
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Plugins\ReceiptFE;
|
||||
|
||||
use Tasks\Manager;
|
||||
|
||||
class ReceiptTask extends Manager
|
||||
{
|
||||
public function execute()
|
||||
{
|
||||
if (!Interaction::isEnabled()){
|
||||
return;
|
||||
}
|
||||
|
||||
$list = Interaction::getReceiptList();
|
||||
|
||||
// Esecuzione dell'importazione
|
||||
foreach ($list as $element) {
|
||||
$name = $element['name'];
|
||||
|
||||
Ricevuta::process($name);
|
||||
}
|
||||
}
|
||||
}
|
@ -26,7 +26,8 @@ INSERT INTO `zz_cache` (`id`, `name`, `content`, `valid_time`, `expire_at`) VALU
|
||||
(NULL, 'Disabilita cron', '', '1 month', NULL);
|
||||
|
||||
INSERT INTO `zz_tasks` (`id`, `name`, `class`, `expression`, `last_executed_at`) VALUES
|
||||
(NULL, 'Backup automatico', 'Modules\\Backups\\BackupTask', '0 1 * * *', NULL);
|
||||
(NULL, 'Backup automatico', 'Modules\\Backups\\BackupTask', '0 1 * * *', NULL)
|
||||
(NULL, 'Importazione automatica Ricevute FE', 'Plugins\\ReceiptFE\\ReceiptTask', '0 */4 * * *', NULL);
|
||||
|
||||
DELETE FROM `zz_hooks` WHERE `class` = 'Modules\\Backups\\BackupHook';
|
||||
|
||||
@ -322,4 +323,4 @@ UPDATE `dt_ddt` SET `idcausalet` = (SELECT `id` FROM `dt_causalet`) WHERE EXISTS
|
||||
UPDATE `zz_modules` SET `options` = 'custom' WHERE `name` = 'Impostazioni';
|
||||
|
||||
-- Fix logica query Scadenzario
|
||||
UPDATE `zz_modules` SET `options2` = 'SELECT |select| FROM `co_scadenziario`\r\n LEFT JOIN `co_documenti` ON `co_scadenziario`.`iddocumento` = `co_documenti`.`id`\r\n LEFT JOIN `an_anagrafiche` ON `co_documenti`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `co_pagamenti` ON `co_documenti`.`idpagamento` = `co_pagamenti`.`id`\r\n LEFT JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento` = `co_tipidocumento`.`id`\r\n LEFT JOIN `co_statidocumento` ON `co_documenti`.`idstatodocumento` = `co_statidocumento`.`id`\r\nWHERE 1=1 AND\r\n (`co_scadenziario`.`scadenza` BETWEEN \'|period_start|\' AND \'|period_end|\' OR ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`)) AND\r\n (`co_statidocumento`.`descrizione` IS NULL OR `co_statidocumento`.`descrizione` IN(\'Emessa\',\'Parzialmente pagato\',\'Pagato\'))\r\nHAVING 2=2\r\nORDER BY `scadenza` ASC' WHERE `zz_modules`.`name` = 'Scadenzario';
|
||||
UPDATE `zz_modules` SET `options2` = 'SELECT |select| FROM `co_scadenziario`\r\n LEFT JOIN `co_documenti` ON `co_scadenziario`.`iddocumento` = `co_documenti`.`id`\r\n LEFT JOIN `an_anagrafiche` ON `co_documenti`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`\r\n LEFT JOIN `co_pagamenti` ON `co_documenti`.`idpagamento` = `co_pagamenti`.`id`\r\n LEFT JOIN `co_tipidocumento` ON `co_documenti`.`idtipodocumento` = `co_tipidocumento`.`id`\r\n LEFT JOIN `co_statidocumento` ON `co_documenti`.`idstatodocumento` = `co_statidocumento`.`id`\r\nWHERE 1=1 AND\r\n (`co_scadenziario`.`scadenza` BETWEEN \'|period_start|\' AND \'|period_end|\' OR ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`)) AND\r\n (`co_statidocumento`.`descrizione` IS NULL OR `co_statidocumento`.`descrizione` IN(\'Emessa\',\'Parzialmente pagato\',\'Pagato\'))\r\nHAVING 2=2\r\nORDER BY `scadenza` ASC' WHERE `zz_modules`.`name` = 'Scadenzario';
|
||||
|
Loading…
x
Reference in New Issue
Block a user