From 2d6817a4d06fa9b205a4be751ff738e1f1c2f1fa Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 18 Apr 2013 07:33:37 +0000 Subject: [PATCH] issue #0001470 : add method setSurveillancesMail --- application/models/Sdv1SurveillancesSite.php | 6 ++++ library/WsScore/Gestion/v0.3/Gestion.php | 29 ++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 application/models/Sdv1SurveillancesSite.php diff --git a/application/models/Sdv1SurveillancesSite.php b/application/models/Sdv1SurveillancesSite.php new file mode 100644 index 00000000..42163eac --- /dev/null +++ b/application/models/Sdv1SurveillancesSite.php @@ -0,0 +1,6 @@ +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