diff --git a/Controleur/ControleurAjaxcontroleavenantpolice.php b/Controleur/ControleurAjaxcontroleavenantpolice.php new file mode 100644 index 0000000..9c67a9f --- /dev/null +++ b/Controleur/ControleurAjaxcontroleavenantpolice.php @@ -0,0 +1,32 @@ +police = new Police(); + } + + public function index() + { + $controler_avenant_info = "0"; + + $idPolice = $_SESSION['idPolice_C']; + + $controle = $this->requete->getParametreFormulaire("controle"); + + if($controle=="existequittance") + { + $controler_avenant_info = $this->police->getExisteQuittance($idPolice); + + if($controler_avenant_info=="0") + { + $controler_avenant_info = $this->police->getExisteConsommationPolice($idPolice); + } + } + + $this->genererVueAjax(array('controler_avenant_info' => $controler_avenant_info)); + } +} \ No newline at end of file diff --git a/Js/fonctions.js b/Js/fonctions.js index 3b24a83..786aef4 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1377,9 +1377,6 @@ function creer_avenant() function enregistrer_avenant() { - alert("enregistrer_avenant"); - return; - codeTypeAvenant=$("#codeTypeAvenant").val(); oldCodeTypeAvenant=$("#oldCodeTypeAvenant").val(); @@ -1419,71 +1416,16 @@ function enregistrer_avenant() } } - if(codeTypeAvenant=="REN") - { - var td1 = new Date($("#DateRenouvellement").val()); - var td2 = $("#dateAvenant").datepicker("getDate"); - - dt1=Math.round(Date.parse(td1)/(1000*3600*24)); - dt2=Math.round(Date.parse(td2)/(1000*3600*24)); - - if (dt1>dt2) - { - v_msg="Veuillez revoir la date de renouvellement!"; - v_msgEng="Please review the renewal date!"; - alert_ebene(v_msg, v_msgEng); + motifavenant=$("#motifavenant").val(); + + if ($("#motifavenant").val()<" ") + { + v_msg="Veuillez fournir le motif!"; + v_msgEng="Please provide the reason"; + alert_ebene(v_msg, v_msgEng); - return; - } - - var eff = $("#dateAvenant").datepicker("getDate"); - var ech = $("#dateEcheanceRen").datepicker("getDate"); - - if (ech>eff.addMonths(12)) { - v_msg="Période supérieur à un an!"; - v_msgEng="Period greater than one year!"; - alert_ebene(v_msg, v_msgEng); - } - } - - if(codeTypeAvenant=="CHE" && oldCodeTypeAvenant=="REN") - { - var td1 = new Date($("#dateEffet").val()); - var td2 = $("#dateAvenant").datepicker("getDate"); - - dt1=Math.round(Date.parse(td1)/(1000*3600*24)); - dt2=Math.round(Date.parse(td2)/(1000*3600*24)); - - if (dt1>dt2) - { - v_msg="Veuillez revoir la date!"; - v_msgEng="Please review the date!"; - alert_ebene(v_msg, v_msgEng); - - return; - } - } - - if ( - codeTypeAvenant=="RET" || - codeTypeAvenant=="RES" || - codeTypeAvenant=="SUS" || - codeTypeAvenant=="ANL"|| - codeTypeAvenant=="RVP"|| - codeTypeAvenant=="ADL"|| - codeTypeAvenant=="CHE") - { - motifavenant=$("#motifavenant").val(); - - if ($("#motifavenant").val()<" ") - { - v_msg="Veuillez fournir le motif!"; - v_msgEng="Please provide the reason"; - alert_ebene(v_msg, v_msgEng); - - return; - } - } + return; + } v_msg="Confirmez-vous cet avenant?"; v_msgEng="Do you confirm this amendment to the contract?"; @@ -1492,75 +1434,6 @@ function enregistrer_avenant() { var div_attente = $('#div_attente'); div_attente.html('
' + 'Chargement en cours! Veuillez patienter...' + '