Contact page picto is more clear to distinguish internal from external users.

This commit is contained in:
Laurent Destailleur 2009-02-16 22:37:30 +00:00
parent ba8a2b094a
commit 5fcd6b4af5
16 changed files with 528 additions and 124 deletions

View File

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

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 <EFBFBD>ric Seigne <erics@rycks.com>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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"], "&amp;type=$type",$sortfield,$sortorder,"",$num);
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin,"&amp;type=$type","",$sortfield,$sortorder);
@ -156,21 +156,21 @@ if ($resql)
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"),"contact");
print '</a>&nbsp;<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.$obj->name.'</a></td>';
print "<td>$obj->firstname</TD>";
print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").'</a>&nbsp;';
print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->nom</a></td>\n";
print '<td>'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').'</td>';
print '<td>'.dol_print_phone($obj->phone,$obj->pays_code,$obj->cidp,$obj->rowid,'AC_TEL').'&nbsp;</td>';
print "</tr>\n";
$i++;
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2007 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
*
* 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 "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Internal");
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
@ -260,8 +260,8 @@ if ($id > 0)
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("External");
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
@ -315,8 +315,8 @@ if ($id > 0)
// Source
print '<td align="left">';
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 '</td>';
// Societe

View File

@ -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 '</td>';
print '</tr>';
// Customer
if ( is_null($commande->client) )
$commande->fetch_client();
print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$commande->client->getNomUrl(1).'</td></tr>';
print "</table>";
@ -232,8 +232,8 @@ if ($id > 0 || ! empty($ref))
// Ligne ajout pour contact interne
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Internal");
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
@ -262,8 +262,8 @@ if ($id > 0 || ! empty($ref))
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("External");
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
@ -273,7 +273,7 @@ if ($id > 0 || ! empty($ref))
print '<td colspan="1">';
// 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 '</td>';
@ -317,8 +317,8 @@ if ($id > 0 || ! empty($ref))
// Source
print '<td align="left">';
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 '</td>';
// Societe

View File

@ -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 "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Internal");
print '</td>';
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
print $mysoc->nom;
print '</td>';
@ -240,11 +240,11 @@ if ($id > 0)
// Ligne ajout pour contact externe
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("External");
print '</td>';
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
$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 '></td>';
print '</tr>';
print "</form>";
print '<tr><td colspan="6">&nbsp;</td></tr>';
}
// Liste des contacts liés
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
@ -296,10 +296,10 @@ if ($id > 0)
// Source
print '<td align="left">';
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 '</td>';
// Societe
print '<td align="left">';
if ($tab[$i]['socid'] > 0)
@ -314,7 +314,7 @@ if ($id > 0)
}
if (! $tab[$i]['socid'])
{
print '&nbsp;';
print '&nbsp;';
}
print '</td>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2007 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
*
* 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 "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Internal");
print '</td>';
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
print $conf->global->MAIN_INFO_SOCIETE_NOM;
print '</td>';
@ -261,11 +261,11 @@ if ($id > 0)
// Ligne ajout pour contact externe
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("External");
print '</td>';
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
$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 '></td>';
print '</tr>';
print "</form>";
}
print '<tr><td colspan="6">&nbsp;</td></tr>';
// Liste des contacts liés
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
@ -318,10 +318,10 @@ if ($id > 0)
// Source
print '<td align="left">';
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 '</td>';
// Societe
print '<td align="left">';
if ($tab[$i]['socid'] > 0)
@ -336,7 +336,7 @@ if ($id > 0)
}
if (! $tab[$i]['socid'])
{
print '&nbsp;';
print '&nbsp;';
}
print '</td>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$fichinter->client->getNomUrl(1).'</td></tr>';
print "</table>";
@ -218,8 +218,8 @@ if ($id > 0)
// Ligne ajout pour contact interne
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Internal");
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
@ -248,8 +248,8 @@ if ($id > 0)
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("External");
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
@ -259,7 +259,7 @@ if ($id > 0)
print '<td colspan="1">';
// 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 '</td>';
@ -303,8 +303,8 @@ if ($id > 0)
// Source
print '<td align="left">';
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 '</td>';
// Societe

View File

