diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e1678027ce3..a93dc6501c1 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -89,7 +89,7 @@ $tabsql[7] = "SELECT a.id as rowid, a.id as code, a.libelle AS libelle, a.ded $tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent"; $tabsql[9] = "SELECT code as rowid, code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies"; $tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; -$tabsql[11]= "SELECT t.rowid as rowid, code, element, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; +$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; // Tri par defaut $tabsqlsort[1] ="pays, code ASC"; @@ -102,7 +102,7 @@ $tabsqlsort[7] ="a.libelle ASC"; $tabsqlsort[8] ="libelle ASC"; $tabsqlsort[9] ="code ASC"; $tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC"; -$tabsqlsort[11]="element ASC, code ASC, libelle ASC"; +$tabsqlsort[11]="element ASC, source ASC, code ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield[1] = "code,libelle,pays"; @@ -115,7 +115,7 @@ $tabfield[7] = "libelle,deductible"; $tabfield[8] = "code,libelle"; $tabfield[9] = "code,code_iso,libelle"; $tabfield[10]= "pays,taux,recuperableonly,note"; -$tabfield[11]= "element,code,libelle"; +$tabfield[11]= "element,source,code,libelle"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert[1] = "code,libelle,fk_pays"; @@ -128,7 +128,7 @@ $tabfieldinsert[7] = "libelle,deductible"; $tabfieldinsert[8] = "code,libelle"; $tabfieldinsert[9] = "code,code_iso,libelle"; $tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note"; -$tabfieldinsert[11]= "element,code,libelle"; +$tabfieldinsert[11]= "element,source,code,libelle"; // Nom du rowid si le champ n'est pas de type autoincrément $tabrowid[1] = ""; @@ -210,7 +210,7 @@ if ($_POST["actionadd"]) $result = $db->query($sql); if (!$result) { - if ($db->errno() == DB_ERROR_RECORD_ALREADY_EXISTS) { + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $msg=$langs->trans("ErrorRecordAlreadyExists").'
'; } else { @@ -334,6 +334,7 @@ if ($_GET["id"]) // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de données $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut + if ($fieldlist[$field]=='source') $valuetoshow=$langs->trans("Contact"); if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); @@ -369,19 +370,31 @@ if ($_GET["id"]) $html->select_lang(MAIN_LANG_DEFAULT,'lang'); print ''; } - // le type de l'element (pour les type de contact).' - elseif ($fieldlist[$field] == 'element') { + // Le type de l'element (pour les type de contact).' + elseif ($fieldlist[$field] == 'element') + { + $langs->load("orders"); + $langs->load("contracts"); + $langs->load("project"); + $langs->load("propal"); + $langs->load("bills"); print ''; - $elementList = array(); - // un peu crad mais je n'ai pas de meilleure idee. - $elementList["contrat"] = "contrat"; - $elementList["projet"] = "projet"; - $elementList["propal"] = "propal"; - $elementList["facture"] = "facture"; - + $elementList = array("commande"=>$langs->trans("Order"), + "contrat"=>$langs->trans("Contract"), + "projet"=>$langs->trans("Project"), + "propal"=>$langs->trans("Propal"), + "facture"=>$langs->trans("Bill")); $html->select_array('element', $elementList); print ''; } + // La source de l'element (pour les type de contact).' + elseif ($fieldlist[$field] == 'source') { + print ''; + $elementList = array("internal"=>$langs->trans("Internal"), + "external"=>$langs->trans("External")); + $html->select_array('source', $elementList); + print ''; + } elseif ($fieldlist[$field] == 'type') { print ''; print 'user'; @@ -422,11 +435,12 @@ if ($_GET["id"]) // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de données $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); - if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); - if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); - if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*"; - if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country"); + if ($fieldlist[$field]=='source') $valuetoshow=$langs->trans("Contact"); + if ($fieldlist[$field]=='lang') $valuetoshow=$langs->trans("Language"); + if ($fieldlist[$field]=='type') $valuetoshow=$langs->trans("Type"); + if ($fieldlist[$field]=='code') $valuetoshow=$langs->trans("Code"); + if ($fieldlist[$field]=='libelle') $valuetoshow=$langs->trans("Label")."*"; + if ($fieldlist[$field]=='pays') $valuetoshow=$langs->trans("Country"); if ($fieldlist[$field]=='recuperableonly') $valuetoshow=$langs->trans("VATReceivedOnly"); // Affiche nom du champ print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield); diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 0ceeb82821e..0f0abbfa69a 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -269,9 +269,9 @@ if ($id > 0) { print ''; print ''.$langs->trans("Source").''; - print ''.$langs->trans("Societe").''; + print ''.$langs->trans("Company").''; print ''.$langs->trans("Contacts").''; - print ''.$langs->trans("ContactType").''; + print ''.$langs->trans("ContactType").''; print ' '; print "\n"; @@ -296,7 +296,7 @@ if ($id > 0) print ''; $html->select_users($user->id,'contactid'); print ''; - print ''; + print ''; select_type_contact($contrat, '', 'type','internal'); print ''; print ''; @@ -325,7 +325,7 @@ if ($id > 0) print ''; $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid'); print ''; - print ''; + print ''; select_type_contact($contrat, '', 'type','external'); print ''; print ''; @@ -342,7 +342,7 @@ if ($id > 0) print ''.$langs->trans("Source").''; print ''.$langs->trans("Company").''; print ''.$langs->trans("Contacts").''; - print ''.$langs->trans("ContactType").''; + print ''.$langs->trans("ContactType").''; print ''.$langs->trans("Status").''; print ' '; print "\n"; @@ -400,8 +400,8 @@ if ($id > 0) } print ''; - // Description - print ''.$tab[$i]['libelle'].''; + // Type de contact + print ''.$tab[$i]['libelle'].''; // Statut print ''; diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 1855710d961..576eb72d326 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -1029,7 +1029,7 @@ class Contrat if ($source == 'external') $sql.=" t.fk_soc as socid,"; if ($source == 'internal') $sql.=" t.name as nom,"; if ($source == 'external') $sql.=" t.name as nom,"; - $sql.= "tc.code, tc.source, tc.libelle"; + $sql.= "tc.source, tc.element, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."element_contact ec,"; if ($source == 'internal') $sql.=" ".MAIN_DB_PREFIX."user t,"; if ($source == 'external') $sql.=" ".MAIN_DB_PREFIX."socpeople t,"; @@ -1054,7 +1054,8 @@ class Contrat { $obj = $this->db->fetch_object($resql); - $libelle_type=($langs->trans("TypeContact".$obj->code)!=$langs->trans("TypeContact".$obj->code) ? $langs->trans("TypeContact".$obj->code) : $obj->libelle); + $transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code; + $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, 'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut); $i++; @@ -1106,11 +1107,15 @@ class Contrat */ function liste_type_contact($source) { + global $langs; + + $element='contrat'; + $tab = array(); $sql = "SELECT distinct tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; - $sql.= " WHERE element='contrat'"; + $sql.= " WHERE element='".$element."'"; $sql.= " AND source='".$source."'"; $sql.= " ORDER by tc.code"; @@ -1122,7 +1127,10 @@ class Contrat while ($i < $num) { $obj = $this->db->fetch_object($result); - $tab[$obj->rowid]=$obj->libelle; + + $transkey="TypeContact_".$element."_".$source."_".$obj->code; + $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); + $tab[$obj->rowid]=$libelle_type; $i++; } return $tab; diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index dedec89d049..bc74293f561 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -63,4 +63,10 @@ NbOfServices=Nb of services CloseService=Close service ServicesNomberShort=%s service(s) RunningServices=Running services -BoardRunningServices=Expired running services \ No newline at end of file +BoardRunningServices=Expired running services +##### Types de contacts ##### +TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract +TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up contract +TypeContact_contrat_external_BILLING=Billing customer contact +TypeContact_contrat_external_CUSTOMER=Following-up customer contact +TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact \ No newline at end of file diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang index 36aaefcd4db..a1bd916d33a 100644 --- a/htdocs/langs/fr_FR/contracts.lang +++ b/htdocs/langs/fr_FR/contracts.lang @@ -63,4 +63,10 @@ NbOfServices=Nb de services CloseService=Fermer service ServicesNomberShort=%s service(s) RunningServices=Services actifs -BoardRunningServices=Services actifs expirés \ No newline at end of file +BoardRunningServices=Services actifs expirés +##### Types de contacts ##### +TypeContact_contrat_internal_SALESREPSIGN=Commercial signataire du contrat +TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat +TypeContact_contrat_external_BILLING=Contact client facturation contrat +TypeContact_contrat_external_CUSTOMER=Contact client suivi contrat +TypeContact_contrat_external_SALESREPSIGN=Contact client signataire contrat diff --git a/mysql/data/data.sql b/mysql/data/data.sql index a81373e8f74..ee68b4f2d00 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -709,15 +709,17 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (10 -- -- Les types de contact d'un element -- -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (10, 'BILLING', 'contrat', 'Contact facturation du contrat', 1); -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (11, 'SALESREPSIGN', 'contrat', 'Commercial signataire du contrat', 1); -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (12, 'SALESREPFOLL', 'contrat', 'Commercial suivi du contrat', 1); -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (13, 'CUSTOMER', 'contrat', 'Contact client pour le contrat', 1); - -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (20, 'BILLING', 'propal', 'Contact facturation de la propale', 1); -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (21, 'SALESREPSIGN', 'propal', 'Commercial signataire de la propale', 1); -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (22, 'SALESREPFOLL', 'propal', 'Commercial suivi de la propale', 1); -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (23, 'CUSTOMER', 'propal', 'Contact client pour la propale', 1); - -insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (80, 'PROJECTLEADER', 'projet', 'Chef de Projet', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (10, 'contrat', 'internal', 'SALESREPSIGN', 'Commercial signataire du contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (11, 'contrat', 'internal', 'SALESREPFOLL', 'Commercial suivi du contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (20, 'contrat', 'external', 'BILLING', 'Contact client facturation contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (21, 'contrat', 'external', 'CUSTOMER', 'Contact client suivi contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (22, 'contrat', 'external', 'SALESREPSIGN', 'Contact client signataire contrat', 1); + +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (30, 'propal', 'internal', 'SALESREPSIGN', 'Commercial signataire de la propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (31, 'propal', 'internal', 'SALESREPFOLL', 'Commercial suivi de la propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (40, 'propal', 'external', 'BILLING', 'Contact client facturation propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (41, 'propal', 'external', 'CUSTOMER', 'Contact client suivi propale', 1); + +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (80, 'projet', 'internal', 'PROJECTLEADER', 'Chef de Projet', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (81, 'projet', 'external', 'PROJECTLEADER', 'Chef de Projet', 1); diff --git a/mysql/migration/1.1.0-2.0.0.sql b/mysql/migration/1.1.0-2.0.0.sql index dd5da37aa93..4bbac2649ba 100644 --- a/mysql/migration/1.1.0-2.0.0.sql +++ b/mysql/migration/1.1.0-2.0.0.sql @@ -1827,15 +1827,16 @@ ALTER TABLE llx_element_contact FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (10, 'contrat', 'external', 'BILLING', 'Contact facturation du contrat', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (11, 'contrat', 'internal', 'SALESREPSIGN', 'Commercial signataire du contrat', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (12, 'contrat', 'internal', 'SALESREPFOLL', 'Commercial suivi du contrat', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (13, 'contrat', 'external', 'CUSTOMER', 'Contact client pour le contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (10, 'contrat', 'internal', 'SALESREPSIGN', 'Commercial signataire du contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (11, 'contrat', 'internal', 'SALESREPFOLL', 'Commercial suivi du contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (20, 'contrat', 'external', 'BILLING', 'Contact client facturation contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (21, 'contrat', 'external', 'CUSTOMER', 'Contact client suivi contrat', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (22, 'contrat', 'external', 'SALESREPSIGN', 'Contact client signataire contrat', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (20, 'propal', 'external', 'BILLING', 'Contact facturation de la propale', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (21, 'propal', 'internal', 'SALESREPSIGN', 'Commercial signataire de la propale', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (22, 'propal', 'internal', 'SALESREPFOLL', 'Commercial suivi de la propale', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (23, 'propal', 'external', 'CUSTOMER', 'Contact client pour la propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (30, 'propal', 'internal', 'SALESREPSIGN', 'Commercial signataire de la propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (31, 'propal', 'internal', 'SALESREPFOLL', 'Commercial suivi de la propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (40, 'propal', 'external', 'BILLING', 'Contact client facturation propale', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (41, 'propal', 'external', 'CUSTOMER', 'Contact client suivi propale', 1); insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (80, 'projet', 'internal', 'PROJECTLEADER', 'Chef de Projet', 1); insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (81, 'projet', 'external', 'PROJECTLEADER', 'Chef de Projet', 1);