[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 71/119: Search on active card for Contact Mul
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 71/119: Search on active card for Contact Multiple |
Date: |
Mon, 26 Oct 2020 18:27:25 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 67ce2beee64fffa412bd874a80279f2b1c7d5b73
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sat Oct 10 19:49:33 2020 +0200
Search on active card for Contact Multiple
---
include/ajax/ajax_add_concerned_card.php | 7 +++++
include/class/card_multiple.class.php | 45 +++++++++++++++++++++++++-------
2 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/include/ajax/ajax_add_concerned_card.php
b/include/ajax/ajax_add_concerned_card.php
index 6b0d61d..1f9f972 100644
--- a/include/ajax/ajax_add_concerned_card.php
+++ b/include/ajax/ajax_add_concerned_card.php
@@ -72,6 +72,12 @@ $r.=HtmlInput::submit('fs', _('Recherche'), "",
"smallbutton");
$r.='</span>';
$r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card');
$r.=HtmlInput::request_to_hidden(array('ag_id'));
+$inactive=$http->get("inactive_card","string",0);
+if ($inactive=="undefined" || $inactive == "") $inactive=0;
+$is=new InputSwitch("inactive_card",$inactive);
+$is->value=$inactive;
+$r.=_("Toutes les fiches").$is->input();
+
$r.='</form>';
@@ -79,6 +85,7 @@ $query=$http->get("query", "string","");
$sql_array['query']=$query;
$sql_array['typecard']='all';
$sql_array['search_in']=$select->selected;
+$sql_array['inactive_card']=$inactive;
$fiche=new Card_Multiple($cn);
/* Build the SQL and show result */
diff --git a/include/class/card_multiple.class.php
b/include/class/card_multiple.class.php
index e03a185..b409485 100644
--- a/include/class/card_multiple.class.php
+++ b/include/class/card_multiple.class.php
@@ -31,41 +31,68 @@ class Card_Multiple
$this->sql="select
f_id,quick_code,vw_name,accounting,vw_first_name,vw_description
from vw_fiche_attr ";
}
-
+ /**
+ *
+ * @param type $sql_array
+ * @return type
+ */
function build_sql($sql_array)
{
$cn=Dossier::connect();
+ $filter="";
+ if ( $sql_array["inactive_card"]==0) {
+ $filter=" and ".$this->filter_enable_card();
+ }
$query=sql_string($sql_array['query']);
if ( $sql_array['search_in'] == "-1")
{
$string_sql=$this->sql."
where
- vw_name ilike '%$query%'
- or quick_code ilike '%$query%'
+ (vw_name ilike '%$query%'
+ or quick_code ilike '%$query%')
+ ".$filter."
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);
+ ad_id = '%s' and ad_value ilike '%%%s%%') and %s"
+ , sql_string($sql_array["search_in"]),$query,$filter);
}
return $string_sql;
}
-
+ /**
+ *
+ * @param type $sql_array
+ * @return type
+ */
function count_sql($sql_array)
{
$cn=Dossier::connect();
$query=sql_string($sql_array['query']);
+ $filter="";
+ if ( $sql_array["inactive_card"]==0) {
+ $filter="and ".$this->filter_enable_card();
+ }
$string_sql="select count(*)
from vw_fiche_attr
where
- vw_name ilike '%$query%'
- or quick_code ilike '%$query%'";
+ ( vw_name ilike '%$query%'
+ or quick_code ilike '%$query%')
+ ".$filter;
- return $cn->get_value($string_sql); ;
+ return $cn->get_value($string_sql);
+ }
+ /**
+ *
+ * @return string
+ */
+ private function filter_enable_card()
+ {
+ $filter_enable_card=" f_id in (select f_id from fiche_detail where
ad_value = '1' and ad_id=54) ";
+ return $filter_enable_card;
}
/**
*
- [Noalyss-commit] [noalyss] 79/119: protect, (continued)
- [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
- [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 <=
- [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
- [Noalyss-commit] [noalyss] 16/119: Predefined Operation rewriting, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 21/119: Bug : remove file by error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 39/119: Bug : remove file by error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 35/119: Predefined Operation rewriting, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 28/119: Bug : cannot export Follow Up, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 38/119: documentation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 34/119: doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 27/119: Bug : correct search remove ~, Dany De Bontridder, 2020/10/26