Sfoglia il codice sorgente

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

refactoring
parent
commit
4012084b08
1 ha cambiato i file con 17 aggiunte e 6 eliminazioni
  1. +17
    -6
      backend/controllers/DocumentController.php

+ 17
- 6
backend/controllers/DocumentController.php Vedi File

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

Loading…
Annulla
Salva