diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 3e5d09b57..b7646559b 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -376,7 +376,7 @@ switch ($op)
$field=$http->get("field");
$type=$http->get("type");
$exercice=$http->get("exercice","number");
- $last=$http->get("last","number");
+ $last=$http->get("last","string",0);
// if last == 1 then show first and last periode of the
// exercice
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 1a8cfc22f..912fa1067 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -3670,8 +3670,16 @@ function updatePeriode(p_dossier, p_exercice, p_periode_from, p_periode_to, p_la
{
waiting_box();
var exercice = $(p_exercice).value;
- new Ajax.Updater(p_periode_from, "ajax_misc.php", {method: "get", parameters: {op: "periode_change", "gDossier": p_dossier, "exercice": exercice, field: p_periode_from, "type": "from", "last": p_last}});
- new Ajax.Updater(p_periode_to, "ajax_misc.php", {method: "get", parameters: {op: "periode_change", "gDossier": p_dossier, "exercice": exercice, field: p_periode_to, "type": "to", "last": p_last}});
+ new Ajax.Updater(p_periode_from, "ajax_misc.php",
+ { method: "get",
+ parameters: {op: "periode_change", "gDossier": p_dossier, "exercice": exercice,
+ field: p_periode_from, "type": "from", "last": p_last}});
+ if ( p_periode_to && p_last ) {
+ new Ajax.Updater(p_periode_to, "ajax_misc.php",
+ { method: "get",
+ parameters: {op: "periode_change", "gDossier": p_dossier, "exercice": exercice,
+ field: p_periode_to, "type": "to", "last": p_last}});
+ }
remove_waiting_box();
}
/**
diff --git a/include/anc_od.inc.php b/include/anc_od.inc.php
index fc7ca554e..a636d6cac 100644
--- a/include/anc_od.inc.php
+++ b/include/anc_od.inc.php
@@ -31,6 +31,7 @@ require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_operation.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_group_operation.class.php';
+require_once NOALYSS_INCLUDE.'/class/exercice.class.php';
global $g_user;
$http=new HttpInput();
@@ -100,7 +101,14 @@ if ( isset($_GET['see']))
echo dossier::hidden();
$hid=new IHidden();
-
+ $exercice=$http->request("exercice","number",0);
+ if ($exercice == 0 ){
+ $exercice=$g_user->get_exercice();
+ }
+ $ex=new Exercice($cn);
+ $js=sprintf("updatePeriode(%d,'%s','%s')",Dossier::id(),'exercice','p_periode');
+ $wex=$ex->select('exercice',$exercice,' onchange="'.$js.'"');
+ echo $wex->input();
$hid->name="ac";
$hid->value=$http->request("ac");
echo $hid->input();
@@ -114,7 +122,8 @@ if ( isset($_GET['see']))
// filter on the current year
$filter_year=" where p_exercice='".$g_user->get_exercice()."'";
- $periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end",1);
+ $periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode
+ where p_exercice=$1 order by p_start,p_end",1,[$exercice]);
$g_user=new User($cn);
$current=$http->get("p_periode","number",$g_user->get_periode());
$w->value=$periode_start;