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) {
echo "Source inconnu"; exit;
}
$ws = new WsScores();
$reponse = $ws->dupliqueAnnonce($sourceNum, $idan, $siretIn, $siretOut);
$error = $reponse->error;
if ( isset($error) && $error->errnum == 0 ){
$output = 'Annonce '.$idan.' dupliqué sur '.$siretOut.'!';
} elseif ( isset($error) && $error->errnum != 0 ) {
$output = 'Erreur lors de la duplication.';
} else {
$output = "Une erreur est survenue...";
}
echo $output;
// Version new
$ws = new Scores_Ws_Client('saisie', '0.2');
$params = new stdClass();
$params->source = $sourceNum;
$params->idAnn = $idan;
$params->siretIn = $siretIn;
$params->siretOut = $siretOut;
$devp=array('sourceNum' => $sourceNum,'idan' => $idan,'siretIn' => $siretIn, 'siretOut' => $siretOut);
$infos = $ws->dupliqueAnnonce($params);
if ($infos === false) {
echo 'Erreur du Webservice';
$this->forward('soap', 'error');
}
echo $infos->error->errmsg;
break;
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>
$('form#saisie').bind('submit', function(){
var options = {
target: '#result',
beforeSubmit: function(data){},
success: function(data){ $('#result').html(data); }
};
$(this).ajaxSubmit(options);
return false;
$('form#saisie').submit(function(){
event.preventDefault(); // Prevent the form from submitting via the browser
var form = $(this);
$.ajax({
target: '#result',
type: "POST",
url: form.attr('action'),
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>

View File

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

View File

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