diff --git a/include/class/contact.class.php b/include/class/contact.class.php
index ad85550fc..6903e30a5 100644
--- a/include/class/contact.class.php
+++ b/include/class/contact.class.php
@@ -77,10 +77,19 @@ class contact extends Fiche
sql_string($array['category']));
$where='';$and=' and ';
}
-
+ if ( isset ($array['active']) && $array['active'] == true) {
+ $sql_query .= $where.$and.sprintf(" f_enable='1' ");
+ $where='';$and=' and ';
+ }
return $sql_query;
}
-
+ function filter_active(bool $p_active) {
+ if ( $p_active) {
+ $this->filter['active']=true;
+ } else {
+ $this->filter['active']=false;
+ }
+ }
function filter_category($pn_category) {
unset($this->filter['category']);
if ( !empty($pn_category)
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index e11fb6d71..9c3169a29 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -1281,7 +1281,7 @@ class Fiche
}
- /*! Summary
+ /*!
* \brief show the default screen
*
* \param $p_search (filter)
@@ -1425,7 +1425,7 @@ class Fiche
$solde=abs(bcsub($deb,$cred));
$side=($deb > $cred)?'Débit':'Crédit';
$r.='
';
- $r.=td("").td("").td("").td("Totaux").td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(" $side ".nbm($solde),'class="num"');
+ $r.=td("").td("").td("").td("").td("Totaux").td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(" $side ".nbm($solde),'class="num"');
$r.='
';
$r.="";
$r.="";
diff --git a/include/constant.php b/include/constant.php
index 4e258c43a..f1de5a037 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
if (!defined("SYSINFO_DISPLAY")) {
define("SYSINFO_DISPLAY", TRUE);
}
-define("DBVERSION", 185);
+define("DBVERSION", 186);
define("MONO_DATABASE", 25);
define("DBVERSIONREPO", 20);
define('NOTFOUND', '--not found--');
diff --git a/include/contact.inc.php b/include/contact.inc.php
index 4b1e96b56..0b27a7343 100644
--- a/include/contact.inc.php
+++ b/include/contact.inc.php
@@ -114,7 +114,7 @@ if ($low_action == "list")
$sel_company=$http->get("sel_company");
$contact->filter_company($sel_company);
}
-
+ $contact->filter_active(true);
echo '';
echo $contact->Summary($search,"contact",$sql);
diff --git a/include/sql/patch/upgrade185.sql b/include/sql/patch/upgrade185.sql
new file mode 100644
index 000000000..f2a934760
--- /dev/null
+++ b/include/sql/patch/upgrade185.sql
@@ -0,0 +1,24 @@
+begin;
+
+drop view if exists v_contact ;
+
+
+create view v_contact as
+with contact_data as (select f.f_id , f.f_enable,f.fd_id from fiche f join fiche_def fd on (f.fd_id=fd.fd_id) where fd.frd_id=16)
+select f_id,f_enable,fd_id,
+ (select ad_value from fiche_detail where ad_id=32 and f_id=cd.f_id) as contact_fname,
+ (select ad_value from fiche_detail where ad_id=1 and f_id=cd.f_id) as contact_name,
+ (select ad_value from fiche_detail where ad_id=23 and f_id=cd.f_id) as contact_qcode,
+ (select ad_value from fiche_detail where ad_id=25 and f_id=cd.f_id) as contact_company,
+ (select ad_value from fiche_detail where ad_id=27 and f_id=cd.f_id) as contact_mobile,
+ (select ad_value from fiche_detail where ad_id=17 and f_id=cd.f_id) as contact_phone,
+ (select ad_value from fiche_detail where ad_id=18 and f_id=cd.f_id) as contact_email,
+ (select ad_value from fiche_detail where ad_id=26 and f_id=cd.f_id) as contact_fax,
+ cd.fd_id as card_category
+from contact_data cd ;
+
+insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id , 34,40 from fiche_def
+ join fiche_def_ref using (frd_id) where frd_id in (4,8,9) on conflict do nothing;
+
+insert into version (val,v_description) values (186,'Correct contact and web site');
+commit;
\ No newline at end of file