@ -0,0 +1,392 @@
<?php
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
*
* 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 = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
}
else
{
$mesg = '<div class="error">'.$commande->error.'</div>';
}
}
}
// 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 '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
print "</table>";
print '</div>';
/*
* Lignes de contacts
*/
echo '<br><table class="noborder" width="100%">';
/*
* 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 '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Contacts").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n";
$var = false;
print '<form action="contact.php?id='.$id.'" method="post">';
print '<input type="hidden" name="action" value="addcontact">';
print '<input type="hidden" name="source" value="internal">';
print '<input type="hidden" name="id" value="'.$id.'">';
// Ligne ajout pour contact interne
print "<tr $bc[$var]>";
print '<td nowrap="0">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
print $conf->global->MAIN_INFO_SOCIETE_NOM;
print '</td>';
print '<td colspan="1">';
// 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 '</td>';
print '<td>';
$commande->selectTypeContact($commande, '', 'type','internal');
print '</td>';
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
print '</form>';
print '<form action="contact.php?id='.$id.'" method="post">';
print '<input type="hidden" name="action" value="addcontact">';
print '<input type="hidden" name="source" value="external">';
print '<input type="hidden" name="id" value="'.$id.'">';
// Ligne ajout pour contact externe
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id;
$selectedCompany = $commande->selectCompaniesForNewContact($commande, 'id', $selectedCompany, $htmlname = 'newcompany');
print '</td>';
print '<td colspan="1">';
// 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 '</td>';
print '<td>';
$commande->selectTypeContact($commande, '', 'type','external');
print '</td>';
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
if (! $nbofcontacts) print ' disabled="true"';
print '></td>';
print '</tr>';
print "</form>";
print '<tr><td colspan="6">&nbsp;</td></tr>';
}
// Liste des contacts liés
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Contacts").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td align="center">'.$langs->trans("Status").'</td>';
print '<td colspan="2">&nbsp;</td>';
print "</tr>\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 '<tr '.$bc[$var].' valign="top">';
// Source
print '<td align="left">';
if ($tab[$i]['source']=='internal') print $langs->trans("User");
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
print '</td>';
// Societe
print '<td align="left">';
if ($tab[$i]['socid'] > 0)
{
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$tab[$i]['socid'].'">';
print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($tab[$i]['socid']);
print '</a>';
}
if ($tab[$i]['socid'] < 0)
{
print $conf->global->MAIN_INFO_SOCIETE_NOM;
}
if (! $tab[$i]['socid'])
{
print '&nbsp;';
}
print '</td>';
// Contact
print '<td>';
if ($tab[$i]['source']=='internal')
{
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$tab[$i]['id'].'">';
print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].'</a>';
}
if ($tab[$i]['source']=='external')
{
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$tab[$i]['id'].'">';
print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].'</a>';
}
print '</td>';
// Type de contact
print '<td>'.$tab[$i]['libelle'].'</td>';
// Statut
print '<td align="center">';
// Activation desativation du contact
if ($commande->statut >= 0) print '<a href="contact.php?id='.$commande->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">';
print $contactstatic->LibStatut($tab[$i]['status'],3);
if ($commande->statut >= 0) print '</a>';
print '</td>';
// Icon update et delete
print '<td align="center" nowrap>';
if ($commande->statut < 5 && $user->rights->commande->creer)
{
print '&nbsp;';
print '<a href="contact.php?id='.$commande->id.'&amp;action=deleteline&amp;lineid='.$tab[$i]['rowid'].'">';
print img_delete();
print '</a>';
}
print '</td>';
print "</tr>\n";
$i ++;
}
}
print "</table>";
}
else
{
// Contrat non trouv
print "ErrorRecordNotFound";
}
}
$db->close();
llxFooter('$Date$');
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
*
* 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 '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
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 "<tr $bc[$var]>";
@ -114,7 +112,7 @@ if ($result) {
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
print '<td>'.$obj->email.'</td>';
print '<td>'.$obj->phone.'</td>';
print "</tr>\n";
$i++;
}

View File

@ -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 "<tr $bc[$var]>";
print '<td>';
print $langs->trans("Internal");
print '</td>';
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
print $mysoc->nom;
print '</td>';
@ -248,11 +248,11 @@ if ($id > 0)
// Ligne ajout pour contact externe
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
print $langs->trans("External");
print '</td>';
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
$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 '></td>';
print '</tr>';
print "</form>";
print '<tr><td colspan="6">&nbsp;</td></tr>';
@ -304,10 +304,10 @@ if ($id > 0)
// Source
print '<td align="left">';
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 '</td>';
// Societe
print '<td align="left">';
if ($tab[$i]['socid'] > 0)
@ -322,7 +322,7 @@ if ($id > 0)
}
if (! $tab[$i]['socid'])
{
print '&nbsp;';
print '&nbsp;';
}
print '</td>';

View File

@ -170,7 +170,7 @@ class CommandeFournisseur extends Commande
}
$this->db->free($result);
return 0;
return 1;
}
else
{

View File

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

View File

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

View File

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

View File

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

View File

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