Works on canvas capability
Works on custom list
This commit is contained in:
parent
fa1e2ffe83
commit
da5f951ff5
35
htdocs/install/mysql/tables/llx_c_field_list.sql
Normal file
35
htdocs/install/mysql/tables/llx_c_field_list.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
-- ========================================================================
|
||||||
|
-- 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.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- ========================================================================
|
||||||
|
|
||||||
|
create table llx_c_field_list
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
element varchar(64) NOT NULL, -- name of element list
|
||||||
|
entity integer DEFAULT 1 NOT NULL, -- entity id
|
||||||
|
name varchar(32) NOT NULL, -- name of field (ex: ref)
|
||||||
|
alias varchar(32) DEFAULT NULL, -- alias of field (ex: prodref)
|
||||||
|
title varchar(32) NOT NULL, -- title (translation) of field (ex: Ref)
|
||||||
|
align varchar(6) DEFAULT 'left', -- align (left,center,right)
|
||||||
|
search tinyint DEFAULT 0 NOT NULL, -- add search field
|
||||||
|
enabled varchar(255) DEFAULT 1, -- Condition to show or hide
|
||||||
|
rang integer DEFAULT 0
|
||||||
|
|
||||||
|
)type=innodb;
|
||||||
@ -39,13 +39,14 @@ class ProductDefault extends Product
|
|||||||
*/
|
*/
|
||||||
function ProductDefault($DB=0, $id=0, $user=0)
|
function ProductDefault($DB=0, $id=0, $user=0)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->id = $id ;
|
$this->id = $id ;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->module = "produit";
|
$this->module = "produit";
|
||||||
$this->canvas = "default";
|
$this->canvas = "default";
|
||||||
$this->name = "default";
|
$this->name = "default";
|
||||||
$this->description = "Canvas par défaut";
|
$this->list = "product_default";
|
||||||
|
$this->description = "Canvas par défaut";
|
||||||
|
|
||||||
$this->next_prev_filter = "canvas='default'";
|
$this->next_prev_filter = "canvas='default'";
|
||||||
}
|
}
|
||||||
@ -60,51 +61,46 @@ class ProductDefault extends Product
|
|||||||
*/
|
*/
|
||||||
function getFieldList()
|
function getFieldList()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$this->list_title = array();
|
$this->field_list = array();
|
||||||
|
|
||||||
$titlelist["name"] = 'ref';
|
$sql = "SELECT rowid, name, alias, title, align, search, enabled, rang";
|
||||||
$titlelist["title"] = $langs->trans("Ref");
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
|
||||||
$titlelist["sortfield"] = 'p.ref';
|
$sql.= " WHERE element = '".$this->list."'";
|
||||||
$titlelist["align"] = 'left';
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
array_push($this->list_title,$titlelist);
|
|
||||||
|
|
||||||
$titlelist["name"] = 'label';
|
$resql = $this->db->query($sql);
|
||||||
$titlelist["title"] = $langs->trans("Label");
|
if ($resql)
|
||||||
$titlelist["sortfield"] = 'p.label';
|
{
|
||||||
$titlelist["align"] = 'left';
|
$num = $this->db->num_rows($resql);
|
||||||
array_push($this->list_title,$titlelist);
|
|
||||||
|
|
||||||
$titlelist["name"] = 'barcode';
|
$i = 0;
|
||||||
$titlelist["title"] = $langs->trans("BarCode");
|
while ($i < $num)
|
||||||
$titlelist["sortfield"] = 'p.barcode';
|
{
|
||||||
$titlelist["align"] = 'center';
|
$fieldlist = array();
|
||||||
array_push($this->list_title,$titlelist);
|
|
||||||
|
|
||||||
$titlelist["name"] = 'datem';
|
$obj = $this->db->fetch_object($resql);
|
||||||
$titlelist["title"] = $langs->trans("DateModification");
|
|
||||||
$titlelist["sortfield"] = 'p.tms';
|
|
||||||
$titlelist["align"] = 'center';
|
|
||||||
array_push($this->list_title,$titlelist);
|
|
||||||
|
|
||||||
$titlelist["name"] = 'sellingprice';
|
$fieldlist["id"] = $obj->rowid;
|
||||||
$titlelist["title"] = $langs->trans("SellingPrice");
|
$fieldlist["name"] = $obj->name;
|
||||||
$titlelist["sortfield"] = 'p.price';
|
$fieldlist["alias"] = $obj->alias;
|
||||||
$titlelist["align"] = 'right';
|
$fieldlist["title"] = $obj->title;
|
||||||
array_push($this->list_title,$titlelist);
|
$fieldlist["align"] = $obj->align;
|
||||||
|
$fieldlist["search"] = $obj->search;
|
||||||
|
$fieldlist["enabled"] = $obj->enabled;
|
||||||
|
$fieldlist["order"] = $obj->rang;
|
||||||
|
|
||||||
$titlelist["name"] = 'stock';
|
array_push($this->field_list,$fieldlist);
|
||||||
$titlelist["title"] = $langs->trans("Stock");
|
|
||||||
$titlelist["sortfield"] = '';
|
|
||||||
$titlelist["align"] = 'right';
|
|
||||||
array_push($this->list_title,$titlelist);
|
|
||||||
|
|
||||||
$titlelist["name"] = 'status';
|
$i++;
|
||||||
$titlelist["title"] = $langs->trans("Status");
|
}
|
||||||
$titlelist["sortfield"] = 'p.envente';
|
$this->db->free($resql);
|
||||||
$titlelist["align"] = 'right';
|
}
|
||||||
array_push($this->list_title,$titlelist);
|
else
|
||||||
|
{
|
||||||
|
print $sql;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +165,6 @@ class ProductDefault extends Product
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$titlelist = array();
|
|
||||||
$datas = array();
|
$datas = array();
|
||||||
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|||||||
@ -73,7 +73,7 @@
|
|||||||
{strip}
|
{strip}
|
||||||
<tr class="{cycle values="pair,impair"}">
|
<tr class="{cycle values="pair,impair"}">
|
||||||
{foreach name=valueline key=key item=value from=$line}
|
{foreach name=valueline key=key item=value from=$line}
|
||||||
{foreach name=fieldline item=field from=$titlelist}
|
{foreach name=fieldline item=field from=$fieldlist}
|
||||||
{if $field.name == $key}
|
{if $field.name == $key}
|
||||||
<td align="{$field.align}">{$value}</td>
|
<td align="{$field.align}">{$value}</td>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@ -225,7 +225,7 @@ if ($resql)
|
|||||||
|
|
||||||
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
||||||
{
|
{
|
||||||
$smarty->assign('titlelist', $object->list_title);
|
$smarty->assign('fieldlist', $object->field_list);
|
||||||
$smarty->assign('datas', $object->list_datas);
|
$smarty->assign('datas', $object->list_datas);
|
||||||
$smarty->assign('url_root', $dolibarr_main_url_root);
|
$smarty->assign('url_root', $dolibarr_main_url_root);
|
||||||
$smarty->assign('theme', $conf->theme);
|
$smarty->assign('theme', $conf->theme);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user