Passage webservice en version 2 + correction affichage du dialogue

This commit is contained in:
Claire DELBOS 2017-02-14 09:56:20 +01:00
parent 5f27da2646
commit f59827e869
4 changed files with 37 additions and 22 deletions

View File

@ -728,18 +728,21 @@ class SaisieController extends Zend_Controller_Action
if ($sourceNum === false) { if ($sourceNum === false) {
echo "Source inconnu"; exit; echo "Source inconnu"; exit;
} }
$ws = new WsScores(); // Version new
$reponse = $ws->dupliqueAnnonce($sourceNum, $idan, $siretIn, $siretOut); $ws = new Scores_Ws_Client('saisie', '0.2');
$error = $reponse->error; $params = new stdClass();
if ( isset($error) && $error->errnum == 0 ){ $params->source = $sourceNum;
$output = 'Annonce '.$idan.' dupliqué sur '.$siretOut.'!'; $params->idAnn = $idan;
} elseif ( isset($error) && $error->errnum != 0 ) { $params->siretIn = $siretIn;
$output = 'Erreur lors de la duplication.'; $params->siretOut = $siretOut;
} else { $devp=array('sourceNum' => $sourceNum,'idan' => $idan,'siretIn' => $siretIn, 'siretOut' => $siretOut);
$output = "Une erreur est survenue..."; $infos = $ws->dupliqueAnnonce($params);
}
echo $output;
if ($infos === false) {
echo 'Erreur du Webservice';
$this->forward('soap', 'error');
}
echo $infos->error->errmsg;
break; break;
case 'edit': case 'edit':

View File

@ -87,13 +87,21 @@ $('select[name="even[]"]').change(function(){
<script type="text/javascript" src="/libs/form/jquery.form.min.js"></script> <script type="text/javascript" src="/libs/form/jquery.form.min.js"></script>
<script> <script>
$('form#saisie').bind('submit', function(){ $('form#saisie').submit(function(){
var options = { event.preventDefault(); // Prevent the form from submitting via the browser
target: '#result', var form = $(this);
beforeSubmit: function(data){}, $.ajax({
success: function(data){ $('#result').html(data); } target: '#result',
}; type: "POST",
$(this).ajaxSubmit(options); url: form.attr('action'),
return false; data: form.serialize()
}).success(function(data) {
$('#result').html(data);
// Optionally alert the user of success here...
}).error(function(data) {
$('#result').html('Copie impossible');
// Optionally alert the user of an error here...
});
return false;
}); });
</script> </script>

View File

@ -166,7 +166,7 @@ class Scores_Ws_Client extends Zend_Soap_Client
Zend_Registry::get('firebug')->info($arguments); Zend_Registry::get('firebug')->info($arguments);
} }
try { //try {
$response = parent::__call($name, $arguments); $response = parent::__call($name, $arguments);
@ -182,7 +182,7 @@ class Scores_Ws_Client extends Zend_Soap_Client
return $response->{$name.'Result'}; return $response->{$name.'Result'};
} catch ( SoapFault $fault ) { /*} catch ( SoapFault $fault ) {
// --- Debug // --- Debug
if ( array_key_exists('debug', $methodConfig) ) { if ( array_key_exists('debug', $methodConfig) ) {
@ -228,7 +228,7 @@ class Scores_Ws_Client extends Zend_Soap_Client
} }
return false; return false;
} }*/
} }
/** /**

View File

@ -5,5 +5,9 @@ return array(
'debug' => true, 'debug' => true,
'log' => 'mail', 'log' => 'mail',
), ),
'dupliqueAnnonce' => array(
'debug' => true,
'log' => 'mail',
),
) )
); );