Pārlūkot izejas kodu

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

refactoring
Guillaume Bourgeois pirms 4 gadiem
vecāks
revīzija
4012084b08
1 mainītis faili ar 17 papildinājumiem un 6 dzēšanām
  1. +17
    -6
      backend/controllers/DocumentController.php

+ 17
- 6
backend/controllers/DocumentController.php Parādīt failu

@@ -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') {

Notiek ielāde…
Atcelt
Saglabāt