From: Alexander Smirnov Date: Fri, 26 Jul 2024 16:11:06 +0000 (+0300) Subject: Исправления X-Git-Tag: 1.4~45^2~9 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=29c4fe5461c1507e9dba3894305a93c33466478a;p=erp24_rep%2Fyii-erp24%2F.git Исправления --- diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 85375e48..66d724f6 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -13,7 +13,11 @@ class MotivationService { public static function uploadTemplatePlan($path) { $motivationCostsItems = MotivationCostsItem::find()->indexBy('code')->all(); - $spreadsheets = IOFactory::load($path); + try { + $spreadsheets = IOFactory::load($path); + } catch (\Exception $ex) { + return ['errors' => ['Некорректный файл. Загрузите файл, заполненный по шаблону.']]; + } $errors = []; foreach ($spreadsheets->getAllSheets() as $indSS => $spreadSheet) { $rows = []; @@ -137,7 +141,9 @@ class MotivationService } } } - $errors []= empty($error) ? '' : $indSS . ":" . $error; + if (!empty($error)) { + $errors []= ($indSS + 1) . ":" . $error; + } } return compact('errors'); diff --git a/erp24/web/js/motivation/index.js b/erp24/web/js/motivation/index.js index 568d8827..79801cd5 100644 --- a/erp24/web/js/motivation/index.js +++ b/erp24/web/js/motivation/index.js @@ -12,12 +12,21 @@ function openUploadDictionary() { $mainModal.find('.close').on('click', () => { $mainModal.modal('hide'); }); $mainModal.find('.modal-title').html('Загрузка плановых значений'); $modalFooter.html(''); - $modalBody.html('
Скачать шаблон
'); + $modalBody.html('
' + + '
' + + '
' + + '
' + + '
' + + '
Скачать шаблон
' + + '
'); const browse = $modalBody.find('input[type=file]').get(0); const btn = $modalBody.find('input[type=submit]').get(0); const info = $modalBody.find('#infoModal').get(0); const form = $modalBody.find('form').get(0); async function UploadDict() { + info.innerHTML = 'загрузка...'; if (browse.files[0].size > 200000) { info.innerHTML = 'Некорректный файл. Загрузите файл, заполненный по шаблону.'; return;