Fix #0002291: Apparence Gestion Client Contact

This commit is contained in:
sparkyx 2023-06-03 13:50:43 +02:00
parent 3d5f49b256
commit b845945ee0
5 changed files with 39 additions and 6 deletions

View file

@ -77,10 +77,19 @@ class contact extends Fiche
sql_string($array['category'])); sql_string($array['category']));
$where='';$and=' and '; $where='';$and=' and ';
} }
if ( isset ($array['active']) && $array['active'] == true) {
$sql_query .= $where.$and.sprintf(" f_enable='1' ");
$where='';$and=' and ';
}
return $sql_query; 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) { function filter_category($pn_category) {
unset($this->filter['category']); unset($this->filter['category']);
if ( !empty($pn_category) if ( !empty($pn_category)

View file

@ -1281,7 +1281,7 @@ class Fiche
} }
/*! Summary /*!
* \brief show the default screen * \brief show the default screen
* *
* \param $p_search (filter) * \param $p_search (filter)
@ -1425,7 +1425,7 @@ class Fiche
$solde=abs(bcsub($deb,$cred)); $solde=abs(bcsub($deb,$cred));
$side=($deb > $cred)?'Débit':'Crédit'; $side=($deb > $cred)?'Débit':'Crédit';
$r.='<tr class="highlight">'; $r.='<tr class="highlight">';
$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.='</tr>'; $r.='</tr>';
$r.="</tfoot>"; $r.="</tfoot>";
$r.="</TABLE>"; $r.="</TABLE>";

View file

@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
if (!defined("SYSINFO_DISPLAY")) { if (!defined("SYSINFO_DISPLAY")) {
define("SYSINFO_DISPLAY", TRUE); define("SYSINFO_DISPLAY", TRUE);
} }
define("DBVERSION", 185); define("DBVERSION", 186);
define("MONO_DATABASE", 25); define("MONO_DATABASE", 25);
define("DBVERSIONREPO", 20); define("DBVERSIONREPO", 20);
define('NOTFOUND', '--not found--'); define('NOTFOUND', '--not found--');

View file

@ -114,7 +114,7 @@ if ($low_action == "list")
$sel_company=$http->get("sel_company"); $sel_company=$http->get("sel_company");
$contact->filter_company($sel_company); $contact->filter_company($sel_company);
} }
$contact->filter_active(true);
echo '<div class="content">'; echo '<div class="content">';
echo $contact->Summary($search,"contact",$sql); echo $contact->Summary($search,"contact",$sql);

View file

@ -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;