mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
fix: modulo categorie contratti
This commit is contained in:
@@ -95,8 +95,8 @@ switch (filter('op')) {
|
||||
$id = $id_record;
|
||||
}
|
||||
|
||||
if ($dbo->fetchNum('SELECT * FROM `co_contratti` WHERE (`id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT `id` FROM `co_categorie` WHERE `parent`='.prepare($id).')) AND `deleted_at` IS NULL') == 0) {
|
||||
$dbo->query('DELETE FROM `co_categorie` WHERE `id`='.prepare($id));
|
||||
if ($dbo->fetchNum('SELECT `mg_articoli`.* FROM `mg_articoli` WHERE (`id_categoria`='.prepare($id).' OR `id_sottocategoria`='.prepare($id).' OR `id_sottocategoria` IN (SELECT `id` FROM `co_categorie_contratti` WHERE `parent`='.prepare($id).')) AND `deleted_at` IS NULL') == 0) {
|
||||
$dbo->query('DELETE FROM `co_categorie_contratti` WHERE `id`='.prepare($id));
|
||||
|
||||
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo!', [
|
||||
'_TYPE_' => 'categoria',
|
||||
|
||||
@@ -50,7 +50,7 @@ if (isset($id_original)) {
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "<?php echo $categoria->nota; ?>" ]}
|
||||
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "<?php echo $categoria ? $categoria->getTranslation('note') : ''; ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ use Models\Module;
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "$note$" ]}
|
||||
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "<?php echo $categoria->getTranslation('note'); ?>" ]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -65,7 +65,7 @@ use Models\Module;
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped table-hover table-condensed">
|
||||
<table class="table table-striped table-hover table-sm">
|
||||
<tr>
|
||||
<th><?php echo tr('Nome'); ?></th>
|
||||
<th><?php echo tr('Colore'); ?></th>
|
||||
@@ -89,7 +89,41 @@ use Models\Module;
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
$elementi = $dbo->fetchArray('SELECT `co_contratti`.`id`, `co_contratti`.`numero` FROM `co_contratti` WHERE (`id_categoria`='.prepare($id_record).' OR `id_sottocategoria`='.prepare($id_record).' OR `id_sottocategoria` IN (SELECT `id` FROM `co_categorie_contratti` WHERE `parent`='.prepare($id_record).')) ');
|
||||
|
||||
if (!empty($elementi)) {
|
||||
echo '
|
||||
<div class="card card-warning collapsable collapsed-card">
|
||||
<div class="card-header with-border">
|
||||
<h3 class="card-title"><i class="fa fa-warning"></i> '.tr('Contratti collegati: _NUM_', [
|
||||
'_NUM_' => count($elementi),
|
||||
]).'</h3>
|
||||
<div class="card-tools pull-right">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul>';
|
||||
|
||||
foreach ($elementi as $elemento) {
|
||||
$descrizione = tr('Contratto _NUMERO_', [
|
||||
'_NUMERO_' => $elemento['numero'],
|
||||
]);
|
||||
$modulo = 'Contratti';
|
||||
$id = $elemento['id'];
|
||||
|
||||
echo '
|
||||
<li>'.Modules::link($modulo, $id, $descrizione).'</li>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</ul>
|
||||
</div>
|
||||
</div>';
|
||||
} else {
|
||||
echo '
|
||||
<a class="btn btn-danger ask" data-backto="record-list">
|
||||
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
||||
</a>';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ include_once __DIR__.'/../../core.php';
|
||||
use Modules\Contratti\CategoriaContratto as Categoria;
|
||||
|
||||
if (!empty($id_record)) {
|
||||
$record = $dbo->fetchOne('SELECT * FROM `co_categorie_contratti` LEFT JOIN `co_categorie_contratti_lang` ON (`co_categorie_contratti`.`id`=`co_categorie_contratti_lang`.`id_record` AND `co_categorie_contratti_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `co_categorie_contratti`.`id`='.prepare($id_record));
|
||||
$record = $dbo->fetchOne('SELECT `co_categorie_contratti`.*, `co_categorie_contratti_lang`.`title` FROM `co_categorie_contratti` LEFT JOIN `co_categorie_contratti_lang` ON (`co_categorie_contratti`.`id`=`co_categorie_contratti_lang`.`id_record` AND `co_categorie_contratti_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') WHERE `co_categorie_contratti`.`id`='.prepare($id_record));
|
||||
|
||||
$categoria = Categoria::find($id_record);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ foreach ($subcategorie as $sub) {
|
||||
<tr>
|
||||
<td>'.$sub->getTranslation('title').'</td>
|
||||
<td>'.$sub->colore.'</td>
|
||||
<td>'.$sub->nota.'</td>
|
||||
<td>'.$sub->getTranslation('note').'</td>
|
||||
<td>
|
||||
<a class="btn btn-warning btn-sm" title="Modifica riga" onclick="launch_modal(\''.tr('Modifica sottocategoria').'\', \''.base_path().'/add.php?id_module='.$id_module.'&id_record='.$sub->id.'&id_original='.$id_record.'\');"><i class="fa fa-edit"></i></a>
|
||||
<a class="btn btn-sm btn-danger ask '.(($n_articoli > 0) ? 'disabled tip' : '').'" data-backto="record-edit" data-id="'.$sub['id'].'" title="'.(($n_articoli > 0) ? 'Sottocategoria collegata a '.$n_articoli.' articoli' : '').'">
|
||||
|
||||
Reference in New Issue
Block a user