issue #0001372 : Return type for getLienDoc

This commit is contained in:
Michael RICOIS 2012-11-09 16:07:16 +00:00
parent 01223b0073
commit 862ad6d4cc
3 changed files with 47 additions and 6 deletions

View File

@ -19,3 +19,4 @@ Type[] = "SupprAnnonceReturn"
Type[] = "DupliqueAnnonceReturn"
Type[] = "BilanInfos"
Type[] = "SearchLienRef"
Type[] = "LienDoc"

View File

@ -1787,7 +1787,7 @@ class Saisie extends WsScore
* @param int $id
* @param string $type Lien|Entreprise
* @throws SoapFault
* @return string
* @return LienDoc[]
*/
public function getLienDoc($id, $type = 'Lien')
{
@ -1815,7 +1815,7 @@ class Saisie extends WsScore
$lienrefM = new Application_Model_JoLiensRef($db);
$sql = $lienrefM->select()->where('siren=?',$id);
$row = $lienrefM->fetchRow($sql);
$idNum = $row->current()->id;
$idNum = $row->id;
}
//Type = Lien
elseif ($type == 'Lien') {
@ -1827,7 +1827,8 @@ class Saisie extends WsScore
try {
$sql = $liendocM->select()
->where('idNum=?', $idNum)
->where('idType=?', $type);
->where('idType=?', $type)
->where('dateSuppr=?', '0000-00-00 00:00:00');
$rowset = $liendocM->fetchAll($sql);
} catch (Zend_Db_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
@ -1836,8 +1837,34 @@ class Saisie extends WsScore
throw new SoapFault('ERR', $e->getMessage());
}
}
$result = $rowset->toArray();
return json_encode($result);
$output = array();
if ( $rowset->count()>0 ) {
$refFileInterne = array(
);
foreach ( $rowset as $item ) {
$struct = new LienDoc();
$struct->perimetre = $item->periDoc;
$params = explode('-', $item->docRef);
switch($params[0]) {
case 'INTERNE' :
$struct->label = $item->docRef;
$struct->url = $item->docRef;
break;
case 'GREFFE' :
$struct->label = $item->docRef;
$struct->url = $item->docRef;
//@todo
break;
}
$struct->date = $item->dateDocRef;
$output[] = $struct;
}
}
return $output;
}
/**

View File

@ -312,4 +312,17 @@ class SearchLienRef
}
class LienDoc
{
/** @var string */
public $perimetre;
/** @var string */
public $label;
/** @var string */
public $url;
/** @var string */
public $date;
}