Fix: modification sur les catégories
This commit is contained in:
parent
4bf1a619f2
commit
1e4b5426fa
@ -2,9 +2,9 @@
|
|||||||
/* 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>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -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= " >> ",$url)
|
function print_primary_way($id, $sep= " >> ", $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>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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
|
||||||
@ -281,18 +282,16 @@ else
|
|||||||
* Fiche produit
|
* Fiche produit
|
||||||
*/
|
*/
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
{
|
{
|
||||||
|
if ($_GET["action"] <> 're-edit')
|
||||||
if ($_GET["action"] <> 're-edit')
|
{
|
||||||
{
|
$product = new Product($db);
|
||||||
$product = new Product($db);
|
$result = $product->fetch($_GET["id"]);
|
||||||
$result = $product->fetch($_GET["id"]);
|
}
|
||||||
}
|
|
||||||
|
if ( $product->id > 0 )
|
||||||
if ( $product->id > 0 )
|
{
|
||||||
{
|
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
|
||||||
|
|
||||||
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* En mode visu
|
* En mode visu
|
||||||
@ -306,15 +305,14 @@ else
|
|||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if($product->isproduct())
|
if($product->isproduct())
|
||||||
{
|
{
|
||||||
if ($conf->stock->enabled)
|
if ($conf->stock->enabled)
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
|
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
|
||||||
$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;
|
||||||
$head[$h][1] = $langs->trans("Photos");
|
$head[$h][1] = $langs->trans("Photos");
|
||||||
@ -322,9 +320,9 @@ else
|
|||||||
|
|
||||||
//Affichage onglet Catégories
|
//Affichage onglet Catégories
|
||||||
if ($conf->categorie->enabled){
|
if ($conf->categorie->enabled){
|
||||||
$head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id;
|
$head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id;
|
||||||
$head[$h][1] = $langs->trans('Categories');
|
$head[$h][1] = $langs->trans('Categories');
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
|
$head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
|
||||||
@ -338,28 +336,28 @@ else
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
if ($conf->categorie->enabled)
|
if ($conf->categorie->enabled)
|
||||||
{
|
{
|
||||||
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," > ",'fourn/product/liste.php');
|
$way = $cat->print_primary_way($product->id," > ",'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";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Categorie")." : ";
|
print $langs->trans("Categorie")." : ";
|
||||||
print $way;
|
print $way;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td width="20%">'.$langs->trans("Ref").'</td><td width="40%">'.$product->ref.'</td>';
|
print '<td width="20%">'.$langs->trans("Ref").'</td><td width="40%">'.$product->ref.'</td>';
|
||||||
print '<td width="40%">';
|
print '<td width="40%">';
|
||||||
print $product->getLibStatut(2);
|
print $product->getLibStatut(2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td>';
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td>';
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user