Works on canvas capability
This commit is contained in:
parent
97b7207d4b
commit
9023ec01ff
@ -64,7 +64,7 @@ class ProductDefault extends Product
|
||||
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte';
|
||||
$sql.= ' 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";
|
||||
@ -76,23 +76,10 @@ class ProductDefault extends Product
|
||||
$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)
|
||||
{
|
||||
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
|
||||
}
|
||||
# if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (strlen($_GET["type"]) || strlen($_POST["type"]))
|
||||
{
|
||||
if ($type==1)
|
||||
{
|
||||
$sql.= " AND p.fk_product_type = '1'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " AND p.fk_product_type <> '1'";
|
||||
}
|
||||
}
|
||||
if ($sref) $sql.= " AND p.ref like '%".$sref."%'";
|
||||
if ($sbarcode) $sql.= " AND p.barcode like '%".$sbarcode."%'";
|
||||
if ($snom) $sql.= " AND p.label like '%".addslashes($snom)."%'";
|
||||
|
||||
0
htdocs/product/canvas/service/index.php
Normal file
0
htdocs/product/canvas/service/index.php
Normal file
143
htdocs/product/canvas/service/product.service.class.php
Normal file
143
htdocs/product/canvas/service/product.service.class.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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/product/canvas/service/product.service.class.php
|
||||
* \ingroup service
|
||||
* \brief Fichier de la classe des services par defaut
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class ProductService
|
||||
* \brief Classe permettant la gestion services par defaut, cette classe surcharge la classe produit
|
||||
*/
|
||||
class ProductService extends Product
|
||||
{
|
||||
//! Numero d'erreur Plage 1280-1535
|
||||
var $errno = 0;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param id Id service (0 par defaut)
|
||||
*/
|
||||
function ProductService($DB=0, $id=0, $user=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
$this->user = $user;
|
||||
$this->module = "service";
|
||||
$this->canvas = "service";
|
||||
$this->name = "service";
|
||||
$this->description = "Canvas des services";
|
||||
|
||||
$this->next_prev_filter = "canvas='service'";
|
||||
}
|
||||
|
||||
function GetListeTitre()
|
||||
{
|
||||
return 'Services';
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fetch datas list
|
||||
*/
|
||||
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
|
||||
$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->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
|
||||
}
|
||||
if ($sref) $sql.= " AND p.ref like '%".$sref."%'";
|
||||
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 = ".addslashes($_GET["envente"]);
|
||||
}
|
||||
if (isset($_GET["canvas"]) && strlen($_GET["canvas"]) > 0)
|
||||
{
|
||||
$sql.= " AND p.canvas = '".addslashes($_GET["canvas"])."'";
|
||||
}
|
||||
if($catid)
|
||||
{
|
||||
$sql.= " AND cp.fk_categorie = ".$catid;
|
||||
}
|
||||
if ($fourn_id > 0)
|
||||
{
|
||||
$sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||
}
|
||||
// Insert categ filter
|
||||
if ($search_categ)
|
||||
{
|
||||
$sql .= " AND cp.fk_categorie = ".addslashes($search_categ);
|
||||
}
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$sql.= $this->db->plimit($limit + 1 ,$offset);
|
||||
|
||||
$this->list_datas = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$datas = array();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$datas["id"] = $obj->rowid;
|
||||
$datas["ref"] = $obj->ref;
|
||||
$datas["label"] = $obj->label;
|
||||
$datas["barcode"] = $obj->barcode;
|
||||
$datas["statut"] = $obj->statut;
|
||||
|
||||
array_push($this->list_datas,$datas);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
0
htdocs/product/canvas/service/templates/index.php
Normal file
0
htdocs/product/canvas/service/templates/index.php
Normal file
102
htdocs/product/canvas/service/templates/liste.tpl
Normal file
102
htdocs/product/canvas/service/templates/liste.tpl
Normal file
@ -0,0 +1,102 @@
|
||||
{* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*}
|
||||
|
||||
<!-- BEGIN SMARTY TEMPLATE -->
|
||||
|
||||
<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;">
|
||||
<tr>
|
||||
<td class="nobordernopadding" width="40" align="left" valign="middle">
|
||||
{$title_picto}
|
||||
</td>
|
||||
<td class="nobordernopadding" valign="middle">
|
||||
<div class="titre">{$title_text}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form action="liste.php?canvas=default" method="post" name="formulaire">
|
||||
|
||||
<table class="liste" width="100%">
|
||||
<tr class="liste_titre">
|
||||
|
||||
<td class="liste_titre">Référence
|
||||
<a href="liste.php?sortfield=p.ref&sortorder=asc&begin=&envente=&canvas=service&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
|
||||
</a>
|
||||
<a href="liste.php?sortfield=p.ref&sortorder=desc&begin=&envente=&canvas=service&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="liste_titre">Libellé
|
||||
<a href="liste.php?sortfield=p.label&sortorder=asc&canvas=service&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
|
||||
</a>
|
||||
<a href="liste.php?sortfield=p.ref&sortorder=desc&begin=&envente=&canvas=service&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="liste_titre">Code barre
|
||||
<a href="liste.php?sortfield=p.label&sortorder=asc&canvas=service&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
|
||||
</a>
|
||||
<a href="liste.php?sortfield=p.ref&sortorder=desc&begin=&envente=&canvas=service&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="liste_titre" align="center">Date de modification</td>
|
||||
<td class="liste_titre" align="right">Durée</td>
|
||||
<td class="liste_titre" align="right">Prix de vente</td>
|
||||
<td class="liste_titre" align="right">Etat</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr class="liste_titre">
|
||||
<td class="liste_titre"><input class="flat" type="text" name="sref" value=""></td>
|
||||
<td class="liste_titre"><input class="flat" type="text" name="snom" value=""></td>
|
||||
<td class="liste_titre"><input class="flat" type="text" name="sbarcode" value=""></td>
|
||||
<td class="liste_titre"> </td>
|
||||
<td class="liste_titre"> </td>
|
||||
<td class="liste_titre"> </td>
|
||||
<td class="liste_titre" align="right">
|
||||
<input type="image" class="liste_titre" name="button_search" src="{$url_root}/theme/{$theme}/img/search.png" alt="Rechercher">
|
||||
<input type="image" class="liste_titre" name="button_removefilter" src="{$url_root}/theme/{$theme}/img/searchclear.png" alt="Supprimer filtre">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{section name=mysec loop=$datas}
|
||||
{strip}
|
||||
<tr class="{cycle values="pair,impair"}">
|
||||
<td><a href="fiche.php?id={$datas[mysec].id}">{$datas[mysec].ref}</a></td>
|
||||
<td>{$datas[mysec].label}</td>
|
||||
<td align="center">{$datas[mysec].barcode}</td>
|
||||
<td align="center">{$datas[mysec].datem}</td>
|
||||
<td align="right">{$datas[mysec].duration}</td>
|
||||
<td align="right">{$datas[mysec].sellingprice}</td>
|
||||
<td align="right">{$datas[mysec].status}</td>
|
||||
</tr>
|
||||
{/strip}
|
||||
{/section}
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!-- END SMARTY TEMPLATE -->
|
||||
Loading…
Reference in New Issue
Block a user