1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-27 16:23:19 +01:00

Correzioni minori

This commit is contained in:
Dasc3er 2021-09-01 13:27:11 +02:00
parent a4ab015a2a
commit 9585ef79f9
2 changed files with 12 additions and 1 deletions

View File

@ -180,6 +180,7 @@ switch (post('op')) {
if (!empty($_FILES) && !empty($_FILES['immagine']['name'])) {
$upload = Uploads::upload($_FILES['immagine'], [
'name' => 'Immagine',
'category' => 'Immagini',
'id_module' => $id_module,
'id_record' => $id_record,
], [

View File

@ -167,13 +167,23 @@ class Combinazione extends Model
protected function sincronizzaCampi($values)
{
$articoli = $this->articoli->pluck('id')->all();
if (empty($articoli)) {
return;
}
// Aggiornamento dati varianti
database()->table('mg_articoli')
->whereIn('id', $articoli)
->update($values);
// Filtro campi combinazioni
$combo = collect($values)->filter(function ($value, $key) {
return in_array($key, self::$campi_combinazione);
});
// Aggiornamento dati combinazioni
database()->table('mg_combinazioni')
->where('id', $this->id)
->update($values);
->update($combo->toArray());
}
}