SD-1 Poss de saisir le siret si absent

This commit is contained in:
Claire DELBOS 2017-03-31 16:19:51 +02:00
parent 8f74f4d930
commit 1c751cf2a4
4 changed files with 39 additions and 5 deletions

View File

@ -61,7 +61,7 @@ class Metier_Credit_Decrement extends Scores_Ws_Server
break;
}
//$newbalance=
$this->logger->info(implode("##",$declog));
//$this->logger->info(implode("##",$declog));
return true;
return $this->logCost.'--->'.$this->rateType;
}
@ -110,17 +110,17 @@ class Metier_Credit_Decrement extends Scores_Ws_Server
$stmt->bindValue('clientId', $user->idClient);
$stmt->bindValue('serviceCode', $user->serviceCode);
$stmt->bindValue('idLog', $idLog);
$this->logger->info($user->serviceCode);
//$this->logger->info($user->serviceCode);
$stmt->execute();
if ($stmt->rowCount() == 1) {
$ratedLog = $stmt->fetch(\PDO::FETCH_OBJ);
$this->rateType=$ratedLog->rateType;
$this->logCost=$ratedLog->cost;
$this->logger->info(__LINE__ . 'getRateType OK'.$idLog.'-'.$user->idClient);
//$this->logger->info(__LINE__ . 'getRateType OK'.$idLog.'-'.$user->idClient);
}else{
$this->rateType=0;
$this->logCost=0;
$this->logger->info(__LINE__ . 'getRateType KO'.$idLog.'-'.$user->idClient);
//$this->logger->info(__LINE__ . 'getRateType KO'.$idLog.'-'.$user->idClient);
}
}
private function sessionGetRateType(){

View File

@ -101,6 +101,11 @@ class Metier_Credit_Information extends Scores_Ws_Server
$infos['commande']=null;
return $infos;
}
if(!isset($infos['commande']['siret']) || intval($infos['commande']['siret'])==0){
$infos['societe']=array();
$infos['entrep']=array();
return $infos;
}
$siren=substr($infos['commande']['siret'],0,9);
$nic=substr($infos['commande']['siret'],9,5);
try {

View File

@ -1468,6 +1468,23 @@ class Account extends Scores_Ws_Server
}
/**
* Change siret
* @param string $siret
* @return boolean
*/
public function setUserSiret($siret)
{
$this->authenticate();
$id = $this->User->id;
$result = $this->conn->update('sdv1.utilisateurs',
array('siret'=>$siret), array('id' => $id));
if ( $result == 1 ) {
return true;
}
return false;
}
/**
* Change password
* @param string $password

View File

@ -4,7 +4,7 @@ require_once __DIR__ . '/Types.php';
class Credit extends Scores_Ws_Server
{
protected $libdroits = 'searchent';
protected $libdroits = 'portemonnaie';
/**
* Retourne le nombre de crédit disponible à un utilisateur
* @return int
@ -104,6 +104,8 @@ class Credit extends Scores_Ws_Server
$ir['transaction']=json_encode($transaction);
$r = $this->conn->update('sdv1.credit__paid', $ir,array('idCmd' => $ir['idCmd']));
}else{
$transaction=array();
$transaction[]=(array)json_decode($ir['transaction']);
$r = $this->conn->insert('sdv1.credit__paid', $ir);
}
if($ir['valid']==1){
@ -220,5 +222,15 @@ class Credit extends Scores_Ws_Server
$GetfactinfosCreditResult->result=$crdt->getInfosFacture($id,$this->User);
return $GetfactinfosCreditResult;
}
public function setsiretCredit($siret){
$this->authenticate();
$idUser = $this->User->id;
$this->permission($this->libdroits);
$GetfactinfosCreditResult=new GetfactinfosCredit();
$GetfactinfosCreditResult->id=$id;
$crdt=new Metier_Credit_Information();
$GetfactinfosCreditResult->result=$crdt->getInfosFacture($id,$this->User);
return $GetfactinfosCreditResult;
}
}