issue #0001470 : add method setSurveillancesMail

This commit is contained in:
Michael RICOIS 2013-04-18 07:33:37 +00:00
parent db385a6c54
commit 2d6817a4d0
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Sdv1SurveillancesSite extends Zend_Db_Table_Abstract
{
protected $_name = 'surveillances_site';
protected $_schema = 'sdv1';
}

View File

@ -1839,6 +1839,8 @@ class Gestion extends WsScore
*/
public function setParam($element, $idClient, $service, $login=null)
{
$this->authenticate();
$element = strtoupper($element);
if ( !in_array($element, array('IP', 'ACCESS')) ) {
throw new SoapFault('ERR', 'Invalid parameters');
@ -1885,6 +1887,33 @@ class Gestion extends WsScore
return true;
}
/**
* Override email(s) in surveillances
* @param string $login
* @param string $email
* @throws SoapFault
* @return int
*/
public function setSurveillancesMail($login, $email)
{
$this->authenticate();
try {
$surveillanceM = new Application_Model_Sdv1SurveillancesSite();
$result = $surveillanceM->update(array('email'=>$email), "login='$login'");
} catch (Zend_Db_Adapter_Exception $e) {
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");
}
return $result;
}
/**
* Remove access to the children