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->authenticate();
|
||||||
$this->permission('actes');
|
$this->permission('actes');
|
||||||
|
|
||||||
if ( strlen($identifiant)!=9 ) {
|
if (strlen($identifiant) != 9) {
|
||||||
$this->sendError('1010');
|
$this->sendError('1010');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty($reference) ) {
|
if (empty($reference)) {
|
||||||
$reference = '';
|
$reference = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,45 +416,65 @@ class Pieces extends Scores_Ws_Server
|
|||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
|
|
||||||
//Génération identifiant de commande unique
|
// Génération identifiant de commande unique
|
||||||
$refCommande = uniqid();
|
$refCommande = uniqid();
|
||||||
|
|
||||||
$iInsee = new Metier_Insee_MInsee();
|
$iInsee = new Metier_Insee_MInsee();
|
||||||
$identite = $iInsee->getIdentiteLight($identifiant);
|
$identite = $iInsee->getIdentiteLight($identifiant);
|
||||||
|
|
||||||
//Sauvegarde dans la base
|
// Sauvegarde dans la base
|
||||||
$commandeM = new Application_Model_Sdv1GreffeCommandesBi();
|
$data = array(
|
||||||
$id = $commandeM->insert(array(
|
'refCommande' => $refCommande,
|
||||||
'refCommande' => $refCommande,
|
'login' => $this->User->login,
|
||||||
'login' => $this->User->login,
|
'email' => $this->User->email,
|
||||||
'email' => $this->User->email,
|
'refClient' => $reference,
|
||||||
'refClient' => $reference,
|
'mode' => $diffusion,
|
||||||
'mode' => $diffusion,
|
'siren' => $identifiant,
|
||||||
'siren' => $identifiant,
|
'raisonSociale' => $identite['Nom'],
|
||||||
'raisonSociale' => $identite['Nom'],
|
'bilanCloture' => $dateCloture,
|
||||||
'bilanCloture' => $dateCloture,
|
'bilanType' => $type,
|
||||||
'bilanType' => $type,
|
'dateInsert' => date('YmdHis'),
|
||||||
'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':
|
case 'T':
|
||||||
|
|
||||||
//Passer la commande chez infogreffe
|
// Passer la commande chez infogreffe
|
||||||
$infogreffe = new Metier_Infogreffe_DocBI($identifiant);
|
$infogreffe = new Metier_Infogreffe_DocBI($identifiant);
|
||||||
//$infogreffe->debug = true;
|
//$infogreffe->debug = true;
|
||||||
try {
|
try {
|
||||||
$pdf = $infogreffe->getCommandeT($dateCloture, $type, $id);
|
$pdf = $infogreffe->getCommandeT($dateCloture, $type, $id);
|
||||||
$commandeM->update(array('dateEnvoi'=> date('YmdHis')), 'id='.$id);
|
try {
|
||||||
} catch (Exception $e) {
|
$this->conn->update('sdv1.greffe_commandes_bi',
|
||||||
$commandeM->update(array('cmdError'=> $e->getMessage()), 'id='.$id);
|
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 ) {
|
if ( $e->getCode() == $infogreffe::INT ) {
|
||||||
throw new SoapFault('ERR', "Erreur lors de la commande auprès de notre prestataire.");
|
throw new SoapFault('ERR', "Erreur lors de la commande auprès de notre prestataire.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Distribuer le fichier
|
// Distribuer le fichier
|
||||||
if ( !empty($pdf) ) {
|
if ( !empty($pdf) ) {
|
||||||
|
|
||||||
$c = Zend_Registry::get('config');
|
$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
|
$output = $hostname . '/fichier/greffes/' . basename($dest); // @todo : Chemin du fichier
|
||||||
$this->wsLog('greffe_bilans', $identifiant, basename($dest));
|
$this->wsLog('greffe_bilans', $identifiant, basename($dest));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
throw new SoapFault('ERR', 'Fichier introuvable');
|
throw new SoapFault('ERR', 'Fichier introuvable');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,15 +504,24 @@ class Pieces extends Scores_Ws_Server
|
|||||||
case 'C':
|
case 'C':
|
||||||
case 'F':
|
case 'F':
|
||||||
|
|
||||||
//Commande chez Infogreffe
|
// Commande chez Infogreffe
|
||||||
if ( $diffusion == 'C' ) {
|
if ( $diffusion == 'C' ) {
|
||||||
$infogreffe = new Metier_Infogreffe_DocBI($identifiant);
|
$infogreffe = new Metier_Infogreffe_DocBI($identifiant);
|
||||||
try {
|
try {
|
||||||
$infogreffe->getCommandeC($dateCloture, $type, 'G-BI-'.$id);
|
$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);
|
$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':
|
case 'F':
|
||||||
|
|
||||||
if ( $diffusion == 'C' ) {
|
if ( $diffusion == 'C' ) {
|
||||||
//Commande chez Infogreffe
|
// Commande chez Infogreffe
|
||||||
$infogreffe = new Metier_Infogreffe_DocAC($identifiant);
|
$infogreffe = new Metier_Infogreffe_DocAC($identifiant);
|
||||||
try {
|
try {
|
||||||
$infogreffe->getCommandeC($depotDate, $depotNum, $acteType, $acteDate, $acteNum, 'G-AC-'.$id);
|
$infogreffe->getCommandeC($depotDate, $depotNum, $acteType, $acteDate, $acteNum, 'G-AC-'.$id);
|
||||||
|
Loading…
Reference in New Issue
Block a user