diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php
index d9fc2b372..2a1c28f56 100644
--- a/include/cfgledger.inc.php
+++ b/include/cfgledger.inc.php
@@ -78,7 +78,9 @@ if ($action_frm == 'delete' )
$ledger->delete_ledger();
$sa="";
echo '
';
- echo '
'.h($name). " est effacé"."
";
+ echo '';
+ printf(_(" %s est effacé"),h($name));
+ echo "
";
echo '';
$show_menu=1;
}
diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php
index 4f278d3b6..7a2333e17 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -2705,6 +2705,12 @@ class Acc_Ledger extends jrn_def_sql
$new=0;
$cn=$this->db;
echo $hidden;
+ $actif=new ISelect("jrn_enable");
+ $actif->value=[
+ ["label"=>_("Activé"),"value"=>1],
+ ["label"=>_("Désactivé"),"value"=>0]
+ ];
+ $actif->selected=$this->jrn_enable;
require_once NOALYSS_TEMPLATE.'/param_jrn.php';
}
@@ -2784,6 +2790,7 @@ class Acc_Ledger extends jrn_def_sql
$this->jrn_def_pj_pref=$jrn_def_pj_pref;
$this->jrn_deb_max_line=($min_row<1)?1:$min_row;
$this->jrn_def_description=$p_description;
+ $this->jrn_enable=$jrn_enable;
switch ($this->jrn_def_type)
{
case 'ACH':
@@ -3239,6 +3246,13 @@ class Acc_Ledger extends jrn_def_sql
"image/bouton-plus.png");
return $str_add_button;
}
+ /**
+ * Check if a ledger is enabled , 1 for yes and 0 if disabled
+ */
+ function is_enable()
+ {
+ return $this->db->get_value("select jrn_enable from jrn_def where jrn_def_id=$1",[$this->id]);
+ }
}
diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php
index ff1654e14..a90f53b62 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -1094,6 +1094,7 @@ class Acc_Ledger_Search
for ($e=0;$eset_attribute("ledger_type", $row['jrn_def_type']);
$idx=$row['jrn_def_id'];
diff --git a/include/class/user.class.php b/include/class/user.class.php
index 4849af92e..256b5e330 100644
--- a/include/class/user.class.php
+++ b/include/class/user.class.php
@@ -317,10 +317,10 @@ class User
switch ($p_access)
{
case 3:
- $sql_access = " and uj_priv!= 'X'";
+ $sql_access = " and uj_priv!= 'X' ";
break;
case 2:
- $sql_access = " and uj_priv = 'W'";
+ $sql_access = " and uj_priv = 'W' and jrn_enable=1 ";
break;
case 1:
@@ -332,7 +332,7 @@ class User
jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
jrn_deb_max_line,jrn_cred_max_line,jrn_def_description
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
- join user_sec_jrn on uj_jrn_id=jrn_def_id
+ join user_sec_jrn on uj_jrn_id=jrn_def_id,jrn_enable
where
uj_login='" . $this->login . "'" .
$sql_type . $sql_access .
@@ -340,9 +340,9 @@ class User
}
else
{
- $sql_type = ($p_type == 'ALL') ? '' : "where jrn_def_type=upper('" . sql_string($p_type) . "')";
+ $sql_type = ($p_type == 'ALL') ? ' ' : "where jrn_def_type=upper('" . sql_string($p_type) . "') ";
$sql = "select jrn_def_id,jrn_def_type,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
- jrn_type_id,jrn_desc,'W' as uj_priv,jrn_def_description
+ jrn_type_id,jrn_desc,'W' as uj_priv,jrn_def_description,jrn_enable
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
$sql_type
order by jrn_Def_name";
diff --git a/include/database/jrn_def_sql.class.php b/include/database/jrn_def_sql.class.php
index e430a43b2..4840fbc34 100644
--- a/include/database/jrn_def_sql.class.php
+++ b/include/database/jrn_def_sql.class.php
@@ -266,7 +266,8 @@ class Jrn_Def_sql
,jrn_def_bank
,jrn_def_num_op
,jrn_def_id
-,jrn_def_description) values ($1
+,jrn_def_description,
+jrn_enable) values ($1
,$2
,$3
,$4
@@ -282,6 +283,7 @@ class Jrn_Def_sql
,$14
,$15
,$16
+,1
) returning jrn_def_id";
$this->jrn_def_id = $this->db->get_value(
@@ -325,6 +327,7 @@ class Jrn_Def_sql
,jrn_def_bank = $13
,jrn_def_num_op = $14
,jrn_def_description = $15
+,jrn_enable=$17
where jrn_def_id= $16";
$res = $this->db->exec_sql(
$sql, array($this->jrn_def_name
@@ -342,7 +345,9 @@ class Jrn_Def_sql
, $this->jrn_def_bank
, $this->jrn_def_num_op
, strip_tags($this->jrn_def_description)
- , $this->jrn_def_id)
+ , $this->jrn_def_id
+ , $this->jrn_enable
+ )
);
}
@@ -368,6 +373,7 @@ class Jrn_Def_sql
,jrn_def_bank
,jrn_def_num_op
,jrn_def_description
+,jrn_enable
from public.jrn_def where jrn_def_id=$1";
/* please adapt */
$res = $this->db->get_array(
diff --git a/include/template/param_jrn.php b/include/template/param_jrn.php
index d31b6b699..4634d0d93 100644
--- a/include/template/param_jrn.php
+++ b/include/template/param_jrn.php
@@ -73,7 +73,14 @@ echo $str_add_button;
|
-
+
+ |
+
+ |
+
+
+ |
+
| |
@@ -113,15 +120,15 @@ echo $str_add_button;
|
-
- |
-
- |
-
-
+ |
+ =_("Journal actif")?>
|
-
+
+ =$actif->input()?>
+ |
+
+