Ajout navigation next et preview sur l'onglet catégorie
This commit is contained in:
parent
a113a9674e
commit
94cb055eab
@ -654,6 +654,35 @@ class Categorie
|
|||||||
|
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query ($sql);
|
||||||
|
|
||||||
|
if ($res)
|
||||||
|
{
|
||||||
|
while ($cat = $this->db->fetch_array ($res))
|
||||||
|
{
|
||||||
|
$cats[] = new Categorie ($this->db, $cat['fk_categorie']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cats;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error ($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne les catégories contenant le produit $ref
|
||||||
|
*/
|
||||||
|
function containing_ref ($ref)
|
||||||
|
{
|
||||||
|
$cats = array ();
|
||||||
|
|
||||||
|
$sql = "SELECT c.fk_categorie, c.fk_product, p.rowid, p.label";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as c, ".MAIN_DB_PREFIX."product as p";
|
||||||
|
$sql.= " WHERE p.label = '".$ref."' AND c.fk_product = p.rowid";
|
||||||
|
|
||||||
|
$res = $this->db->query ($sql);
|
||||||
|
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
while ($cat = $this->db->fetch_array ($res))
|
while ($cat = $this->db->fetch_array ($res))
|
||||||
|
|||||||
@ -149,7 +149,15 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
|
|
||||||
|
if ($_GET["id"])
|
||||||
|
{
|
||||||
$cats = $c->containing($_REQUEST['id']);
|
$cats = $c->containing($_REQUEST['id']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cats = $c->containing_ref($_REQUEST['ref']);
|
||||||
|
}
|
||||||
|
|
||||||
if (sizeof($cats) > 0)
|
if (sizeof($cats) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user