Compare commits

...

3 Commits

Author SHA1 Message Date
valentina 8b46f867a2 Fix link al plugin 2024-07-04 12:54:08 +02:00
valentina 5a513a13c4 Aggiunto avviso nel caso di scadenza durante mese di chiusura azienda 2024-07-04 12:53:58 +02:00
valentina bc2f91f3c0 Fix eliminazione regola pagamento 2024-07-04 12:04:05 +02:00
5 changed files with 25 additions and 5 deletions

View File

@ -26,6 +26,26 @@ $numero = $documento->numero_esterno ?: $documento->numero;
$id_modulo_banche = Module::where('name', 'Banche')->first()->id;
$id_modulo_prima_nota = Module::where('name', 'Prima nota')->first()->id;
$mesi_chiusura = $dbo->fetchArray('SELECT mese FROM an_pagamenti_anagrafiche WHERE idanagrafica = '.$record['idanagrafica']);
$scadenza_in_chiusura = 0;
foreach ($scadenze as $scadenza) {
$scadenza = (array) $scadenza;
foreach ($mesi_chiusura as $mese) {
if (date('m', strtotime(($scadenza['data_concordata'] && $scadenza['data_concordata'] != '0000-00-00') ? $scadenza['data_concordata'] : $scadenza['scadenza'])) == str_pad($mese['mese'], 2, '0', STR_PAD_LEFT)) {
$scadenza_in_chiusura = 1;
}
}
}
if ($scadenza_in_chiusura) {
echo '
<div class="alert alert-warning">
<i class="fa fa-warning"></i> '.tr("E' presente una scadenza che rientra nel periodo di chiusura dell'azienda, impostato nel plugin").'
<b>'.Plugins::link('Regole pagamenti', $scadenza['idanagrafica'], tr('Regole pagamenti')).'</b>
</div>';
}
echo '
<form action="" method="post" id="edit-form">
<input type="hidden" name="op" value="update">

View File

@ -51,8 +51,8 @@ switch ($operazione) {
break;
case 'deletepagamento':
$id = filter('id');
$dbo->query('DELETE FROM `an_pagamenti_anagrafiche` WHERE `id` = '.prepare($id).'');
$id_record = post('id_record');
$dbo->query('DELETE FROM `an_pagamenti_anagrafiche` WHERE `id` = '.prepare($id_record).'');
flash()->info(tr('Regola pagamento eliminata!'));

View File

@ -88,7 +88,7 @@ echo '
backto: "record-edit",
hash: hash,
op: "deletepagamento",
id: "'.$record['id'].'",
id_record: "'.$record['id'].'",
id_plugin: "'.$id_plugin.'",
id_module: "'.$id_module.'",
id_parent: "'.$id_parent.'",

View File

@ -282,7 +282,7 @@ class Modules
$testo = $testo.' <i class="fa fa-external-link"></i>';
}
$module = self::get(Module::where('name', $modulo)->first()->id);
$module = self::get(Module::where('name', $modulo)->orWhere('id', $modulo)->first()->id);
$extra .= !empty($blank) ? ' target="_blank"' : '';

View File

@ -135,7 +135,7 @@ class Plugins
if (!empty($plugin) && in_array($plugin->permission, ['r', 'rw'])) {
$anchor = 'tab_'.$plugin->id;
return Modules::link($plugin->module->name, $id_record, $testo, $alternativo, $extra, $blank, $anchor);
return Modules::link($plugin->idmodule_to, $id_record, $testo, $alternativo, $extra, $blank, $anchor);
}
return $alternativo;