[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 87/119: Document Type : CFGACTION cannot add
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 87/119: Document Type : CFGACTION cannot add new document, fix order in dialog box, Fix= cannot delete action cause cascade on action_person |
Date: |
Mon, 26 Oct 2020 18:27:31 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit ed50fc802d59c74df8b9d1e61378bb228b405f23
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Mon Oct 12 12:59:22 2020 +0200
Document Type : CFGACTION cannot add new document, fix order in dialog
box,Fix= cannot delete action cause cascade on action_person
---
include/ajax/ajax_cfgaction.php | 4 +-
.../class/action_document_type_mtable.class.php | 70 ++++++++++++++--------
sql/upgrade.sql | 2 +
3 files changed, 50 insertions(+), 26 deletions(-)
diff --git a/include/ajax/ajax_cfgaction.php b/include/ajax/ajax_cfgaction.php
index 6562531..8d2312e 100644
--- a/include/ajax/ajax_cfgaction.php
+++ b/include/ajax/ajax_cfgaction.php
@@ -63,13 +63,15 @@ $action_document_type->set_object_name($ctl_id);
if ($action=="input")
{
-
+ $action_document_type->set_order(["dt_id", "dt_value","dt_prefix"]);
+
header('Content-type: text/xml; charset=UTF-8');
echo $action_document_type->ajax_input()->saveXML();
return;
}
elseif ($action=="save")
{
+ $action_document_type->set_order(["dt_id", "dt_value","dt_prefix"]);
$xml=$action_document_type->ajax_save();
header('Content-type: text/xml; charset=UTF-8');
echo $xml->saveXML();
diff --git a/include/class/action_document_type_mtable.class.php
b/include/class/action_document_type_mtable.class.php
index f02f56d..a48b98a 100644
--- a/include/class/action_document_type_mtable.class.php
+++ b/include/class/action_document_type_mtable.class.php
@@ -162,35 +162,55 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
function input()
{
parent::input();
-
-
-
+
+
+
// Detail option contact
$table=$this->get_table();
$cn=$table->cn;
- // insert new contact options
- $cn->exec_sql("insert into jnt_document_option_contact
(jdoc_enable,document_type_id,
- contact_option_ref_id)
- select 0 , $1, cor_id
- from contact_option_ref
- where
- cor_id not in (select cor_id from
- jnt_document_option_contact a
- where
a.document_type_id=$1)",[$table->dt_id]);
-
- // Select all
-
- $aOption=$cn->get_array("select
cor_id,cor_label,cor_type,document_type_id ,coalesce(jdoc_enable,0) jdoc_enable
- from
- contact_option_ref cor
- left join jnt_document_option_contact jdoc on
(cor_id=contact_option_ref_id)
- where
- document_type_id is null
- or document_type_id = $1
- order by cor_label",[$this->table->dt_id]);
+ try
+ {
+ $cn->start();
+ if ( $table->dt_id == -1 ){
+ $aOption=$cn->get_array("select cor_id,cor_label,cor_type,-1
document_type_id,0 jdoc_enable
+ from
+ contact_option_ref cor
+ order by cor_label");
+
+ } else {
+ // insert new contact options
+ $cn->exec_sql("insert into jnt_document_option_contact
(jdoc_enable,document_type_id,
+ contact_option_ref_id)
+ select 0 , $1, cor_id
+ from contact_option_ref
+ where
+ cor_id not in (select cor_id from
+ jnt_document_option_contact a
+ where a.document_type_id=$1)",
[$table->dt_id]);
+
+ // Select all
+ $aOption=$cn->get_array("select
cor_id,cor_label,cor_type,document_type_id ,coalesce(jdoc_enable,0) jdoc_enable
+ from
+ contact_option_ref cor
+ left join jnt_document_option_contact jdoc on
(cor_id=contact_option_ref_id)
+ where
+ document_type_id is null
+ or document_type_id = $1
+ order by cor_label", [$this->table->dt_id]);
+ }
+
+ // Detail option
+ require NOALYSS_TEMPLATE."/action_document_type_mtable_input.php";
+ $cn->commit();
+ }
+ catch (Exception $exc)
+ {
+ $cn->rollback();
+
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ }
- // Detail option
- require NOALYSS_TEMPLATE."/action_document_type_mtable_input.php";
}
/**
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index e69de29..847dce7 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -0,0 +1,2 @@
+ALTER TABLE public.action_person drop CONSTRAINT action_gestion_ag_id_fk2 ;
+ALTER TABLE public.action_person ADD CONSTRAINT action_gestion_ag_id_fk2
FOREIGN KEY (ag_id) REFERENCES action_gestion(ag_id) on delete cascade on
update cascade;
- [Noalyss-commit] [noalyss] 41/119: Rewriting of Predefined Operation. You can add new Predefined Operation, (continued)
- [Noalyss-commit] [noalyss] 41/119: Rewriting of Predefined Operation. You can add new Predefined Operation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 51/119: Add group of tag to an action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 59/119: prevent divide by zero in formula, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 65/119: Rewriting of card attributes, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 69/119: Improve Input_Switch , do not echo but returns string, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 66/119: Multiple contact Search on selected attribute, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 77/119: fix upgrade145.sql , default value must be 1 for actif, sql wrong, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 78/119: Fix FollowUp : price Purchase or Sale, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 79/119: protect, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 86/119: Follow up cosmetic add title to anchor, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 87/119: Document Type : CFGACTION cannot add new document, fix order in dialog box, Fix= cannot delete action cause cascade on action_person,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 89/119: upgrade db 146, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 91/119: Follow-up correct link, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 97/119: Fix : generate document remove "extract", Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 105/119: Follow-Up Cosmetic, form before creating a new follow-up action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 109/119: Remove select_dialog file, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 117/119: Follow-up export contact option with all the the card's attribute, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 94/119: typo : tag instead of étiquette, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 71/119: Search on active card for Contact Multiple, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 95/119: fix : select_box search doesn't work, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 12/119: Bug 1834 : duplicate , cannot confirm an duplicated operation because the $_GET is taken in priority, Dany De Bontridder, 2020/10/26