$file = UploadedFile::getInstanceByName('myfile');
if ($file) {
$adjustment = (boolean) Yii::$app->request->post('adjustment');
-
if ($adjustment && in_array(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors())) {
- return implode('<br>', [$adjustment, in_array(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors()), 'Вы не можете вносить корректировки']);
- }
+ $fileName = $adjustment ? '/template_adjustment_temp.xlsx' : '/template_plan_temp.xlsx';
+ $path1 = Yii::getAlias('@uploads') . $fileName;
+ $file->saveAs($path1);
- $fileName = $adjustment ? '/template_adjustment_temp.xlsx' : '/template_plan_temp.xlsx';
- $path1 = Yii::getAlias('@uploads') . $fileName;
- $file->saveAs($path1);
-
- $data = MotivationService::uploadTemplatePlan($path1, !$adjustment);
+ $data = MotivationService::uploadTemplatePlan($path1, !$adjustment);
+ } else {
+ return implode('<br>', ['Вы не можете вносить корректировки']);
+ }
return implode('<br>', $data['errors']);
} else {