Possibilit d'affecter une socit un contact qui n'est affect a aucune.
This commit is contained in:
parent
068e3ef30a
commit
373340307c
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2006 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
|
||||
@ -19,7 +19,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -86,13 +85,12 @@ if ($type == "f")
|
||||
$sql = "SELECT s.idp, s.nom, st.libelle as stcomm";
|
||||
$sql .= ", p.idp as cidp, p.name, p.firstname, p.email, p.phone";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = p.fk_soc";
|
||||
$sql .= " WHERE s.fk_stcomm = st.id";
|
||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
if ($type == "c") $sql .= " AND s.client = 1";
|
||||
if ($type == "p") $sql .= " AND s.client = 2";
|
||||
if ($type == "f") $sql .= " AND s.fournisseur = 1";
|
||||
|
||||
@ -131,7 +131,7 @@ class Contact
|
||||
$this->email=trim($this->email);
|
||||
$this->phone_pro=trim($this->phone_pro);
|
||||
|
||||
if ($this->phone_pro && $this->socid > 0)
|
||||
if (! $this->phone_pro && $this->socid > 0)
|
||||
{
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->socid);
|
||||
@ -139,7 +139,9 @@ class Contact
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
$sql .= " civilite='".addslashes($this->civilite_id)."'";
|
||||
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."'";
|
||||
if ($this->socid == -1) $sql .= " fk_soc=null";
|
||||
$sql .= ", civilite='".addslashes($this->civilite_id)."'";
|
||||
$sql .= ", name='".addslashes($this->name)."'";
|
||||
$sql .= ", firstname='".addslashes($this->firstname)."'";
|
||||
$sql .= ", address='".addslashes($this->address)."'";
|
||||
@ -160,7 +162,7 @@ class Contact
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -62,12 +62,13 @@ if ($page < 0) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$langs->load("companies");
|
||||
$titre=$langs->trans("ListOfContacts");
|
||||
if ($type == "c") { $titre=$langs->trans("ListOfCustomersContacts"); }
|
||||
if ($type == "f") { $titre=$langs->trans("ListOfSuppliersContacts"); }
|
||||
if ($view == 'phone') { $text="(Vue Téléphones)"; }
|
||||
if ($view == 'mail') { $text="(Vue EMail)"; }
|
||||
if ($view == 'recent') { $text="(Récents)"; }
|
||||
if ($type == "c") { $titre=$langs->trans("ListOfContacts").' ('.$langs->trans("ThirdPartyCustomers").')'; }
|
||||
if ($type == "f") { $titre=$langs->trans("ListOfSuppliersContacts").' ('.$langs->trans("ThirdPartySuppliers").')'; }
|
||||
if ($view == 'phone') { $text="( Vue Téléphones)"; }
|
||||
if ($view == 'mail') { $text=" (Vue EMail)"; }
|
||||
if ($view == 'recent') { $text=" (Récents)"; }
|
||||
$titre = $titre." $text";
|
||||
|
||||
if ($_POST["button_removefilter"])
|
||||
|
||||
@ -456,7 +456,7 @@ class Form
|
||||
* \param htmlname Nom champ formulaire
|
||||
* \param filter Criteres optionnels de filtre
|
||||
*/
|
||||
function select_societes($selected='',$htmlname='soc_id',$filter='')
|
||||
function select_societes($selected='',$htmlname='soc_id',$filter='',$showempty=0)
|
||||
{
|
||||
// On recherche les societes
|
||||
$sql = "SELECT s.idp, s.nom FROM";
|
||||
@ -468,6 +468,7 @@ class Form
|
||||
if ($resql)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($showempty) print '<option value="-1"> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user