diff --git a/ChangeLog b/ChangeLog index 86cdefdb5e0..ed4129eea4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.3 compared to 3.2 ***** For users: +- New: Can filter list of proposal, order or invoice on sales representative. - New: Add supplier ref on supplier orders. - New: Can export supplier orders. - New: First feature to install external plugins from gui. diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 5c62ca781d3..151b9240668 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -365,6 +365,9 @@ if ($id > 0) print ''; } + // Sales representative + include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'); + // Module Adherent if ($conf->adherent->enabled) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e287ebc0863..74e783192af 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -51,6 +51,7 @@ $confirm=GETPOST('confirm','alpha'); $lineid=GETPOST('lineid','int'); $search_user=GETPOST('search_user','int'); +$search_sale=GETPOST('search_sale','int'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); $search_refcustomer=GETPOST('search_refcustomer','alpha'); $search_societe=GETPOST('search_societe','alpha'); @@ -105,6 +106,7 @@ if (GETPOST("button_removefilter_x")) { $search_categ=''; $search_user=''; + $search_sale=''; $search_ref=''; $search_refcustomer=''; $search_societe=''; @@ -152,7 +154,8 @@ $sql.= ' u.login'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p'; if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; -if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +// We'll need this table joined to the select in order to filter by sale +if ($search_sale || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) { $sql.=", ".MAIN_DB_PREFIX."element_contact as c"; @@ -160,7 +163,6 @@ if ($search_user > 0) } $sql.= ' WHERE p.fk_soc = s.rowid'; $sql.= ' AND p.entity = '.$conf->entity; - if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; @@ -200,6 +202,7 @@ else if ($year > 0) { $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; @@ -224,13 +227,14 @@ if ($result) } $param='&socid='.$socid.'&viewstatut='.$viewstatut; - if ($month) $param.='&month='.$month; - if ($year) $param.='&year='.$year; - if ($search_ref) $param.='&search_ref=' .$search_ref; + if ($month) $param.='&month='.$month; + if ($year) $param.='&year='.$year; + if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_refcustomer) $param.='&search_ref=' .$search_refcustomer; - if ($search_societe) $param.='&search_societe=' .$search_societe; + if ($search_societe) $param.='&search_societe=' .$search_societe; if ($search_user > 0) $param.='&search_user='.$search_user; - if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; + if ($search_sale > 0) $param.='&search_sale='.$search_sale; + if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->nom:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num); // Lignes des champs de filtre @@ -239,6 +243,13 @@ if ($result) $i = 0; print ''; + // If the user can view prospects other than his' + if ($user->rights->societe->client->voir || $socid) + { + $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); + $moreforfilter.='       '; + } // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index c3c11d8f7c8..ce876da83cd 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -41,6 +41,8 @@ $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe', $socid, '&societe'); +$object = new Prospect($db); + /* * Actions @@ -55,9 +57,8 @@ if ($_GET["action"] == 'cstc') // set prospect level if ($_POST["action"] == 'setprospectlevel' && $user->rights->societe->creer) { - $societe = new Societe($db); - $societe->fetch($_GET["socid"]); - $societe->fk_prospectlevel=$_POST['prospect_level_id']; + $object->fetch($_GET["socid"]); + $object->fk_prospectlevel=$_POST['prospect_level_id']; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id']; $sql.= "' WHERE rowid='".$_GET["socid"]."'"; $result = $db->query($sql); @@ -81,8 +82,7 @@ $formcompany=new FormCompany($db); if ($socid > 0) { $actionstatic=new ActionComm($db); - $societe = new Prospect($db, $socid); - $result = $societe->fetch($socid); + $result = $object->fetch($socid); if ($result < 0) { dol_print_error($db); @@ -92,7 +92,7 @@ if ($socid > 0) /* * Affichage onglets */ - $head = societe_prepare_head($societe); + $head = societe_prepare_head($object); dol_fiche_head($head, 'prospect', $langs->trans("ThirdParty"),0,'company'); @@ -101,51 +101,51 @@ if ($socid > 0) print '
'; print ''; // Address print '"; // Zip / Town - print ''; + print ''; print ''; // Country print ''; // Phone - print ''; - print ''; + print ''; + print ''; // EMail - print ''; + print ''; // Web - print '"; + print '"; // Level of prospect print '"; @@ -160,23 +160,26 @@ if ($socid > 0) print '
'.$langs->trans("ThirdPartyName").''; - $societe->next_prev_filter="te.client in (2,3)"; - print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom','',''); + $object->next_prev_filter="te.client in (2,3)"; + print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print '
'.$langs->trans("Address").''; - dol_print_address($societe->address,'gmap','thirdparty',$societe->id); + dol_print_address($object->address,'gmap','thirdparty',$object->id); print "
'.$langs->trans('Zip').' / '.$langs->trans("Town").''.$societe->cp.(($societe->cp && $societe->ville)?' / ':'').$societe->ville.'
'.$langs->trans('Zip').' / '.$langs->trans("Town").''.$object->zip.(($object->zip && $object->town)?' / ':'').$societe->town.'
'.$langs->trans("Country").''; - $img=picto_from_langcode($societe->country_code); - if ($societe->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$societe->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$societe->country; + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; print '
'.$langs->trans("Phone").''.dol_print_phone($societe->tel,$societe->country_code,0,$societe->id,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($societe->fax,$societe->country_code).'
'.$langs->trans("Phone").''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($object->fax,$object->country_code).'
'.$langs->trans('EMail').''.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'
'.$langs->trans('EMail').''.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'
'.$langs->trans("Web")."url\">$societe->url
'.$langs->trans("Web")."url\">$object->url
'; print ''; + if (($_GET['action'] != 'editlevel') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('ProspectLevelShort'); print ''; - if (($_GET['action'] != 'editlevel') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetLevel'),1).'id.'">'.img_edit($langs->trans('SetLevel'),1).'
'; print '
'; if ($_GET['action'] == 'editlevel') { - $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$societe->id,$societe->fk_prospectlevel,'prospect_level_id',1); + $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1); } else { - print $societe->getLibLevel(); + print $object->getLibLevel(); //$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'none'); } print "'; if ($user->rights->societe->creer) { - print ''.img_edit($langs->trans("Modify")).''; + print ''.img_edit($langs->trans("Modify")).''; } print '
'; - print ''.$societe->price_level.""; + print ''.$object->price_level.""; print ''; } // Status - print ''.$langs->trans("StatusProsp").''.$societe->getLibProspStatut(4).''; + print ''.$langs->trans("StatusProsp").''.$object->getLibProspStatut(4).''; print ''; - if ($societe->stcomm_id != -1) print ''.img_action(0,-1).''; - if ($societe->stcomm_id != 0) print ''.img_action(0,0).''; - if ($societe->stcomm_id != 1) print ''.img_action(0,1).''; - if ($societe->stcomm_id != 2) print ''.img_action(0,2).''; - if ($societe->stcomm_id != 3) print ''.img_action(0,3).''; + if ($object->stcomm_id != -1) print ''.img_action(0,-1).''; + if ($object->stcomm_id != 0) print ''.img_action(0,0).''; + if ($object->stcomm_id != 1) print ''.img_action(0,1).''; + if ($object->stcomm_id != 2) print ''.img_action(0,2).''; + if ($object->stcomm_id != 3) print ''.img_action(0,3).''; print ''; + // Sales representative + include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'); + // Module Adherent if ($conf->adherent->enabled) { @@ -185,7 +188,7 @@ if ($socid > 0) print ''.$langs->trans("LinkedToDolibarrMember").''; print ''; $adh=new Adherent($db); - $result=$adh->fetch('','',$societe->id); + $result=$adh->fetch('','',$object->id); if ($result > 0) { $adh->ref=$adh->getFullName($langs); @@ -213,7 +216,7 @@ if ($socid > 0) print ''; print ''; print ''; + print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowProspectPreview").'
'.$langs->trans("ShowProspectPreview").'
'; print ''; print ''; print '
'; @@ -235,7 +238,7 @@ if ($socid > 0) $sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " AND p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND s.rowid = ".$societe->id; + $sql.= " AND s.rowid = ".$object->id; $sql.= " ORDER BY p.datep DESC"; $resql=$db->query($sql); @@ -249,8 +252,8 @@ if ($socid > 0) { print ''; print ''; - print '
'; - print ''; + print ''; print ''; } @@ -296,7 +299,7 @@ if ($socid > 0) if ($conf->propal->enabled && $user->rights->propale->creer) { - print ''.$langs->trans("AddProp").''; + print ''.$langs->trans("AddProp").''; } // Add action @@ -304,7 +307,7 @@ if ($socid > 0) { if ($user->rights->agenda->myactions->create) { - print ''.$langs->trans("AddAction").''; + print ''.$langs->trans("AddAction").''; } else { @@ -321,7 +324,7 @@ if ($socid > 0) { print '
'; // List of contacts - show_contacts($conf,$langs,$db,$societe,$_SERVER["PHP_SELF"].'?socid='.$societe->id); + show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) @@ -329,10 +332,10 @@ if ($socid > 0) print load_fiche_titre($langs->trans("ActionsOnCompany"),'',''); // List of todo actions - show_actions_todo($conf,$langs,$db,$societe); + show_actions_todo($conf,$langs,$db,$object); // List of done actions - show_actions_done($conf,$langs,$db,$societe); + show_actions_done($conf,$langs,$db,$object); } } diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index fc1a2796fae..5d93a069b0a 100755 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -159,7 +159,7 @@ if ($_GET["action"] == 'cstc') * View */ -$htmlother=new FormOther($db); +$formother=new FormOther($db); $sql = "SELECT s.rowid, s.nom, s.ville, s.datec, s.datea, s.status as status,"; $sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; @@ -271,14 +271,14 @@ if ($resql) if ($conf->categorie->enabled) { $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$htmlother->select_categories(2,$search_categ,'search_categ'); + $moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ'); $moreforfilter.='       '; } // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; - $moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale',$user); + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); } if ($moreforfilter) { diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 82a146038f1..542727e08c6 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -27,7 +27,8 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); -require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); +require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); $langs->load('orders'); $langs->load('deliveries'); @@ -43,6 +44,7 @@ $snom=GETPOST('snom','alpha'); $sall=GETPOST('sall'); $socid=GETPOST('socid','int'); $search_user=GETPOST('search_user','int'); +$search_sale=GETPOST('search_sale','int'); // Security check $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int')); @@ -63,6 +65,25 @@ $limit = $conf->liste_limit; $viewstatut=GETPOST('viewstatut'); +/* + * Actions + */ + +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_categ=''; + $search_user=''; + $search_sale=''; + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_montant_ht=''; + $year=''; + $month=''; +} + + /* * View @@ -71,6 +92,7 @@ $viewstatut=GETPOST('viewstatut'); $now=dol_now(); $form = new Form($db); +$formother = new FormOther($db); $formfile = new FormFile($db); $companystatic = new Societe($db); @@ -80,7 +102,8 @@ $sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c. $sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; -if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +// We'll need this table joined to the select in order to filter by sale +if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) { $sql.=", ".MAIN_DB_PREFIX."element_contact as ec"; @@ -152,6 +175,7 @@ if (!empty($sref_client)) { $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; } +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; @@ -190,12 +214,13 @@ if ($resql) $title.=' - '.$langs->trans('StatusOrderToProcessShort'); $param='&socid='.$socid.'&viewstatut='.$viewstatut; - if ($month) $param.='&month='.$month; - if ($year) $param.='&year='.$year; - if ($sref) $param.='&sref='.$sref; - if ($snom) $param.='&snom='.$snom; - if ($sref_client) $param.='&sref_client='.$sref_client; + if ($month) $param.='&month='.$month; + if ($year) $param.='&year='.$year; + if ($sref) $param.='&sref='.$sref; + if ($snom) $param.='&snom='.$snom; + if ($sref_client) $param.='&sref_client='.$sref_client; if ($search_user > 0) $param.='&search_user='.$search_user; + if ($search_sale > 0) $param.='&search_sale='.$search_sale; $num = $db->num_rows($resql); print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num); @@ -206,6 +231,13 @@ if ($resql) print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').''; + print ''; print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').'
'; + // If the user can view prospects other than his' + if ($user->rights->societe->client->voir || $socid) + { + $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); + $moreforfilter.='       '; + } // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d6f980a2aeb..6c356015ab1 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -112,7 +112,19 @@ $now=dol_now(); $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -// None +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_categ=''; + $search_user=''; + $search_sale=''; + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_montant_ht=''; + $year=''; + $month=''; +} /* @@ -122,7 +134,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); $form = new Form($db); -$htmlother = new FormOther($db); +$formother = new FormOther($db); $formfile = new FormFile($db); $bankaccountstatic=new Account($db); $facturestatic=new Facture($db); @@ -135,10 +147,11 @@ $sql.= ' f.paye as paye, f.fk_statut, f.note,'; $sql.= ' s.nom, s.rowid as socid'; if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ', '.MAIN_DB_PREFIX.'facture as f'; if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid'; +// We'll need this table joined to the select in order to filter by sale +if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) { $sql.=", ".MAIN_DB_PREFIX."element_contact as ec"; @@ -191,6 +204,7 @@ else if ($year > 0) { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; @@ -225,11 +239,12 @@ if ($resql) } $param='&socid='.$socid; - if ($month) $param.='&month='.$month; - if ($year) $param.='&year=' .$year; - if ($search_ref) $param.='&search_ref=' .$search_ref; - if ($search_societe) $param.='&search_societe=' .$search_societe; - if ($search_user > 0) $param.='&search_user=' .$search_user; + if ($month) $param.='&month='.$month; + if ($year) $param.='&year=' .$year; + if ($search_ref) $param.='&search_ref=' .$search_ref; + if ($search_societe) $param.='&search_societe=' .$search_societe; + if ($search_sale > 0) $param.='&search_sale=' .$search_sale; + if ($search_user > 0) $param.='&search_user=' .$search_user; if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc; print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num); @@ -238,6 +253,13 @@ if ($resql) print ''."\n"; print '
'; + // If the user can view prospects other than his' + if ($user->rights->societe->client->voir || $socid) + { + $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); + $moreforfilter.='       '; + } // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { @@ -272,7 +294,7 @@ if ($resql) print ''; print ''; print ''; // Category + /* This must be set into category tab, like for customer category if ($object->fournisseur) { $load = $object->LoadSupplierCateg(); @@ -773,7 +774,7 @@ else print ''; } } - } + }*/ } // Status @@ -860,7 +861,7 @@ else print "\n"; print ''; print "\n"; @@ -1747,43 +1748,8 @@ else print ''; } - // Commercial - print ''; - print ''; + // Sales representative + include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'); // Module Adherent if ($conf->adherent->enabled)
'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; - $htmlother->select_year($year?$year:-1,'year',1, 20, 5); + $formother->select_year($year?$year:-1,'year',1, 20, 5); print ' '; diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 95a3287915e..d2f08c0ad49 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -24,6 +24,7 @@ TaskRDVWith=Meeting with %s ShowTask=Show task ShowAction=Show event ActionsReport=Events report +ThirdPartiesOfSaleRepresentative=Thirdparties with sales representative SalesRepresentative=Sales representative SalesRepresentatives=Sales representatives SalesRepresentativeFollowUp=Sales representative (follow-up) diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang index 9218c5651d5..cc57c86ff95 100644 --- a/htdocs/langs/fr_FR/commercial.lang +++ b/htdocs/langs/fr_FR/commercial.lang @@ -24,6 +24,7 @@ TaskRDVWith=Rendez-vous avec %s ShowTask=Afficher tâche ShowAction=Afficher événement ActionsReport=Rapport des événements +ThirdPartiesOfSaleRepresentative=Tiers ayant pour commercial SalesRepresentative=Commercial SalesRepresentatives=Commerciaux SalesRepresentativeFollowUp=Commercial (suivi) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 1b7364fc180..b7f71df267f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Brian Fraval - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin @@ -629,7 +629,7 @@ else $object->forme_juridique_code=$_POST['forme_juridique_code']; /* Show create form */ - print_fiche_titre($langs->trans("NewCompany")); + print_fiche_titre($langs->trans("NewThirdParty")); if ($conf->use_javascript_ajax) { @@ -760,6 +760,7 @@ else print '
'; - print '
'; - print $langs->trans('SalesRepresentatives'); - print ''; - if ($user->rights->societe->creer) - print ''.img_edit().''; - else - print ' '; - print '
'; - print '
'; - - $listsalesrepresentatives=$object->getSalesRepresentatives($user); - $nbofsalesrepresentative=count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 3) // We print only number - { - print ''; - print $nbofsalesrepresentative; - print ''; - } - else if ($nbofsalesrepresentative > 0) - { - $userstatic=new User($db); - $i=0; - foreach($listsalesrepresentatives as $val) - { - $userstatic->id=$val['id']; - $userstatic->lastname=$val['name']; - $userstatic->firstname=$val['firstname']; - print $userstatic->getNomUrl(1); - $i++; - if ($i < $nbofsalesrepresentative) print ', '; - } - } - else print $langs->trans("NoSalesRepresentativeAffected"); - print '