[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 80/119: Follow Up : multiple card , search by
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 80/119: Follow Up : multiple card , search by category of card |
Date: |
Mon, 26 Oct 2020 18:27:29 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 5ee686eae65331401a2c334c1f1cdd077bd138f9
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Oct 11 17:58:24 2020 +0200
Follow Up : multiple card , search by category of card
---
html/js/card.js | 9 +++++++--
include/ajax/ajax_add_concerned_card.php | 15 +++++++++++++--
include/class/card_multiple.class.php | 18 ++++++++++++++----
3 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/html/js/card.js b/html/js/card.js
index 3228d51..3e9c112 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -188,6 +188,7 @@ function action_concerned_search_card(obj)
var ag_id=0;
var search_in=-1;
var inactive_card=0;
+ var search_cat=-1;
if (obj.dossier) {
dossier = obj.dossier; /* From the button */
@@ -212,9 +213,12 @@ function action_concerned_search_card(obj)
if (obj.elements['search_in']) {
search_in = obj.elements['search_in'].value;
}
- if ( obj.inactive_card) {
+ if ( obj.elements['inactive_card']) {
inactive_card=obj.elements['inactive_card'].value;
}
+ if ( obj.elements['search_cat']) {
+ search_cat=obj.elements['search_cat'].value;
+ }
}
if (dossier == 0) {
throw "obj.dossier not found";
@@ -231,7 +235,8 @@ function action_concerned_search_card(obj)
'op':'card',
'accvis':0,
'search_in':search_in,
- 'inactive_card':inactive_card
+ 'inactive_card':inactive_card,
+ 'search_cat':search_cat
});
waiting_box();
diff --git a/include/ajax/ajax_add_concerned_card.php
b/include/ajax/ajax_add_concerned_card.php
index de16902..9187a70 100644
--- a/include/ajax/ajax_add_concerned_card.php
+++ b/include/ajax/ajax_add_concerned_card.php
@@ -63,21 +63,31 @@ $q->value=(isset($query))?$query:'';
$r.='<span style="margin-left:50px">';
$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 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");
+
$r.='</span>';
$r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card');
$r.=HtmlInput::request_to_hidden(array('ag_id'));
+
+// Search by category
+$sel_Category=new ISelect("search_cat");
+$sel_Category->value=$cn->make_array("select fd_id,fd_label from fiche_def
order by 2",1);
+$sel_Category->set_value($http->request("search_cat","string","-1"));
+$r.=_("Catégorie")." ".$sel_Category->input();
+
+// search also inactive card
$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.=_("Fiches inactives").$is->input();
+$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton");
$r.='</form>';
@@ -86,6 +96,7 @@ $sql_array['query']=$query;
$sql_array['typecard']='all';
$sql_array['search_in']=$select->selected;
$sql_array['inactive_card']=$inactive;
+$sql_array['search_cat']=$sel_Category->selected;
$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 d70c237..4f59e8b 100644
--- a/include/class/card_multiple.class.php
+++ b/include/class/card_multiple.class.php
@@ -44,6 +44,11 @@ class Card_Multiple
if ( $sql_array["inactive_card"]==0) {
$filter=" and ".$this->filter_enable_card();
}
+ // By Cat of card
+ $sql_cat="";
+ if ( $sql_array['search_cat']!=-1) {
+ $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']);
+ }
$query=sql_string($sql_array['query']);
if ( $sql_array['search_in'] == "-1")
{
@@ -51,14 +56,14 @@ class Card_Multiple
where
(vw_name ilike '%$query%'
or quick_code ilike '%$query%')
- ".$filter."
+ ".$filter.$sql_cat."
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%%') %s"
- , sql_string($sql_array["search_in"]),$query,$filter);
+ ad_id = '%s' and ad_value ilike '%%%s%%') %s %s"
+ ,
sql_string($sql_array["search_in"]),$query,$filter,$sql_cat);
}
return $string_sql;
}
@@ -75,13 +80,18 @@ class Card_Multiple
if ( $sql_array["inactive_card"]==0) {
$filter="and ".$this->filter_enable_card();
}
+ // By Cat of card
+ $sql_cat="";
+ if ( $sql_array['search_cat']!=-1) {
+ $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']);
+ }
$string_sql="select count(*)
from vw_fiche_attr
where
( vw_name ilike '%$query%'
or quick_code ilike '%$query%')
- ".$filter;
+ ".$filter.$sql_cat;
return $cn->get_value($string_sql);
- [Noalyss-commit] [noalyss] 30/119: Bug 1834 : duplicate , cannot confirm an duplicated operation because the $_GET is taken in priority, (continued)
- [Noalyss-commit] [noalyss] 30/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] 29/119: Remove debug info, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 37/119: javascript: remove hardcoding of dialog box for manage_table, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 52/119: NEW Security : add tag, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 22/119: ManageTable : you can set the style of the dialog box, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 23/119: Rewriting of Predefined Operation. You can add new Predefined Operation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 43/119: Documentation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 50/119: Follow-up search : show the closing status, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 60/119: FollowUp Deatil : add the amount + tva from card, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 74/119: Search concerned card with company , name , ... and export contact option to CSV, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 80/119: Follow Up : multiple card , search by category of card,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 15/119: doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 19/119: fix type, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 20/119: documentation, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 26/119: FollowUp : new right : delete action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 40/119: ManageTable : you can set the style of the dialog box, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 36/119: javascript : add function to concat 2 json objects, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 32/119: Bug : syntax error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 31/119: Bug : use ilike instead of tilde, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 46/119: Follow-up : tag enable when create doc, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 48/119: Action and Document Add missing files, Dany De Bontridder, 2020/10/26