2019-05-10 06:32:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Plugins\ImportFE;
|
|
|
|
|
|
|
|
use Common\HookManager;
|
2019-05-10 17:14:34 +02:00
|
|
|
use Modules;
|
2019-05-10 06:32:06 +02:00
|
|
|
|
|
|
|
class InvoiceHook extends HookManager
|
|
|
|
{
|
|
|
|
public function manage()
|
|
|
|
{
|
2019-07-24 17:17:54 +02:00
|
|
|
$list = Interaction::getInvoiceList();
|
2019-05-10 06:32:06 +02:00
|
|
|
|
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function response($results)
|
|
|
|
{
|
|
|
|
$count = count($results);
|
2019-06-29 11:12:43 +02:00
|
|
|
$notify = false;
|
2019-05-10 06:32:06 +02:00
|
|
|
|
2019-05-10 17:14:34 +02:00
|
|
|
$module = Modules::get('Fatture di acquisto');
|
2019-06-29 11:12:43 +02:00
|
|
|
$plugins = $module->plugins;
|
2019-05-10 17:14:34 +02:00
|
|
|
|
2019-06-29 11:12:43 +02:00
|
|
|
if (!empty($plugins)) {
|
|
|
|
$notify = !empty($count);
|
|
|
|
|
|
|
|
$plugin = $plugins->first(function ($value, $key) {
|
|
|
|
return $value->name == 'Fatturazione Elettronica';
|
|
|
|
});
|
|
|
|
|
|
|
|
$link = ROOTDIR.'/controller.php?id_module='.$module->id.'#tab_'.$plugin->id;
|
|
|
|
}
|
2019-05-24 20:15:05 +02:00
|
|
|
|
|
|
|
$message = tr('Ci sono _NUM_ fatture passive da importare', [
|
|
|
|
'_NUM_' => $count,
|
|
|
|
]);
|
2019-05-16 04:52:16 +02:00
|
|
|
|
2019-05-10 06:32:06 +02:00
|
|
|
return [
|
2019-05-24 20:15:05 +02:00
|
|
|
'icon' => 'fa fa-file-text-o text-yellow',
|
2019-05-10 17:14:34 +02:00
|
|
|
'link' => $link,
|
2019-05-13 19:21:46 +02:00
|
|
|
'message' => $message,
|
2019-06-29 11:12:43 +02:00
|
|
|
'notify' => $notify,
|
2019-05-10 06:32:06 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|