/[dolibarr]/dolibarr/htdocs/fourn/product/pre.inc.php
ViewVC logotype

Diff of /dolibarr/htdocs/fourn/product/pre.inc.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by hregis, Sat Jul 9 11:40:19 2005 UTC revision 1.7 by eldy, Sun Sep 11 17:30:48 2005 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3   * Copyright (C) 2004      Laurent Destailleur  <eldy@users.sourceforge.net>   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
4   *   *
5   * This program is free software; you can redistribute it and/or modify   * 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   * it under the terms of the GNU General Public License as published by
# Line 18  Line 18 
18   *   *
19   * $Id$   * $Id$
20   * $Source$   * $Source$
  *  
21   */   */
22    
23  /*!  /**
24    \file       htdocs/product/pre.inc.php          \file       htdocs/fourn/product/pre.inc.php
25    \ingroup    product,service          \ingroup    product,service
26    \brief      Fichier gestionnaire du menu gauche des produits et services          \brief      Fichier gestionnaire du menu gauche des produits et services fournisseurs
27    \version    $Revision$          \version    $Revision$
28  */  */
29    
30  require("../../main.inc.php");  require("../../main.inc.php");
31  require_once DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php";  require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php");
32  require_once DOL_DOCUMENT_ROOT."/categories/categorie.class.php";  require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
33    
34  $langs->load("suppliers");  $langs->load("suppliers");
35  $langs->load("products");  $langs->load("products");
36    
37  $user->getrights("produit");  $user->getrights("produit");
38    
39    
40  function llxHeader($head = "", $title="", $help_url='',$addons='')  function llxHeader($head = "", $title="", $help_url='',$addons='')
41  {  {
42    global $db, $user, $conf, $langs;      global $db, $user, $conf, $langs;
43    
     
   top_menu($head, $title);  
44    
45    $menu = new Menu();      top_menu($head, $title);
46    
47    if (is_array($addons))      $menu = new Menu();
48    
49        if (is_array($addons))
50      {      {
51        //$menu->add($url, $libelle);          //$menu->add($url, $libelle);
52        $menu->add($addons[0][0], $addons[0][1]);          $menu->add($addons[0][0], $addons[0][1]);
53      }      }
54    
55    if ($conf->produit->enabled)      if ($conf->produit->enabled)
56    {      {
57      $menu->add(DOL_URL_ROOT."/fourn/product/", $langs->trans("Products"));          $menu->add(DOL_URL_ROOT."/fourn/product/", $langs->trans("Products"));
58      $menu->add_submenu(DOL_URL_ROOT."/fourn/product/liste.php?type=0", $langs->trans("List"));          $menu->add_submenu(DOL_URL_ROOT."/fourn/product/liste.php?type=0", $langs->trans("List"));
   
     if ($user->societe_id == 0 && $user->rights->produit->creer)  
       {  
         if ($conf->categorie->enabled)  
         {  
                   $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&amp;type=0&amp;catid=".$_REQUEST['catid'], $langs->trans("NewProduct"));  
         }  
         else  
         {  
                 $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&amp;type=0", $langs->trans("NewProduct"));  
         }                
       }  
   }  
   
   if ($conf->categorie->enabled)  
   {  
     $menu->add(DOL_URL_ROOT."/categories/", $langs->trans("Categories"));  
   }  
59    
60    $menu->add('liste.php','Top');          if ($user->societe_id == 0 && $user->rights->produit->creer)
61            {
62                if ($conf->categorie->enabled)
63                {
64                    $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&amp;type=0&amp;catid=".$_REQUEST['catid'], $langs->trans("NewProduct"));
65                }
66                else
67                {
68                    $menu->add_submenu(DOL_URL_ROOT."/fourn/product/fiche.php?action=create&amp;type=0", $langs->trans("NewProduct"));
69                }
70            }
71        }
72    
73    if (isset($_REQUEST['catid']))      if ($conf->categorie->enabled)
74      {      {
75        $catid = $_REQUEST['catid'];          $menu->add(DOL_URL_ROOT."/categories/", $langs->trans("Categories"));
76        }
77    
78        $menu->add('liste.php','Top');
79    
80        $c = new Categorie ($db, $catid);      if (isset($_REQUEST['catid']) && $_REQUEST['catid'] != '')
81            {
82        $menu->add('liste.php?catid='.$c->id, $c->label);          $catid = $_REQUEST['catid'];
83    
84        $cats = $c->get_filles();          $c = new Categorie ($db, $catid);
85      
86        if (sizeof ($cats) > 0)          $menu->add('liste.php?catid='.$c->id, $c->label);
87          {  
88            foreach ($cats as $cat)          $cats = $c->get_filles();
89              {  
90                $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);          if (sizeof ($cats) > 0)
91              }          {
92          }              foreach ($cats as $cat)
93                {
94                    $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);
95                }
96            }
97      }      }
98    else      else
99      {      {
100        $c = new Categorie ($db);          $c = new Categorie ($db);
101        $cats = $c->get_main_categories();          $cats = $c->get_main_categories();
102    
103        if (sizeof ($cats) > 0)          if (sizeof ($cats) > 0)
104          {          {
105            foreach ($cats as $cat)              foreach ($cats as $cat)
106              {              {
107                $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);                  $menu->add_submenu('liste.php?catid='.$cat->id, $cat->label);
108              }              }
109          }          }
110      }      }
111    
112    left_menu($menu->liste, $help_url);      left_menu($menu->liste, $help_url);
113  }  }
114    
115  ?>  ?>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26