* Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006-2007 Rodolphe Quiedeville * Copyright (C) 2007 Auguria SARL * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/product/admin/produit.php * \ingroup produit * \brief Page d'administration/configuration du module Produit * \version $Id$ */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/includes/barcode/html.formbarcode.class.php"); $langs->load("admin"); $langs->load("propal"); $langs->load("products"); // Security check if (!$user->admin) accessforbidden(); if ($_POST["action"] == 'nbprod') { dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", $_POST["value"],'chaine',0,'',$conf->entity); } else if ($_POST["action"] == 'multiprix_num') { dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", $_POST["value"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'multiprix') { dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "5",'chaine',0,'',$conf->entity); } else if ($_POST["action"] == 'sousproduits') { dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $_POST["activate_sousproduits"],'chaine',0,'',$conf->entity); } else if ($_POST["action"] == 'viewProdDescInForm') { dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $_POST["activate_viewProdDescInForm"],'chaine',0,'',$conf->entity); } else if ($_POST["action"] == 'usesearchtoselectproduct') { dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectproduct"],'chaine',0,'',$conf->entity); } else if ($_GET["action"] == 'set') { $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); } else if ($_POST["action"] == 'useecotaxe') { dolibarr_set_const($db, "PRODUIT_USE_ECOTAXE", $_POST["activate_useecotaxe"],'chaine',0,'',$conf->entity); } /* * View */ $formbarcode=new FormBarCode($db); llxHeader('',$langs->trans("ProductSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("ProductSetup"),$linkback,'setup'); $h = 0; $head[$h][0] = DOL_URL_ROOT."/product/admin/produit.php"; $head[$h][1] = $langs->trans("Products"); $hselected=$h; $h++; dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); $html=new Form($db); $var=true; print ''; print ''; print " \n"; print " \n"; print " \n"; /* * Formulaire parametres divers */ // multiprix activation/desactivation $var=!$var; print ""; print ''; print ""; print ""; print ''; print '"; print ''; print ''; // multiprix nombre de prix a proposer if($conf->global->PRODUIT_MULTIPRICES) { $var=!$var; print ""; print ''; print ""; print ""; print ''; print ""; print ''; print ''; print ''; } // sousproduits activation/desactivation $var=!$var; print ""; print ''; print ""; print ""; print ''; print '"; print ''; print ''; // utilisation formulaire Ajax sur choix produit $var=!$var; print ""; print ''; print ""; print ""; print ''; if (! $conf->use_javascript_ajax) { print '"; } else { print '"; } print ''; print ''; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { $var=!$var; print ""; print ''; print ""; print ""; print ''; print ""; print ''; print ''; print ''; } // Visualiser description produit dans les formulaires activation/desactivation $var=!$var; print ""; print ''; print ""; print ""; print ''; print '"; print ''; print ''; // Confirmation de suppression d'un ligne produit dans les formulaires activation/desactivation /* $var=!$var; print ""; print ''; print ""; print ""; print ''; print '"; print ''; print ''; */ if ($conf->global->PRODUCT_CANVAS_ABILITY) { // Add canvas feature $dir = DOL_DOCUMENT_ROOT . "/product/canvas/"; $var = false; print ''; print ''."\n"; print ''."\n"; print ''."\n"; if (is_dir($dir)) { require_once(DOL_DOCUMENT_ROOT . "/product/class/product.class.php"); $handle=opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle))!==false) { if (file_exists($dir.$file.'/product.'.$file.'.class.php')) { $classfile = $dir.$file.'/product.'.$file.'.class.php'; $classname = 'Product'.ucfirst($file); require_once($classfile); $object = new $classname(); $module = $object->module; if ($conf->$module->enabled) { $var=!$var; print "'; } } } closedir($handle); } } else { print "\n"; } print '
".$langs->trans("Parameters")."".$langs->trans("Value")." 
'.$langs->trans("MultiPricesAbility").''; print $html->selectyesno("activate_multiprix",$conf->global->PRODUIT_MULTIPRICES,1); print ''; print ''; print "
'.$langs->trans("MultiPricesNumPrices").'global->PRODUIT_MULTIPRICES_LIMIT."\">
'.$langs->trans("AssociatedProductsAbility").''; print $html->selectyesno("activate_sousproduits",$conf->global->PRODUIT_SOUSPRODUITS,1); print ''; print ''; print "
'.$langs->trans("UseSearchToSelectProduct").''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; print $html->selectyesno("activate_usesearchtoselectproduct",$conf->global->PRODUIT_USE_SEARCH_TO_SELECT,1); print ''; print ''; print "
'.$langs->trans("NumberOfProductShowInSelect").'global->PRODUIT_LIMIT_SIZE."\">
'.$langs->trans("ViewProductDescInFormAbility").''; print $html->selectyesno("activate_viewProdDescInForm",$conf->global->PRODUIT_DESC_IN_FORM,1); print ''; print ''; print "
'.$langs->trans("ConfirmDeleteProductLineAbility").''; print $html->selectyesno("activate_confirmDeleteProdLineInForm",$conf->global->PRODUIT_CONFIRM_DELETE_LINE,1); print ''; print ''; print "
'.$langs->trans("ProductSpecial").''.$langs->trans("Value").' 
"; print $object->description; print ''; $const = "PRODUCT_SPECIAL_".strtoupper($file); if ($conf->global->$const) { print img_tick(); print ''; print ''.$langs->trans("Disable").''; } else { print ' '; print ''.$langs->trans("Activate").''; } print '
ERROR: $dir is not a directory !
'; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>