* Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2005 Éric Seigne * * 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$ * $Source$ */ /** \file htdocs/admin/facture.php \ingroup facture \brief Page d'administration/configuration du module Facture \version $Revision$ */ require("./pre.inc.php"); $langs->load("admin"); $langs->load("bills"); if (!$user->admin) accessforbidden(); $facture_addon_var = FACTURE_ADDON; $facture_addon_var_pdf = FACTURE_ADDON_PDF; $facture_rib_number_var = FACTURE_RIB_NUMBER; $facture_chq_number_var = FACTURE_CHQ_NUMBER; $facture_tva_option = FACTURE_TVAOPTION; $typeconst=array('yesno','texte','chaine'); if ($_GET["action"] == 'set') { if (dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"])) $facture_addon_var = $_GET["value"]; } if ($_POST["action"] == 'setribchq') { if (dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$_POST["rib"])) $facture_rib_number_var = $_POST["rib"]; if (dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"])) $facture_chq_number_var = $_POST["chq"]; } if ($_GET["action"] == 'setpdf') { if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"])) $facture_addon_var_pdf = $_GET["value"]; } if ($_POST["action"] == 'setforcedate') { dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"]); Header("Location: facture.php"); exit; } if ($_POST["action"] == 'update' || $_POST["action"] == 'add') { if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:'')); { print $db->error(); } } if ($_GET["action"] == 'delete') { if (! dolibarr_del_const($db, $_GET["rowid"])); { print $db->error(); } } /* * Affiche page */ $dir = "../includes/modules/facture/"; llxHeader('',$langs->trans("BillsSetup"),'FactureConfiguration'); print_titre($langs->trans("BillsSetup")); /* * Module numérotation */ print "
"; print_titre($langs->trans("BillsNumberingModule")); print ''; print ''; print ''; print ''; print ''; print ''; print ''."\n"; clearstatcache(); $handle=opendir($dir); $var=True; while (($file = readdir($handle))!==false) { if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { $var = !$var; print ''; // Affiche example print ''; print '\n"; } } closedir($handle); print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Default").'
'; echo "$file"; print "\n"; $filebis = $file."/".$file.".modules.php"; // Chargement de la classe de numérotation $classname = "mod_facture_".$file; require_once($dir.$filebis); $obj = new $classname($db); print $obj->info(); print ''.$obj->getExample().''; if ($facture_addon_var == "$file") { $title=''; if ($obj->getNextValue() != $langs->trans("NotAvailable")) { $title=$langs->trans("NextValue").': '.$obj->getNextValue(); } print img_tick($title); } else { print ''.$langs->trans("Default").''; } print "
'; /* * PDF */ print '
'; print_titre("Modèles de facture pdf"); print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; clearstatcache(); $handle=opendir($dir); $var=True; while (($file = readdir($handle))!==false) { if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') { $var = !$var; $name = substr($file, 4, strlen($file) -16); $classname = substr($file, 0, strlen($file) -12); print '\n"; } } closedir($handle); print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Activated").''.$langs->trans("Default").'
'; echo "$name"; print "\n"; require_once($dir.$file); $obj = new $classname($db); print $obj->description; print ''; if ($facture_addon_var_pdf == "$name") { print ' '; print ''; print img_tick(); } else { print ' '; print ''; print ''.$langs->trans("Default").''; } print "
'; /* * Modes de règlement * */ print '
'; print_titre( "Mode de règlement à afficher sur les factures"); print ''; $var=True; print ''; print ''; print ''; print ''; print ''; print "\n"; $var=!$var; print ''; print ""; print ""; $var=!$var; print ''; print ""; print ""; print ""; print "
Mode règlement à proposer
Proposer paiement par RIB sur le compte"; $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " where clos = 0"; $sql.= " and courant = 1"; if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; if ($num > 0) { print ""; } else { print "Aucun compte bancaire actif créé"; } } print "
Proposer paiement par chèque à l'ordre et adresse du titulaire du compte"; $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " where clos = 0"; $sql.= " and courant = 1"; $var=True; if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; if ($num > 0) { print ""; } else { print "Aucun compte bancaire actif créé"; } } print "
"; print "
"; print_titre($langs->trans("OtherOptions")); print ''; print ''; print ''; print ''; print ''; print "\n"; $var=false; print ''; print ''; print '\n"; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; echo "Forcer la définition de la date des factures lors de la validation"; print ''; $forcedate=(defined("FAC_FORCE_DATE_VALIDATION") && FAC_FORCE_DATE_VALIDATION)?1:0; $html=new Form($db); print $html->selectyesno("forcedate",$forcedate,1); print ''; print ''; print "
'; print "
"; $db->close(); llxFooter('$Date$ - $Revision$'); ?>