Переглянути джерело

Modification d'un document : problème chargement adresse document si différente de celle initiale de l'utilisateur #166

refactoring
Guillaume Bourgeois 4 роки тому
джерело
коміт
4012084b08
1 змінених файлів з 17 додано та 6 видалено
  1. +17
    -6
      backend/controllers/DocumentController.php

+ 17
- 6
backend/controllers/DocumentController.php Переглянути файл

@@ -125,11 +125,6 @@ class DocumentController extends BackendController
{
$model = $this->findModel($id);

$class = $this->getClass();
$model = $class::searchOne([
'id' => $id
]);

if(!$model) {
throw new NotFoundHttpException('Le document n\'a pas été trouvé.');
}
@@ -197,9 +192,25 @@ class DocumentController extends BackendController
]);

if ($user) {

$document = null ;
if(Document::isValidClass($classDocument)) {
$document = $classDocument::searchOne([
'id' => $idDocument,
'id_user' => $idUser
]) ;
}

if($document && $document->id_user == $user->id) {
$address = $document->address ;
}
else {
$address = $user->getFullAddress() ;
}

$json = [
'return' => 'success',
'address' => $user->getFullAddress()
'address' => $address
];

if($classDocument == 'Invoice') {

Завантаження…
Відмінити
Зберегти