mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Aggiunto deleted_at in Articoli
This commit is contained in:
parent
8bc57a533f
commit
27c97da691
@ -5,7 +5,6 @@ include_once __DIR__.'/../../core.php';
|
||||
switch (post('op')) {
|
||||
// Aggiunta articolo
|
||||
case 'add':
|
||||
|
||||
//Se non specifico il codice articolo lo imposto uguale all'id della riga
|
||||
if (empty(post('codice'))) {
|
||||
$codice = $dbo->fetchOne('SELECT (MAX(id)+1) as codice FROM mg_articoli')['codice'];
|
||||
@ -280,13 +279,7 @@ switch (post('op')) {
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
// Fix per i seriali utilizzati
|
||||
$dbo->query('UPDATE mg_prodotti SET id_articolo = NULL WHERE id_articolo='.prepare($id_record));
|
||||
|
||||
$dbo->query('DELETE FROM mg_articoli WHERE id='.prepare($id_record));
|
||||
$dbo->query('DELETE FROM mg_movimenti WHERE idarticolo='.prepare($id_record));
|
||||
//$dbo->query('DELETE FROM mg_prodotti WHERE id_articolo='.prepare($id_record));
|
||||
//$dbo->query('DELETE FROM mg_articoli_automezzi WHERE idarticolo='.prepare($id_record));
|
||||
$articolo->delete();
|
||||
|
||||
flash()->info(tr('Articolo eliminato!'));
|
||||
break;
|
||||
|
@ -79,7 +79,8 @@ switch ($resource) {
|
||||
$filter[] = 'mg_articoli.id='.prepare($element);
|
||||
}
|
||||
|
||||
$where[] = 'attivo = 1';
|
||||
$where[] = 'mg_articoli.attivo = 1';
|
||||
$where[] = 'mg_articoli.deleted_at IS NULL';
|
||||
|
||||
// Filtro articolo solo per documenti di vendita
|
||||
if ($superselect['dir'] == 'entrata' && isset($superselect['idsede_partenza'])) {
|
||||
@ -196,23 +197,6 @@ switch ($resource) {
|
||||
|
||||
break;
|
||||
|
||||
case 'prodotti_lotti':
|
||||
$query = 'SELECT DISTINCT lotto AS descrizione FROM mg_prodotti |where|';
|
||||
|
||||
$where[] = 'idarticolo='.prepare($superselect['idarticolo']);
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'lotto='.prepare($element);
|
||||
}
|
||||
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'lotto LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
$custom['id'] = 'descrizione';
|
||||
|
||||
break;
|
||||
|
||||
case 'prodotti_serial':
|
||||
$query = 'SELECT DISTINCT serial AS descrizione FROM mg_prodotti |where|';
|
||||
|
||||
@ -230,24 +214,6 @@ switch ($resource) {
|
||||
|
||||
break;
|
||||
|
||||
case 'prodotti_altro':
|
||||
$query = 'SELECT DISTINCT altro AS descrizione FROM mg_prodotti |where|';
|
||||
|
||||
$where[] = 'id_articolo='.prepare($superselect['idarticolo']);
|
||||
$where[] = 'lotto='.prepare($superselect['lotto']);
|
||||
$where[] = 'serial='.prepare($superselect['serial']);
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'altro='.prepare($element);
|
||||
}
|
||||
if (!empty($search)) {
|
||||
$search_fields[] = 'altro LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
$custom['id'] = 'descrizione';
|
||||
|
||||
break;
|
||||
|
||||
case 'categorie':
|
||||
$query = 'SELECT id, nome AS descrizione FROM mg_categorie |where| ORDER BY id';
|
||||
|
||||
|
@ -6,9 +6,12 @@ use Common\Model;
|
||||
use Modules;
|
||||
use Modules\Interventi\Components\Articolo as ArticoloIntervento;
|
||||
use Uploads;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Articolo extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'mg_articoli';
|
||||
|
||||
/**
|
||||
|
@ -536,12 +536,12 @@ if (!$block_edit) {
|
||||
}
|
||||
|
||||
// Lettura articoli
|
||||
$art_query = 'SELECT COUNT(*) AS tot FROM mg_articoli WHERE attivo = 1';
|
||||
$art_query = 'SELECT id FROM mg_articoli WHERE attivo = 1 AND deleted_at IS NULL';
|
||||
if ($dir == 'entrata') {
|
||||
$art_query .= ' AND (qta > 0 OR servizio = 1)';
|
||||
}
|
||||
|
||||
$articoli = $dbo->fetchArray($art_query)[0]['tot'];
|
||||
$articoli = $dbo->fetchNum($art_query);
|
||||
echo '
|
||||
<a class="btn btn-sm btn-primary'.(!empty($articoli) ? '' : ' disabled').'" data-href="'.$structure->fileurl('row-add.php').'?id_module='.$id_module.'&id_record='.$id_record.'&is_articolo" data-toggle="tooltip" data-title="'.tr('Aggiungi articolo').'">
|
||||
<i class="fa fa-plus"></i> '.tr('Articolo').'
|
||||
|
@ -312,3 +312,7 @@ ORDER BY `co_documenti`.`data` DESC, CAST(`co_documenti`.`numero_esterno` AS UNS
|
||||
|
||||
-- Rimozione Pianificazione fatturazione
|
||||
DELETE FROM `zz_plugins` WHERE `name` = 'Pianificazione fatturazione';
|
||||
|
||||
-- Aggiunta deleted_at su mg_articoli
|
||||
ALTER TABLE `mg_articoli` ADD `deleted_at` timestamp NULL DEFAULT NULL;
|
||||
UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `mg_articoli` WHERE 1=1 AND `deleted_at` IS NULL HAVING 2=2 ORDER BY `descrizione`' WHERE `name` = 'Articoli';
|
||||
|
Loading…
x
Reference in New Issue
Block a user