Version 2.1
This commit is contained in:
parent
c5261c5690
commit
b2b1e1be17
@ -1,6 +1,6 @@
|
||||
## import
|
||||
|
||||
## Модуль импорта v2.0.1 (Light версия)
|
||||
## Модуль импорта v2.1 (Light версия)
|
||||
|
||||
## Автор: @MadDen
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
|
||||
## Changelog:
|
||||
|
||||
13.04.2017 - версия 2.1
|
||||
|
||||
10.08.2016 - версия 2.0.1
|
||||
|
||||
08.08.2016 - версия 2.0
|
||||
|
@ -35,7 +35,7 @@ class ModuleImportParsers
|
||||
|
||||
$ii = 0;
|
||||
|
||||
$items = [];
|
||||
$items = array();
|
||||
|
||||
while ($item = fgetcsv($handle, 0, $sep, $protect))
|
||||
{
|
||||
@ -80,7 +80,7 @@ class ModuleImportParsers
|
||||
|
||||
$tags = $Excel->sheets[0]['cells'][1]; // Определяем теги
|
||||
|
||||
$items = [];
|
||||
$items = array();
|
||||
|
||||
$ii = 0;
|
||||
|
||||
@ -121,14 +121,14 @@ class ModuleImportParsers
|
||||
|
||||
$a = array_values($xml);
|
||||
|
||||
$tags = []; // Определяем теги
|
||||
$tags = array(); // Определяем теги
|
||||
|
||||
foreach ($a[0][0] AS $key => $value)
|
||||
{
|
||||
$tags[] = $key;
|
||||
}
|
||||
|
||||
$items = [];
|
||||
$items = array();
|
||||
|
||||
foreach ($a[0] AS $key => $row)
|
||||
{
|
||||
@ -150,4 +150,43 @@ class ModuleImportParsers
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* !DBF */
|
||||
public static function DBF2Array($fname)
|
||||
{
|
||||
$db = dbase_open($fname, 0);
|
||||
|
||||
$cols = dbase_get_header_info($db);
|
||||
|
||||
$count = dbase_numrecords($db);
|
||||
|
||||
$rows = array();
|
||||
|
||||
$tags = array();
|
||||
|
||||
foreach($cols AS $k => $v)
|
||||
{
|
||||
$tags[] = $v['name'];
|
||||
}
|
||||
|
||||
$ii = 1;
|
||||
|
||||
for ($ii; $ii <= $count; $ii++)
|
||||
{
|
||||
$rows[] = dbase_get_record_with_names($db, $ii);
|
||||
}
|
||||
|
||||
$result =
|
||||
[
|
||||
'num' => $count - $parser_row,
|
||||
'tags' => $tags,
|
||||
'rows' => $rows
|
||||
];
|
||||
|
||||
dbase_close($db);
|
||||
|
||||
unset($cols, $count, $tags, $rows);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ class ModuleImport
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
// если новый
|
||||
if (!$import_id)
|
||||
if (! $import_id)
|
||||
{
|
||||
$AVE_DB->Query("
|
||||
INSERT INTO
|
||||
@ -416,13 +416,14 @@ class ModuleImport
|
||||
$message = $AVE_Template->get_config_vars('saved');
|
||||
$header = $AVE_Template->get_config_vars('success');
|
||||
$theme = 'accept';
|
||||
|
||||
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $import_id;
|
||||
}
|
||||
{
|
||||
return $import_id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -584,12 +585,11 @@ class ModuleImport
|
||||
|
||||
$i = 0;
|
||||
|
||||
$log =
|
||||
[
|
||||
$log = array(
|
||||
'updated' => array(),
|
||||
'created' => array(),
|
||||
'notfound' => array()
|
||||
];
|
||||
);
|
||||
|
||||
// Обрабатываем по очереди каждый объект
|
||||
foreach($import_data['rows'] as $item)
|
||||
@ -601,6 +601,7 @@ class ModuleImport
|
||||
|
||||
// парсим шаблоны
|
||||
$item_fields = $fields;
|
||||
|
||||
array_walk_recursive($item_fields, array($this, '_parse_tpl'), $replace);
|
||||
|
||||
// чистим память
|
||||
@ -618,7 +619,8 @@ class ModuleImport
|
||||
}
|
||||
}
|
||||
|
||||
if (! $pass) continue;
|
||||
if (! $pass)
|
||||
continue;
|
||||
|
||||
// проверяем обязательные поля в теле документа
|
||||
foreach ($fields_oblig['body'] as $field_id)
|
||||
@ -630,7 +632,8 @@ class ModuleImport
|
||||
}
|
||||
}
|
||||
|
||||
if (! $pass) continue;
|
||||
if (! $pass)
|
||||
continue;
|
||||
|
||||
// находим документ по ключевым полям
|
||||
$docids = $this->_docs_find($fields_key, $fields_comp, $item_fields, $import->rub_id);
|
||||
|
@ -16,10 +16,10 @@ if (defined('ACP'))
|
||||
[
|
||||
'ModuleName' => "Импорт (Облегченная версия)",
|
||||
'ModuleSysName' => "import",
|
||||
'ModuleVersion' => "2.0.1",
|
||||
'ModuleVersion' => "2.1",
|
||||
'ModuleDescription' => "Осуществляет импорт документов из файлов различных типов",
|
||||
'ModuleAutor' => "AVE.cms Team",
|
||||
'ModuleCopyright' => "© AVE.cms Team 2016",
|
||||
'ModuleCopyright' => "© AVE.cms Team 2017",
|
||||
'ModuleStatus' => 1,
|
||||
'ModuleIsFunction' => 0,
|
||||
'ModuleTemplate' => 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user