[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 146/323: Ergonomy : ask exercice and periode
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 146/323: Ergonomy : ask exercice and periode separately in preference |
Date: |
Wed, 14 Mar 2018 17:38:40 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 37435125f42817b417e1e5fa541524f4665f738c
Author: Dany De Bontridder <address@hidden>
Date: Wed Feb 7 17:36:08 2018 +0100
Ergonomy : ask exercice and periode separately in preference
---
html/ajax_misc.php | 13 +++++++++++++
html/js/scripts.js | 5 +++++
include/ajax/ajax_preference.php | 35 ++++++++++++++++++++++++++---------
include/class/exercice.class.php | 2 +-
include/lib/iperiod.class.php | 9 +++++++--
5 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index c77c74c..1432864 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -245,6 +245,19 @@ if (array_key_exists($op, $path)) {
}
switch ($op)
{
+ case "pref_exercice":
+ $iperiod = new IPeriod("period");
+ $iperiod->id="setting_period";
+ $iperiod->user = $g_user;
+ $iperiod->cn = $cn;
+ $iperiod->filter_year = true;
+ $iperiod->exercice=$http->get("exercice");
+
+ $iperiod->type = ALL;
+ echo $iperiod->input();
+
+ return;
+ break;
case "remove_anc":
if ($g_user->check_module('ANCODS') == 0)
exit();
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 42942da..027e8a4 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3480,3 +3480,8 @@ function progress_bar_check(p_idx, p_taskid)
}
+function updatePeriodePreference(p_dossier)
+{
+ var exercice=$('exercice').value;
+ new
Ajax.Updater('setting_period',"ajax_misc.php",{method:"get",parameters:{
"op":"pref_exercice","gDossier":p_dossier,"exercice":exercice}});
+}
\ No newline at end of file
diff --git a/include/ajax/ajax_preference.php b/include/ajax/ajax_preference.php
index 1b92a86..f2d1aac 100644
--- a/include/ajax/ajax_preference.php
+++ b/include/ajax/ajax_preference.php
@@ -27,6 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/lib/iperiod.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_report.class.php';
require_once NOALYSS_INCLUDE.'/class/periode.class.php';
+require_once NOALYSS_INCLUDE.'/class/exercice.class.php';
echo HtmlInput::title_box(_('Préférence'), 'preference_div');
echo '<DIV class="content">';
echo '<p class="notice">';
@@ -105,21 +106,37 @@ if (isset($_REQUEST['gDossier']) &&
$_REQUEST['gDossier']<>0)
$period->p_id = $l_user_per;
$period->jrn_def_id = 0;
+ $selected_exercice=$period->get_exercice();
+
$js=sprintf('onchange="updatePeriodePreference(%d);"',Dossier::id());
+ $exercice=new Exercice($cn);
+
if ($period->is_closed($l_user_per) == 1)
{
$msg = _('Attention cette période est fermée, vous ne
pourrez rien modifier dans le module comptable');
$msg = '<h2 class="notice">' . $msg . '</h2>';
}
-
- $period = new IPeriod("period");
- $period->user = $g_user;
- $period->cn = $cn;
- $period->filter_year = false;
- $period->value = $l_user_per;
- $period->type = ALL;
- $l_form_per = $period->input();
+
+ $iperiod = new IPeriod("period");
+ $iperiod->id="setting_period";
+ $iperiod->user = $g_user;
+ $iperiod->cn = $cn;
+ $iperiod->filter_year = true;
+ $iperiod->exercice=$selected_exercice;
+ $iperiod->value = $l_user_per;
+ $iperiod->type = ALL;
+ $l_form_per = $iperiod->input();
?>
- <tr><td><?php echo _('Période');?></td>
+ <tr>
+ <td>
+ <?=_("Exercice")?>
+ </td>
+ <td>
+
<?=$exercice->select("exercice",$selected_exercice,$js)->input();?>
+ </td>
+ </tr>
+ <tr>
+
+ <td><?php echo _('Période');?></td>
<td>
<?php printf(' %s ', $l_form_per);?>
</td>
diff --git a/include/class/exercice.class.php b/include/class/exercice.class.php
index 991eea4..56290e4 100644
--- a/include/class/exercice.class.php
+++ b/include/class/exercice.class.php
@@ -26,7 +26,7 @@ require_once NOALYSS_INCLUDE.'/lib/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
class Exercice
{
- function __construct(&$cn)
+ function __construct($cn)
{
$this->cn=$cn;
}
diff --git a/include/lib/iperiod.class.php b/include/lib/iperiod.class.php
index 6b70d08..a4f1b6e 100644
--- a/include/lib/iperiod.class.php
+++ b/include/lib/iperiod.class.php
@@ -55,7 +55,8 @@ class IPeriod extends HtmlInput
$this->extra2="all";
$this->show_start_date=true;
$this->show_end_date=true;
- $this->exercice=$p_exercice;
+ $this->exercice=$p_exercice;
+ $this->id=$p_name;
}
/*!
* \brief show the input html for a periode
@@ -121,7 +122,11 @@ class IPeriod extends HtmlInput
$Res=$this->cn->exec_sql($sql);
$Max=$this->cn->size($Res);
if ( $Max == 0 ) throw new Exception(_('Aucune periode trouvée'),1);
- $ret='<SELECT NAME="'.$this->name.'" '.$this->javascript.'>';
+ $ret=sprintf('<SELECT NAME="%s" id="%s" %s>',
+ $this->name,
+ $this->id,
+ $this->javascript)
+ ;
for ( $i = 0; $i < $Max;$i++)
{
$l_line=$this->cn->fetch($i);
- [Noalyss-commit] [noalyss] 148/323: Fix : ajax_history : history of accounting , exercice was not set, (continued)
- [Noalyss-commit] [noalyss] 148/323: Fix : ajax_history : history of accounting , exercice was not set, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 150/323: Fix : PRINTJRN export CSV $Jrn used before created, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 153/323: FIX : PRINTJRN, ledger PDF, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 152/323: FIX : PRINTJRN, ledger, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 151/323: CSS : improve classic7, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 156/323: Improve : Exercice suivit par mois puis année, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 147/323: Logo : install / index, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 65/323: Task #0001530: Réécriture PRINTJRN, Base + Sale, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 155/323: Improve : last exercice in first place, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 157/323: typo, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 146/323: Ergonomy : ask exercice and periode separately in preference,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 160/323: bug: error js missing quote in ajax_input, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 145/323: merge rel6919.9, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 159/323: bug: error js in Icon_Action::close, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 171/323: History based on the date of the operation which it comes from, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 162/323: esthetic : improve title2, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 158/323: bug: cannot create user, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 167/323: Suppress obsolete files, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 174/323: Improve Documentation, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 172/323: History accounting / card : first column is date, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 176/323: Manage_Table_SQL : Add tips for some col, Dany De Bontridder, 2018/03/14