mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-27 00:37:38 +01:00
Bugfix eliminazione ricevute
This commit is contained in:
parent
0ca9f9b739
commit
cbbc4069ab
@ -16,8 +16,7 @@ class Interaction extends Services
|
||||
$list = self::getRemoteList();
|
||||
|
||||
// Ricerca fisica
|
||||
$names = array_column($list, 'name');
|
||||
$files = self::getFileList($names);
|
||||
$files = self::getFileList($list);
|
||||
|
||||
$list = array_merge($list, $files);
|
||||
|
||||
@ -50,9 +49,9 @@ class Interaction extends Services
|
||||
return $list ?: [];
|
||||
}
|
||||
|
||||
public static function getFileList($names = [])
|
||||
public static function getFileList($list = [])
|
||||
{
|
||||
$list = [];
|
||||
$names = array_column($list, 'name');
|
||||
|
||||
// Ricerca fisica
|
||||
$directory = Ricevuta::getImportDirectory();
|
||||
@ -60,13 +59,16 @@ class Interaction extends Services
|
||||
$files = glob($directory.'/*.xml*');
|
||||
foreach ($files as $id => $file) {
|
||||
$name = basename($file);
|
||||
$pos = array_search($name, $names);
|
||||
|
||||
if (!in_array($name, $names)) {
|
||||
if ($pos === false) {
|
||||
$list[] = [
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
'file' => true,
|
||||
];
|
||||
} else {
|
||||
$list[$pos]['id'] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user