Merge branch '8.0_canvas' of https://github.com/hregis/dolibarr into

hregis-8.0_canvas

# Conflicts:
#	htdocs/product/canvas/product/tpl/list.tpl.php
This commit is contained in:
Laurent Destailleur 2018-06-30 18:29:08 +02:00
commit d8c7c61951
16 changed files with 497 additions and 742 deletions

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -145,7 +145,7 @@ class Canvas
{
if (empty($this->template_dir)) return 0;
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
else return 0;
}
@ -161,7 +161,7 @@ class Canvas
global $db, $conf, $langs, $user, $canvas;
global $form, $formfile;
include $this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
include $this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
}

View File

@ -174,11 +174,10 @@ function dol_verifyHash($chain, $hash, $type='0')
* @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param Canvas $objcanvas Object canvas
* @return int Always 1, die process if not allowed
* @see dol_check_secure_access_document
*/
function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
{
global $db, $conf;
global $hookmanager;

View File

@ -35,3 +35,5 @@ ALTER TABLE llx_extrafields ADD COLUMN help text NULL;
ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment;
ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search;

View File

@ -1,5 +1,5 @@
-- ========================================================================
-- Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
--
-- 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
@ -33,6 +33,7 @@ create table llx_c_field_list
align varchar(6) DEFAULT 'left', -- align (left,center,right)
sort tinyint DEFAULT 1 NOT NULL, -- add sort field
search tinyint DEFAULT 0 NOT NULL, -- add search field
visible tinyint DEFAULT 1 NOT NULL, -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only
enabled varchar(255) DEFAULT 1, -- Condition to show or hide
rang integer DEFAULT 0

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -123,20 +123,6 @@ class ActionsCardProduct
$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
}
if ($action == 'create' || $action == 'edit')
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);
//To Buy
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view')
{
$head = product_prepare_head($this->object);
@ -180,10 +166,13 @@ class ActionsCardProduct
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$_POST["statut"]);
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->object->status);
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$this->object->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
// Finished
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
@ -208,10 +197,6 @@ class ActionsCardProduct
if ($action == 'view')
{
// Status
$this->tpl['status'] = $this->object->getLibStatut(2,0);
$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);
// Photo
$this->tpl['nblignes'] = 4;
if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity]))
@ -268,7 +253,7 @@ class ActionsCardProduct
$this->field_list = array();
$sql = "SELECT rowid, name, alias, title, align, sort, search, enabled, rang";
$sql = "SELECT rowid, name, alias, title, align, sort, search, visible, enabled, rang";
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
$sql.= " WHERE element = '".$this->db->escape($this->fieldListName)."'";
$sql.= " AND entity = ".$conf->entity;
@ -293,6 +278,7 @@ class ActionsCardProduct
$fieldlist["align"] = $obj->align;
$fieldlist["sort"] = $obj->sort;
$fieldlist["search"] = $obj->search;
$fieldlist["visible"] = $obj->visible;
$fieldlist["enabled"] = verifCond($obj->enabled);
$fieldlist["order"] = $obj->rang;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -30,7 +30,10 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<!-- BEGIN PHP TEMPLATE -->
<?php print load_fiche_titre($langs->trans("Product")); ?>
<?php
print load_fiche_titre($langs->trans("NewProduct"),'','title_products.png');
dol_fiche_head('');
?>
<?php dol_htmloutput_errors((is_numeric($object->error)?'':$object->error),$object->errors); ?>
@ -65,7 +68,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<?php if (! empty($conf->stock->enabled)) { ?>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -31,7 +31,9 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<!-- BEGIN PHP TEMPLATE -->
<?php
print load_fiche_titre($langs->trans("Product"));
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
dol_fiche_head($head, 'card', $titre, 0, 'product');
dol_htmloutput_errors($object->error,$object->errors);
?>
@ -65,7 +67,7 @@ dol_htmloutput_errors($object->error,$object->errors);
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<?php if (! empty($conf->stock->enabled)) { ?>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -27,7 +27,20 @@ $object=$GLOBALS['object'];
?>
<!-- BEGIN PHP TEMPLATE -->
<?php echo $langs->trans("Product"); ?>
<?php
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
dol_fiche_head($head, 'card', $titre, -1, 'product');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
?>
<?php dol_htmloutput_errors($object->error,$object->errors); ?>
@ -50,16 +63,6 @@ $object=$GLOBALS['object'];
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
<td><?php echo $object->status; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $object->status_buy; ?></td>
</tr>
<tr>
<td class="tdtop"><?php echo $langs->trans("Description"); ?></td>
<td colspan="2"><?php echo $object->description; ?></td>

View File

@ -1,107 +0,0 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?>
<!-- BEGIN PHP TEMPLATE -->
<table class="notopnoleftnoright allwidth" style="margin-bottom: 2px;">
<tr>
<td class="nobordernopadding" width="40" align="left" valign="middle">
<?php echo $title_picto; ?>
</td>
<td class="nobordernopadding" valign="middle">
<div class="titre"><?php echo $title_text; ?></div>
</td>
</tr>
</table>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="formulaire">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="list">
<input type="hidden" name="sortfield" value="<?php echo $sortfield; ?>">
<input type="hidden" name="sortorder" value="<?php echo $sortorder; ?>">
<input type="hidden" name="canvas" value="default">
<input type="hidden" name="type" value="0">
<table class="liste allwidth">
<!-- FIELDS TITLE -->
<tr class="liste_titre">
<?php
foreach($fieldlist as $field) {
if ($field['enabled']) {
if ($field['sort']) { ?>
<td class="liste_titre" align="<?php echo $field['align']; ?>"><?php echo $field['title']; ?>
<a href="<?php echo $_SERVER["PHP_SELF"];?>?sortfield=<?php echo $field['name']; ?>&amp;sortorder=asc&amp;begin=&amp;tosell=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="<?php echo $_SERVER["PHP_SELF"];?>?sortfield=<?php echo $field['name']; ?>&amp;sortorder=desc&amp;begin=&amp;tosell=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<?php } else { ?>
<td class="liste_titre" align="<?php echo $field['align']; ?>"><?php echo $field['title']; ?></td>
<?php } } } ?>
</tr>
<!-- FIELDS SEARCH -->
<tr class="liste_titre">
<?php
$num = count($fieldlist);
foreach($fieldlist as $key => $searchfield) {
if ($searchfield['enabled']) {
if ($searchfield['search']) { ?>
<td class="liste_titre" align="<?php echo $searchfield['align']; ?>"><input class="flat" type="text" name="s<?php echo $searchfield['alias']; ?>" value=""></td>
<?php } else if ($key == $num) {
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
} else { ?>
<td class="liste_titre">&nbsp;</td>
<?php } } } ?>
</tr>
<!-- FIELDS DATA -->
<?php
foreach($datas as $line) {
?>
<tr class="oddeven">
<?php
foreach($line as $key => $value) {
foreach($fieldlist as $field) {
if ($field['alias'] == $key) { ?>
<td align="<?php echo $field['align']; ?>"><?php echo $value; ?></td>
<?php } } } ?>
</tr>
<?php } ?>
</table>
</form>
<!-- END PHP TEMPLATE -->

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -122,20 +122,6 @@ class ActionsCardService
$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
}
if ($action == 'create' || $action == 'edit')
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);
//To Buy
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view')
{
$head = product_prepare_head($this->object);
@ -182,10 +168,13 @@ class ActionsCardService
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$_POST["statut"]);
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->object->status);
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
$this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$this->object->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
// Duration unit
// TODO creer fonction
@ -203,10 +192,6 @@ class ActionsCardService
if ($action == 'view')
{
// Status
$this->tpl['status'] = $this->object->getLibStatut(2,0);
$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);
// Photo
$this->tpl['nblignes'] = 4;
if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity]))
@ -247,7 +232,7 @@ class ActionsCardService
$this->field_list = array();
$sql = "SELECT rowid, name, alias, title, align, sort, search, enabled, rang";
$sql = "SELECT rowid, name, alias, title, align, sort, search, visible, enabled, rang";
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
$sql.= " WHERE element = '".$this->db->escape($this->fieldListName)."'";
$sql.= " AND entity = ".$conf->entity;
@ -272,6 +257,7 @@ class ActionsCardService
$fieldlist["align"] = $obj->align;
$fieldlist["sort"] = $obj->sort;
$fieldlist["search"] = $obj->search;
$fieldlist["visible"] = $obj->visible;
$fieldlist["enabled"] = verifCond($obj->enabled);
$fieldlist["order"] = $obj->rang;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -30,7 +30,10 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<!-- BEGIN PHP TEMPLATE CREATE.TPL -->
<?php print load_fiche_titre($langs->trans("Service")); ?>
<?php
print load_fiche_titre($langs->trans("NewService"),'','title_products.png');
dol_fiche_head('');
?>
<?php dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); ?>
@ -62,7 +65,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<tr><td><?php echo $langs->trans("Duration"); ?></td>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -31,7 +31,9 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<!-- BEGIN PHP TEMPLATE EDIT.TPL -->
<?php
print load_fiche_titre($langs->trans("Service"));
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
dol_fiche_head($head, 'card', $titre, 0, 'service');
dol_htmloutput_errors($object->error,$object->errors);
?>
@ -62,7 +64,7 @@ dol_htmloutput_errors($object->error,$object->errors);
<tr>
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_tobuy); ?></td>
<td><?php echo $form->selectarray('statut_buy',$statutarray,$object->status_buy); ?></td>
</tr>
<tr><td><?php echo $langs->trans("Duration"); ?></td>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -27,7 +27,20 @@ $object=$GLOBALS['object'];
?>
<!-- BEGIN PHP TEMPLATE VIEW.TPL -->
<?php echo $langs->trans("Service"); ?>
<?php
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
dol_fiche_head($head, 'card', $titre, -1, 'service');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
?>
<?php dol_htmloutput_errors($object->error,$object->errors); ?>
@ -50,16 +63,6 @@ $object=$GLOBALS['object'];
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
<td><?php echo $object->status; ?></td>
</tr>
<tr>
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
<td><?php echo $object->status_buy; ?></td>
</tr>
<tr>
<td class="tdtop"><?php echo $langs->trans("Description"); ?></td>
<td colspan="2"><?php echo $object->description; ?></td>

