if (Yii::$app->request->isPost) {
$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())) {
- $fileName = $adjustment ? '/template_adjustment_temp.xlsx' : '/template_plan_temp.xlsx';
- $path1 = Yii::getAlias('@uploads') . $fileName;
- $file->saveAs($path1);
-
- $data = MotivationService::uploadTemplatePlan($path1, !$adjustment);
- } else {
- return implode('<br>', ['Вы не можете вносить корректировки']);
- }
+ $adjustment = (boolean)Yii::$app->request->post('adjustment');
+ $fileName = $adjustment ? '/template_adjustment_temp.xlsx' : '/template_plan_temp.xlsx';
+ $path1 = Yii::getAlias('@uploads') . $fileName;
+ $file->saveAs($path1);
+
+ $data = MotivationService::uploadTemplatePlan($path1, !$adjustment);
return implode('<br>', $data['errors']);
} else {