Fix: reorganisation du fonctionnement des canvas de produits
Fix: migration du module droitpret en module externe
This commit is contained in:
parent
8b93460a90
commit
dd408be68c
@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/droitpret.php
|
||||
* \ingroup pret
|
||||
* \brief Page d'administration/configuration du module DroitPret
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("categories");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
// positionne la variable pour le test d'affichage de l'icone
|
||||
|
||||
$var=True;
|
||||
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
||||
{
|
||||
|
||||
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$_POST["consttype"],0,isset($_POST["constnote"])?$_POST["constnote"]:'',$conf->entity))
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
else
|
||||
{
|
||||
Header("Location: droitpret.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
* Interface de configuration de certaines variables de la partie adherent
|
||||
*/
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("PretSetup"),$linkback,'setup');
|
||||
print "<br>";
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("MemberMainOptions"),'','');
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Action").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
$form = new Form($db);
|
||||
|
||||
// Categorie
|
||||
$var=!$var;
|
||||
print '<form action="droitpret.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="hidden" name="constname" value="DROITPRET_CAT">';
|
||||
print '<input type="hidden" name="consttype" value="chaine">';
|
||||
print "<tr $bc[$var] class=value><td>".$langs->trans("catActive").'</td><td>';
|
||||
|
||||
print $form->select_all_categories(2,$conf->global->DROITPRET_CAT,"constvalue");
|
||||
|
||||
print '</td><td align="center" width="80">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Adresse destination
|
||||
$var=!$var;
|
||||
print '<form action="droitpret.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="hidden" name="constname" value="DROITPRET_MAIL">';
|
||||
print '<input type="hidden" name="consttype" value="chaine">';
|
||||
print "<tr $bc[$var] class=value><td>".$langs->trans("mailDroitPret").'</td>';
|
||||
|
||||
print '<td><input type="text" name="constvalue" value="'.$conf->global->DROITPRET_MAIL.'"></td>';
|
||||
|
||||
print '<td align="center" width="80">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
?>
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Auguria SARL <info@auguria.org>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-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
|
||||
@ -110,11 +110,7 @@ else if ($_POST["action"] == 'usesearchtoselectproduct')
|
||||
}
|
||||
else if ($_GET["action"] == 'set')
|
||||
{
|
||||
// Create temp directory for smarty
|
||||
if (! empty($dolibarr_smarty_compile)) create_exdir($dolibarr_smarty_compile);
|
||||
if (! empty($dolibarr_smarty_cache)) create_exdir($dolibarr_smarty_cache);
|
||||
|
||||
$const = "PRODUIT_SPECIAL_".strtoupper($_GET["spe"]);
|
||||
$const = "PRODUCT_SPECIAL_".strtoupper($_GET["spe"]);
|
||||
if ($_GET["value"]) dolibarr_set_const($db, $const, $_GET["value"],'chaine',0,'',$conf->entity);
|
||||
else dolibarr_del_const($db, $const,$conf->entity);
|
||||
}
|
||||
@ -278,64 +274,70 @@ print "</td>";
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Add droitpret feature
|
||||
if ($conf->droitpret->enabled)
|
||||
if ($conf->global->PRODUCT_CANVAS_ABILITY)
|
||||
{
|
||||
// Propose utilisation de canvas.
|
||||
// Ces derniers ne sont geres que par le menu default
|
||||
// Add canvas feature
|
||||
$dir = DOL_DOCUMENT_ROOT . "/product/canvas/";
|
||||
$var = false;
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("ProductSpecial")."</td>\n";
|
||||
print " <td align=\"right\" width=\"60\">".$langs->trans("Value")."</td>\n";
|
||||
print " <td width=\"80\"> </td></tr>\n";
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT . "/product.class.php");
|
||||
$dir = DOL_DOCUMENT_ROOT . "/product/templates/";
|
||||
|
||||
if (is_dir($dir) )
|
||||
print '<td>'.$langs->trans("ProductSpecial").'</td>'."\n";
|
||||
print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td width="80"> </td></tr>'."\n";
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT . "/product.class.php");
|
||||
|
||||
$handle=opendir($dir);
|
||||
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.')
|
||||
if (file_exists($dir.$file.'/product.'.$file.'.class.php'))
|
||||
{
|
||||
$parts = explode('.',$file);
|
||||
$classname = 'Product'.ucfirst($parts[1]);
|
||||
require_once($dir.$file);
|
||||
$module = new $classname();
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print $module->description;
|
||||
|
||||
print '</td><td align="right">';
|
||||
|
||||
$const = "PRODUIT_SPECIAL_".strtoupper($parts[1]);
|
||||
if ($conf->global->$const)
|
||||
$classfile = $dir.$file.'/product.'.$file.'.class.php';
|
||||
$classname = 'Product'.ucfirst($file);
|
||||
|
||||
require_once($classfile);
|
||||
$object = new $classname();
|
||||
|
||||
$module = $object->module;
|
||||
|
||||
if ($conf->$module->enabled)
|
||||
{
|
||||
print img_tick();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
print $object->description;
|
||||
|
||||
print '</td><td align="right">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&spe='.$parts[1].'&value=0">'.$langs->trans("Disable").'</a>';
|
||||
|
||||
$const = "PRODUCT_SPECIAL_".strtoupper($file);
|
||||
|
||||
if ($conf->global->$const)
|
||||
{
|
||||
print img_tick();
|
||||
print '</td><td align="right">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&spe='.$file.'&value=0">'.$langs->trans("Disable").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' </td><td align="right">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&spe='.$file.'&value=1">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' </td><td align="right">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&spe='.$parts[1].'&value=1">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr><td><b>ERROR</b>: $dir is not a directory !</td></tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.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 2 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ========================================================================
|
||||
|
||||
CREATE TABLE llx_droitpret_rapport (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
date_envoie datetime NOT NULL,
|
||||
format varchar(10) NOT NULL,
|
||||
date_debut datetime NOT NULL,
|
||||
date_fin datetime NOT NULL,
|
||||
fichier varchar(255) NOT NULL,
|
||||
nbfact integer NOT NULL
|
||||
) type=innodb;
|
||||
@ -1,44 +0,0 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
--
|
||||
-- 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$
|
||||
-- ============================================================================
|
||||
|
||||
--
|
||||
-- Produit specifique livre
|
||||
--
|
||||
create table llx_product_cnv_livre
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
isbn varchar(13), -- code ISBN
|
||||
ean varchar(13), -- code EAN
|
||||
format varchar(7), -- format de l'ouvrage
|
||||
|
||||
px_feuillet float(12,4), -- prix au feuillet
|
||||
px_reliure float(12,4), -- prix de la reliure
|
||||
px_couverture float(12,4), -- prix de la couverture
|
||||
px_revient float(12,4), -- prix de revient
|
||||
|
||||
pages smallint UNSIGNED, -- nombre de page
|
||||
|
||||
fk_couverture integer,
|
||||
fk_contrat integer,
|
||||
fk_auteur integer DEFAULT 0 -- auteur lien vers llx_societe
|
||||
)type=innodb;
|
||||
|
||||
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ============================================================================
|
||||
|
||||
create table llx_product_cnv_livre_contrat
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_cnv_livre integer,
|
||||
|
||||
quantite integer, -- quantite achete
|
||||
taux float(3,2), -- taux contractuel
|
||||
|
||||
date_app datetime, -- date d'application
|
||||
duree varchar(50), -- duree du contrat
|
||||
fk_user integer, -- utilisateur qui a saisi le contrat
|
||||
locked tinyint default 0 -- indique si le contrat est verrouille a la modification
|
||||
)type=innodb;
|
||||
|
||||
|
||||
|
||||
0
htdocs/product/canvas/default/index.php
Normal file
0
htdocs/product/canvas/default/index.php
Normal file
0
htdocs/product/canvas/default/templates/index.php
Normal file
0
htdocs/product/canvas/default/templates/index.php
Normal file
102
htdocs/product/canvas/default/templates/liste.tpl
Normal file
102
htdocs/product/canvas/default/templates/liste.tpl
Normal file
@ -0,0 +1,102 @@
|
||||
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*}
|
||||
|
||||
<!-- BEGIN SMARTY TEMPLATE -->
|
||||
|
||||
<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;">
|
||||
<tr>
|
||||
<td class="nobordernopadding" width="40" align="left" valign="middle">
|
||||
{$title_picto}
|
||||
</td>
|
||||
<td class="nobordernopadding" valign="middle">
|
||||
<div class="titre">{$title_text}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form action="liste.php?canvas=default" method="post" name="formulaire">
|
||||
|
||||
<table class="liste" width="100%">
|
||||
<tr class="liste_titre">
|
||||
|
||||
<td class="liste_titre">Référence
|
||||
<a href="liste.php?sortfield=p.ref&sortorder=asc&begin=&envente=&canvas=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=p.ref&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>
|
||||
|
||||
<td class="liste_titre">Libellé
|
||||
<a href="liste.php?sortfield=p.label&sortorder=asc&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=p.ref&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>
|
||||
|
||||
<td class="liste_titre">Code barre
|
||||
<a href="liste.php?sortfield=p.label&sortorder=asc&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=p.ref&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>
|
||||
|
||||
<td class="liste_titre" align="center">Date de modification</td>
|
||||
<td class="liste_titre" align="right">Prix de vente</td>
|
||||
<td class="liste_titre" align="right">Stock</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].sellingprice}</td>
|
||||
<td align="right">{$datas[mysec].stock}</td>
|
||||
<td align="right">{$datas[mysec].status}</td>
|
||||
</tr>
|
||||
{/strip}
|
||||
{/section}
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!-- END SMARTY TEMPLATE -->
|
||||
0
htdocs/product/canvas/index.php
Normal file
0
htdocs/product/canvas/index.php
Normal file
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
|
||||
*
|
||||
@ -120,10 +120,10 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($_POST["canvas"] <> '' && file_exists('templates/product.'.$_POST["canvas"].'.class.php') )
|
||||
if ($_POST["canvas"] <> '' && file_exists('canvas/'.$_POST["canvas"].'/product.'.$_POST["canvas"].'.class.php') )
|
||||
{
|
||||
$class = 'Product'.ucfirst($_POST["canvas"]);
|
||||
include_once('templates/product.'.$_POST["canvas"].'.class.php');
|
||||
include_once('canvas/'.$_POST["canvas"].'/product.'.$_POST["canvas"].'.class.php');
|
||||
$product = new $class($db);
|
||||
}
|
||||
else
|
||||
@ -248,10 +248,10 @@ if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rig
|
||||
}
|
||||
|
||||
// Specific product
|
||||
if ($product->canvas <> '' && file_exists('templates/product.'.$product->canvas.'.class.php') )
|
||||
if ($product->canvas <> '' && file_exists('canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php') )
|
||||
{
|
||||
$class = 'Product'.ucfirst($product->canvas);
|
||||
include_once('templates/product.'.$product->canvas.'.class.php');
|
||||
include_once('canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php');
|
||||
|
||||
$product = new $class($db);
|
||||
if ($product->FetchCanvas($_POST["id"]))
|
||||
@ -613,22 +613,16 @@ $formproduct = new FormProduct($db);
|
||||
*/
|
||||
if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
if ($conf->droitpret->enabled)
|
||||
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
if (! isset($product))
|
||||
{
|
||||
$filecanvas=DOL_DOCUMENT_ROOT.'/product/templates/product.'.$_GET["canvas"].'.class.php';
|
||||
if ($_GET["canvas"] && file_exists($filecanvas) )
|
||||
{
|
||||
$class = 'Product'.ucfirst($_GET["canvas"]);
|
||||
include_once($filecanvas);
|
||||
|
||||
$product = new $class($db,0,$user);
|
||||
}
|
||||
else
|
||||
{
|
||||
$product = new Product($db);
|
||||
}
|
||||
$filecanvas = DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php';
|
||||
$class = 'Product'.ucfirst($_GET["canvas"]);
|
||||
|
||||
include_once($filecanvas);
|
||||
|
||||
$product = new $class($db,0,$user);
|
||||
}
|
||||
|
||||
$product->assign_smarty_values($smarty, 'create');
|
||||
@ -653,7 +647,17 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
||||
|
||||
if ($mesg) print $mesg."\n";
|
||||
|
||||
if (empty($conf->droitpret->enabled) || empty($_GET["canvas"]))
|
||||
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
// On assigne les valeurs meme en creation car elles sont definies si
|
||||
// on revient en erreur
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/templates/';
|
||||
$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($_GET["canvas"].'-create.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -825,16 +829,6 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// On assigne les valeurs meme en creation car elles sont definies si
|
||||
// on revient en erreur
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/templates/'.$_GET["canvas"].'/';
|
||||
$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($_GET["canvas"].'-create.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -857,20 +851,17 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
|
||||
// Gestion des produits specifiques
|
||||
if ($conf->droitpret->enabled)
|
||||
if ($product->canvas <> '' && file_exists('canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php') )
|
||||
{
|
||||
if ($product->canvas <> '' && file_exists('templates/product.'.$product->canvas.'.class.php') )
|
||||
{
|
||||
$class = 'Product'.ucfirst($product->canvas);
|
||||
include_once('templates/product.'.$product->canvas.'.class.php');
|
||||
$product = new $class($db);
|
||||
$class = 'Product'.ucfirst($product->canvas);
|
||||
include_once('canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php');
|
||||
$product = new $class($db);
|
||||
|
||||
$result = $product->FetchCanvas($_GET["id"],'',$_GET["action"]);
|
||||
$result = $product->FetchCanvas($_GET["id"],'',$_GET["action"]);
|
||||
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/templates/'.$product->canvas.'/';
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/templates/';
|
||||
|
||||
$product->assign_smarty_values($smarty,$_GET["action"]);
|
||||
}
|
||||
$product->assign_smarty_values($smarty,$_GET["action"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-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
|
||||
@ -86,10 +86,10 @@ if ($conf->categorie->enabled && isset($_REQUEST['catid']))
|
||||
|
||||
$htmlother=new FormOther($db);
|
||||
|
||||
if ($_GET["canvas"] <> '' && file_exists('templates/product.'.$_GET["canvas"].'.class.php') )
|
||||
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php') )
|
||||
{
|
||||
$class = 'Product'.ucfirst($_GET["canvas"]);
|
||||
include_once('templates/product.'.$_GET["canvas"].'.class.php');
|
||||
include_once('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php');
|
||||
|
||||
$object = new $class($db);
|
||||
$object->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
@ -213,7 +213,7 @@ if ($resql)
|
||||
print "</div><br>";
|
||||
}
|
||||
|
||||
if ($conf->droitpret->enabled && isset($_GET["canvas"]))
|
||||
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
$smarty->assign('datas', $object->list_datas);
|
||||
$smarty->assign('url_root', $dolibarr_main_url_root);
|
||||
@ -226,14 +226,14 @@ if ($resql)
|
||||
// Check if a custom template is present
|
||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/liste.tpl'))
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/';
|
||||
$template = $_GET["canvas"].'/liste.tpl';
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/';
|
||||
$template = 'liste.tpl';
|
||||
}
|
||||
// Check if a default template is present
|
||||
else if (file_exists(DOL_DOCUMENT_ROOT . '/product/templates/'.$_GET["canvas"].'/liste.tpl'))
|
||||
else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/liste.tpl'))
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/product/templates/';
|
||||
$template = $_GET["canvas"].'/liste.tpl';
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/';
|
||||
$template = 'liste.tpl';
|
||||
}
|
||||
// Error template
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user