Récupération fiche service par le code
This commit is contained in:
parent
6f0de74424
commit
fd3e43e8cd
@ -430,11 +430,11 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
/**
|
||||
* Détail d'un service
|
||||
* @param int $id
|
||||
* @param string $code
|
||||
* @throws SoapFault
|
||||
* @return Service
|
||||
*/
|
||||
public function getService($id)
|
||||
public function getService($code)
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
@ -443,7 +443,7 @@ class Gestion extends Scores_Ws_Server
|
||||
// Détail d'un service
|
||||
$serviceM = new Application_Model_Sdv1ClientsServices();
|
||||
try {
|
||||
$sql = $serviceM->select()->where('IdClient=?', $client)->where('Deleted=?', 0)->where('id=?', $id);
|
||||
$sql = $serviceM->select()->where('IdClient=?', $client)->where('Deleted=?', 0)->where('Code=?', $code);
|
||||
$result = $serviceM->fetchRow($sql);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
if ($this->User->idClient == 1) {
|
||||
@ -459,6 +459,7 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
$output = new Service();
|
||||
$output->id = $result->id;
|
||||
$output->IdClient = $client;
|
||||
$output->Code = $result->Code;
|
||||
$output->Label = $result->Label;
|
||||
$output->TypeCompte = $result->TypeCompte;
|
||||
@ -689,12 +690,11 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
$sql->where('u.deleted=?', 0);
|
||||
|
||||
if ($service->Code == 'DEFAULT') {
|
||||
$sql->where('(s.Service IS NULL) OR (s.Service="DEFAULT" AND sd.idClient='.$client.') OR sd.Code='.$service);
|
||||
if ($service == 'DEFAULT') {
|
||||
$sql->where('(s.Service IS NULL) OR (s.Service="DEFAULT" AND sd.idClient='.$client.')');
|
||||
} else {
|
||||
$sql->where('sd.Code=?', $service);
|
||||
}
|
||||
|
||||
$result = $userM->fetchAll($sql);
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
if ($this->User->idClient == 1) {
|
||||
@ -810,8 +810,8 @@ class Gestion extends Scores_Ws_Server
|
||||
if ( count($droits) > 0 ) {
|
||||
foreach ($droits as $item) {
|
||||
$acces = new Acces();
|
||||
$acces->Code = $item->Acces;
|
||||
$acces->Label = $this->listeDroits[$item->Acces];
|
||||
$acces->Code = strtoupper($item->Acces);
|
||||
$acces->Label = $this->listeDroits[strtoupper($item->Acces)];
|
||||
$output->Acces[] = $acces;
|
||||
}
|
||||
}
|
||||
@ -827,7 +827,6 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Service - IP
|
||||
try {
|
||||
$ipM = new Application_Model_Sdv1ClientsServicesIP();
|
||||
@ -1047,7 +1046,7 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
/**
|
||||
* Définition d'un utilisateur
|
||||
* Paramétrage d'un utilisateur
|
||||
* @param string $data
|
||||
* @param int $id
|
||||
* @throws SoapFault
|
||||
@ -1057,75 +1056,52 @@ class Gestion extends Scores_Ws_Server
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
// Vérification des droits de création d'utilisateur
|
||||
// --- Vérification des droits de création d'utilisateur
|
||||
if ( $this->User->id != $id || !in_array($this->User->profil, array('SuperAdministrateur', 'Administrateur')) ) {
|
||||
throw new SoapFault('ERR', 'Accès non authorisé');
|
||||
}
|
||||
|
||||
$infos = json_decode($data);
|
||||
$values = json_decode($data);
|
||||
|
||||
$userM = new Application_Model_Sdv1Utilisateurs();
|
||||
|
||||
$userData = array(
|
||||
'idClient',
|
||||
'login',
|
||||
'email',
|
||||
'idClient' => $values['idClient'],
|
||||
'login' => trim($values['login']),
|
||||
'email' => strtolower(trim($values['email'])),
|
||||
'password' => '',
|
||||
'actif' => 0,
|
||||
'actif' => 1,
|
||||
'deleted' => 0,
|
||||
'typeCompte' => 'PROD',
|
||||
'filtre_ip' => '',
|
||||
'civilite' => 'M',
|
||||
'nom' => '',
|
||||
'prenom' => '',
|
||||
'raisonSociale' => '',
|
||||
'siret' => '000000000',
|
||||
'adrNum' => null,
|
||||
'adrIndRep' => null,
|
||||
'adrTypeVoie' => null,
|
||||
'adrLibVoie' => '',
|
||||
'adrCp' => null,
|
||||
`adrVille` => null,
|
||||
`adrComp` => '',
|
||||
'tel' => '',
|
||||
'fax' => null,
|
||||
'mobile' => null,
|
||||
'pref' => '',
|
||||
'civilite' => $values['civilite'],
|
||||
'nom' => trim($values['nom']),
|
||||
'prenom' => trim($values['prenom']),
|
||||
'profil' => 'Utilisateur',
|
||||
'dateInscription' => '0000-00-00 00:00:00',
|
||||
'dateValidation' => '0000-00-00 00:00:00',
|
||||
'nombreConnexions' => '0',
|
||||
'dateDerniereConnexion' => '0000-00-00 00:00:00',
|
||||
'droits' => '',
|
||||
'referenceParDefaut' => '',
|
||||
'nbReponses' => '020',
|
||||
'lang' => null,
|
||||
'formatMail' => 'txt1',
|
||||
'nbReponses' => 10,
|
||||
'lang' => 'fr',
|
||||
'formatMail' => 'txt2',
|
||||
'lienExtranetMail' => 0,
|
||||
'lienSurvFic' => 0,
|
||||
'idSurvFic' => '',
|
||||
'loginCptSurvFic' => '',
|
||||
'listeEven' => '',
|
||||
'dateDebutCompte' => null,
|
||||
'dateFinCompte' => null,
|
||||
'maxFicheId' => null,
|
||||
'accesWS' => '0',
|
||||
'rechRefType' => 'UTI',
|
||||
'acceptationCGU' => null,
|
||||
);
|
||||
|
||||
// --- Création
|
||||
if ( $id === null ) {
|
||||
|
||||
$sql = $userM->select()->where('login=?', $infos->login);
|
||||
$sql = $userM->select()->where('login=?', $values['login']);
|
||||
$row = $userM->fetchRow($sql);
|
||||
//Utilisateur existant
|
||||
// --- Utilisateur existant
|
||||
if ( null !== $row ) {
|
||||
throw new SoapFault('ERR', "User exist");
|
||||
}
|
||||
//Prepare data to insert
|
||||
foreach ($infos as $key => $value) {
|
||||
// --- Prepare data to insert
|
||||
foreach ($values as $key => $value) {
|
||||
if (array_key_exists($key, $userData)) {
|
||||
$userData[$key] = $value;
|
||||
$userData[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
$userData['dateInsert'] = date('YmdHis');
|
||||
@ -1150,22 +1126,24 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
}
|
||||
// --- Modification
|
||||
else {
|
||||
|
||||
$sql = $userM->select()->where('id=?', $id);
|
||||
$row = $userM->fetchRow($sql);
|
||||
if ( null === $row ) {
|
||||
throw new SoapFault('ERR', "User doesn't exist");
|
||||
}
|
||||
//Prepare data to update
|
||||
// --- Prepare data to update
|
||||
foreach ($row as $key => $value) {
|
||||
if (array_key_exists($key, $userData)) {
|
||||
$userData[$key] = $value;
|
||||
$userData[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
foreach ($infos as $key => $value) {
|
||||
foreach ($values as $key => $value) {
|
||||
if (array_key_exists($key, $userData)) {
|
||||
$userData[$key] = $value;
|
||||
$userData[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1326,10 +1304,14 @@ class Gestion extends Scores_Ws_Server
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Catégorie et Accès
|
||||
* @return AccesCategory[]
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
$output = array();
|
||||
foreach ( $this->listeCategory as $code => $desc ) {
|
||||
foreach ($this->listeCategory as $code => $desc) {
|
||||
$c = new AccesCategory();
|
||||
$c->Code = $code;
|
||||
$c->Label = $desc['label'];
|
||||
@ -1339,9 +1321,22 @@ class Gestion extends Scores_Ws_Server
|
||||
return $output;
|
||||
}
|
||||
|
||||
protected function getAccess()
|
||||
/**
|
||||
* Liste des acces
|
||||
* @return Acces[]
|
||||
*/
|
||||
public function getAccess()
|
||||
{
|
||||
//Liste des accès - Code, Label, Category, Description,
|
||||
$droits = $this->listeDroits;
|
||||
$list = array();
|
||||
foreach ($droits as $k => $v) {
|
||||
$acces = new Acces();
|
||||
$acces->Code = $k;
|
||||
$acces->Label = $v;
|
||||
$list[] = $acces;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
protected function getPref()
|
||||
|
Loading…
Reference in New Issue
Block a user