From: Vladimir Fomichev Date: Fri, 30 Aug 2024 09:48:38 +0000 (+0300) Subject: добавил проверку на пустой масссив X-Git-Tag: 1.4~15^2~6 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b214709f041dadcd81d17b02e0c1b93459c54bc9;p=erp24_rep%2Fyii-erp24%2F.git добавил проверку на пустой масссив --- diff --git a/erp24/actions/motivation/IndexAction.php b/erp24/actions/motivation/IndexAction.php index 1aaeb10c..d552d7c4 100644 --- a/erp24/actions/motivation/IndexAction.php +++ b/erp24/actions/motivation/IndexAction.php @@ -169,8 +169,10 @@ class IndexAction extends Action $row['forecast'] = $row['plan']; } } + if(!empty($motivationDataTableSort)){ + $motivationDataTableSort = MotivationService::calculateFactFormula($motivationDataTableSort, $model->year, $model->month); + } - $motivationDataTableSort = MotivationService::calculateFactFormula($motivationDataTableSort, $model->year, $model->month); // Формируем заголовок для 5-й недели if ($model->month == 2) { // Февраль diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index a720cf8f..23473923 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -1125,23 +1125,14 @@ class MotivationService default: { $column = 'week' . $indexItem; break; } } - // Проверка на наличие необходимого ключа в $indMap - if (isset($indMap[self::CODE_SALE_OF_GOODS]) && - isset($indMap[self::CODE_OFFLINE_SALES]) && - isset($indMap[self::CODE_ONLINE_SALES])) { + // Выполняем вычисление только если все нужные ключи существуют $motivationDataTableSort[$indMap[self::CODE_SALE_OF_GOODS]][$column] = $motivationDataTableSort[$indMap[self::CODE_OFFLINE_SALES]][$column] + $motivationDataTableSort[$indMap[self::CODE_ONLINE_SALES]][$column] + 0; - } else { - Yii::error("Один из ключей отсутствует: " . - (isset($indMap[self::CODE_SALE_OF_GOODS]) ? '' : 'CODE_SALE_OF_GOODS ') . - (isset($indMap[self::CODE_OFFLINE_SALES]) ? '' : 'CODE_OFFLINE_SALES ') . - (isset($indMap[self::CODE_ONLINE_SALES]) ? '' : 'CODE_ONLINE_SALES ') - ); - } + $motivationDataTableSort[$indMap[self::CODE_OTHER_SERVICES]][$column] = // "Прочие услуги" $motivationDataTableSort[$indMap[self::CODE_ASSEMBLY_SERVICES]][$column] + // "Услуги по сборке" diff --git a/erp24/views/motivation/index.php b/erp24/views/motivation/index.php index dd04fd36..24542d14 100644 --- a/erp24/views/motivation/index.php +++ b/erp24/views/motivation/index.php @@ -353,5 +353,6 @@ $this->registerJsFile('/js/motivation/index.js', ['position' => \yii\web\View::P - + + store_id); ?> \ No newline at end of file