Suppression des blocages
This commit is contained in:
parent
2ade7e965b
commit
4b18ed1eaf
@ -7,9 +7,9 @@ class Order extends Scores_Ws_Server
|
||||
* Financial account : Placing an order to have the entered numbers in the database
|
||||
* @param string $siren
|
||||
* Le siren de l'entité
|
||||
* @param string $date
|
||||
* @param string $date
|
||||
* Date de cloture du bilan
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
* N:Normal, S:Simplifié, C:Consolidé
|
||||
* @param string $source
|
||||
* Code partenaire fourni pour l'envoi de bilan PDF
|
||||
@ -25,20 +25,20 @@ class Order extends Scores_Ws_Server
|
||||
$this->permission('UPLOADBILAN');
|
||||
|
||||
// Check source
|
||||
if (in_array($source, array('extranet', 'greffe'))) {
|
||||
|
||||
}
|
||||
if (in_array($source, array('extranet', 'infogreffe'))) {
|
||||
|
||||
}
|
||||
// Check Siren
|
||||
else {
|
||||
if (strlen($siren) != 9 || intval($siren) == 0) {
|
||||
throw new SoapFault('ERR', "SIREN invalid");
|
||||
}
|
||||
}
|
||||
$iInsee = new Metier_Insee_MInsee();
|
||||
$result = $iInsee->getIdentiteLight($siren);
|
||||
if (count($result) == 0) {
|
||||
throw new SoapFault('ERR', "SIREN invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$refCommande = uniqid();
|
||||
|
||||
@ -64,9 +64,9 @@ class Order extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send file content as base64
|
||||
* Send file content as base64
|
||||
* @param string $ref
|
||||
* Order reference
|
||||
* @param string $file
|
||||
@ -80,44 +80,44 @@ class Order extends Scores_Ws_Server
|
||||
{
|
||||
$this->authenticate();
|
||||
$this->permission('UPLOADBILAN');
|
||||
|
||||
|
||||
// Ref exist
|
||||
$commandeM = new Application_Model_Sdv1OrderBilanInput();
|
||||
$commandeSql = $commandeM->select()->where('refCommande=?', $ref);
|
||||
$commandeResult = $commandeM->fetchRow($commandeSql);
|
||||
|
||||
|
||||
if ($commandeResult === false) {
|
||||
throw new SoapFault('ERR', "Ref not exist");
|
||||
}
|
||||
|
||||
|
||||
// Generate filename
|
||||
$siren = $commandeResult->siren;
|
||||
$siren = $commandeResult->siren;
|
||||
$type = $commandeResult->type;
|
||||
$cloture = $commandeResult->bilanCloture;
|
||||
$ref = $commandeResult->refCommande;
|
||||
$filename = $siren.'_'.$type.'_'.$cloture.'_'.$ref.'.pdf';
|
||||
|
||||
// Save file
|
||||
$filename = $siren.'_'.$type.'_'.$cloture.'_'.$ref.'.pdf';
|
||||
|
||||
// Save file
|
||||
$decoded = base64_decode($file);
|
||||
if ($decoded === false) {
|
||||
throw new SoapFault('ERR', "Error decoding");
|
||||
}
|
||||
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = $c->profil->path->shared.'/datafile/clients/bilansext/send';
|
||||
|
||||
|
||||
$write = file_put_contents($path.'/'.$filename, $decoded);
|
||||
if ($write === false) {
|
||||
throw new SoapFault('ERR', "Error writing");
|
||||
}
|
||||
|
||||
|
||||
// Check MD5
|
||||
if (!empty($hash)) {
|
||||
if (md5_file($path.'/'.$filename) != $hash) {
|
||||
throw new SoapFault('ERR', "File hash verification failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sauvegarde database
|
||||
$data = array(
|
||||
'bilanFileSent' => date('YmdHis'),
|
||||
@ -133,10 +133,10 @@ class Order extends Scores_Ws_Server
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Financial account : Tag file is sent
|
||||
@ -151,10 +151,10 @@ class Order extends Scores_Ws_Server
|
||||
$this->permission('UPLOADBILAN');
|
||||
|
||||
// Check source = extranet
|
||||
if (!in_array($source, array('extranet', 'greffe'))) {
|
||||
/*if ($this->authApp != 'extranet') {
|
||||
throw new SoapFault('ERR', "Not authorize");
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
$data = array(
|
||||
'bilanFileSent' => date('YmdHis'),
|
||||
'bilanFile' => $filename,
|
||||
|
Loading…
Reference in New Issue
Block a user