[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 66/119: Multiple contact Search on selected a
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 66/119: Multiple contact Search on selected attribute |
Date: |
Mon, 26 Oct 2020 18:27:23 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 7aadc12a6d8de949848c142fa9c5bb0b3135e42e
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Oct 10 14:01:48 2020 +0200
Multiple contact Search on selected attribute
---
html/js/card.js | 7 ++++++-
include/ajax/ajax_add_concerned_card.php | 5 +++--
include/class/card_attribut_mtable.class.php | 2 +-
include/class/card_multiple.class.php | 29 +++++++++++++++++-----------
4 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/html/js/card.js b/html/js/card.js
index aed90e9..253d213 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -183,6 +183,7 @@ function action_concerned_search_card(obj)
var dossier = 0;
var inp="";
var ag_id=0;
+ var search_in=-1;
if (obj.dossier) {
dossier = obj.dossier; /* From the button */
@@ -204,6 +205,9 @@ function action_concerned_search_card(obj)
if (obj.elements['ag_id']) {
ag_id = obj.elements['ag_id'].value;
}
+ if (obj.elements['search_in']) {
+ search_in = obj.elements['search_in'].value;
+ }
}
if (dossier == 0) {
throw "obj.dossier not found";
@@ -218,7 +222,8 @@ function action_concerned_search_card(obj)
'ctl' : 'unused',
'ag_id' : ag_id,
'op':'card',
- 'accvis':0
+ 'accvis':0,
+ 'search_in':search_in
});
waiting_box();
diff --git a/include/ajax/ajax_add_concerned_card.php
b/include/ajax/ajax_add_concerned_card.php
index c8e7091..6b0d61d 100644
--- a/include/ajax/ajax_add_concerned_card.php
+++ b/include/ajax/ajax_add_concerned_card.php
@@ -1,4 +1,4 @@
-<?php,
+<?php
/*
* This file is part of NOALYSS.
@@ -65,7 +65,7 @@ $r.=_('Fiche contenant').Icon_Action::infobulle(19);
$r.=$q->input();
// where to search
$select=new ISelect("search_in");
-$select->value=$cn->make_array("select ad_id, ad_text from attr_def order by 2
",1);
+$select->value=$cn->make_array("select ad_id, ad_text from attr_def where
ad_search_followup = 1 order by 2 ",1);
$select->selected=$http->get("search_in","string","");
$r.=_("limité aux champs ").$select->input();
$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton");
@@ -78,6 +78,7 @@ $r.='</form>';
$query=$http->get("query", "string","");
$sql_array['query']=$query;
$sql_array['typecard']='all';
+$sql_array['search_in']=$select->selected;
$fiche=new Card_Multiple($cn);
/* Build the SQL and show result */
diff --git a/include/class/card_attribut_mtable.class.php
b/include/class/card_attribut_mtable.class.php
index 5638384..3ba7d9b 100644
--- a/include/class/card_attribut_mtable.class.php
+++ b/include/class/card_attribut_mtable.class.php
@@ -34,7 +34,7 @@ class Card_Attribut_MTable extends Manage_Table_SQL
function __construct(\Data_SQL $p_table)
{
parent::__construct($p_table);
- $this->set_property_visible("ad_id", FALSE);
+ $this->set_property_visible("ad_id", TRUE);
$this->set_property_updatable("ad_id", FALSE);
$this->set_col_label("ad_text", _("Nom"));
$this->set_col_label("ad_type", _("Type"));
diff --git a/include/class/card_multiple.class.php
b/include/class/card_multiple.class.php
index 2296d80..270a700 100644
--- a/include/class/card_multiple.class.php
+++ b/include/class/card_multiple.class.php
@@ -25,25 +25,31 @@
*/
class Card_Multiple
{
-
+ private $sql ; //!< SQL with the right column name
function __construct()
{
-
+ $this->sql="select
f_id,quick_code,vw_name,accounting,vw_first_name,vw_description
+ from vw_fiche_attr ";
}
function build_sql($sql_array)
{
$cn=Dossier::connect();
$query=sql_string($sql_array['query']);
-
- $string_sql="select *
- from vw_fiche_attr
- where
- vw_name ilike '%$query%'
- or quick_code ilike '%$query%'
- order by vw_name
- limit
- ".MAX_CARD_SEARCH;
+ if ( $sql_array['search_in'] == "-1")
+ {
+ $string_sql=$this->sql."
+ where
+ vw_name ilike '%$query%'
+ or quick_code ilike '%$query%'
+ order by vw_name
+ limit
+ ".MAX_CARD_SEARCH;
+ } else {
+ $string_sql=sprintf($this->sql." where f_id in (select f_id from
fiche_detail where
+ ad_id = '%s' and ad_value ilike '%%%s%%') "
+ , sql_string($sql_array["search_in"]),$query);
+ }
return $string_sql;
}
@@ -83,6 +89,7 @@ class Card_Multiple
if ( ! $g_user->can_read_action($ag_id)) {
throw new Exception (_("CMCDO01"."Security"));
}
+ // First select the option
$sql="select
cor.cor_id,
cor.cor_label,
- [Noalyss-commit] [noalyss] 63/119: Bug #1839 : : accentuated character broken, (continued)
- [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, 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 <=
- [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
- [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