From 5fcd6b4af5b4eb7a1eff6509ca852e8ee670b63b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Feb 2009 22:37:30 +0000 Subject: [PATCH] Contact page picto is more clear to distinguish internal from external users. --- ChangeLog | 1 + htdocs/comm/contact.php | 20 +- htdocs/comm/propal/contact.php | 18 +- htdocs/commande/contact.php | 22 +- htdocs/compta/facture/contact.php | 38 +- htdocs/contrat/contact.php | 40 +- htdocs/fichinter/contact.php | 22 +- htdocs/fourn/commande/contact.php | 392 ++++++++++++++++++++ htdocs/fourn/contact.php | 26 +- htdocs/fourn/facture/contact.php | 36 +- htdocs/fourn/fournisseur.commande.class.php | 2 +- htdocs/langs/en_US/companies.lang | 3 + htdocs/langs/fr_FR/companies.lang | 4 + htdocs/lib/fourn.lib.php | 8 +- mysql/data/data.sql | 10 +- mysql/migration/2.5.0-2.6.0.sql | 10 +- 16 files changed, 528 insertions(+), 124 deletions(-) create mode 100644 htdocs/fourn/commande/contact.php diff --git a/ChangeLog b/ChangeLog index a66745a5a55..65d519e4621 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ For users: - New: Distinct status "running not expired" from "running expired" in lines contract status. - New: Add a first version of a module for Paybox. +- New: Can add contact to suppliers orders. - Fix: Handle correctly the comment in status changing of supplier orders. - Fix: Author, title and topic are correctly encoded in PDF. - Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users. diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 6795874c783..77041745127 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -1,7 +1,7 @@ - * Copyright (C) 2003 �ric Seigne - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2003 Eric Seigne + * Copyright (C) 2004-2009 Laurent Destailleur * * 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 @@ -126,12 +126,12 @@ if ($socid) { $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($limit+1, $offset); $resql = $db->query($sql); -if ($resql) +if ($resql) { $num = $db->num_rows($resql); - + print_barre_liste($langs->trans("ListOfContacts").($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], "&type=$type",$sortfield,$sortorder,"",$num); - + print ''; print ''; print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin,"&type=$type","",$sortfield,$sortorder); @@ -156,21 +156,21 @@ if ($resql) while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - + $var=!$var; print ""; print ''; print ""; - + print '\n"; - + print ''; - + print ''; - + print "\n"; $i++; } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 01036115c27..f72b13f7401 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Destailleur Laurent + * Copyright (C) 2005-2009 Destailleur Laurent * * 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 @@ -47,7 +47,7 @@ $result = restrictedArea($user, 'propale', $propalid, 'propal'); if ($_POST["action"] == 'addcontact' && $user->rights->propale->creer) { - + $result = 0; $propal = new Propal($db); $result = $propal->fetch($_GET["propalid"]); @@ -56,7 +56,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->propale->creer) { $result = $propal->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); } - + if ($result >= 0) { Header("Location: contact.php?propalid=".$propal->id); @@ -230,8 +230,8 @@ if ($id > 0) // Ligne ajout pour contact interne print ""; - print ''; print '"; - print ''; print ''; // Societe diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 82a379081d2..ac8caa4b0ee 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -47,7 +47,7 @@ $result = restrictedArea($user, 'commande', $commandeid); if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer) { - + $result = 0; $commande = new Commande($db); $result = $commande->fetch($_GET["id"]); @@ -56,7 +56,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer) { $result = $commande->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); } - + if ($result >= 0) { Header("Location: contact.php?id=".$commande->id); @@ -192,11 +192,11 @@ if ($id > 0 || ! empty($ref)) print $commande->ref_client; print ''; print ''; - + // Customer if ( is_null($commande->client) ) $commande->fetch_client(); - + print ""; print ''; print "
'.img_object($langs->trans("ShowContact"),"contact"); print ' '.$obj->name.'$obj->firstname'.img_object($langs->trans("ShowCompany"),"company").' '; print "rowid."\">$obj->nom'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').''.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->rowid,'AC_TEL').' 
'; - print $langs->trans("Internal"); + print ''; + print img_object('','user').' '.$langs->trans("Users"); print ''; @@ -260,8 +260,8 @@ if ($id > 0) $var=!$var; print "
'; - print $langs->trans("External"); + print ''; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); print ''; @@ -315,8 +315,8 @@ if ($id > 0) // Source print ''; - if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); - if ($tab[$i]['source']=='external') print $langs->trans("External"); + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); print '
".$langs->trans("Company")."'.$commande->client->getNomUrl(1).'
"; @@ -232,8 +232,8 @@ if ($id > 0 || ! empty($ref)) // Ligne ajout pour contact interne print ""; - print ''; - print $langs->trans("Internal"); + print ''; + print img_object('','user').' '.$langs->trans("Users"); print ''; print ''; @@ -262,8 +262,8 @@ if ($id > 0 || ! empty($ref)) $var=!$var; print ""; - print ''; - print $langs->trans("External"); + print ''; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); print ''; print ''; @@ -273,7 +273,7 @@ if ($id > 0 || ! empty($ref)) print ''; // On récupère les id des contacts déjà sélectionnés - // $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type + // $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); print ''; @@ -317,8 +317,8 @@ if ($id > 0 || ! empty($ref)) // Source print ''; - if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); - if ($tab[$i]['source']=='external') print $langs->trans("External"); + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); print ''; // Societe diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index f012cd1e692..6750dd2e717 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -45,7 +45,7 @@ $result = restrictedArea($user, 'facture', $facid); if ($_POST["action"] == 'addcontact' && $user->rights->facture->creer) { - + $result = 0; $facture = new Facture($db); $result = $facture->fetch($_GET["facid"]); @@ -54,7 +54,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->facture->creer) { $result = $facture->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); } - + if ($result >= 0) { Header("Location: contact.php?facid=".$facture->id); @@ -160,7 +160,7 @@ if ($id > 0) if ( $facture->fetch($_GET['facid'], $user->societe_id) > 0) { $facture->fetch_client(); - + $head = facture_prepare_head($facture); dolibarr_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer')); @@ -210,11 +210,11 @@ if ($id > 0) // Ligne ajout pour contact interne print ""; - - print ''; - print $langs->trans("Internal"); - print ''; - + + print ''; + print img_object('','user').' '.$langs->trans("Users"); + print ''; + print ''; print $mysoc->nom; print ''; @@ -240,11 +240,11 @@ if ($id > 0) // Ligne ajout pour contact externe $var=!$var; print ""; - - print ''; - print $langs->trans("External"); - print ''; - + + print ''; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); + print ''; + print ''; $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id; $selectedCompany = $facture->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany'); @@ -263,12 +263,12 @@ if ($id > 0) if (! $nbofcontacts) print ' disabled="true"'; print '>'; print ''; - + print ""; print ' '; } - + // Liste des contacts liés print ''; print ''.$langs->trans("Source").''; @@ -296,10 +296,10 @@ if ($id > 0) // Source print ''; - if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); - if ($tab[$i]['source']=='external') print $langs->trans("External"); + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); print ''; - + // Societe print ''; if ($tab[$i]['socid'] > 0) @@ -314,7 +314,7 @@ if ($id > 0) } if (! $tab[$i]['socid']) { - print ' '; + print ' '; } print ''; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index cf9d924da2c..22600eece31 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Destailleur Laurent + * Copyright (C) 2005-2009 Destailleur Laurent * * 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 @@ -54,7 +54,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->contrat->creer) { $result = $contrat->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); } - + if ($result >= 0) { Header("Location: contact.php?id=".$contrat->id); @@ -105,7 +105,7 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->contrat->creer) if ($contrat->fetch($_GET["id"])) { $db->begin(); - + $contact = $contrat->detail_contact($_GET["ligne"]); $id_type_contact = $contact->fk_c_type_contact; @@ -167,7 +167,7 @@ if ($id > 0) $soc->fetch($contrat->socid); $head = contract_prepare_head($contrat); - + $hselected=1; dolibarr_fiche_head($head, $hselected, $langs->trans("Contract")); @@ -231,11 +231,11 @@ if ($id > 0) // Ligne ajout pour contact interne print ""; - - print ''; - print $langs->trans("Internal"); - print ''; - + + print ''; + print img_object('','user').' '.$langs->trans("Users"); + print ''; + print ''; print $conf->global->MAIN_INFO_SOCIETE_NOM; print ''; @@ -261,11 +261,11 @@ if ($id > 0) // Ligne ajout pour contact externe $var=!$var; print ""; - - print ''; - print $langs->trans("External"); - print ''; - + + print ''; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); + print ''; + print ''; $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$contrat->societe->id; $selectedCompany = $contrat->selectCompaniesForNewContact($contrat, 'id', $selectedCompany, $htmlname = 'newcompany'); @@ -284,13 +284,13 @@ if ($id > 0) if (! $nbofcontacts) print ' disabled="true"'; print '>'; print ''; - + print ""; } print ' '; - + // Liste des contacts liés print ''; print ''.$langs->trans("Source").''; @@ -318,10 +318,10 @@ if ($id > 0) // Source print ''; - if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); - if ($tab[$i]['source']=='external') print $langs->trans("External"); + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); print ''; - + // Societe print ''; if ($tab[$i]['socid'] > 0) @@ -336,7 +336,7 @@ if ($id > 0) } if (! $tab[$i]['socid']) { - print ' '; + print ' '; } print ''; diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index 778aa4e10d7..1c927677682 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2007 Laurent Destailleur + * Copyright (C) 2007-2009 Laurent Destailleur * * 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 @@ -46,7 +46,7 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); if ($_POST["action"] == 'addcontact' && $user->rights->ficheinter->creer) { - + $result = 0; $fichinter = new Fichinter($db); $result = $fichinter->fetch($_GET["id"]); @@ -55,7 +55,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->ficheinter->creer) { $result = $fichinter->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); } - + if ($result >= 0) { Header("Location: contact.php?id=".$fichinter->id); @@ -182,7 +182,7 @@ if ($id > 0) // Customer if ( is_null($fichinter->client) ) $fichinter->fetch_client(); - + print "".$langs->trans("Company").""; print ''.$fichinter->client->getNomUrl(1).''; print ""; @@ -218,8 +218,8 @@ if ($id > 0) // Ligne ajout pour contact interne print ""; - print ''; - print $langs->trans("Internal"); + print ''; + print img_object('','user').' '.$langs->trans("Users"); print ''; print ''; @@ -248,8 +248,8 @@ if ($id > 0) $var=!$var; print ""; - print ''; - print $langs->trans("External"); + print ''; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); print ''; print ''; @@ -259,7 +259,7 @@ if ($id > 0) print ''; // On récupère les id des contacts déjà sélectionnés - //$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type + //$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); print ''; @@ -303,8 +303,8 @@ if ($id > 0) // Source print ''; - if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); - if ($tab[$i]['source']=='external') print $langs->trans("External"); + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); print ''; // Societe diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php new file mode 100644 index 00000000000..0783886c8b0 --- /dev/null +++ b/htdocs/fourn/commande/contact.php @@ -0,0 +1,392 @@ + + * Copyright (C) 2005-2009 Destailleur Laurent + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + \file htdocs/commande/contact.php + \ingroup commande + \brief Onglet de gestion des contacts de commande + \version $Id$ +*/ + +require ("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php"); +require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); +require_once DOL_DOCUMENT_ROOT."/lib/fourn.lib.php"; + +$langs->load("facture"); +$langs->load("orders"); +$langs->load("sendings"); +$langs->load("companies"); + +$commandeid = isset($_GET["id"])?$_GET["id"]:''; + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'commande_fournisseur', $commandeid); + + +/* + * Ajout d'un nouveau contact + */ + +if ($_POST["action"] == 'addcontact' && $user->rights->commande->creer) +{ + + $result = 0; + $commande = new CommandeFournisseur($db); + $result = $commande->fetch($_GET["id"]); + + if ($result > 0 && $_GET["id"] > 0) + { + $result = $commande->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + Header("Location: contact.php?id=".$commande->id); + exit; + } + else + { + if ($commande->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + } + else + { + $mesg = '
'.$commande->error.'
'; + } + } +} +// modification d'un contact. On enregistre le type +if ($_POST["action"] == 'updateligne' && $user->rights->commande->creer) +{ + $commande = new CommandeFournisseur($db); + if ($commande->fetch($_GET["id"])) + { + $contact = $commande->detail_contact($_POST["elrowid"]); + $type = $_POST["type"]; + $statut = $contact->statut; + + $result = $commande->update_contact($_POST["elrowid"], $statut, $type); + if ($result >= 0) + { + $db->commit(); + } else + { + dolibarr_print_error($db, "result=$result"); + $db->rollback(); + } + } else + { + dolibarr_print_error($db); + } +} + +// bascule du statut d'un contact +if ($_GET["action"] == 'swapstatut' && $user->rights->commande->creer) +{ + $commande = new CommandeFournisseur($db); + if ($commande->fetch($_GET["id"])) + { + $contact = $commande->detail_contact($_GET["ligne"]); + $id_type_contact = $contact->fk_c_type_contact; + $statut = ($contact->statut == 4) ? 5 : 4; + + $result = $commande->update_contact($_GET["ligne"], $statut, $id_type_contact); + if ($result >= 0) + { + $db->commit(); + } else + { + dolibarr_print_error($db, "result=$result"); + $db->rollback(); + } + } else + { + dolibarr_print_error($db); + } +} + +// Efface un contact +if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer) +{ + $commande = new CommandeFournisseur($db); + $commande->fetch($_GET["id"]); + $result = $commande->delete_contact($_GET["lineid"]); + + if ($result >= 0) + { + Header("Location: contact.php?id=".$commande->id); + exit; + } + else { + dolibarr_print_error($db); + } +} + + + +/* + * View + */ + +llxHeader('', $langs->trans("Order"), "Commande"); + +$html = new Form($db); +$contactstatic=new Contact($db); + + +/* *************************************************************************** */ +/* */ +/* Mode vue et edition */ +/* */ +/* *************************************************************************** */ +if (isset($mesg)) print $mesg; + +$id = $_GET['id']; +$ref= $_GET['ref']; +if ($id > 0 || ! empty($ref)) +{ + $langs->trans("OrderCard"); + $commande = new CommandeFournisseur($db); + if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0) + { + $soc = new Societe($db, $commande->socid); + $soc->fetch($commande->socid); + + + $head = ordersupplier_prepare_head($commande); + dolibarr_fiche_head($head, 'contact', $langs->trans("SupplierOrder")); + + + /* + * Facture synthese pour rappel + */ + print ''; + + // Ref + print ''; + print ''; + print ''; + + // Fournisseur + print '"; + print ''; + print ''; + + print "
'.$langs->trans("Ref").''; + print $html->showrefnav($commande,'ref','',1,'ref','ref'); + print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
"; + + print ''; + + /* + * Lignes de contacts + */ + echo '
'; + + /* + * Ajouter une ligne de contact + * Non affiché en mode modification de ligne + */ + if ($_GET["action"] != 'editline' && $user->rights->fournisseur->facture->creer) + { + // TODO All contacts page should use same code + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $var = false; + + print ''; + print ''; + print ''; + print ''; + + // Ligne ajout pour contact interne + print ""; + + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + + // Ligne ajout pour contact externe + $var=!$var; + print ""; + + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ""; + + print ''; + } + + // Liste des contacts liés + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $societe = new Societe($db); + $var = true; + + foreach(array('internal','external') as $source) + { + $tab = $commande->liste_contact(-1,$source); + $num=sizeof($tab); + + $i = 0; + while ($i < $num) + { + $var = !$var; + + print ''; + + // Source + print ''; + + // Societe + print ''; + + // Contact + print ''; + + // Type de contact + print ''; + + // Statut + print ''; + + // Icon update et delete + print ''; + + print "\n"; + + $i ++; + } + } + print "
'.$langs->trans("Source").''.$langs->trans("Company").''.$langs->trans("Contacts").''.$langs->trans("ContactType").' 
'; + print img_object('','user').' '.$langs->trans("Users"); + print ''; + print $conf->global->MAIN_INFO_SOCIETE_NOM; + print ''; + // On récupère les id des users déjà sélectionnés + //$userAlreadySelected = $commande->getListContactId('internal'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type + $html->select_users($user->id,'contactid',0,$userAlreadySelected); + print ''; + $commande->selectTypeContact($commande, '', 'type','internal'); + print '
'; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); + print ''; + $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id; + $selectedCompany = $commande->selectCompaniesForNewContact($commande, 'id', $selectedCompany, $htmlname = 'newcompany'); + print ''; + // On récupère les id des contacts déjà sélectionnés + // $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type + $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected); + if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); + print ''; + $commande->selectTypeContact($commande, '', 'type','external'); + print '
 
'.$langs->trans("Source").''.$langs->trans("Company").''.$langs->trans("Contacts").''.$langs->trans("ContactType").''.$langs->trans("Status").' 
'; + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); + print ''; + if ($tab[$i]['socid'] > 0) + { + print ''; + print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($tab[$i]['socid']); + print ''; + } + if ($tab[$i]['socid'] < 0) + { + print $conf->global->MAIN_INFO_SOCIETE_NOM; + } + if (! $tab[$i]['socid']) + { + print ' '; + } + print ''; + if ($tab[$i]['source']=='internal') + { + print ''; + print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].''; + } + if ($tab[$i]['source']=='external') + { + print ''; + print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].''; + } + print ''.$tab[$i]['libelle'].''; + // Activation desativation du contact + if ($commande->statut >= 0) print ''; + print $contactstatic->LibStatut($tab[$i]['status'],3); + if ($commande->statut >= 0) print ''; + print ''; + if ($commande->statut < 5 && $user->rights->commande->creer) + { + print ' '; + print ''; + print img_delete(); + print ''; + } + print '
"; + } + else + { + // Contrat non trouv + print "ErrorRecordNotFound"; + } +} + +$db->close(); + +llxFooter('$Date$'); +?> \ No newline at end of file diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 1248da1e43a..91ffa252143 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -16,16 +16,14 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ - + /** - \file htdocs/fourn/contact.php - \ingroup fournisseur - \brief Liste des contacts fournisseurs - \version $Revision$ -*/ + * \file htdocs/fourn/contact.php + * \ingroup fournisseur + * \brief Liste des contacts fournisseurs + * \version $Id$ + */ require("./pre.inc.php"); @@ -36,7 +34,7 @@ llxHeader(); /* * Sécurité accés client */ -if ($user->societe_id > 0) +if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; @@ -88,9 +86,9 @@ $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + print_barre_liste($langs->trans("ListOfContacts")." (".$langs->trans("Suppliers").")",$page, "contact.php", "",$sortfield,$sortorder,"",$num); - + print ''; print ''; print_liste_field_titre($langs->trans("Lastname"),"contact.php","p.name", $begin, "", "", $sortfield,$sortorder); @@ -104,7 +102,7 @@ if ($result) { while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - + $var=!$var; print ""; @@ -114,7 +112,7 @@ if ($result) { print ''; print ''; print ''; - + print "\n"; $i++; } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 5943a832e0f..5aa47398175 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -45,7 +45,7 @@ $result = restrictedArea($user, 'fournisseur', $facid, '', 'facture'); if ($_POST["action"] == 'addcontact' && $user->rights->fournisseur->facture->creer) { - + $result = 0; $facture = new FactureFournisseur($db); $result = $facture->fetch($_GET["facid"]); @@ -54,7 +54,7 @@ if ($_POST["action"] == 'addcontact' && $user->rights->fournisseur->facture->cre { $result = $facture->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); } - + if ($result >= 0) { Header("Location: contact.php?facid=".$facture->id); @@ -164,7 +164,7 @@ if ($id > 0) if ($facture->fetch($_GET['facid'], $user->societe_id) > 0) { $facture->fetch_client(); - + $head = facturefourn_prepare_head($facture); dolibarr_fiche_head($head, 'contact', $langs->trans('SupplierInvoice')); @@ -218,11 +218,11 @@ if ($id > 0) // Ligne ajout pour contact interne print ""; - - print ''; - + + print ''; + print ''; @@ -248,11 +248,11 @@ if ($id > 0) // Ligne ajout pour contact externe $var=!$var; print ""; - - print ''; - + + print ''; + print ''; print ''; - + print ""; print ''; @@ -304,10 +304,10 @@ if ($id > 0) // Source print ''; - + // Societe print ''; diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 39e9ccf9968..f3f39a2ad09 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -170,7 +170,7 @@ class CommandeFournisseur extends Commande } $this->db->free($result); - return 0; + return 1; } else { diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 69f5c9878b1..02cc132a53d 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -25,6 +25,9 @@ IdThirdParty=Id third party IdCompany=Company Id IdContact=Contact Id Contacts=Contacts +ThirdPartyContacts=Third party contacts +ThirdPartyContact=Third party contact +StatusContactValidated=Status of contact Company=Company CompanyName=Company name Companies=Companies diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 83a82dafb96..44d49ed23a1 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -25,6 +25,10 @@ IdThirdParty=Id tiers IdCompany=Id société IdContact=Id contact Contacts=Contacts +ThirdPartyContacts=Contacts tiers +ThirdPartyContact=Contact tiers +StatusContactValidated=Etat du contact +CustomerContact=Contact client Company=Société CompanyName=Raison sociale Companies=Sociétés diff --git a/htdocs/lib/fourn.lib.php b/htdocs/lib/fourn.lib.php index 9954556e384..d718ce92c70 100644 --- a/htdocs/lib/fourn.lib.php +++ b/htdocs/lib/fourn.lib.php @@ -81,18 +81,24 @@ function ordersupplier_prepare_head($commande) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); + $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; if ($conf->stock->enabled) { + $langs->load("stocks"); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$commande->id; $head[$h][1] = $langs->trans("OrderDispatch"); $head[$h][2] = 'dispatch'; $h++; } + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$commande->id; + $head[$h][1] = $langs->trans('OrderContact'); + $head[$h][2] = 'contact'; + $h++; + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$commande->id; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; diff --git a/mysql/data/data.sql b/mysql/data/data.sql index b20a0311bb4..75f69830434 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -1287,11 +1287,11 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (72, 'facture_fourn', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (73, 'facture_fourn', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (140,'commande_fourn','internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (141,'commande_fourn','internal', 'SHIPPING', 'Responsable réception de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (142,'commande_fourn','external', 'BILLING', 'Contact fournisseur facturation commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (143,'commande_fourn','external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (145,'commande_fourn','external', 'SHIPPING', 'Contact fournisseur livraison commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (140,'order_supplier','internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (141,'order_supplier','internal', 'SHIPPING', 'Responsable réception de la commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (142,'order_supplier','external', 'BILLING', 'Contact fournisseur facturation commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (143,'order_supplier','external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (145,'order_supplier','external', 'SHIPPING', 'Contact fournisseur livraison commande', 1); -- diff --git a/mysql/migration/2.5.0-2.6.0.sql b/mysql/migration/2.5.0-2.6.0.sql index 5c8ae9f15a0..ec35a1d4b3a 100644 --- a/mysql/migration/2.5.0-2.6.0.sql +++ b/mysql/migration/2.5.0-2.6.0.sql @@ -6,11 +6,11 @@ -- when current version is 2.4.0 or higher. -- -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (140,'commande_fourn','internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (141,'commande_fourn','internal', 'SHIPPING', 'Responsable réception de la commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (142,'commande_fourn','external', 'BILLING', 'Contact fournisseur facturation commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (143,'commande_fourn','external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1); -insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (145,'commande_fourn','external', 'SHIPPING', 'Contact fournisseur livraison commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (140,'order_supplier','internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (141,'order_supplier','internal', 'SHIPPING', 'Responsable réception de la commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (142,'order_supplier','external', 'BILLING', 'Contact fournisseur facturation commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (143,'order_supplier','external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1); +insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (145,'order_supplier','external', 'SHIPPING', 'Contact fournisseur livraison commande', 1); alter table llx_expedition_methode change statut active tinyint DEFAULT 1;
'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.$obj->email.''.$obj->phone.'
'; - print $langs->trans("Internal"); - print ''; + print img_object('','user').' '.$langs->trans("Users"); + print ''; print $mysoc->nom; print '
'; - print $langs->trans("External"); - print ''; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); + print ''; $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$facture->client->id; $selectedCompany = $facture->selectCompaniesForNewContact($facture, 'facid', $selectedCompany, $htmlname = 'newcompany'); @@ -271,7 +271,7 @@ if ($id > 0) if (! $nbofcontacts) print ' disabled="true"'; print '>
 
'; - if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); - if ($tab[$i]['source']=='external') print $langs->trans("External"); + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); print ''; if ($tab[$i]['socid'] > 0) @@ -322,7 +322,7 @@ if ($id > 0) } if (! $tab[$i]['socid']) { - print ' '; + print ' '; } print '