issue #0001265 : Interval to +/-5, Add parameter to force or only to check

This commit is contained in:
Michael RICOIS 2012-09-21 10:16:05 +00:00
parent fc83e995cc
commit c319564e19

View File

@ -1267,12 +1267,12 @@ class Saisie extends WsScore
* Saisie d'un bilan
* @param string $siren
* @param BilanInfos $data
* @param string $step (normal|nocheck|onlycheck)
* @return int
* @throws SoapFault
*/
public function setBilan($siren, $data)
public function setBilan($siren, $data, $step = null)
{
set_time_limit(300);
$this->authenticate();
//Control input value
@ -1313,7 +1313,8 @@ class Saisie extends WsScore
}
//Mathematic control
if (count($tabPostes)>0) {
if ($step != 'nocheck' && count($tabPostes)>0)
{
global $tabCtrl;
require_once 'Metier/partenaires/classMBilans.php';
$tabFormules = array();
@ -1366,12 +1367,15 @@ class Saisie extends WsScore
} else {
$total = $tabPostes[$formule['total']];
}
if ($calc!=$total && !($calc-3<$total && $calc+3>$total) ) {
if ($calc!=$total && !($calc-5<$total && $calc+5>$total) ) {
throw new SoapFault('ERR', join(';',$checkPostes));
}
}
}
}
if ( $step == 'onlycheck' ) {
return 1;
}
//Connect to the database
try {
@ -1437,15 +1441,7 @@ class Saisie extends WsScore
//Update
try {
//$bilansM->getAdapter()->getProfiler()->setEnabled(true);
$id = $bilansM->update($dataToUpdate, 'id = '.$row->id);
/*
$query = $bilansM->getAdapter()->getProfiler()->getLastQueryProfile()->getQuery();
$queryParams = $bilansM->getAdapter()->getProfiler()->getLastQueryProfile()->getQueryParams();
file_put_contents('test.log', $query."\n".print_r($queryParams,1));
$bilansM->getAdapter()->getProfiler()->setEnabled(false);
*/
$id = $bilansM->update($dataToUpdate, 'id = '.$row->id);
} catch (Zend_Db_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
throw new SoapFault('ERR', "Application error");