[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: commerciaux.php,v 1.7 2005/08/20 16:03:05 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/societe/commerciaux.php,v $ 21 */ 22 23 /** 24 \file htdocs/societe/commerciaux.php 25 \ingroup societe 26 \brief Page d'affectations des commerciaux aux societes 27 \version $Revision: 1.7 $ 28 */ 29 30 require ("./pre.inc.php"); 31 32 $user->getrights(); 33 34 $langs->load("companies"); 35 $langs->load("commercial"); 36 $langs->load("customers"); 37 $langs->load("suppliers"); 38 $langs->load("banks"); 39 40 /* 41 * Sécurité accés client 42 */ 43 44 if ($user->societe_id > 0) 45 { 46 $action = ''; 47 $socid = $user->societe_id; 48 } 49 50 if($_GET["socid"] && $_GET["commid"]) 51 { 52 if ($user->rights->societe->creer) 53 { 54 $soc = new Societe($db); 55 $soc->id = $_GET["socid"]; 56 $soc->fetch($_GET["socid"]); 57 $soc->add_commercial($user, $_GET["commid"]); 58 59 Header("Location: commerciaux.php?socid=".$soc->id); 60 } 61 else 62 { 63 Header("Location: commerciaux.php?socid=".$_GET["socid"]); 64 } 65 } 66 67 if($_GET["socid"] && $_GET["delcommid"]) 68 { 69 if ($user->rights->societe->creer) 70 { 71 $soc = new Societe($db); 72 $soc->id = $_GET["socid"]; 73 $soc->fetch($_GET["socid"]); 74 $soc->del_commercial($user, $_GET["delcommid"]); 75 76 Header("Location: commerciaux.php?socid=".$soc->id); 77 } 78 else 79 { 80 Header("Location: commerciaux.php?socid=".$_GET["socid"]); 81 } 82 } 83 84 85 llxHeader(); 86 87 if($_GET["socid"]) 88 { 89 $soc = new Societe($db); 90 $soc->id = $_GET["socid"]; 91 $soc->fetch($_GET["socid"]); 92 93 $h=0; 94 95 $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; 96 $head[$h][1] = $langs->trans("Company"); 97 $h++; 98 99 $head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$soc->id; 100 $head[$h][1] = $langs->trans("BankAccount")." $account->number"; 101 $h++; 102 103 $head[$h][0] = 'lien.php?socid='.$soc->id; 104 $head[$h][1] = $langs->trans("Links"); 105 $h++; 106 107 $head[$h][0] = 'commerciaux.php?socid='.$soc->id; 108 $head[$h][1] = $langs->trans("SalesRepresentative"); 109 $hselected=$h; 110 $h++; 111 112 dolibarr_fiche_head($head, $hselected, $soc->nom); 113 114 /* 115 * Fiche société en mode visu 116 */ 117 118 print '<table class="border" width="100%">'; 119 print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$soc->nom.'</td></tr>'; 120 121 print '<tr><td>'; 122 print $langs->trans('CustomerCode').'</td><td width="20%">'; 123 print $soc->code_client; 124 if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); 125 print '</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>'; 126 127 print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."</td></tr>"; 128 129 print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$soc->cp."</td>"; 130 print '<td>'.$langs->trans('Town').'</td><td>'.$soc->ville."</td></tr>"; 131 132 print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$soc->pays.'</td>'; 133 134 print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($soc->tel).'</td>'; 135 print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($soc->fax).'</td></tr>'; 136 137 print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">'; 138 if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; } 139 print '</td></tr>'; 140 141 // Liste les commerciaux 142 print '<tr><td valign="top">'.$langs->trans("SalesRepresentatives").'</td>'; 143 print '<td colspan="3">'; 144 145 $sql = "SELECT u.rowid, u.name, u.firstname"; 146 $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; 147 $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; 148 $sql .= " WHERE sc.fk_soc =".$soc->id; 149 $sql .= " AND sc.fk_user = u.rowid"; 150 $sql .= " ORDER BY u.name ASC "; 151 152 $resql = $db->query($sql); 153 if ($resql) 154 { 155 $num = $db->num_rows($resql); 156 $i = 0; 157 158 while ($i < $num) 159 { 160 $obj = $db->fetch_object($resql); 161 print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'; 162 print img_object($langs->trans("ShowUser"),"user").' '; 163 print stripslashes($obj->firstname)." " .stripslashes($obj->name)."\n"; 164 print '</a> '; 165 print '<a href="commerciaux.php?socid='.$_GET["socid"].'&delcommid='.$obj->rowid.'">'; 166 print img_delete(); 167 print '</a><br>'; 168 $i++; 169 } 170 171 $db->free($resql); 172 } 173 else 174 { 175 dolibarr_print_error($db); 176 } 177 if($i == 0) { print $langs->trans("NoSalesRepresentativeAffected"); } 178 179 print "</td></tr>"; 180 181 182 print '</table>'; 183 print "</div>\n"; 184 185 186 187 if ($user->rights->societe->creer) 188 { 189 /* 190 * Liste 191 * 192 */ 193 194 $langs->load("users"); 195 $title=$langs->trans("ListOfUsers"); 196 197 $sql = "SELECT u.rowid, u.name, u.firstname, u.code"; 198 $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; 199 $sql .= " ORDER BY u.name ASC "; 200 201 $resql = $db->query($sql); 202 if ($resql) 203 { 204 $num = $db->num_rows($resql); 205 $i = 0; 206 207 print_titre($title); 208 209 // Lignes des titres 210 print '<table class="noborder" width="100%">'; 211 print '<tr class="liste_titre">'; 212 print '<td>'.$langs->trans("Name").'</td>'; 213 print '<td>'.$langs->trans("Code").'</td>'; 214 print '<td> </td>'; 215 print "</tr>\n"; 216 217 $var=True; 218 219 while ($i < $num) 220 { 221 $obj = $db->fetch_object($resql); 222 $var=!$var; 223 print "<tr $bc[$var]><td>"; 224 print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'; 225 print img_object($langs->trans("ShowUser"),"user").' '; 226 print stripslashes($obj->firstname)." " .stripslashes($obj->name)."\n"; 227 print '</a>'; 228 print '</td><td>'.$obj->code.'</td>'; 229 print '<td><a href="commerciaux.php?socid='.$_GET["socid"].'&commid='.$obj->rowid.'">'.$langs->trans("Add").'</a></td>'; 230 231 print '</tr>'."\n"; 232 $i++; 233 } 234 235 print "</table>"; 236 $db->free($resql); 237 } 238 else 239 { 240 dolibarr_print_error($db); 241 } 242 } 243 244 } 245 246 247 $db->close(); 248 249 llxFooter('$Date: 2005/08/20 16:03:05 $ - $Revision: 1.7 $'); 250 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |