extranet/includes/saisie/saisie_annonces.php
2010-06-24 09:42:23 +00:00

69 lines
1.5 KiB
PHP

<?php
function getAnnonceCollecte($idan, $siret = ''){
global $client;
$idanResult = false;
try {
$O = $client->getAnnonceCollecte($idan, $siret);
$idanResult = $O['result'];
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client, $fault, $_SESSION['tabInfo']);
}
return $idanResult;
}
switch ( $subaction ) {
case 'deleteDialog':
$idan = $params[2];
$siret = $params[3];
?>
<div id="result">
Êtes-vous sur de vouloir supprimer l'annonce <?=$idan?> ?
</div>
<form name="deleteDialog">
<input type="hidden" name="idan" value="<?=$idan?>" />
<input type="hidden" name="siret" value="<?=$siret?>" />
</form>
<?php
break;
case 'copyDialog':
break;
case 'editDialog':
$idan = $params[2];
$siret = $params[3];
if ( !empty($idan) ){
$idanResult = getAnnonceCollecte($idan, $siret);
FB::log($idanResult, 'result');
}
break;
case 'delete':
$idan = $_REQUEST['idan'];
$siret = $_REQUEST['siret'];
FB::log($idan, 'idan');
try {
$O = $client->supprAnnonceCollecte($idan, $siret);
$error = $O['error'];
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client, $fault, $_SESSION['tabInfo']);
}
FB::log($O, 'O');
if ( isset($error) && $error['errNum'] == 0 ){
echo 'Annonce '.$idan.' supprimé !';
} elseif ( isset($error) && $error['errNum'] != 0 ) {
echo 'Erreur lors de la suppression.';
} else {
echo "Une erreur est survenue...";
}
break;
case 'copy':
break;
case 'edit':
break;
}