Filter year on the current year
This commit is contained in:
parent
0d1c21d308
commit
2dd99ad8e2
3 changed files with 11 additions and 5 deletions
|
|
@ -51,14 +51,14 @@ $input_from=new IPeriod("from_periode",$from);
|
|||
$input_from->show_end_date=false;
|
||||
$input_from->type=ALL;
|
||||
$input_from->cn=$cn;
|
||||
$input_from->filter_year;
|
||||
$input_from->filter_year=true;
|
||||
$input_from->user=$User;
|
||||
echo 'Depuis :'.$input_from->input();
|
||||
// filter on the current year
|
||||
$to=(isset($_GET["to_periode"]))?$_GET['to_periode']:"";
|
||||
$input_to=new IPeriod("to_periode",$to);
|
||||
$input_to->show_start_date=false;
|
||||
$input_to->filter_year;
|
||||
$input_to->filter_year=true;
|
||||
$input_to->type=ALL;
|
||||
$input_to->cn=$cn;
|
||||
$input_to->user=$User;
|
||||
|
|
|
|||
|
|
@ -95,15 +95,19 @@ class IPeriod extends HtmlInput
|
|||
to_char(p_end,'DD.MM.YYYY') as p_end_string
|
||||
from parm_periode
|
||||
$sql_closed ";
|
||||
|
||||
$cond="";
|
||||
|
||||
/* Create a filter on the current exercice */
|
||||
if ( ! isset($this->filter_year) || (isset($this->filter_year) && $this->filter_year==true))
|
||||
{
|
||||
if (! isset($this->user) ) throw new Exception (__FILE__.':'.__LINE__.' user is not set');
|
||||
$cond='';
|
||||
if ($this->type == 'all' ) $cond=' where true ';
|
||||
$cond.=" and p_exercice='".$this->user->get_exercice()."'";
|
||||
if ( $sql_closed=="") $and=" where " ; else $and=" and ";
|
||||
if ($this->type == 'all' ) $cond=$and.' true ';
|
||||
$cond.=" $and p_exercice='".$this->user->get_exercice()."'";
|
||||
}
|
||||
$sql.=" order by p_start,p_end";
|
||||
$sql.=$cond." order by p_start,p_end";
|
||||
$Res=$this->cn->exec_sql($sql);
|
||||
$Max=$this->cn->size($Res);
|
||||
if ( $Max == 0 ) throw new Exception(_('Aucune periode trouvée'),1);
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ if ( isset ($_REQUEST['gDossier']))
|
|||
|
||||
// if periode is closed then warns the users
|
||||
$period=new Periode($cn,$l_user_per);
|
||||
|
||||
$period->p_id=$l_user_per;
|
||||
$period->jrn_def_id=0;
|
||||
if ( $period->is_closed($l_user_per)==1)
|
||||
|
|
@ -147,6 +148,7 @@ if ( isset ($_REQUEST['gDossier']))
|
|||
$period=new IPeriod("period");
|
||||
$period->user=$User;
|
||||
$period->cn=$cn;
|
||||
$period->filter_year=false;
|
||||
$period->value=$l_user_per;
|
||||
$period->type=ALL;
|
||||
$l_form_per=$period->input();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue