Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions radicalform.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,30 @@ public function onAjaxRadicalform()
}



// Вычисляем номер заявки (rfLatestNumber)
$config = Factory::getConfig();
$log_path = str_replace('\\', '/', $config->get('log_path'));
$data = $this->getCSV($log_path . '/plg_system_radicalform.php', "\t");

// Удаляем комментарии и пустые строки
if (count($data) > 0) {
for ($i = 0; $i < 6; $i++) {
if (count($data[$i]) < 4 || $data[$i][0][0] == '#') {
unset($data[$i]);
}
}
}
$latestNumber = 1;
if (count($data) > 0) {
$data = array_reverse($data);
$json = json_decode($data[0][2], true);
if (is_array($json) && isset($json['rfLatestNumber'])) {
$latestNumber = $json['rfLatestNumber'] + 1;
}
}
$input['rfLatestNumber'] = $latestNumber;

if (isset($get['deletefile']) && isset($get['catalog']) && isset($get['uniq']))
{
return $this->deleteUploadedFile($get['catalog'], $get['deletefile'], $get['uniq']);
Expand Down Expand Up @@ -970,22 +994,6 @@ public function onAjaxRadicalform()
}
}

// here we get latest serial number from log file
$latestNumber=1;
if(count($data)>0)
{
$data = array_reverse($data);
$json = json_decode($data[0][2], true);
if (is_array($json))
{
if (isset($json['rfLatestNumber']))
{
$latestNumber = $json['rfLatestNumber'] + 1;
}
}
}


if (isset($get['admin']) && $get['admin'] == 2 )
{
if ($this->app->isClient('administrator'))
Expand Down