Fix aggiunta record da plugin

This commit is contained in:
MatteoPistorello 2022-03-11 13:01:11 +01:00
parent 9c7557b9b1
commit dc513dc29a
1 changed files with 24 additions and 22 deletions

View File

@ -502,30 +502,32 @@ if (Auth::check()) {
</li>'; </li>';
// Tab dei plugin // Tab dei plugin
$plugins = $dbo->fetchArray('SELECT id, title, options, options2 FROM zz_plugins WHERE idmodule_to='.prepare($id_module)." AND position='tab' AND enabled = 1 ORDER BY zz_plugins.order DESC"); if (!empty($id_record)) {
foreach ($plugins as $plugin) { $plugins = $dbo->fetchArray('SELECT id, title, options, options2 FROM zz_plugins WHERE idmodule_to='.prepare($id_module)." AND position='tab' AND enabled = 1 ORDER BY zz_plugins.order DESC");
foreach ($plugins as $plugin) {
//Badge count per record plugin //Badge count per record plugin
$count = 0; $count = 0;
if (!empty($plugin['options2'])){ if (!empty($plugin['options2'])){
$opt = json_decode($plugin['options2'], true); $opt = json_decode($plugin['options2'], true);
}else{ }else{
$opt = json_decode($plugin['options'], true); $opt = json_decode($plugin['options'], true);
}
if (!empty($opt)){
$q = str_replace('|id_parent|', $id_record, $opt['main_query'][0]['query']);
$count = $dbo->fetchNum($q);
}
echo '
<li data-toggle="control-sidebar">
<a data-toggle="tab" href="#tab_'.$plugin['id'].'" id="link-tab_'.$plugin['id'].'">
'.$plugin['title'].'
<span class="badge pull-right">'.($count>0 ? $count: '').'</span>
</a>
</li>';
} }
if (!empty($opt)){
$q = str_replace('|id_parent|', $id_record, $opt['main_query'][0]['query']);
$count = $dbo->fetchNum($q);
}
echo '
<li data-toggle="control-sidebar">
<a data-toggle="tab" href="#tab_'.$plugin['id'].'" id="link-tab_'.$plugin['id'].'">
'.$plugin['title'].'
<span class="badge">'.($count>0 ? $count: '').'</span>
</a>
</li>';
} }
// Tab per le note interne // Tab per le note interne
@ -536,7 +538,7 @@ if (Auth::check()) {
<li data-toggle="control-sidebar" class="bg-info"> <li data-toggle="control-sidebar" class="bg-info">
<a data-toggle="tab" href="#tab_note" id="link-tab_note"> <a data-toggle="tab" href="#tab_note" id="link-tab_note">
'.tr('Note interne').' '.tr('Note interne').'
<span class="badge">'.($notes->count() ?: '').'</span> <span class="badge pull-right">'.($notes->count() ?: '').'</span>
</a> </a>
</li>'; </li>';
} }