[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com> 4 * Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 */ 21 22 require ("./pre.inc.php"); 23 require_once(DOL_DOCUMENT_ROOT."/product.class.php"); 24 25 $langs->load("categories"); 26 27 $mesg = ''; 28 29 if (!$user->rights->produit->lire) accessforbidden(); 30 31 $types[0] = $langs->trans("Product"); 32 $types[1] = $langs->trans("Service"); 33 34 /* 35 * Creation de l'objet produit correspondant à l'id 36 */ 37 if ($_GET["id"]) 38 { 39 $product = new Product($db); 40 $result = $product->fetch($_GET["id"]); 41 } 42 43 llxHeader("","",$langs->trans("CardProduct0")); 44 45 /* 46 * Fiche produit 47 */ 48 if ($_GET["id"]) 49 { 50 //on veut supprimer une catégorie 51 if ($_REQUEST["cat"]) 52 { 53 $cat = new Categorie($db,$_REQUEST["cat"]); 54 $cat->del_product($product); 55 } 56 57 //on veut ajouter une catégorie 58 if (isset($_REQUEST["add_cat"]) && $_REQUEST["add_cat"]>=0) 59 { 60 $cat = new Categorie($db,$_REQUEST["add_cat"]); 61 $cat->add_product($product); 62 } 63 64 if ( $result ) 65 { 66 67 /* 68 * En mode visu 69 */ 70 71 $h=0; 72 73 $head[$h][0] = DOL_URL_ROOT."/fourn/product/fiche.php?id=".$product->id; 74 $head[$h][1] = $langs->trans("Card"); 75 $h++; 76 77 78 if ($conf->stock->enabled) 79 { 80 $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; 81 $head[$h][1] = $langs->trans("Stock"); 82 $h++; 83 } 84 85 if ($conf->fournisseur->enabled) 86 { 87 $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; 88 $head[$h][1] = $langs->trans("Suppliers"); 89 $h++; 90 } 91 92 $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; 93 $head[$h][1] = $langs->trans("Photos"); 94 $h++; 95 96 $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; 97 $head[$h][1] = $langs->trans('Statistics'); 98 $h++; 99 100 //affichage onglet catégorie 101 if ($conf->categorie->enabled){ 102 $head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id; 103 $head[$h][1] = $langs->trans('Categories'); 104 $hselected = $h; 105 $h++; 106 } 107 108 109 dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); 110 111 print($mesg); 112 print '<table class="border" width="100%">'; 113 print "<tr>"; 114 print '<td>'.$langs->trans("Ref").'</td><td>'.$product->ref.'</td>'; 115 116 print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>'; 117 print "</table><br>\n"; 118 119 $c = new Categorie($db); 120 $cats = $c->containing($_REQUEST['id']); 121 122 if (sizeof($cats) > 0) 123 { 124 print "Vous avez stocké le produit dans les catégorie suivantes:<br/><br/>"; 125 print '<table class="noborder" width="100%">'; 126 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("AllWays").'</td></tr>'; 127 128 129 foreach ($cats as $cat) 130 { 131 132 $ways = $cat->print_all_ways (); 133 foreach ($ways as $way) 134 { 135 $i = !$i; 136 print "<tr ".$bc[$i]."><td>".$way."</td>"; 137 print "<td><a href= '".DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id."&cat=".$cat->id."'>".$langs->trans("DeleteFromCat")."</a></td></tr>\n"; 138 139 } 140 141 } 142 print "</table><br/><br/>\n"; 143 } 144 else if($cats < 0) 145 { 146 print $langs->trans("ErrorUnknown"); 147 } 148 149 else 150 { 151 print $langs->trans("NoCat")."<br/><br/>"; 152 } 153 154 } 155 156 print $langs->trans("AddProductToCat")."<br/><br/>"; 157 print '<table class="border" width="100%">'; 158 print "<form method='post' action='".DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id."'>"; 159 print "<tr><td><select name='add_cat'><option value='-1'>".$langs->trans("Choose")."</option>"; 160 $cat = new Categorie($db); 161 foreach ($cat->get_all_categories() as $categorie) 162 { 163 print "<option value='".$categorie->id."'>".$categorie->label."</option>\n"; 164 } 165 print "</select></td><td><input type='submit' value='".$langs->trans("Select")."'></td></tr>"; 166 print "</form></table><br/>"; 167 168 } 169 $db->close(); 170 171 172 llxFooter("<em>Dernière modification $Date: 2005/12/03 12:28:02 $ révision $Revision: 1.4 $</em>"); 173 ?> 174
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 |
![]() |