Compare commits

...

1 Commits

Author SHA1 Message Date
Claire DELBOS
37c0929561 SD-36 2017-04-14 16:58:37 +02:00
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?php
class Application_Model_Sdv1Banques extends Zend_Db_Table_Abstract
{
protected $_name = 'banques';
protected $_schema = 'sdv1';
public function setBanque($data){
}
}

View File

@ -2816,6 +2816,94 @@ class Saisie extends Scores_Ws_Server
return $output;
}
/**
* Définition d'un rib
* @param string $infos
* @throws SoapFault
* @return string
*/
public function getRib($infos)
{
$this->authenticate();
$data = (array) json_decode($infos, true);
$where='1';
foreach($data as $k => $v){
if(!empty($v)){
$where .= ' AND '.$k.' = "'.$v.'"';
}
}
$db=new Application_Model_Sdv1Banques();
$select=$db->select()->from('sdv1.banques')->where($where);
$stmt = $select->query();
$result=$stmt->fetch();
//$result=$db->query('SELECT * FROM sdv1.banques where '. $where);
return json_encode($result);
}
/**
* Définition d'un rib
* @param string $infos
* @throws SoapFault
* @return int
*/
public function setRib($infos)
{
$this->authenticate();
$data = (array) json_decode($infos, true);
$mode=$data['mode'];
unset($data['mode']);
$oldvals=(array)json_decode($data['oldvals']);
unset($data['oldvals']);
if(isset($data['banqueID'])){
$id=$data['banqueID'];
unset($data['banqueID']);
}
$db=new Application_Model_Sdv1Banques();
if($mode=='add'){
$data['dateInsert']=Date('Y-m-d H:i:s');
$data['dateUpdate']=Date('Y-m-d H:i:s');
$db->insert($data);
return true;
}
if($mode=='edit'){
if(!isset($oldvals['siren'])){
return __LINE__;
}
$data['dateUpdate']=Date('Y-m-d H:i:s');
$where='1';
foreach($oldvals as $k => $v){
if(!empty($v)){
$where.=' AND '.$k.' = "'.$v.'"';
}
}
try{
$db->update($data,$where);
}catch(Exception $e){
$this->logger->error($e->getMessage());
return __LINE__;
}
return true;
//$mode='delete';
}
if($mode=='delete'){
if(!isset($oldvals['siren'])){
return __LINE__;
}
$values['dateUpdate']=Date('Y-m-d H:i:s');
$values['dateSuppr']=Date('Y-m-d H:i:s');
$where='dateSuppr="0000-00-00 00:00:00"';
foreach($oldvals as $k => $v){
if(!empty($v)){
$where.=' AND '.$k.' = "'.$v.'"';
}
}
$db->update($values,$where);
return true;
}
return __LINE__;
}
protected function getLienUser($id, $type = null)
{
$this->authenticate();