From 53f01685e334e804292247c9a3511274ab054ed3 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 11 Nov 2013 16:23:11 +0100 Subject: [PATCH 1/9] Display customer code (according setting) into list --- htdocs/societe/societe.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index 28a3c5c2885..bf21bfecfa7 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -187,7 +187,7 @@ if ($socname) */ $title=$langs->trans("ListOfThirdParties"); -$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.datec, s.datea,"; +$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.datec, s.datea, s.code_client, s.code_fournisseur, "; $sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) @@ -408,6 +408,9 @@ if ($resql) $companystatic->canvas=$obj->canvas; $companystatic->client=$obj->client; $companystatic->status=$obj->status; + $companystatic->fournisseur=$obj->fournisseur; + $companystatic->code_client=$obj->code_client; + $companystatic->code_fournisseur=$obj->code_fournisseur; print $companystatic->getNomUrl(1,'',100); print "\n"; // Barcode From a76d5f8a1d936bda0f59f44021fac2c1455cce23 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 11 Nov 2013 16:29:35 +0100 Subject: [PATCH 2/9] Fix getNomURL societe --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e79242d35a9..effc67b004d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1438,7 +1438,7 @@ class Societe extends CommonObject $name=$this->name?$this->name:$this->nom; - if ($conf->global->SOCIETE_ADD_REF_IN_LIST) { + if ($conf->global->SOCIETE_ADD_REF_IN_LIST && empty($option)) { if (($this->client) && (! empty ( $this->code_client ))) { $code = $this->code_client . ' - '; } From 6bf2220a67b4354b9661672943f4a9644012bc72 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 12 Nov 2013 15:22:11 +0100 Subject: [PATCH 3/9] Add status filter into prospect and customer list --- htdocs/comm/list.php | 24 ++++++++++++++++++++---- htdocs/comm/prospect/list.php | 17 ++++++++++++++--- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 2c256ec2fda..ebb08916758 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,6 +53,8 @@ $search_zipcode=GETPOST("search_zipcode"); $search_town=GETPOST("search_town"); $search_code=GETPOST("search_code"); $search_compta=GETPOST("search_compta"); +$search_status = GETPOST("search_status",'int'); +if ($search_status=='') $search_status=1; // always display activ customer first // Load sale and categ filters $search_sale = GETPOST("search_sale"); @@ -83,6 +86,7 @@ if (GETPOST("button_removefilter_x")) $search_idprof2=''; $search_idprof3=''; $search_idprof4=''; + $seach_status=1; } @@ -92,6 +96,7 @@ if (GETPOST("button_removefilter_x")) */ $formother=new FormOther($db); +$form = new Form($db); $thirdpartystatic=new Societe($db); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; @@ -125,6 +130,8 @@ if ($search_town) { } if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'"; if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'"; + +if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); // Insert sale filter if ($search_sale) { @@ -152,6 +159,7 @@ if ($result) $param = "&search_nom=".$search_nom."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; if ($search_sale != '') $param.='&search_sale='.$search_sale; + if ($search_status != '') $param.='&search_status='.$search_status; print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); @@ -190,7 +198,7 @@ if ($result) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); - + print ' '; $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook @@ -218,7 +226,13 @@ if ($result) print ''; print ''; - print ' '; + print ''; + print ' '; + print ''; + + print ''; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print ''; print ''; print '  '; @@ -243,6 +257,7 @@ if ($result) $thirdpartystatic->id=$obj->rowid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->client=$obj->client; + $thirdpartystatic->code_client=$obj->code_client; $thirdpartystatic->canvas=$obj->canvas; $thirdpartystatic->status=$obj->status; print $thirdpartystatic->getNomUrl(1); @@ -252,9 +267,10 @@ if ($result) print ''.$obj->code_client.''; print ''.$obj->code_compta.''; print ''.dol_print_date($db->jdate($obj->datec),'day').''; - print ''.$thirdpartystatic->getLibStatut(3); + print ''.$thirdpartystatic->getLibStatut(3); print ''; - + print ''; + $parameters=array('obj' => $obj); $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 959c271b85e..75ace1c4acd 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -47,6 +47,8 @@ $search_town = GETPOST("search_town"); $search_state = GETPOST("search_state"); $search_datec = GETPOST("search_datec"); $search_categ = GETPOST("search_categ",'int'); +$search_status = GETPOST("search_status",'int'); +if ($search_status=='') $search_status=1; // always display activ customer first $catid = GETPOST("catid",'int'); $sortfield = GETPOST("sortfield",'alpha'); @@ -173,6 +175,7 @@ if ($action == 'cstc') */ $formother=new FormOther($db); +$form=new Form($db); $sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.datea, s.status as status,"; $sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; @@ -205,6 +208,7 @@ if ($search_state) { $sql .= natural_search('d.nom', $search_state); } if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; +if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); // Insert levels filters if ($search_levels) { @@ -231,7 +235,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= " ORDER BY $sortfield $sortorder, s.nom ASC"; $sql.= $db->plimit($conf->liste_limit+1, $offset); - +dol_syslog('comm/prospect/list.php sql='.$sql,LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -265,6 +269,7 @@ if ($resql) if ($search_level_to != '') $param.='&search_level_to='.$search_level_to; if ($search_categ != '') $param.='&search_categ='.$search_categ; if ($search_sale != '') $param.='&search_sale='.$search_sale; + if ($search_status != '') $param.='&search_status='.$search_status; // $param and $urladd should have the same value $urladd = $param; @@ -306,7 +311,8 @@ if ($resql) print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); print ' '; - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); + print ' '; $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook @@ -368,6 +374,10 @@ if ($resql) print ' '; print ''; + print ''; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print ''; + // Print the search button print ''; print ''; @@ -425,9 +435,10 @@ if ($resql) } print ''; - print ''; + print ''; print $prospectstatic->LibStatut($prospectstatic->status,3); print ''; + print ''; $parameters=array('obj' => $obj); $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook From 8fca860a2d63c5d24b23ca7c4d65adf4727738a3 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 12 Nov 2013 15:40:00 +0100 Subject: [PATCH 4/9] Add status filter on contact list --- htdocs/contact/list.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index dcaf4aaac4b..2b1c5e982df 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -52,7 +52,8 @@ $search_email=GETPOST("search_email"); $search_skype=GETPOST("search_skype"); $search_priv=GETPOST("search_priv"); $search_categ = GETPOST("search_categ",'int'); -$search_statut=GETPOST("search_statut"); +$search_status = GETPOST("search_status",'int'); +if ($search_status=='') $search_status=1; // always display activ customer first $type=GETPOST("type"); @@ -104,6 +105,7 @@ if (GETPOST('button_removefilter')) $search_skype=""; $search_priv=""; $sall=""; + $seach_status=1; } if ($search_priv < 0) $search_priv=''; @@ -192,6 +194,7 @@ if (strlen($search_skype)) // filtre sur skype { $sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'"; } +if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status); if ($type == "o") // filtre sur type { $sql .= " AND p.fk_soc IS NULL"; @@ -245,6 +248,7 @@ if ($result) $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); if (!empty($search_categ)) $param.='&search_categ='.$search_categ; + if ($search_status != '') $param.='&search_status='.$search_status; if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); $num = $db->num_rows($result); @@ -335,7 +339,9 @@ if ($result) $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); print $form->selectarray('search_priv',$selectarray,$search_priv,1); print ''; - print ' '; + print ''; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print ''; print ''; print ''; print '  '; From a73275b9c1be2057a752b70e4e8aa602a6bf9773 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 13 Nov 2013 13:17:32 +0100 Subject: [PATCH 5/9] Add prospect code client into prospect list --- htdocs/comm/prospect/list.php | 4 +++- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 75ace1c4acd..7284827e657 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -177,7 +177,7 @@ if ($action == 'cstc') $formother=new FormOther($db); $form=new Form($db); -$sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.datea, s.status as status,"; +$sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.datea, s.status as status, s.code_client, s.client,"; $sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; $sql.= " d.nom as departement"; // Updated by Matelli @@ -405,6 +405,8 @@ if ($resql) $prospectstatic->id=$obj->rowid; $prospectstatic->nom=$obj->nom; $prospectstatic->status=$obj->status; + $prospectstatic->code_client=$obj->code_client; + $prospectstatic->client=$obj->client; $prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel; print $prospectstatic->getNomUrl(1,'prospect'); print ''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index effc67b004d..3ed53f2692e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1438,7 +1438,7 @@ class Societe extends CommonObject $name=$this->name?$this->name:$this->nom; - if ($conf->global->SOCIETE_ADD_REF_IN_LIST && empty($option)) { + if ($conf->global->SOCIETE_ADD_REF_IN_LIST && (!empty($withpicto))) { if (($this->client) && (! empty ( $this->code_client ))) { $code = $this->code_client . ' - '; } From 0065adc298748ff415e7db51633656c2fdb0ae62 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 13 Nov 2013 16:37:17 +0100 Subject: [PATCH 6/9] Wrong call of show_contact into fourn/fiche.php --- htdocs/fourn/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 9f3b32166dc..089b540146d 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -467,7 +467,7 @@ if ($object->fetch($id)) { print '
'; // List of contacts - show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?id='.$object->id); + show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } // Addresses list From 6d8871b4cfdeaa36745a10d83eba4871aa90a9ae Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 13 Nov 2013 17:02:30 +0100 Subject: [PATCH 7/9] Add filter on show_contact company.lib.php --- htdocs/core/lib/company.lib.php | 80 ++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 582922cd60e..f210e44be88 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -522,6 +522,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') global $user,$conf; global $bc; + $form= new Form($db); + + $sortfield = GETPOST("sortfield",'alpha'); + $sortorder = GETPOST("sortorder",'alpha'); + $search_status = GETPOST("search_status",'int'); + if ($search_status=='') $search_status=1; // always display activ customer first + $search_name = GETPOST("search_name",'alpha'); + + if (! $sortorder) $sortorder="ASC"; + if (! $sortfield) $sortfield="p.lastname"; + $i=-1; $contactstatic = new Contact($db); @@ -547,20 +558,30 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "\n".''."\n"; + + $param="socid=".$object->id; + if ($search_status != '') $param.='&search_status='.$search_status; + if ($search_name != '') $param.='&search_name='.urlencode($search_name); + + print ''; + print ''; + print ''; + print ''; + $colspan=8; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhonePro"),$_SERVER["PHP_SELF"],"p.phone","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); if (! empty($conf->skype->enabled)) { $colspan++; print ''; } - print ''; print ""; if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { @@ -573,14 +594,54 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; } print ""; - + + + print ''; + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + if (! empty($conf->skype->enabled)) + { + $colspan++; + print ''; + } + print ""; + if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) + { + $colspan++; + print ''; + } + + print ''; + + print ""; + $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut "; $sql .= ", p.civilite, p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; - $sql .= " ORDER by p.datec"; + if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status); + if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape(strtolower($search_name))."%' OR p.firstname LIKE '%".$db->escape(strtolower($search_name))."%')"; + $sql.= " ORDER BY $sortfield $sortorder"; + dol_syslog('core/lib/company.lib.php :: show_contacts sql='.$sql,LOG_DEBUG); $result = $db->query($sql); $num = $db->num_rows($result); @@ -688,7 +749,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } - print "\n"; $i++; } From 652d7db0b40927a73e59560f1202e2c30e744a1b Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 13 Nov 2013 17:26:29 +0100 Subject: [PATCH 8/9] Get Status from getLibStatus ! --- htdocs/core/lib/company.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f210e44be88..8a67e350115 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -658,6 +658,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; } - if ($obj->statut==0) print ''; - elseif ($obj->statut==1) print ''; + print ''; // copy in clipboard $coords = ''; From fe0006c71d1aec357c477db04c23afe67f3530e7 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 13 Nov 2013 21:34:02 +0100 Subject: [PATCH 9/9] Merge from dev --- htdocs/core/lib/company.lib.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e748124c1a8..c08be97cac4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -609,9 +609,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; print ''; - - - if (! empty($conf->skype->enabled)) { $colspan++;
'.$langs->trans("Name").''.$langs->trans("Poste").''.$langs->trans("PhonePro").''.$langs->trans("PhoneMobile").''.$langs->trans("Fax").''.$langs->trans("EMail").''.$langs->trans("Skype").''.$langs->trans("Status").'  
'; + print ''; + print '     '; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print '   '; + print ''; + print '
'; $contactstatic->id = $obj->rowid; + $contactstatic->statut = $obj->statut; $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; print $contactstatic->getNomUrl(1); @@ -687,8 +688,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0').''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').''; + print $contactstatic->getLibStatut(3); + print '