View File

@ -1,107 +0,0 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?>
<!-- BEGIN PHP TEMPLATE -->
<table class="notopnoleftnoright allwidth" style="margin-bottom: 2px;">
<tr>
<td class="nobordernopadding" width="40" align="left" valign="middle">
<?php echo $title_picto; ?>
</td>
<td class="nobordernopadding" valign="middle">
<div class="titre"><?php echo $title_text; ?></div>
</td>
</tr>
</table>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="formulaire">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
<input type="hidden" name="action" value="list">
<input type="hidden" name="sortfield" value="<?php echo $sortfield; ?>">
<input type="hidden" name="sortorder" value="<?php echo $sortorder; ?>">
<input type="hidden" name="canvas" value="service">
<input type="hidden" name="type" value="1">
<table class="liste allwidth">
<!-- FIELDS TITLE -->
<tr class="liste_titre">
<?php
foreach($fieldlist as $field) {
if ($field['enabled']) {
if ($field['sort']) { ?>
<td class="liste_titre" align="<?php echo $field['align']; ?>"><?php echo $field['title']; ?>
<a href="<?php echo $_SERVER["PHP_SELF"];?>?sortfield=<?php echo $field['name']; ?>&amp;sortorder=asc&amp;begin=&amp;tosell=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="<?php echo $_SERVER["PHP_SELF"];?>?sortfield=<?php echo $field['name']; ?>&amp;sortorder=desc&amp;begin=&amp;tosell=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<?php } else { ?>
<td class="liste_titre" align="<?php echo $field['align']; ?>"><?php echo $field['title']; ?></td>
<?php } } } ?>
</tr>
<!-- FIELDS SEARCH -->
<tr class="liste_titre">
<?php
$num = count($fieldlist);
foreach($fieldlist as $key => $searchfield) {
if ($searchfield['enabled']) {
if ($searchfield['search']) { ?>
<td class="liste_titre" align="<?php echo $searchfield['align']; ?>"><input class="flat" type="text" name="s<?php echo $searchfield['alias']; ?>" value=""></td>
<?php } else if ($key == $num) {
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
} else { ?>
<td class="liste_titre">&nbsp;</td>
<?php } } } ?>
</tr>
<!-- FIELDS DATA -->
<?php
foreach($datas as $line) {
?>
<tr class="oddeven">
<?php
foreach($line as $key => $value) {
foreach($fieldlist as $field) {
if ($field['alias'] == $key) { ?>
<td align="<?php echo $field['align']; ?>"><?php echo $value; ?></td>
<?php } } } ?>
</tr>
<?php } ?>
</table>
</form>
<!-- END PHP TEMPLATE -->

