Sfoglia il codice sorgente

User : ajout fonction getFullAddress()

dev
parent
commit
7c46297cb4
2 ha cambiato i file con 13 aggiunte e 5 eliminazioni
  1. +4
    -5
      backend/controllers/DocumentController.php
  2. +9
    -0
      common/models/User.php

+ 4
- 5
backend/controllers/DocumentController.php Vedi File

@@ -151,15 +151,14 @@ class DocumentController extends BackendController
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

if ($idUser > 0) {
$user = User::findOne($idUser);
$user = User::searchOne([
'id' => $idUser
]) ;

if ($user) {
$address = $user['lastname'] . ' ' . $user['name'] . "\n";
$address .= $user['address'];

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

+ 9
- 0
common/models/User.php Vedi File

@@ -651,6 +651,14 @@ class User extends ActiveRecordCommon implements IdentityInterface
->send();
}
}

public function getFullAddress()
{
$address = '' ;
$address .= $this->lastname . ' ' . $this->name . "\n";
$address .= $this->address;
return $address ;
}
/**
* Retourne l'ID de l'utilisateur courant connecté.
@@ -684,4 +692,5 @@ class User extends ActiveRecordCommon implements IdentityInterface
return User::getCurrentStatus() == USER::STATUS_ADMIN || User::getCurrentStatus() == USER::STATUS_PRODUCER;
}


}

Loading…
Annulla
Salva