[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 12/12: Bug : follow-up , add a new security a
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 12/12: Bug : follow-up , add a new security against the duplicate for Follo_Up reference (ag_ref) |
Date: |
Sun, 8 Nov 2020 15:52:16 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9d5d626ad80fd656f11914a95661d5b3d85ad4f0
Author: Dany wm De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Nov 8 21:47:03 2020 +0100
Bug : follow-up , add a new security against the duplicate for Follo_Up
reference (ag_ref)
---
include/class/follow_up.class.php | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/class/follow_up.class.php
b/include/class/follow_up.class.php
index 010958b..37191c6 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -539,13 +539,17 @@ class Follow_Up
$this->ag_title=$doc_mod->dt_value;
}
$this->ag_id=$this->db->get_next_seq('action_gestion_ag_id_seq');
- // Get The sequence id,
$seq_name="seq_doc_type_".$this->dt_id;
-
- // Create the reference
- $ag_ref=$this->db->get_value('select dt_prefix from document_type
where dt_id=$1', array($this->dt_id)).'-'.$this->db->get_next_seq($seq_name);
+ // to avoid duplicate
+ do {
+ // Create the reference
+ $ag_ref=$this->db->get_value('select dt_prefix from document_type
where dt_id=$1', array($this->dt_id)).'-'.$this->db->get_next_seq($seq_name);
+ // if reference does not exist , finish the loop
+ if ( $this->db->get_value("select count(*) from action_gestion
where ag_ref = $1",array($ag_ref)) == 0)
+ break;
+ } while (1);
+ // check if the reference already exist and try to compute new one
$this->ag_ref=$ag_ref;
-
// save into the database
if ($this->ag_remind_date!=null||$this->ag_remind_date!='')
{
- [Noalyss-commit] [noalyss] 02/12: Cosmetic : install structure input, (continued)
- [Noalyss-commit] [noalyss] 02/12: Cosmetic : install structure input, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 01/12: Cosmetic : follow up, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 03/12: Cosmetic, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 04/12: Bug : incompatibilty with php 7.4, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 05/12: ergonomy : add waiting box, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 06/12: Bug : follow up mixed description and comment, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 09/12: Print Accounting : export pdf does not work, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 10/12: Bug : when ledger not found, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 07/12: task #0001861: Plage de cases à cocher , search action, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 08/12: Remove direct access _GET, Dany De Bontridder, 2020/11/08
- [Noalyss-commit] [noalyss] 12/12: Bug : follow-up , add a new security against the duplicate for Follo_Up reference (ag_ref),
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 11/12: Improve Test, Dany De Bontridder, 2020/11/08