Fix: modification sur les catégories

This commit is contained in:
Regis Houssin 2007-10-26 11:12:13 +00:00
parent 4bf1a619f2
commit 1e4b5426fa
4 changed files with 51 additions and 53 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com> * Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Regis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2006-2007 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* *
@ -743,10 +743,10 @@ class Categorie
/** /**
* get_primary_way() affiche le chemin le plus court pour se rendre à un produit * get_primary_way() affiche le chemin le plus court pour se rendre à un produit
*/ */
function get_primary_way($id) function get_primary_way($id, $type="")
{ {
$primary_way = Array("taille"=>-1,"chemin"=>Array()); $primary_way = Array("taille"=>-1,"chemin"=>Array());
$meres = $this->containing($id); $meres = $this->containing($id,$type);
foreach ($meres as $mere) foreach ($meres as $mere)
{ {
foreach ($mere->get_all_ways() as $way) foreach ($mere->get_all_ways() as $way)
@ -765,10 +765,10 @@ class Categorie
/** /**
* print_primary_way() affiche le chemin le plus court pour se rendre à un produit * print_primary_way() affiche le chemin le plus court pour se rendre à un produit
*/ */
function print_primary_way($id, $sep= " &gt;&gt; ",$url) function print_primary_way($id, $sep= " &gt;&gt; ", $url, $type="")
{ {
$primary_way = Array(); $primary_way = Array();
$way = $this->get_primary_way($id); $way = $this->get_primary_way($id,$type);
$w = array(); $w = array();
foreach ($way as $cat) foreach ($way as $cat)
{ {
@ -778,7 +778,7 @@ class Categorie
} }
else else
{ {
$w[] = "<a href='".DOL_URL_ROOT."/$url?catid=".$cat->id."'>".$cat->label."</a>"; $w[] = "<a href='".DOL_URL_ROOT."/".$url."?catid=".$cat->id."'>".$cat->label."</a>";
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com> * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -114,7 +114,7 @@ if ($_GET["id"])
print "</table><br>\n"; print "</table><br>\n";
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($_REQUEST['id']); $cats = $c->containing($_REQUEST['id'],"product");
if (sizeof($cats) > 0) if (sizeof($cats) > 0)
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -282,7 +283,6 @@ else
*/ */
if ($_GET["id"]) if ($_GET["id"])
{ {
if ($_GET["action"] <> 're-edit') if ($_GET["action"] <> 're-edit')
{ {
$product = new Product($db); $product = new Product($db);
@ -291,7 +291,6 @@ else
if ( $product->id > 0 ) if ( $product->id > 0 )
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{ {
/* /*
@ -313,7 +312,6 @@ else
$head[$h][1] = $langs->trans("Stock"); $head[$h][1] = $langs->trans("Stock");
$h++; $h++;
} }
} }
$head[$h][0] = DOL_URL_ROOT."/fourn/product/photos.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/fourn/product/photos.php?id=".$product->id;
@ -342,7 +340,7 @@ else
print '<tr id="ways">'; print '<tr id="ways">';
print '<td colspan="3">'; print '<td colspan="3">';
$cat = new Categorie ($db); $cat = new Categorie ($db);
$way = $cat->print_primary_way($product->id," &gt; ",'fourn/product/liste.php'); $way = $cat->print_primary_way($product->id," &gt; ",'fourn/product/liste.php',"product");
if ($way == "") if ($way == "")
{ {
print "Ce produit n'appartient à aucune catégorie"; print "Ce produit n'appartient à aucune catégorie";

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -83,7 +84,7 @@ $sql .= ", s.nom";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if ($catid) if ($catid)
{ {
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
} }
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = pf.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = pf.fk_soc";
@ -115,7 +116,6 @@ else
} }
if($catid) if($catid)
{ {
$sql .= " AND cp.fk_product = p.rowid";
$sql .= " AND cp.fk_categorie = ".$catid; $sql .= " AND cp.fk_categorie = ".$catid;
} }