Amélioration javascript mise en surveillance

This commit is contained in:
Michael RICOIS 2015-07-03 09:19:34 +00:00
parent 8b39a102dd
commit 02cf20aa85
2 changed files with 25 additions and 14 deletions

View File

@ -143,11 +143,19 @@ class SurveillanceController extends Zend_Controller_Action
$validateur = new Zend_Validate_EmailAddress();
//Vérification siret / email / ref
if (empty($siret) || empty($email) || empty($ref)){
$msg = 'Erreur email ou reférence non définie !';
// --- Vérification siret
if ( empty($siret) ){
$msg = 'Erreur SIRET non définie !';
}
// --- Vérification email
elseif ( empty($email) ){
$msg = 'Erreur email non définie !';
}
// --- Vérification ref
elseif ( empty($ref) ){
$msg = 'Erreur reférence non définie !';
} else {
// --- Vérification des emails
$emails = explode(';', $email);
$emailsValid = true;
foreach ( $emails as $email ) {
@ -156,7 +164,6 @@ class SurveillanceController extends Zend_Controller_Action
break;
}
}
if ( $emailsValid ) {
//Vérification de l'encours (chiffres)
if (!preg_match('/([0-9]+)/', $encours)){

View File

@ -103,20 +103,24 @@ function survSubmit(){
}
$('#frmSurv').replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
if (source.length>0) {
var i = 0;
$.each( source, function( key, value ) {
$.post(action, {siret: siret, ref: ref, email: email, encours: encours, source: value} ,
function(data) { $('#frmSurv').append('<br/>'+data);
$.post(action, {siret: siret, ref: ref, email: email, encours: encours, source: value}, function(data) {
$('#frmSurv').append('<br/>'+data);
}, 'text');
i++;
if (i == source.length) {
$('#frmSurv').append('<br/>Mise sous surveillance terminé.');
}
});
$('#frmSurv').append('<br/>Mise sous surveillance terminé.');
$('#dialogsurv').dialog({ buttons: [
{ text: "Fermer", click: function() { window.location.href = windowhref; } }
]});
$('#dialogsurv').dialog({ buttons: [ {
text: "Fermer", click: function() { window.location.href = windowhref; }
} ]});
} else {
$('#frmSurv').replaceWith('<div id="frmSurv">Aucune source !</div>');
$('#dialogsurv').dialog({ buttons: [
{ text: "Fermer", click: function() { window.location.href = windowhref; } }
]});
$('#dialogsurv').dialog({ buttons: [ {
text: "Fermer", click: function() { window.location.href = windowhref; }
} ]});
}
}
</script>