View File

@ -112,7 +112,7 @@ if (! empty($canvas))
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($id) ? 'rowid' : 'ref');
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype,$objcanvas);
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productcard','globalcard'));

View File

@ -450,530 +450,509 @@ if ($resql)
print "</div><br>";
}
if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php'))
if ($sall)
{
$fieldlist = $object->field_list;
$datas = $object->list_datas;
$picto='title.png';
$title_picto = img_picto('',$picto);
$title_text = $title;
// Default templates directory
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/';
// Check if a custom template is present
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php'))
{
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/';
}
include $template_dir.'list.tpl.php'; // Include native PHP templates
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
else
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))
{
if ($sall)
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
//Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && $search_type === 0) {
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= '<input type="checkbox" id="search_hidechildproducts" name="search_hidechildproducts" value="on"'.($search_hidechildproducts ? 'checked="checked"' : '').'>';
$moreforfilter.= ' <label for="search_hidechildproducts">'.$langs->trans('HideChildProducts').'</label>';
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint;
else $moreforfilter=$hookmanager->resPrint;
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Lines with input filters
print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['p.ref']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
if (! empty($arrayfields['pfp.ref_fourn']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref_supplier" size="8" value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
}
if (! empty($arrayfields['p.label']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
print '</td>';
}
// Type
if (! empty($arrayfields['p.fk_product_type']['checked']))
{
print '<td class="liste_titre" align="left">';
$array=array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
print $form->selectarray('search_type', $array, $search_type);
print '</td>';
}
// Barcode
if (! empty($arrayfields['p.barcode']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">';
print '</td>';
}
// Duration
if (! empty($arrayfields['p.duration']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
// Sell price
if (! empty($arrayfields['p.sellprice']['checked']))
{
print '<td class="liste_titre" align="right">';
print '</td>';
}
// Minimum buying Price
if (! empty($arrayfields['p.minbuyprice']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
// Number buying Price
if (! empty($arrayfields['p.numbuyprice']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
// WAP
if (! empty($arrayfields['p.pmp']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
// Limit for alert
if (! empty($arrayfields['p.seuil_stock_alerte']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
// Desired stock
if (! empty($arrayfields['p.desiredstock']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
// Stock
if (! empty($arrayfields['p.stock']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
// Stock
if (! empty($arrayfields['stock_virtual']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
// To batch
if (! empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno($search_tobatch, '', '', '', 1).'</td>';
// Accountancy code sell
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_sell" size="6" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
// Accountancy code sell
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_buy" size="6" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['p.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['p.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
if (! empty($arrayfields['p.tosell']['checked']))
{
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1);
print '</td >';
}
if (! empty($arrayfields['p.tobuy']['checked']))
{
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1);
print '</td>';
}
print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$product_static=new Product($db);
$product_fourn =new ProductFournisseur($db);
$i = 0;
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
$sql = "SELECT label";
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql.= " WHERE fk_product=".$obj->rowid;
$sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'";
$sql.= " LIMIT 1";
$result = $db->query($sql);
if ($result)
{
$objtp = $db->fetch_object($result);
if (! empty($objtp->label)) $obj->label = $objtp->label;
}
}
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))
$product_static->id = $obj->rowid;
$product_static->ref = $obj->ref;
$product_static->ref_fourn = $obj->ref_supplier;
$product_static->label = $obj->label;
$product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy;
$product_static->status = $obj->tosell;
$product_static->status_batch = $obj->tobatch;
$product_static->entity = $obj->entity;
$product_static->pmp = $obj->pmp;
$product_static->accountancy_code_sell = $obj->accountancy_code_sell;
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$product_static->accountancy_code_buy = $obj->accountancy_code_buy;
if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service
{
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
}
}
//Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && $search_type === 0) {
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= '<input type="checkbox" id="search_hidechildproducts" name="search_hidechildproducts" value="on"'.($search_hidechildproducts ? 'checked="checked"' : '').'>';
$moreforfilter.= ' <label for="search_hidechildproducts">'.$langs->trans('HideChildProducts').'</label>';
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint;
else $moreforfilter=$hookmanager->resPrint;
print '<tr class="oddeven">';
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Lines with input filters
print '<tr class="liste_titre_filter">';
// Ref
if (! empty($arrayfields['p.ref']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
print '<td class="tdoverflowmax200">';
print $product_static->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Ref supplier
if (! empty($arrayfields['pfp.ref_fourn']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref_supplier" size="8" value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td class="tdoverflowmax200">';
print $product_static->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Label
if (! empty($arrayfields['p.label']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
print '</td>';
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label,40).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type
if (! empty($arrayfields['p.fk_product_type']['checked']))
{
print '<td class="liste_titre" align="left">';
$array=array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
print $form->selectarray('search_type', $array, $search_type);
print '</td>';
print '<td>'.$obj->fk_product_type.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Barcode
if (! empty($arrayfields['p.barcode']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">';
print '</td>';
print '<td>'.$obj->barcode.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Duration
if (! empty($arrayfields['p.duration']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '<td align="center">';
if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration))
{
if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
//elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
else print $obj->duration;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Sell price
if (! empty($arrayfields['p.sellprice']['checked']))
{
print '<td class="liste_titre" align="right">';
print '<td align="right">';
if ($obj->tosell)
{
if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC");
else print price($obj->price).' '.$langs->trans("HT");
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Minimum buying Price
// Better buy price
if (! empty($arrayfields['p.minbuyprice']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '<td align="right">';
if ($obj->tobuy && $obj->minsellprice != '')
{
//print price($obj->minsellprice).' '.$langs->trans("HT");
if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0)
{
if ($product_fourn->product_fourn_price_id > 0)
{
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
{
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext);
}
else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
}
}
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Number buying Price
// Number of buy prices
if (! empty($arrayfields['p.numbuyprice']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '<td align="right">';
if ($obj->tobuy)
{
if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0)
{
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
print $form->textwithpicto(count($productFournList),$htmltext);
}
}
print '</td>';
}
// WAP
if (! empty($arrayfields['p.pmp']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '<td class="nowrap" align="right">';
print price($product_static->pmp, 1, $langs);
print '</td>';
}
// Limit for alert
// Limit alert
if (! empty($arrayfields['p.seuil_stock_alerte']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
print $obj->seuil_stock_alerte;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Desired stock
if (! empty($arrayfields['p.desiredstock']['checked']))
{
print '<td class="liste_titre">';
print '&nbsp;';
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
print $obj->desiredstock;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Stock real
if (! empty($arrayfields['p.stock']['checked']))
{
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
print $product_static->stock_reel;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Stock virtual
if (! empty($arrayfields['stock_virtual']['checked']))
{
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
print $product_static->stock_theorique;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Lot/Serial
if (! empty($arrayfields['p.tobatch']['checked']))
{
print '<td align="center">';
print yn($obj->tobatch);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Stock
if (! empty($arrayfields['p.stock']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
// Stock
if (! empty($arrayfields['stock_virtual']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
// To batch
if (! empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno($search_tobatch, '', '', '', 1).'</td>';
// Accountancy code sell
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_sell" size="6" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
if (! empty($arrayfields['p.accountancy_code_sell']['checked']))
{
print '<td>'.$obj->accountancy_code_sell.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Accountancy code sell
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_buy" size="6" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
if (! empty($arrayfields['p.accountancy_code_buy']['checked']))
{
print '<td>'.$obj->accountancy_code_buy.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['p.datec']['checked']))
{
print '<td class="liste_titre">';
print '<td align="center">';
print dol_print_date($obj->date_creation, 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['p.tms']['checked']))
{
print '<td class="liste_titre">';
print '<td align="center">';
print dol_print_date($obj->date_update, 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status (to sell)
if (! empty($arrayfields['p.tosell']['checked']))
{
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1);
print '</td >';
}
if (! empty($arrayfields['p.tobuy']['checked']))
{
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1);
print '</td>';
}
print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$product_static=new Product($db);
$product_fourn =new ProductFournisseur($db);
$i = 0;
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
{
$sql = "SELECT label";
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql.= " WHERE fk_product=".$obj->rowid;
$sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'";
$sql.= " LIMIT 1";
$result = $db->query($sql);
if ($result)
{
$objtp = $db->fetch_object($result);
if (! empty($objtp->label)) $obj->label = $objtp->label;
}
}
$product_static->id = $obj->rowid;
$product_static->ref = $obj->ref;
$product_static->ref_fourn = $obj->ref_supplier;
$product_static->label = $obj->label;
$product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy;
$product_static->status = $obj->tosell;
$product_static->status_batch = $obj->tobatch;
$product_static->entity = $obj->entity;
$product_static->pmp = $obj->pmp;
$product_static->accountancy_code_sell = $obj->accountancy_code_sell;
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$product_static->accountancy_code_buy = $obj->accountancy_code_buy;
if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock
{
if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service
{
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
}
}
print '<tr class="oddeven">';
// Ref
if (! empty($arrayfields['p.ref']['checked']))
{
print '<td class="tdoverflowmax200">';
print $product_static->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Ref supplier
if (! empty($arrayfields['pfp.ref_fourn']['checked']))
{
print '<td class="tdoverflowmax200">';
print $product_static->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Label
if (! empty($arrayfields['p.label']['checked']))
{
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label,40).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type
if (! empty($arrayfields['p.fk_product_type']['checked']))
{
print '<td>'.$obj->fk_product_type.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Barcode
if (! empty($arrayfields['p.barcode']['checked']))
{
print '<td>'.$obj->barcode.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Duration
if (! empty($arrayfields['p.duration']['checked']))
{
print '<td align="center">';
if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration))
{
if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
//elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
else print $obj->duration;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Sell price
if (! empty($arrayfields['p.sellprice']['checked']))
{
print '<td align="right">';
if ($obj->tosell)
{
if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC");
else print price($obj->price).' '.$langs->trans("HT");
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Better buy price
if (! empty($arrayfields['p.minbuyprice']['checked']))
{
print '<td align="right">';
if ($obj->tobuy && $obj->minsellprice != '')
{
//print price($obj->minsellprice).' '.$langs->trans("HT");
if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0)
{
if ($product_fourn->product_fourn_price_id > 0)
{
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
{
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext);
}
else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
}
}
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Number of buy prices
if (! empty($arrayfields['p.numbuyprice']['checked']))
{
print '<td align="right">';
if ($obj->tobuy)
{
if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0)
{
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
print $form->textwithpicto(count($productFournList),$htmltext);
}
}
print '</td>';
}
// WAP
if (! empty($arrayfields['p.pmp']['checked']))
{
print '<td class="nowrap" align="right">';
print price($product_static->pmp, 1, $langs);
print '</td>';
}
// Limit alert
if (! empty($arrayfields['p.seuil_stock_alerte']['checked']))
{
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
print $obj->seuil_stock_alerte;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Desired stock
if (! empty($arrayfields['p.desiredstock']['checked']))
{
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
print $obj->desiredstock;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Stock real
if (! empty($arrayfields['p.stock']['checked']))
{
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
print $product_static->stock_reel;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Stock virtual
if (! empty($arrayfields['stock_virtual']['checked']))
{
print '<td align="right">';
if ($obj->fk_product_type != 1)
{
if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
print $product_static->stock_theorique;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Lot/Serial
if (! empty($arrayfields['p.tobatch']['checked']))
{
print '<td align="center">';
print yn($obj->tobatch);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Accountancy code sell
if (! empty($arrayfields['p.accountancy_code_sell']['checked']))
{
print '<td>'.$obj->accountancy_code_sell.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Accountancy code sell
if (! empty($arrayfields['p.accountancy_code_buy']['checked']))
{
print '<td>'.$obj->accountancy_code_buy.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['p.datec']['checked']))
{
print '<td align="center">';
print dol_print_date($obj->date_creation, 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['p.tms']['checked']))
{
print '<td align="center">';
print dol_print_date($obj->date_update, 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status (to sell)
if (! empty($arrayfields['p.tosell']['checked']))
{
print '<td align="right" nowrap="nowrap">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
print $product_static->LibStatut($obj->tosell,5,0);
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status (to buy)
if (! empty($arrayfields['p.tobuy']['checked']))
{
print '<td align="right" nowrap="nowrap">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
print $product_static->LibStatut($obj->tobuy,5,1);
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
print '<td align="right" nowrap="nowrap">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
print $product_static->LibStatut($obj->tosell,5,0);
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
// Status (to buy)
if (! empty($arrayfields['p.tobuy']['checked']))
{
print '<td align="right" nowrap="nowrap">';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
print $product_static->LibStatut($obj->tobuy,5,1);
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
$db->free($resql);
print "</table>";
print "</div>";
print "</tr>\n";
$i++;
}
$db->free($resql);
print "</table>";
print "</div>";
print '</form>';
}
else