issue #0000930 : Tarifs
This commit is contained in:
parent
57faf97562
commit
0cbc80351d
@ -633,7 +633,7 @@ class Gestion extends WsScore
|
||||
public function getListePrefs()
|
||||
{
|
||||
$tabRet = array();
|
||||
foreach($this->listePrefs as $code => $desc){
|
||||
foreach ( $this->listePrefs as $code => $desc ) {
|
||||
$pref = new ListePrefsReturn();
|
||||
$pref->code = $code;
|
||||
$pref->desc = $desc;
|
||||
@ -646,13 +646,13 @@ class Gestion extends WsScore
|
||||
* Retourne la liste des logs
|
||||
* @return ListeLogsReturn[]
|
||||
*/
|
||||
protected function getLogs()
|
||||
public function getLogs()
|
||||
{
|
||||
$tabRet = array();
|
||||
foreach($this->logs as $code => $desc){
|
||||
foreach ( $this->logs as $code => $desc ) {
|
||||
$log = new ListeLogsReturn();
|
||||
$log->code = $code;
|
||||
$log->desc = $desc;
|
||||
$log->desc = $desc['label'];
|
||||
$tabRet[] = $log;
|
||||
}
|
||||
return $tabRet;
|
||||
@ -1294,7 +1294,7 @@ class Gestion extends WsScore
|
||||
throw new SoapFault('ClientTarif', 'Erreur type');
|
||||
}
|
||||
|
||||
if (!in_array($tarif->doublon, array('jour','mois', 'period'))) {
|
||||
if (!in_array($tarif->doublon, array('jour','mois', 'period','none'))) {
|
||||
throw new SoapFault('ClientTarif', 'Erreur doublon');
|
||||
}
|
||||
|
||||
@ -1307,23 +1307,23 @@ class Gestion extends WsScore
|
||||
'type' => $tarif->type,
|
||||
'priceUnit' => $tarif->priceUnit,
|
||||
'limit' => $tarif->limit,
|
||||
'dateDebut' => date('YmdHis', $time),
|
||||
'dateDebut' => date('Y-m-d H:i:s', $time),
|
||||
'duree' => $tarif->duree,
|
||||
'doublon' => $tarif->doublon,
|
||||
);
|
||||
|
||||
try {
|
||||
$tarifM = new Application_Model_Sdv1ClientsTarifs();
|
||||
if (empty($id)) {
|
||||
$result = $tarifM->update($data, 'id='.$id);
|
||||
} else {
|
||||
if ( null === $id) {
|
||||
$result = $tarifM->insert($data);
|
||||
} else {
|
||||
$result = $tarifM->update($data, 'id='.$id);
|
||||
}
|
||||
} catch (Zend_Db_Adapter_Exception $e) {
|
||||
if ($this->tabInfoUser['idClient']!=1) {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
} else {
|
||||
if ($this->tabInfoUser['idClient']==1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} else {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
} catch (Zend_Exception $e) {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
@ -1337,20 +1337,22 @@ class Gestion extends WsScore
|
||||
* @param int $idClient
|
||||
* @param string $service
|
||||
* @throws SoapFault
|
||||
* @return ClientTarif
|
||||
* @return ClientTarif[]
|
||||
*/
|
||||
public function getClientTarifs($idClient, $service = null)
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
if ( null === $service ) {
|
||||
$service = 'DEFAULT';
|
||||
}
|
||||
|
||||
try {
|
||||
$tarifM = new Application_Model_Sdv1ClientsTarifs();
|
||||
$sql = $tarifM->select()
|
||||
->where('idClient=?', $idClient);
|
||||
if (!empty($service)) {
|
||||
$sql->where('service=?',$service);
|
||||
}
|
||||
$sql->order('dateDebut DESC');
|
||||
->where('idClient=?', $idClient)
|
||||
->where('service=?',$service)
|
||||
->order('dateDebut DESC');
|
||||
$rows = $tarifM->fetchAll($sql);
|
||||
} catch (Zend_Db_Adapter_Exception $e) {
|
||||
if ($this->tabInfoUser['idClient']==1) {
|
||||
@ -1362,7 +1364,26 @@ class Gestion extends WsScore
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
|
||||
return $rows;
|
||||
$output = array();
|
||||
if ( $rows->count()>0 ) {
|
||||
foreach ( $rows as $row ) {
|
||||
$item = new ClientTarif();
|
||||
$item->id = $row->id;
|
||||
$item->idClient = $row->idClient;
|
||||
$item->service = $row->service;
|
||||
$item->log = $row->log;
|
||||
$item->type = $row->type;
|
||||
$item->priceUnit = $row->priceUnit;
|
||||
$item->limit = $row->limit;
|
||||
$item->dateDebut = $row->dateDebut;
|
||||
$item->duree = $row->duree;
|
||||
$item->doublon = $row->doublon;
|
||||
|
||||
$output[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user