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