creata funzione di inserimento movimenti non Duplicati

This commit is contained in:
Amministratore 2025-09-25 08:36:08 +02:00
parent efc3b3da9b
commit 93de5c36c5

View File

@ -247,7 +247,22 @@ public function ContoA()
return md5($data.$movimento_dare.$movimento_avere.$descrizione); return md5($data.$movimento_dare.$movimento_avere.$descrizione);
} }
public function importHashExists($hash)
{
return self::where('import_hash', $hash)->exists();
}
public function importNoDuplicate($data, $movimento_dare, $movimento_avere, $descrizione)
{
$hash = $this->makeHash($data, $movimento_dare, $movimento_avere, $descrizione);
$exists = self::where('import_hash', $hash)->exists();
if (!$exists) {
self::create([
// TODO: ...altri campi...
'import_hash' => $hash,
]);
}
}
public static function getByTag($tag) { public static function getByTag($tag) {
$expression=DB::raw('SELECT $expression=DB::raw('SELECT