Pieces - getBilan ;: Doctrine
This commit is contained in:
parent
73c0f03392
commit
aba40d6db4
@ -367,11 +367,11 @@ class Pieces extends Scores_Ws_Server
|
||||
$this->authenticate();
|
||||
$this->permission('actes');
|
||||
|
||||
if ( strlen($identifiant)!=9 ) {
|
||||
if (strlen($identifiant) != 9) {
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
if ( empty($reference) ) {
|
||||
if (empty($reference)) {
|
||||
$reference = '';
|
||||
}
|
||||
|
||||
@ -416,15 +416,14 @@ class Pieces extends Scores_Ws_Server
|
||||
*/
|
||||
else {
|
||||
|
||||
//Génération identifiant de commande unique
|
||||
// Génération identifiant de commande unique
|
||||
$refCommande = uniqid();
|
||||
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$identite = $iInsee->getIdentiteLight($identifiant);
|
||||
|
||||
//Sauvegarde dans la base
|
||||
$commandeM = new Application_Model_Sdv1GreffeCommandesBi();
|
||||
$id = $commandeM->insert(array(
|
||||
// Sauvegarde dans la base
|
||||
$data = array(
|
||||
'refCommande' => $refCommande,
|
||||
'login' => $this->User->login,
|
||||
'email' => $this->User->email,
|
||||
@ -435,26 +434,47 @@ class Pieces extends Scores_Ws_Server
|
||||
'bilanCloture' => $dateCloture,
|
||||
'bilanType' => $type,
|
||||
'dateInsert' => date('YmdHis'),
|
||||
));
|
||||
);
|
||||
try {
|
||||
$this->conn->insert('sdv1.greffe_commandes_bi', $data);
|
||||
$id = $this->conn->lastInsertId();
|
||||
}
|
||||
catch(\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->User->idClient == 1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
}
|
||||
else {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $diffusion ) {
|
||||
switch ($diffusion) {
|
||||
|
||||
case 'T':
|
||||
|
||||
//Passer la commande chez infogreffe
|
||||
// Passer la commande chez infogreffe
|
||||
$infogreffe = new Metier_Infogreffe_DocBI($identifiant);
|
||||
//$infogreffe->debug = true;
|
||||
try {
|
||||
$pdf = $infogreffe->getCommandeT($dateCloture, $type, $id);
|
||||
$commandeM->update(array('dateEnvoi'=> date('YmdHis')), 'id='.$id);
|
||||
} catch (Exception $e) {
|
||||
$commandeM->update(array('cmdError'=> $e->getMessage()), 'id='.$id);
|
||||
try {
|
||||
$this->conn->update('sdv1.greffe_commandes_bi',
|
||||
array('dateEnvoi'=> date('YmdHis')), array('id' => $id));
|
||||
}
|
||||
catch(\Doctrine\DBAL\DBALException $e) {}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
try {
|
||||
$this->conn->update('sdv1.greffe_commandes_bi',
|
||||
array('cmdError'=> $e->getMessage()), array('id' => $id));
|
||||
}
|
||||
catch(\Doctrine\DBAL\DBALException $e) {}
|
||||
if ( $e->getCode() == $infogreffe::INT ) {
|
||||
throw new SoapFault('ERR', "Erreur lors de la commande auprès de notre prestataire.");
|
||||
}
|
||||
}
|
||||
|
||||
//Distribuer le fichier
|
||||
// Distribuer le fichier
|
||||
if ( !empty($pdf) ) {
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
@ -473,7 +493,8 @@ class Pieces extends Scores_Ws_Server
|
||||
}
|
||||
$output = $hostname . '/fichier/greffes/' . basename($dest); // @todo : Chemin du fichier
|
||||
$this->wsLog('greffe_bilans', $identifiant, basename($dest));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new SoapFault('ERR', 'Fichier introuvable');
|
||||
}
|
||||
|
||||
@ -483,15 +504,24 @@ class Pieces extends Scores_Ws_Server
|
||||
case 'C':
|
||||
case 'F':
|
||||
|
||||
//Commande chez Infogreffe
|
||||
// Commande chez Infogreffe
|
||||
if ( $diffusion == 'C' ) {
|
||||
$infogreffe = new Metier_Infogreffe_DocBI($identifiant);
|
||||
try {
|
||||
$infogreffe->getCommandeC($dateCloture, $type, 'G-BI-'.$id);
|
||||
$commandeM->update(array('dateCommande'=> date('YmdHis')), 'id='.$id);
|
||||
try {
|
||||
$this->conn->update('sdv1.greffe_commandes_bi',
|
||||
array('dateCommande'=> date('YmdHis')), array('id' => $id));
|
||||
}
|
||||
catch(\Doctrine\DBAL\DBALException $e) {}
|
||||
$this->wsLog('greffe_bilans', $identifiant, $refCommande);
|
||||
} catch(Exception $e) {
|
||||
$commandeM->update(array('cmdError'=> $e->getMessage()), 'id='.$id);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
try {
|
||||
$this->conn->update('sdv1.greffe_commandes_bi',
|
||||
array('cmdError'=> $e->getMessage()), array('id' => $id));
|
||||
}
|
||||
catch(\Doctrine\DBAL\DBALException $e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -691,7 +721,7 @@ class Pieces extends Scores_Ws_Server
|
||||
case 'F':
|
||||
|
||||
if ( $diffusion == 'C' ) {
|
||||
//Commande chez Infogreffe
|
||||
// Commande chez Infogreffe
|
||||
$infogreffe = new Metier_Infogreffe_DocAC($identifiant);
|
||||
try {
|
||||
$infogreffe->getCommandeC($depotDate, $depotNum, $acteType, $acteDate, $acteNum, 'G-AC-'.$id);
|
||||
|
Loading…
Reference in New Issue
Block a user