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