[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 51/119: Add group of tag to an action
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 51/119: Add group of tag to an action |
Date: |
Mon, 26 Oct 2020 18:27:17 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit a5b27d92538f9531cc452c1e45a67478142132ef
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Mon Oct 5 16:25:42 2020 +0200
Add group of tag to an action
---
html/js/scripts.js | 5 +++--
include/ajax/ajax_search_add_tag.php | 2 +-
include/ajax/ajax_tag_add_action.php | 21 ++++++++++++++++++---
include/class/follow_up.class.php | 3 ++-
include/class/tag.class.php | 5 +++++
include/template/tag_select.php | 7 +++++--
6 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index b29f056..f1658da 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -2575,13 +2575,14 @@ function action_tag_select(p_dossier, ag_id)
* @brief Add the current tag to the current ag_id
* @param {type} p_dossier
* @param {type} ag_id
+ * @param p_isgroup g it is a group , t is a single tag
* @returns {undefined}
*/
-function action_tag_add(p_dossier, ag_id, t_id)
+function action_tag_add(p_dossier, ag_id, t_id,p_isgroup)
{
try {
waiting_box();
- var queryString = "t_id=" + t_id + "&ag_id=" + ag_id +
"&op=tag_add&gDossier=" + p_dossier;
+ var queryString = "t_id=" + t_id + "&ag_id=" + ag_id +
"&op=tag_add&gDossier=" + p_dossier+"&isgroup="+p_isgroup;
var action = new Ajax.Request(
"ajax_misc.php",
{
diff --git a/include/ajax/ajax_search_add_tag.php
b/include/ajax/ajax_search_add_tag.php
index 2e5b2d2..d1e3b85 100644
--- a/include/ajax/ajax_search_add_tag.php
+++ b/include/ajax/ajax_search_add_tag.php
@@ -42,7 +42,7 @@ if ($http->request("obj")=='t')
elseif ($http->request("obj")=="g")
{
// Add all the tag from the group
- $aTag=$cn->get_array("select t_id,t_tag from jnt_tag_group_tag jtgt join
tags on (tag_id=t_id) where tag_group_id=1 order by 2 ");
+ $aTag=$cn->get_array("select t_id,t_tag from jnt_tag_group_tag jtgt join
tags on (tag_id=t_id) where tag_group_id=$1 order by 2 ",[$http->get("id",
"number")]);
$nb_atag=count($aTag);
$pref=$http->get("pref");
if ( $nb_atag > 0) {
diff --git a/include/ajax/ajax_tag_add_action.php
b/include/ajax/ajax_tag_add_action.php
index cdb4c4a..890966c 100644
--- a/include/ajax/ajax_tag_add_action.php
+++ b/include/ajax/ajax_tag_add_action.php
@@ -24,11 +24,26 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas
permis');
*@see Follow_Up
*@see Tag
*/
+$http=new HttpInput();
$fl=new Follow_Up($cn);
-$fl->ag_id=$_REQUEST['ag_id'];
-if ( $g_user->can_write_action($fl->ag_id) == TRUE )
- $fl->tag_add($_REQUEST['t_id']);
+
+$fl->ag_id=$http->request("ag_id","number");
+
+if ( $g_user->can_write_action($fl->ag_id) != TRUE ) return;
+
+if ( $http->request("isgroup") == 't') {
+ $fl->tag_add($http->request('t_id',"number"));
+} else {
+ // Add all the tag from the group
+ $aTag=$cn->get_array("select t_id,t_tag from jnt_tag_group_tag jtgt join
tags on (tag_id=t_id) where tag_group_id=$1 order by 2
",[$http->request("t_id","number")]);
+ $nb_atag=count($aTag);
+ if ( $nb_atag > 0) {
+ for ($i=0;$i<$nb_atag;$i++){
+ $fl->tag_add($aTag[$i]['t_id']);
+ }
+ }
+}
ob_start();
diff --git a/include/class/follow_up.class.php
b/include/class/follow_up.class.php
index 26a8927..6734dd2 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -1504,9 +1504,10 @@ class Follow_Up
echo ' ';
echo ' ';
}
- $js=sprintf("onclick=\"action_tag_select('%s','%s')\"", dossier::id(),
$this->ag_id);
+
if ($g_user->can_write_action($this->ag_id)==true)
{
+ $js=sprintf("onclick=\"action_tag_select('%s','%s')\"",
dossier::id(), $this->ag_id);
echo HtmlInput::button('tag_bt', 'Ajout tag', $js, 'smallbutton');
}
}
diff --git a/include/class/tag.class.php b/include/class/tag.class.php
index 27e8b00..792e8cd 100644
--- a/include/class/tag.class.php
+++ b/include/class/tag.class.php
@@ -42,6 +42,11 @@ class Tag
function select()
{
$ret=$this->data->seek("where t_actif='Y' order by t_tag");
+ $ret=$this->cn->exec_sql(" select t_id,t_tag,t_description,'t' as
tag_type
+ from tags
+ where t_actif='Y'
+ union all
+ select tg_id,tg_name ,'G','g' from tag_group order by 2");
require_once NOALYSS_TEMPLATE.'/tag_select.php';
}
/**
diff --git a/include/template/tag_select.php b/include/template/tag_select.php
index ea6d4bb..709c9ff 100644
--- a/include/template/tag_select.php
+++ b/include/template/tag_select.php
@@ -5,7 +5,9 @@
* @file
* @brief list of tags
*/
-?><?php
+$http=new HttpInput();
+?>
+<?php
echo HtmlInput::title_box('Tag', 'tag_div');
$max=$this->cn->count($ret);
if ( $max == 0 ) {
@@ -26,13 +28,14 @@ if ( $max == 0 ) {
<?php
$gDossier=Dossier::id();
if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
+$ag_id=$http->request("ag_id","number");
for ($i=0;$i<$max;$i++):
$row=Database::fetch_array($ret, $i);
?>
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
-
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
+
$js=sprintf("action_tag_add('%s','%s','%s','%s')",$gDossier,$ag_id,$row['t_id'],$row['tag_type']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>
- [Noalyss-commit] [noalyss] 70/119: Card can be disable if not used anymore, (continued)
- [Noalyss-commit] [noalyss] 70/119: Card can be disable if not used anymore, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 73/119: Contact option : export CSV, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 67/119: Link between contact option and document, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 75/119: Fix : by default new contact options were not added to document_type, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 63/119: Bug #1839 : : accentuated character broken, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 76/119: Add : upgrade scrip added, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 24/119: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 25/119: erge branch 'dev-7400-7500', Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 33/119: doc, Dany De Bontridder, 2020/10/26
- [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 <=
- [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, 2020/10/26
- [Noalyss-commit] [noalyss] 89/119: upgrade db 146, Dany De Bontridder, 2020/10/26