[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 35/39: Task #0001813: CA – avertissement util
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 35/39: Task #0001813: CA – avertissement utilisation poste Info nombre d'utilisation Avoid delete on closed periode |
Date: |
Sat, 11 Jul 2020 13:20:47 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 6274b5eef69118a3048df54f6d27a4924f34ba69
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Fri Jul 10 18:52:27 2020 +0200
Task #0001813: CA – avertissement utilisation poste
Info nombre d'utilisation
Avoid delete on closed periode
---
include/class/anc_account_table.class.php | 34 ++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/include/class/anc_account_table.class.php
b/include/class/anc_account_table.class.php
index d92b0f9..08ad0c3 100644
--- a/include/class/anc_account_table.class.php
+++ b/include/class/anc_account_table.class.php
@@ -74,7 +74,7 @@ class Anc_Account_Table extends Manage_Table_SQL
$table->po_name=str_replace(">", '', $table->po_name);
// po_name must be uniq in the Analytic Plan
- if ( $cn->get_value("select count(*) from poste_analytique where
pa_id=$1 and po_name=$2 and po_id != $3",
+ if ( $cn->get_value("select count(*) from poste_analytique where
pa_id=$1 and po_name=upper($2) and po_id != $3",
array($table->pa_id,$table->po_name,$table->po_id)) > 0)
{
$is_error++;
@@ -90,4 +90,36 @@ class Anc_Account_Table extends Manage_Table_SQL
if ($is_error==0)return TRUE;
return FALSE;
}
+
+ /**
+ * @brief display a data row in the table, with the order defined
+ * in a_order and depending of the visibility of the column
+ */
+ function display_row($p_row)
+ {
+ $cn=Dossier::connect();
+ $count=$cn->get_value("select count(*) from
public.operation_analytique where po_id=$1",[$p_row["po_id"]]);
+ $p_row["po_name"]=sprintf("%s (%d)",$p_row['po_name'],$count);
+ parent::display_row($p_row);
+ }
+
+ /**
+ * Before deleting , we check that nothing is in a closed periode
+ */
+ function delete() {
+ $cn=Dossier::connect();
+ $count_closed=$cn->get_value(" select count(*)
+ from jrnx as jx1
+ join jrn jn1 on (jx1.j_grpt = jn1.jr_grpt_id )
+ join jrn_def as jf1 on (jn1.jr_def_id =jf1.jrn_def_id )
+ join jrn_periode as je1 on (jf1.jrn_def_id =je1.jrn_def_id
)
+ join operation_analytique as oa on (oa.j_id =jx1.j_id )
+ where
+ je1.status = 'CL' and oa.po_id=$1
",[$this->table->po_id]);
+ if ( $count_closed > 0 ) {
+ throw new \Exception(_("Effacement impossible : le poste est
utilisé dans une période fermée"));
+ }
+
+ }
+
}
- [Noalyss-commit] [noalyss] 27/39: Cosmetic #1808 : Ma au lieu de Me dans le calendrier, (continued)
- [Noalyss-commit] [noalyss] 27/39: Cosmetic #1808 : Ma au lieu de Me dans le calendrier, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 24/39: Cosmetic : disconnect, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 21/39: Install show choosen password for admin, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 28/39: update config.inc.example file, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 29/39: Orthographe, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 31/39: Bug : extourne ne fonctionne plus, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 20/39: Install : initialize variabvle, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 34/39: Improve error log, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 30/39: Ergonomie : autoliquidation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 32/39: Fix Bug : when duplicating an ODS operation, the accounting is cleared if a card is used, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 35/39: Task #0001813: CA – avertissement utilisation poste Info nombre d'utilisation Avoid delete on closed periode,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 36/39: CC Cosmetic, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 39/39: Error concat, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 33/39: Fix bug SQL check if a periode is closed returned wrong value, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 38/39: Improve : logging error, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 37/39: Javascript object before, Dany De Bontridder, 2020/07/11