Browse Source

Modification d'un document : redirection vers download si document validé

refactoring
Guillaume Bourgeois 4 years ago
parent
commit
2860f40346
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      backend/controllers/DocumentController.php

+ 5
- 1
backend/controllers/DocumentController.php View File

@@ -111,8 +111,12 @@ class DocumentController extends BackendController
'id' => $id
]);

if(!$model) {
throw new NotFoundHttpException('Le document n\'a pas été trouvé.');
}

if ($model->isStatusValid()) {
throw new UserException('Vous ne pouvez pas modifier un document validé.');
return $this->redirect(['download', 'id' => $id]) ;
}

if ($model && $model->load(Yii::$app->request->post()) && $model->save()) {

Loading…
Cancel
Save