New: Can filter on categories for third parties list
This commit is contained in:
parent
f1216bfe4c
commit
353a63390a
@ -25,7 +25,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
require_once("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/prospect.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
|
||||
|
||||
$langs->load("propal");
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/prospect/pre.inc.php
|
||||
\ingroup commercial
|
||||
\brief Fichier de gestion du menu gauche de l'espace commercial
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
|
||||
function llxHeader($head = "", $urlp = "")
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("commercial");
|
||||
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/comm/prospect/", $langs->trans("Prospection"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/soc.php?action=create&type=p", $langs->trans("MenuNewProspect"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php", $langs->trans("List"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=0", $langs->trans("LastProspectNeverContacted"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=1", $langs->trans("LastProspectToContact"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=2", $langs->trans("LastProspectContactInProcess"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3", $langs->trans("LastProspectContactDone"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/contact.php?type=p", $langs->trans("Contacts"));
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/comm/action/index.php", $langs->trans("Actions"));
|
||||
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
{
|
||||
$langs->load("propal");
|
||||
$menu->add(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop"));
|
||||
}
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/comm/clients.php", $langs->trans("Customers"));
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
?>
|
||||
@ -25,7 +25,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/prospect.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
|
||||
if ($conf->categorie->enabled) require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
|
||||
|
||||
$langs->load("products");
|
||||
@ -55,6 +56,10 @@ if ($type=='0') $result=restrictedArea($user,'produit',$id,'product','','',$fiel
|
||||
else if ($type=='1') $result=restrictedArea($user,'service',$id,'service','','',$fieldid);
|
||||
else $result=restrictedArea($user,'produit|service',$id,'service','','',$fieldid);
|
||||
|
||||
// Load sale and categ filters
|
||||
$search_sale = isset($_GET["search_sale"])?$_GET["search_sale"]:$_POST["search_sale"];
|
||||
$search_categ = isset($_GET["search_categ"])?$_GET["search_categ"]:$_POST["search_categ"];
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -79,6 +84,8 @@ if ($conf->categorie->enabled && isset($_REQUEST['catid']))
|
||||
* View
|
||||
*/
|
||||
|
||||
$htmlother=new FormOther($db);
|
||||
|
||||
if ($_GET["canvas"] <> '' && file_exists('templates/product.'.$_GET["canvas"].'.class.php') )
|
||||
{
|
||||
$class = 'Product'.ucfirst($_GET["canvas"]);
|
||||
@ -104,13 +111,15 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
if ($_GET["fourn_id"] > 0)
|
||||
{
|
||||
$fourn_id = $_GET["fourn_id"];
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
||||
}
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||
if ($sall)
|
||||
@ -131,11 +140,11 @@ if ($sbarcode) $sql.= " AND p.barcode like '%".$sbarcode."%'";
|
||||
if ($snom) $sql.= " AND p.label like '%".addslashes($snom)."%'";
|
||||
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
|
||||
{
|
||||
$sql.= " AND p.envente = ".$_GET["envente"];
|
||||
$sql.= " AND p.envente = ".addslashes($_GET["envente"]);
|
||||
}
|
||||
if (isset($_GET["canvas"]) && strlen($_GET["canvas"]) > 0)
|
||||
{
|
||||
$sql.= " AND p.canvas = '".$_GET["canvas"]."'";
|
||||
$sql.= " AND p.canvas = '".addslashes($_GET["canvas"])."'";
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
@ -145,7 +154,12 @@ if ($fourn_id > 0)
|
||||
{
|
||||
$sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||
}
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
// Insert categ filter
|
||||
if ($search_categ)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".addslashes($search_categ);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||
$resql = $db->query($sql) ;
|
||||
|
||||
@ -241,6 +255,22 @@ if ($resql)
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="9">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Lignes des titres
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"liste.php", "p.ref",$param,"","",$sortfield,$sortorder);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user