Aggiunta azione di gruppo per cambiare stato a gli ordini

This commit is contained in:
MatteoPistorello 2021-01-19 12:20:06 +01:00
parent 9861e410f1
commit e2d209dfdf
2 changed files with 37 additions and 6 deletions

View File

@ -252,7 +252,7 @@ return [
'cambia_stato' => [
'text' => '<span><i class="fa fa-refresh"></i> '.tr('Cambia stato'),
'data' => [
'title' => tr('Vuoi davvero cambinare le stato per questi interventi?'),
'title' => tr('Vuoi davvero cambiare lo stato per questi interventi?'),
'msg' => tr('Seleziona lo stato in cui spostare tutti gli interventi non completati').'.<br>
<br>{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento WHERE deleted_at IS NULL" ]}',
'button' => tr('Procedi'),

View File

@ -112,6 +112,29 @@ switch (post('op')) {
flash()->warning(tr('Nessun ordine fatturato!'));
}
break;
case 'cambia_stato':
$id_stato = post('id_stato');
$n_ordini = 0;
foreach ($id_records as $id) {
$dbo->update('or_ordini', [
'idstatoordine' => $id_stato,
], ['id' => $id]);
++$n_ordini;
}
if ($n_ordini > 0) {
flash()->info(tr('Stato cambiato a _NUM_ ordini!', [
'_NUM_' => $n_ordini,
]));
} else {
flash()->warning(tr('Nessun ordine modificato!'));
}
break;
}
if ($module['name'] == 'Ordini cliente') {
$operations['crea_fattura'] = [
@ -126,8 +149,16 @@ $operations['crea_fattura'] = [
],
];
}
if($operations){
return $operations;
} else {
return;
}
$operations['cambia_stato'] = [
'text' => '<span><i class="fa fa-refresh"></i> '.tr('Cambia stato'),
'data' => [
'title' => tr('Vuoi davvero cambiare lo stato per questi ordini?'),
'msg' => tr('Seleziona lo stato in cui spostare tutti gli ordini').'.<br>
<br>{[ "type": "select", "label": "'.tr('Stato').'", "name": "id_stato", "required": 1, "values": "query=SELECT id, descrizione FROM or_statiordine" ]}',
'button' => tr('Procedi'),
'class' => 'btn btn-lg btn-warning',
'blank' => false,
],
];
return $operations;