mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-03 17:27:29 +01:00
Aggiunta bulk per cambiare la categoria degli articoli
This commit is contained in:
parent
3577327acd
commit
3f4e813007
@ -170,6 +170,29 @@ switch (post('op')) {
|
|||||||
|
|
||||||
download($file, 'articoli.csv');
|
download($file, 'articoli.csv');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'change-categoria':
|
||||||
|
$categoria = post('id_categoria');
|
||||||
|
$n_articoli = 0;
|
||||||
|
|
||||||
|
foreach ($id_records as $id) {
|
||||||
|
$articolo = Articolo::find($id);
|
||||||
|
$articolo->id_categoria = $categoria;
|
||||||
|
$articolo->id_sottocategoria = null;
|
||||||
|
$articolo->save();
|
||||||
|
|
||||||
|
++$n_articoli;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($n_articoli > 0) {
|
||||||
|
flash()->info(tr('Categoria cambiata a _NUM_ articoli!', [
|
||||||
|
'_NUM_' => $n_articoli,
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
flash()->warning(tr('Nessun articolo modificato!'));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App::debug()) {
|
if (App::debug()) {
|
||||||
@ -255,4 +278,15 @@ $operations['crea-preventivo'] = [
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$operations['change-categoria'] = [
|
||||||
|
'text' => '<span><i class="fa fa-briefcase"></i> '.tr('Aggiorna categoria').'</span>',
|
||||||
|
'data' => [
|
||||||
|
'title' => tr('Cambiare la categoria?'),
|
||||||
|
'msg' => tr('Per ciascun articolo selezionato, verrà modificata la categoria').'
|
||||||
|
<br><br>{[ "type": "select", "label": "'.tr('Categoria').'", "name": "id_categoria", "required": 1, "ajax-source": "categorie" ]}',
|
||||||
|
'button' => tr('Procedi'),
|
||||||
|
'class' => 'btn btn-lg btn-warning',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
return $operations;
|
return $operations;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user