creata funzione di inserimento movimenti non Duplicati
This commit is contained in:
parent
efc3b3da9b
commit
93de5c36c5
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user