Ajout méthode getSurveillances (avec retour array), issue #0000379

This commit is contained in:
Michael RICOIS 2010-11-24 17:23:48 +00:00
parent 20494b7a84
commit 5de704d2d2
3 changed files with 108 additions and 33 deletions

View File

@ -78,3 +78,7 @@ Type.76 = "ListeSurveillancesCsv"
Type.77 = "RechercheHistoReturn"
Type.78 = "RechercheHistoCriteres"
Type.79 = "RechercheHistoReponses"
Type.80 = "SurveillancesReturn"
Type.81 = "SurveillancesResult"
Type.82 = "SurveillancesCriteres"
Type.83 = "SurveillancesReponses"

View File

@ -1164,3 +1164,63 @@ class RechercheHistoReponses
/** @var string */
public $Texte;
}
class SurveillancesReturn
{
/** @var ErrorType */
public $error;
/** @var SurveillancesResult */
public $result;
}
class SurveillancesResult
{
/** @var SurveillancesCriteres */
public $criteres;
/** @var int */
public $nbReponses;
/** @var int */
public $nbReponsesTotal;
/** @var int */
public $duree;
/** @var array */
public $mots;
/** @var SurveillancesReponses[] */
public $reponses;
}
class SurveillancesCriteres
{
/** @var string */
public $siren;
/** @var string */
public $nic;
/** @var string */
public $source;
}
class SurveillancesReponses
{
/** @var string */
public $source;
/** @var string */
public $email;
/** @var string */
public $siren;
/** @var string */
public $nic;
/** @var string */
public $ref;
/** @var string */
public $dateAjout;
/** @var string */
public $dateDerEnvoi;
/** @var string */
public $encoursClient;
/** @var string */
public $rs;
/** @var string */
public $cp;
/** @var string */
public $ville;
}

View File

@ -3274,7 +3274,7 @@ class WsInterne
* @param string $tri
* @return SurveillancesReturn
*/
protected function getSurveillances($siret=0, $source='annonces', $detail=false, $deb=0, $nbRet=100, $tri='siren')
public function getSurveillances($siret=0, $source='annonces', $detail=false, $deb=0, $nbRet=100, $tri='siren')
{
//Authentification
if (!$this->checkAuth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR']))
@ -3322,15 +3322,14 @@ class WsInterne
{
if (!$detail)
{
$tabRet[]=array(
'source' => $tabSurv['source'],
'email' => $tabSurv['email'],
'siren' => $tabSurv['siren'],
'nic' => $tabSurv['nic'],
'ref' => prepareString($tabSurv['ref']),
'dateAjout' => $tabSurv['dateAjout'],
'dateDerEnvoi' => $tabSurv['dateDerEnvoi'],
);
$surveillance = new SurveillancesReponses();
$surveillance->source = $tabSurv['source'];
$surveillance->email = $tabSurv['email'];
$surveillance->siren = $tabSurv['siren'];
$surveillance->nic = $tabSurv['nic'];
$surveillance->ref = $tabSurv['ref'];
$surveillance->dateAjout = $tabSurv['dateAjout'];
$surveillance->dateDerEnvoi = $tabSurv['dateDerEnvoi'];
}
else
{
@ -3343,33 +3342,45 @@ class WsInterne
$rs=$tabIdentite['Nom'];
$cp=$tabIdentite['CP'];
$ville=$tabIdentite['Ville'];
$iDb->update('surveillances_site',array('rs' => $rs,
'cp' => $cp,
'ville' => $ville),
"login='$login' AND dateSuppr=0 AND siren=".$tabSurv['siren']." AND nic=".$tabSurv['nic']." $strSource", false);
$iDb->update('surveillances_site',array(
'rs' => $rs,
'cp' => $cp,
'ville' => $ville),
"login='$login' AND dateSuppr=0 AND siren=".$tabSurv['siren']." AND nic=".$tabSurv['nic']." $strSource", false);
}
$tabRet[]=array('source' => $tabSurv['source'],
'email' => $tabSurv['email'],
'siren' => $tabSurv['siren'],
'nic' => $tabSurv['nic'],
'ref' => prepareString($tabSurv['ref']),
'dateAjout' => $tabSurv['dateAjout'],
'encoursClient' => $tabSurv['encoursClient'],
'rs' => $rs,
'cp' => $cp,
'ville' => $ville,
'dateDerEnvoi' => $tabSurv['dateDerEnvoi'],
);
$surveillance = new SurveillancesReponses();
$surveillance->source = $tabSurv['source'];
$surveillance->email = $tabSurv['email'];
$surveillance->siren = $tabSurv['siren'];
$surveillance->nic = $tabSurv['nic'];
$surveillance->ref = $tabSurv['ref'];
$surveillance->dateAjout = $tabSurv['dateAjout'];
$surveillance->dateDerEnvoi = $tabSurv['dateDerEnvoi'];
$surveillance->encoursClient = $tabSurv['encoursClient'];
$surveillance->rs = $rs;
$surveillance->cp = $cp;
$surveillance->ville = $ville;
}
$tabRet[] = $surveillance;
}
$rep=array( 'criteres'=>array( 'siren'=>$siren, 'nic'=>$nic, 'source'=>$source),
'nbReponses'=>count($tabRet),
'nbReponsesTotal'=>$nbRepTot,
'reponses'=>$tabRet,
);
// debugLog('I',"getSurveillances".print_r($tabRet,true),__LINE__,__FILE__, __FUNCTION__, __CLASS__);
return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'results'=>$rep);
$criteres = new SurveillancesCriteres();
$criteres->siren = $siren;
$criteres->nic = $nic;
$criteres->source = $source;
$result = new SurveillancesResult();
$result->criteres = $criteres;
$result->nbReponses = count($tabRet);
$result->nbReponsesTotal = $nbRepTot;
$result->reponses = $tabRet;
$output = new SurveillancesReturn();
$output->error = $error;
$output->result = $result;
return $output;
}
/**