diff --git a/html/ajax_history.php b/html/ajax_history.php index 056dac545..96b013682 100644 --- a/html/ajax_history.php +++ b/html/ajax_history.php @@ -1,36 +1,37 @@ get_exercice(); if ( $year == 0 ) - { + { $html="erreur aucune période par défaut, allez dans préférence pour en choisir une"; - } + } else - { + { $per=new Periode($cn); $limit_periode=$per->get_limit($year); $array['from_periode']=$limit_periode[0]->first_day(); $array['to_periode']=$limit_periode[1]->last_day(); + if (isset($_GET['ex'])) + { + $limit_periode=$per->get_limit($_GET['ex']); + $array['from_periode']=$limit_periode[0]->first_day(); + } + + /* + * Add button to select another year + */ + if ($exercice->count() > 1 ) + { + $default=(isset($_GET['ex']))?$_GET['ex']:$year; + $dossier=dossier::id(); + if ( $div != 'popup') + { + $obj="{div:'$div',f_id:'".$_GET['f_id']."',gDossier:'$dossier',select:this}"; + $is=$exercice->select('p_exercice',$default,' onchange="update_history_card('.$obj.');"'); + $old="Autre exercice ".$is->input(); + } + else + { + $old='
'; + } + } ob_start(); require_once('template/history_top.php'); if ( $fiche->HtmlTable($array)==-1){ - echo h2info("Aucun opération pour l'exercice courant"); + echo h2info( $fiche->getName().'['.$fiche->strAttribut(ATTR_DEF_QUICKCODE).']'); + echo h2("Aucun opération pour l'exercice courant",'class="error"'); } + echo $old; + $html=ob_get_contents(); ob_clean(); - } -} + } + } /////////////////////////////////////////////////////////////////////////// // for an account /////////////////////////////////////////////////////////////////////////// if ( isset($_REQUEST['pcm_val'])) -{ + { $poste=new Acc_Account_Ledger($cn,$_REQUEST['pcm_val']); $year=$user->get_exercice(); if ( $year == 0 ) - { + { $html="erreur aucune période par défaut, allez dans préférence pour en choisir une"; - } + } else - { + { + $exercice=new Exercice($cn); + $old=''; $per=new Periode($cn); $limit_periode=$per->get_limit($year); $array['from_periode']=$limit_periode[0]->first_day(); $array['to_periode']=$limit_periode[1]->last_day(); + if (isset($_GET['ex'])) + { + $limit_periode=$per->get_limit($_GET['ex']); + $array['from_periode']=$limit_periode[0]->first_day(); + } + /* + * Add button to select another year + */ + if ($exercice->count() > 1 ) + { + $default=(isset($_GET['ex']))?$_GET['ex']:$year; + $dossier=dossier::id(); + if ( $div != 'popup') + { + $obj="{div:'$div',pcm_val:'".$_GET['pcm_val']."',gDossier:'$dossier',select:this}"; + $is=$exercice->select('p_exercice',$default,' onchange="update_history_account('.$obj.');"'); + $old="Autre exercice ".$is->input(); + } + else + { + $old=''; + } + + } ob_start(); require_once('template/history_top.php'); + if ( $poste->HtmlTable($array) == -1) { - echo h2info("Aucun opération pour l'exercice courant"); + echo h2info($poste->id." ".$poste->name); + echo h2("Aucun opération pour l'exercice courant",'class="error"'); } + echo $old; + $html=ob_get_contents(); ob_clean(); - } -} + } + } $html=escape_xml($html); header('Content-type: text/xml; charset=UTF-8'); echo <<