Works on product canvas and templates
!! WARNING : not stable !!
This commit is contained in:
parent
17a2034b02
commit
01b46068e6
@ -81,6 +81,12 @@ class ProductDefault extends Product
|
||||
global $html;
|
||||
global $formproduct;
|
||||
|
||||
// canvas
|
||||
$this->tpl['canvas'] = $this->canvas;
|
||||
|
||||
// id
|
||||
$this->tpl['id'] = $this->id;
|
||||
|
||||
// Ref
|
||||
$this->tpl['ref'] = $this->ref;
|
||||
|
||||
@ -123,6 +129,11 @@ class ProductDefault extends Product
|
||||
$this->tpl['tva_tx'] = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||
}
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->ref, "");
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Status
|
||||
|
||||
113
htdocs/product/canvas/default/tpl/edit.tpl.php
Normal file
113
htdocs/product/canvas/default/tpl/edit.tpl.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $product->tpl['title']; ?>
|
||||
|
||||
<?php if ($mesg) { ?>
|
||||
<br><div class="error"><?php echo $mesg; ?></div><br>
|
||||
<?php } ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="id" value="<?php echo $product->tpl['id']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $product->tpl['canvas']; ?>">
|
||||
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $product->tpl['ref']; ?>">
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $product->tpl['label']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $product->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->stock->enabled) { ?>
|
||||
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
|
||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $product->tpl['seuil_stock_alerte']; ?>">
|
||||
</td></tr>
|
||||
<?php } else { ?>
|
||||
<input name="seuil_stock_alerte" type="hidden" value="0">
|
||||
<?php } ?>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $product->tpl['textarea_description']) {
|
||||
$product->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $product->tpl['textarea_description'];
|
||||
}?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Nature"); ?></td><td>
|
||||
<?php echo $product->tpl['finished']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Weight"); ?></td><td>
|
||||
<input name="weight" size="4" value="<?php echo $product->tpl['weight']; ?>">
|
||||
<?php echo $product->tpl['weight_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Length"); ?></td><td>
|
||||
<input name="size" size="4" value="<?php echo $product->tpl['length']; ?>">
|
||||
<?php echo $product->tpl['length_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Surface"); ?></td><td>
|
||||
<input name="surface" size="4" value="<?php echo $product->tpl['surface']; ?>">
|
||||
<?php echo $product->tpl['surface_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Volume"); ?></td><td>
|
||||
<input name="volume" size="4" value="<?php echo $product->tpl['volume']; ?>">
|
||||
<?php echo $product->tpl['volume_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td><?php echo $product->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $product->tpl['textarea_note']) {
|
||||
$product->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $product->tpl['textarea_note'];
|
||||
}?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<center><input type="submit" class="button" value="<?php echo $langs->trans("Save"); ?>">
|
||||
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"></center>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -1,104 +0,0 @@
|
||||
{* 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="{$smarty.server.PHP_SELF}?canvas=default" method="post" name="formulaire">
|
||||
|
||||
<table class="liste" width="100%">
|
||||
|
||||
<!-- FIELDS TITLE -->
|
||||
|
||||
<tr class="liste_titre">
|
||||
{section name=field loop=$fieldlist}
|
||||
{strip}
|
||||
|
||||
{if $fieldlist[field].enabled}
|
||||
{if $fieldlist[field].sort}
|
||||
<td class="liste_titre" align="{$fieldlist[field].align}">{$fieldlist[field].title}
|
||||
<a href="liste.php?sortfield={$fieldlist[field].name}&sortorder=asc&begin=&envente=&canvas=default&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={$fieldlist[field].name}&sortorder=desc&begin=&envente=&canvas=default&fourn_id=&snom=&sref=">
|
||||
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
|
||||
</a>
|
||||
</td>
|
||||
{else}
|
||||
<td class="liste_titre" align="{$fieldlist[field].align}">{$fieldlist[field].title}</td>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{/strip}
|
||||
{/section}
|
||||
</tr>
|
||||
|
||||
<!-- FIELDS SEARCH -->
|
||||
|
||||
<tr class="liste_titre">
|
||||
{section name=searchfield loop=$fieldlist}
|
||||
{strip}
|
||||
|
||||
{if $fieldlist[searchfield].enabled}
|
||||
{if $fieldlist[searchfield].search}
|
||||
<td class="liste_titre" align="{$fieldlist[searchfield].align}"><input class="flat" type="text" name="s{$fieldlist[searchfield].alias}" value=""></td>
|
||||
{elseif $smarty.section.search.last}
|
||||
<td class="liste_titre" align="right">
|
||||
<input type="image" class="liste_titre" name="button_search" src="{$url_root}/theme/{$theme}/img/search.png" alt="{$langs->trans('Search')}">
|
||||
<input type="image" class="liste_titre" name="button_removefilter" src="{$url_root}/theme/{$theme}/img/searchclear.png" alt="{$langs->trans('RemoveFilter')}">
|
||||
</td>
|
||||
{else}
|
||||
<td class="liste_titre"> </td>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{/strip}
|
||||
{/section}
|
||||
</tr>
|
||||
|
||||
<!-- FIELDS DATA -->
|
||||
|
||||
{foreach name=prodline item=line from=$datas}
|
||||
{strip}
|
||||
<tr class="{cycle values="pair,impair"}">
|
||||
{foreach name=valueline key=key item=value from=$line}
|
||||
{foreach name=fieldline item=field from=$fieldlist}
|
||||
{if $field.alias == $key}
|
||||
<td align="{$field.align}">{$value}</td>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</tr>
|
||||
{/strip}
|
||||
{/foreach}
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!-- END SMARTY TEMPLATE -->
|
||||
@ -32,6 +32,8 @@ class ProductService extends Product
|
||||
//! Numero d'erreur Plage 1280-1535
|
||||
var $errno = 0;
|
||||
|
||||
var $tpl = array();
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
@ -45,7 +47,7 @@ class ProductService extends Product
|
||||
$this->module = "service";
|
||||
$this->canvas = "service";
|
||||
$this->name = "service";
|
||||
$this->description = "Canvas des services";
|
||||
$this->definition = "Canvas des services";
|
||||
|
||||
$this->next_prev_filter = "canvas='service'";
|
||||
}
|
||||
@ -72,17 +74,122 @@ class ProductService extends Product
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$html;
|
||||
global $conf,$langs;
|
||||
global $html;
|
||||
global $formproduct;
|
||||
|
||||
// canvas
|
||||
$this->tpl['canvas'] = $this->canvas;
|
||||
|
||||
// id
|
||||
$this->tpl['id'] = $this->id;
|
||||
|
||||
// Ref
|
||||
$this->tpl['showrefnav'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||
$this->tpl['ref'] = $this->ref;
|
||||
|
||||
// Label
|
||||
$this->tpl['label'] = $this->libelle;
|
||||
|
||||
// Description
|
||||
$this->tpl['description'] = nl2br($this->description);
|
||||
|
||||
// Statut
|
||||
$this->tpl['status'] = $this->getLibStatut(2);
|
||||
|
||||
// Note
|
||||
$this->tpl['note'] = nl2br($this->note);
|
||||
|
||||
// Duration
|
||||
$this->tpl['duration_value'] = $this->duration_value;
|
||||
|
||||
// Hidden
|
||||
if ($this->user->rights->service->hidden)
|
||||
{
|
||||
$this->tpl['hidden'] = yn($this->hidden);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['hidden'] = yn("No");
|
||||
}
|
||||
|
||||
// Stock alert
|
||||
$this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte;
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
// Title
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans("NewService"));
|
||||
|
||||
// Price
|
||||
$this->tpl['price'] = $this->price;
|
||||
$this->tpl['price_min'] = $this->price_min;
|
||||
$this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type");
|
||||
|
||||
// VAT
|
||||
$this->tpl['tva_tx'] = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||
}
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->ref, "");
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Status
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status);
|
||||
|
||||
// Hidden
|
||||
if ($this->user->rights->service->hidden)
|
||||
{
|
||||
$this->tpl['hidden'] = $html->selectyesno('hidden',$this->hidden);
|
||||
}
|
||||
|
||||
// Duration unit
|
||||
// TODO creer fonction
|
||||
$duration_unit = '<input name="duration_unit" type="radio" value="h"'.($this->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="d"'.($this->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="w"'.($this->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="m"'.($this->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="y"'.($this->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||
$this->tpl['duration_unit'] = $duration_unit;
|
||||
|
||||
// TODO creer fonction
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
|
||||
$doleditor=new DolEditor('desc',$this->description,160,'dolibarr_notes','',false);
|
||||
$this->tpl['doleditor_description'] = $doleditor;
|
||||
|
||||
$doleditor=new DolEditor('note',$this->note,180,'dolibarr_notes','',false);
|
||||
$this->tpl['doleditor_note'] = $doleditor;
|
||||
}
|
||||
else
|
||||
{
|
||||
$textarea = '<textarea name="desc" rows="4" cols="90">';
|
||||
$textarea.= $this->description;
|
||||
$textarea.= '</textarea>';
|
||||
$this->tpl['textarea_description'] = $textarea;
|
||||
|
||||
$textarea = '<textarea name="note" rows="8" cols="70">';
|
||||
$textarea.= $this->note;
|
||||
$textarea.= '</textarea>';
|
||||
$this->tpl['textarea_note'] = $textarea;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Ref
|
||||
$this->tpl['ref'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||
|
||||
// Photo
|
||||
$this->tpl['nblignes'] = 4;
|
||||
if ($this->is_photo_available($conf->produit->dir_output))
|
||||
{
|
||||
@ -97,9 +204,6 @@ class ProductService extends Product
|
||||
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
|
||||
// Description
|
||||
$this->tpl['description'] = nl2br($this->description);
|
||||
|
||||
// Duration
|
||||
if ($this->duration_value > 1)
|
||||
{
|
||||
@ -109,20 +213,7 @@ class ProductService extends Product
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
}
|
||||
$this->tpl['duration'] = $langs->trans($dur[$this->duration_unit]);
|
||||
|
||||
// Hidden
|
||||
if ($user->rights->service->hidden)
|
||||
{
|
||||
$this->tpl['hidden'] = yn($this->hidden);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['hidden'] = yn("No");
|
||||
}
|
||||
|
||||
// Note
|
||||
$this->tpl['note'] = nl2br($this->note);
|
||||
$this->tpl['duration_unit'] = $langs->trans($dur[$this->duration_unit]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
102
htdocs/product/canvas/service/tpl/create.tpl.php
Normal file
102
htdocs/product/canvas/service/tpl/create.tpl.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $product->tpl['title']; ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<input type="hidden" name="canvas" value="<?php echo $_GET['canvas']; ?>">
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $product->tpl['ref']; ?>">
|
||||
<?php if ($_error == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $product->tpl['label']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $product->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $product->tpl['textarea_description']) {
|
||||
$product->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $product->tpl['textarea_description'];
|
||||
}?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Duration"); ?></td>
|
||||
<td><input name="duration_value" size="6" maxlength="5" value="<?php echo $product->tpl['duration_value']; ?>">
|
||||
<?php echo $product->tpl['duration_unit']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td><?php echo $product->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $product->tpl['textarea_note']) {
|
||||
$product->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $product->tpl['textarea_note'];
|
||||
}?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<?php if (! $conf->global->PRODUIT_MULTIPRICES) { ?>
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr><td><?php echo $langs->trans("SellingPrice"); ?></td>
|
||||
<td><input name="price" size="10" value="<?php echo $product->tpl['price']; ?>">
|
||||
<?php echo $product->tpl['price_base_type']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("MinPrice"); ?></td>
|
||||
<td><input name="price_min" size="10" value="<?php echo $product->tpl['price_min']; ?>">
|
||||
</td></tr>
|
||||
|
||||
<tr><td width="20%"><?php echo $langs->trans("VATRate"); ?></td><td>
|
||||
<?php echo $product->tpl['tva_tx']; ?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<?php } ?>
|
||||
|
||||
<center><input type="submit" class="button" value="<?php echo $langs->trans("Create"); ?>"></center>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
86
htdocs/product/canvas/service/tpl/edit.tpl.php
Normal file
86
htdocs/product/canvas/service/tpl/edit.tpl.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $product->tpl['title']; ?>
|
||||
|
||||
<?php if ($mesg) { ?>
|
||||
<br><div class="error"><?php echo $mesg; ?></div><br>
|
||||
<?php } ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="id" value="<?php echo $product->tpl['id']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $product->tpl['canvas']; ?>">
|
||||
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $product->tpl['ref']; ?>">
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $product->tpl['label']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $product->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $product->tpl['textarea_description']) {
|
||||
$product->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $product->tpl['textarea_description'];
|
||||
}?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Duration"); ?></td>
|
||||
<td><input name="duration_value" size="6" maxlength="5" value="<?php echo $product->tpl['duration_value']; ?>">
|
||||
<?php echo $product->tpl['duration_unit']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td><?php echo $product->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $product->tpl['textarea_note']) {
|
||||
$product->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $product->tpl['textarea_note'];
|
||||
}?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<center><input type="submit" class="button" value="<?php echo $langs->trans("Save"); ?>">
|
||||
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"></center>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
102
htdocs/product/canvas/service/tpl/list.tpl.php
Normal file
102
htdocs/product/canvas/service/tpl/list.tpl.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<table width="100%" border="0" class="notopnoleftnoright" 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"]; ?>?canvas=default" 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="type" value="<?php echo $type; ?>">
|
||||
|
||||
<table class="liste" width="100%">
|
||||
|
||||
<!-- 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']; ?>&sortorder=asc&begin=&envente=&canvas=default&fourn_id=&snom=&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']; ?>&sortorder=desc&begin=&envente=&canvas=default&fourn_id=&snom=&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) { ?>
|
||||
<td class="liste_titre" align="right">
|
||||
<input type="image" class="liste_titre" name="button_search" src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/search.png" alt="<?php echo $langs->trans('Search'); ?>">
|
||||
<input type="image" class="liste_titre" name="button_removefilter" src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/searchclear.png" alt="<?php echo $langs->trans('RemoveFilter'); ?>">
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td class="liste_titre"> </td>
|
||||
<?php } } } ?>
|
||||
</tr>
|
||||
|
||||
<!-- FIELDS DATA -->
|
||||
|
||||
<?php
|
||||
$var=True;
|
||||
foreach($datas as $line) {
|
||||
$var=!$var; ?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<?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 -->
|
||||
@ -1,102 +0,0 @@
|
||||
{* 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=service" 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&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.label&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.barcode&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.barcode&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 -->
|
||||
81
htdocs/product/canvas/service/tpl/view.tpl.php
Normal file
81
htdocs/product/canvas/service/tpl/view.tpl.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['ref']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Label") ?></td>
|
||||
<td><?php echo $product->tpl['label']; ?></td>
|
||||
|
||||
<?php if ($product->tpl['photos']) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $product->tpl['nblignes']; ?>">
|
||||
<?php echo $product->tpl['photos']; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $product->tpl['accountancyBuyCodeKey']; ?></td>
|
||||
<td><?php echo $product->tpl['accountancyBuyCodeVal']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $product->tpl['accountancySellCodeKey']; ?></td>
|
||||
<td><?php echo $product->tpl['accountancySellCodeVal']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $product->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Description"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['description']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Duration"); ?></td>
|
||||
<td><?php echo $product->tpl['duration_value']; ?>
|
||||
<?php echo $product->tpl['duration_unit']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['hidden']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['note']; ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -51,6 +51,12 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
$socid=$user->societe_id?$user->societe_id:0;
|
||||
$result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
|
||||
|
||||
if (empty($_GET["canvas"]))
|
||||
{
|
||||
$_GET["canvas"] = 'default';
|
||||
if ($_GET["type"] == 1) $_GET["canvas"] = 'service';
|
||||
}
|
||||
|
||||
$mesg = '';
|
||||
|
||||
|
||||
@ -156,7 +162,7 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
||||
$product->note = dol_htmlcleanlastbr($_POST["note"]);
|
||||
$product->duration_value = $_POST["duration_value"];
|
||||
$product->duration_unit = $_POST["duration_unit"];
|
||||
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
|
||||
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]?$_POST["seuil_stock_alerte"]:0;
|
||||
$product->canvas = $_POST["canvas"];
|
||||
$product->weight = $_POST["weight"];
|
||||
$product->weight_units = $_POST["weight_units"];
|
||||
@ -658,189 +664,12 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
||||
|
||||
if (!empty($_GET["canvas"]) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
// On assigne les valeurs meme en creation car elles sont definies si
|
||||
// on revient en erreur
|
||||
$template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/tpl/';
|
||||
$tvaarray = load_tva($db,"tva_tx",$conf->defaulttx,$mysoc,'');
|
||||
//$smarty->assign('tva_taux_value', $tvaarray['value']);
|
||||
//$smarty->assign('tva_taux_libelle', $tvaarray['label']);
|
||||
|
||||
$product->assign_values('create');
|
||||
|
||||
include($template_dir.'create.tpl.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
|
||||
|
||||
if ($_GET["type"]==1) $title=$langs->trans("NewService");
|
||||
else $title=$langs->trans("NewProduct");
|
||||
print_fiche_titre($title);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$_POST["ref"].'">';
|
||||
if ($_error == 1)
|
||||
{
|
||||
print $langs->trans("RefAlreadyExists");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$_POST["libelle"].'"></td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td><td>';
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$html->select_array('statut',$statutarray,$_POST["statut"]);
|
||||
print '</td></tr>';
|
||||
|
||||
// Stock min level
|
||||
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
||||
print '<input name="seuil_stock_alerte" size="4" value="'.$_POST["seuil_stock_alerte"].'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input name="seuil_stock_alerte" type="hidden" value="0">';
|
||||
}
|
||||
|
||||
// Description (used in invoice, propal...)
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('desc',$_POST["desc"],160,'dolibarr_notes','',false);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" rows="4" cols="90">';
|
||||
print $_POST["desc"];
|
||||
print '</textarea>';
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
// Nature
|
||||
if ($_GET["type"] != 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
||||
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||
$html->select_array('finished',$statutarray,$_POST["finished"]);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
//Duration
|
||||
if ($_GET["type"] == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td><input name="duration_value" size="6" maxlength="5" value="'.$product->duree.'"> ';
|
||||
print '<input name="duration_unit" type="radio" value="h">'.$langs->trans("Hour").' ';
|
||||
print '<input name="duration_unit" type="radio" value="d">'.$langs->trans("Day").' ';
|
||||
print '<input name="duration_unit" type="radio" value="w">'.$langs->trans("Week").' ';
|
||||
print '<input name="duration_unit" type="radio" value="m">'.$langs->trans("Month").' ';
|
||||
print '<input name="duration_unit" type="radio" value="y">'.$langs->trans("Year").' ';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services
|
||||
{
|
||||
// Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||
print '<input name="weight" size="4" value="'.$_POST["weight"].'">';
|
||||
print $formproduct->select_measuring_units("weight_units","weight");
|
||||
print '</td></tr>';
|
||||
// Length
|
||||
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||
print '<input name="size" size="4" value="'.$_POST["size"].'">';
|
||||
print $formproduct->select_measuring_units("size_units","size");
|
||||
print '</td></tr>';
|
||||
// Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||
print '<input name="surface" size="4" value="'.$_POST["surface"].'">';
|
||||
print $formproduct->select_measuring_units("surface_units","surface");
|
||||
print '</td></tr>';
|
||||
// Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||
print '<input name="volume" size="4" value="'.$_POST["volume"].'">';
|
||||
print $formproduct->select_measuring_units("volume_units","volume");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Hidden
|
||||
if (($_GET["type"] != 1 && $user->rights->produit->hidden)
|
||||
|| ($_GET["type"] == 1 && $user->rights->service->hidden))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||
print $html->selectyesno('hidden',$product->hidden);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||
print yn("No");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Note (invisible sur facture, propales...)
|
||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note',$_POST["note"],180,'dolibarr_notes','',false);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" rows="8" cols="70">';
|
||||
print $_POST["note"];
|
||||
print '</textarea>';
|
||||
}
|
||||
print "</td></tr>";
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
// We do no show price array on create when multiprices enabled.
|
||||
// We must set them on prices tab.
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// PRIX
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
|
||||
print '<td><input name="price" size="10" value="'.$product->price.'">';
|
||||
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
|
||||
print '</td></tr>';
|
||||
|
||||
// MIN PRICE
|
||||
print '<tr><td>'.$langs->trans("MinPrice").'</td>';
|
||||
print '<td><input name="price_min" size="10" value="'.$product->price_min.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// VAT
|
||||
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
||||
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -876,6 +705,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$picto=($product->type==1?'service':'product');
|
||||
dol_fiche_head($head, 'card', $titre, 0, $picto);
|
||||
print "\n<!-- CUT HERE -->\n";
|
||||
|
||||
// Confirmation de la suppression de la facture
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
@ -896,170 +726,13 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
*/
|
||||
if ($_GET["action"] == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
if ($product->isservice()) {
|
||||
print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$product->ref, "");
|
||||
} else {
|
||||
print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$product->ref, "");
|
||||
}
|
||||
|
||||
if ($mesg) {
|
||||
print '<br><div class="error">'.$mesg.'</div><br>';
|
||||
}
|
||||
|
||||
if ( $product->canvas == '')
|
||||
{
|
||||
print "<!-- CUT HERE -->\n";
|
||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||
print '<input type="hidden" name="canvas" value="'.$product->canvas.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="32" value="'.$product->ref.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
print '<select class="flat" name="statut">';
|
||||
if ($product->status)
|
||||
{
|
||||
print '<option value="1" selected="true">'.$langs->trans("OnSell").'</option>';
|
||||
print '<option value="0">'.$langs->trans("NotOnSell").'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="1">'.$langs->trans("OnSell").'</option>';
|
||||
print '<option value="0" selected="true">'.$langs->trans("NotOnSell").'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Description (used in invoice, propal...)
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
|
||||
print "\n";
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('desc',$product->description,160,'dolibarr_notes','',false);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" rows="4" cols="90">';
|
||||
print dol_htmlentitiesbr_decode($product->description);
|
||||
print "</textarea>";
|
||||
}
|
||||
print "</td></tr>";
|
||||
print "\n";
|
||||
|
||||
// Nature
|
||||
if($product->type!=1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
||||
$statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||
$html->select_array('finished',$statutarray,$product->finished);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($product->isproduct() && $conf->stock->enabled)
|
||||
{
|
||||
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td colspan="2">';
|
||||
print '<input name="seuil_stock_alerte" size="4" value="'.$product->seuil_stock_alerte.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input name="seuil_stock_alerte" type="hidden" value="'.$product->seuil_stock_alerte.'">';
|
||||
}
|
||||
|
||||
if ($product->isservice())
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2"><input name="duration_value" size="3" maxlength="5" value="'.$product->duration_value.'">';
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="h"'.($product->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="d"'.($product->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="w"'.($product->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="m"'.($product->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="y"'.($product->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||
print '<input name="weight" size="5" value="'.$product->weight.'"> ';
|
||||
print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units);
|
||||
print '</td></tr>';
|
||||
// Length
|
||||
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||
print '<input name="size" size="5" value="'.$product->length.'"> ';
|
||||
print $formproduct->select_measuring_units("size_units", "size", $product->length_units);
|
||||
print '</td></tr>';
|
||||
// Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||
print '<input name="surface" size="5" value="'.$product->surface.'"> ';
|
||||
print $formproduct->select_measuring_units("surface_units", "surface", $product->surface_units);
|
||||
print '</td></tr>';
|
||||
// Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||
print '<input name="volume" size="5" value="'.$product->volume.'"> ';
|
||||
print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Hidden
|
||||
if ((! $product->isservice() && $user->rights->produit->hidden)
|
||||
|| ($product->isservice() && $user->rights->service->hidden))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||
print $html->selectyesno('hidden',$product->hidden);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||
print yn("No");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note',$product->note,200,'dolibarr_notes','',false);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" rows="8" cols="70">';
|
||||
print dol_htmlentitiesbr_decode($product->note);
|
||||
print "</textarea>";
|
||||
}
|
||||
print "</td></tr>";
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
print "<!-- CUT HERE -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$tvaarray = load_tva($db,"tva_tx",$conf->defaulttx,$mysoc,'','');
|
||||
$smarty->assign('tva_taux_value', $tvaarray['value']);
|
||||
$smarty->assign('tva_taux_libelle', $tvaarray['label']);
|
||||
$smarty->display($product->canvas.'-edit.tpl');
|
||||
}
|
||||
|
||||
$product->assign_values('edit');
|
||||
|
||||
include($template_dir.'edit.tpl.php');
|
||||
}
|
||||
}
|
||||
else if (!$_GET["action"] == 'create')
|
||||
@ -1519,60 +1192,4 @@ $db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
|
||||
/**
|
||||
* \brief Load tva_taux_value and tva_taux_libelle array
|
||||
* \remarks Ne sert que pour smarty
|
||||
* \ TODO deplacer dans une classe
|
||||
*/
|
||||
function load_tva($db,$name='tauxtva', $defaulttx='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='')
|
||||
{
|
||||
global $langs,$conf,$mysoc;
|
||||
|
||||
$retarray=array();
|
||||
|
||||
if (is_object($societe_vendeuse->pays_code))
|
||||
{
|
||||
$code_pays=$societe_vendeuse->pays_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
$code_pays=$mysoc->pays_code; // Pour compatibilite ascendente
|
||||
}
|
||||
|
||||
// Recherche liste des codes TVA du pays vendeur
|
||||
$sql = "SELECT t.taux,t.recuperableonly";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$code_pays."'";
|
||||
$sql .= " AND t.active = 1";
|
||||
$sql .= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$txtva[ $i ] = $obj->taux;
|
||||
$libtva[ $i ] = $obj->taux.'%'.($obj->recuperableonly ? ' *':'');
|
||||
}
|
||||
}
|
||||
|
||||
// Definition du taux a pre-selectionner
|
||||
if ($defaulttx == '') $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$taux_produit);
|
||||
// Si taux par defaut n'a pu etre trouve, on prend dernier.
|
||||
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
|
||||
if ($defaulttx == '') $defaulttx = $txtva[sizeof($txtva)-1];
|
||||
|
||||
$nbdetaux = sizeof($txtva);
|
||||
|
||||
for ($i = 0 ; $i < $nbdetaux ; $i++)
|
||||
{
|
||||
$retarray['value'][$i] = $txtva[$i];
|
||||
$retarray['label'][$i] = $libtva[$i];
|
||||
}
|
||||
|
||||
return $retarray;
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user