Creato funzione di filtraggio e assegnazione categoria in importazione in base alle regole di assegnazione

This commit is contained in:
2025-08-07 08:26:43 +02:00
parent 652f9a7e76
commit f82f65a0c5
6 changed files with 59 additions and 9 deletions

View File

@@ -44,7 +44,15 @@ class ImportRuleController extends Controller
'is_active' => 'boolean',
'created_by' => 'nullable|string|max:255',
]);
ImportRule::create($request->all());
ImportRule::create(
[
'category_id'=>$request->category_id,
'pattern'=>$request->pattern,
'description'=>$request->description,
'is_active'=>1,
]
);
return redirect()->route('import_rules.index'); // Redirect to the index after storing the rule
}

View File

@@ -381,7 +381,7 @@ class MovimentiController extends Controller
'mov_descrizione' => $line[$this->map['mov_descrizione']],
'mov_importo_dare' => $line[$this->map['mov_importo_dare']],
'mov_importo_avere' => $line[$this->map['mov_importo_avere']],
'mov_fk_categoria' => '1',
'mov_fk_categoria' => Movimenti::setCategoriesFromCsv($line[$this->map['mov_descrizione']]),
'mov_fk_tags' => 1,
'mov_inserito_da' => Auth::id(),
'conto_id_da' => 1