/[dolibarr]/dolibarr/htdocs/product/liste.php
ViewVC logotype

Diff of /dolibarr/htdocs/product/liste.php

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

revision 1.32 by eldy, Mon Aug 15 16:25:33 2005 UTC revision 1.33 by eldy, Wed Aug 24 21:06:25 2005 UTC
# Line 18  Line 18 
18   *   *
19   * $Id$   * $Id$
20   * $Source$   * $Source$
  *  
21   */   */
22    
23  /**  /**
# Line 40  if (!$user->rights->produit->lire) Line 39  if (!$user->rights->produit->lire)
39    
40  $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];  $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
41  $snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];  $snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
42    $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
43    
44  $type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];  $type=isset($_GET["type"])?$_GET["type"]:$_POST["type"];
45    
46  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
47  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
48    if (! $sortfield) $sortfield="p.ref";
49    if (! $sortorder) $sortorder="DESC";
50  $page = $_GET["page"];  $page = $_GET["page"];
   
51  $limit = $conf->liste_limit;  $limit = $conf->liste_limit;
52  $offset = $limit * $page ;  $offset = $limit * $page ;
     
 if (! $sortfield) $sortfield="p.ref";  
 if (! $sortorder) $sortorder="DESC";  
53    
54  if (isset($_POST["button_removefilter_x"])) {  if (isset($_POST["button_removefilter_x"]))
55    {
56      $sref="";      $sref="";
57      $snom="";      $snom="";
58  }  }
59    
60    
61  /*  /*
62   * Mode Liste   * Mode Liste
63   *   *
# Line 70  $sql.= ' FROM '.MAIN_DB_PREFIX.'product Line 70  $sql.= ' FROM '.MAIN_DB_PREFIX.'product
70    
71  if ($_GET["fourn_id"] > 0)  if ($_GET["fourn_id"] > 0)
72  {  {
73    $fourn_id = $_GET["fourn_id"];      $fourn_id = $_GET["fourn_id"];
74    $sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";      $sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
75  }  }
76    $sql .= " WHERE 1=1";
77  if ($_POST["mode"] == 'search')  if ($sall)
78    {
79        $sql .= " AND (p.label like '%".$sall."%' OR p.description like '%".$sall."%' OR p.note like '%".$sall."%')";
80    }
81    if (strlen($_GET["type"]) || strlen($_POST["type"]))
82    {
83        $sql .= " AND p.fk_product_type = ".(strlen($_GET["type"])?$_GET["type"]:$_POST["type"]);
84    }
85    if ($sref)
86  {  {
87    $sql .= " WHERE p.ref like '%".$_POST["sall"]."%'";      $sql .= " AND p.ref like '%".$sref."%'";
88    $sql .= " OR p.label like '%".$_POST["sall"]."%'";  }
89    if ($snom)
90    {
91        $sql .= " AND p.label like '%".$snom."%'";
92    }
93    if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
94    {
95        $sql .= " AND p.envente = ".$_GET["envente"];
96  }  }
97  else  else
98  {  {
99    $sql .= " WHERE 1=1";      if ($fourn_id == 0)
   if (strlen($_GET["type"]) || strlen($_POST["type"]))  
     {  
       $sql .= " AND p.fk_product_type = ".(strlen($_GET["type"])?$_GET["type"]:$_POST["type"]);  
     }  
   if ($sref)  
     {  
       $sql .= " AND p.ref like '%".$sref."%'";  
     }  
   if ($snom)  
     {  
       $sql .= " AND p.label like '%".$snom."%'";  
     }  
   if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)  
     {  
       $sql .= " AND p.envente = ".$_GET["envente"];  
     }  
   else  
100      {      {
101        if ($fourn_id == 0)          $sql .= " AND p.envente = 1";
         {  
           $sql .= " AND p.envente = 1";  
         }  
102      }      }
103  }  }
104    

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

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