SD-13 CDC V3
This commit is contained in:
parent
c6716c0f81
commit
8f74f4d930
@ -1,9 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* PDO Connection with Doctrine
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
|
||||
class Metier_Credit_Contact extends Scores_Ws_Server
|
||||
{
|
||||
/**
|
||||
@ -12,6 +7,47 @@ class Metier_Credit_Contact extends Scores_Ws_Server
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Categorie de message
|
||||
* @var array
|
||||
*/
|
||||
private $subjects=array(
|
||||
'Le fonctionnement logiciel',
|
||||
'Vos achats',
|
||||
'Vos consommations',
|
||||
'Autre'
|
||||
);
|
||||
|
||||
/**
|
||||
* Etape de traitement
|
||||
* @var array
|
||||
*/
|
||||
private $stages=array(
|
||||
'1' => 'En attente de reponse',
|
||||
'2' => 'En cours de traitement',
|
||||
'3' => 'Resolu'
|
||||
);
|
||||
|
||||
/**
|
||||
* Libelle des champs de valeur
|
||||
* @var array
|
||||
*/
|
||||
private $libelles=array(
|
||||
'id' => 'Reference enregistrement',
|
||||
'idUSer' => 'Reference utilisateur',
|
||||
'begin' => 'Message du',
|
||||
'subject' => 'Categorie',
|
||||
'message' => 'Message envoyé',
|
||||
'stage' => 'Etape',
|
||||
'answer' => 'Suivi'
|
||||
);
|
||||
|
||||
public function __construct($db = null)
|
||||
{
|
||||
// Set Database
|
||||
@ -25,6 +61,15 @@ class Metier_Credit_Contact extends Scores_Ws_Server
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Libelles correspondants aux id
|
||||
* @return array
|
||||
*/
|
||||
public function getLibelles()
|
||||
{
|
||||
return array('libelles' => $this->libelles, 'stages' => $this->stages,'subjects' => $this->subjects);
|
||||
}
|
||||
public function saveFirstContact($data){
|
||||
try{
|
||||
$res=$this->conn->insert('sdv1.credit__contact',$data);
|
||||
@ -37,8 +82,10 @@ class Metier_Credit_Contact extends Scores_Ws_Server
|
||||
return true;
|
||||
}
|
||||
public function getlisteContacts($idUser){
|
||||
$sql='select * from sdv1.credit__contact where idUSer=:idUser
|
||||
and (stage<3 or (stage=3 and begin>"'.Date('Y-m-d',time()-300*24*3600).'")) order by id desc;';
|
||||
$sql='select c.*, u.email, u.login,u.nom, u.prenom
|
||||
from sdv1.credit__contact c inner join sdv1.utilisateurs u on c.idUSer=u.id
|
||||
where c.idUSer=:idUser
|
||||
and (stage<3 or (stage=3 and begin>"'.Date('Y-m-d',time()-300*24*3600).'")) order by c.stage asc,c.id desc;';
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('idUser', $idUser);
|
||||
$stmt->execute();
|
||||
|
@ -80,12 +80,20 @@ class Metier_Credit_Information extends Scores_Ws_Server
|
||||
* Recuperation des informations necessaires a la facturation
|
||||
* @param int $id
|
||||
*/
|
||||
public function getInfosFacture($id){
|
||||
$sql='select c.*, u.idClient, u.siret, u.email,u.nom,u.prenom
|
||||
from sdv1.credit__paid c inner join sdv1.utilisateurs u on c.idUser=u.id
|
||||
where c.id= :id;';
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('id', $id);
|
||||
public function getInfosFacture($id,$user){
|
||||
if(intval($id)>0){
|
||||
$sql='select c.*, u.idClient, u.siret, u.email,u.nom,u.prenom
|
||||
from sdv1.credit__paid c inner join sdv1.utilisateurs u on c.idUser=u.id
|
||||
where c.id= :id;';
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('id', $id);
|
||||
}else{
|
||||
$sql='select u.idClient, u.siret, u.email,u.nom,u.prenom
|
||||
from sdv1.utilisateurs u
|
||||
where u.id= :id;';
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('id', $user->id);
|
||||
}
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 1) {
|
||||
$infos['commande']=$stmt->fetch(PDO::FETCH_ASSOC);
|
||||
@ -106,7 +114,8 @@ class Metier_Credit_Information extends Scores_Ws_Server
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$infos['entrep']= $iInsee->getIdentiteEntreprise($siren, $nic, 0, false);
|
||||
return $infos;
|
||||
}
|
||||
public function getHistoUser($user,$nbligpaid=20,$nbligused=50){
|
||||
|
@ -91,6 +91,7 @@ class Credit extends Scores_Ws_Server
|
||||
$PayCreditResult->result=false;
|
||||
return $PayCreditResult;
|
||||
}
|
||||
|
||||
$sql = "SELECT transaction FROM sdv1.credit__paid c
|
||||
WHERE c.idCmd=:idCmd";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
@ -216,7 +217,7 @@ class Credit extends Scores_Ws_Server
|
||||
$GetfactinfosCreditResult=new GetfactinfosCredit();
|
||||
$GetfactinfosCreditResult->id=$id;
|
||||
$crdt=new Metier_Credit_Information();
|
||||
$GetfactinfosCreditResult->result=$crdt->getInfosFacture($id);
|
||||
$GetfactinfosCreditResult->result=$crdt->getInfosFacture($id,$this->User);
|
||||
return $GetfactinfosCreditResult;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user