From 0040e1b360d471f9ac92160acd23e036ac56b2df Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Mar 2006 10:35:48 +0000 Subject: [PATCH] =?UTF-8?q?La=20gestion=20des=20avoirs=20sera=20int=E9gr?= =?UTF-8?q?=E9=20au=20module=20facturation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/avoir.php | 279 --------------------- htdocs/includes/modules/modAvoir.class.php | 173 ------------- 2 files changed, 452 deletions(-) delete mode 100644 htdocs/admin/avoir.php delete mode 100644 htdocs/includes/modules/modAvoir.class.php diff --git a/htdocs/admin/avoir.php b/htdocs/admin/avoir.php deleted file mode 100644 index 2f3cc2aa87f..00000000000 --- a/htdocs/admin/avoir.php +++ /dev/null @@ -1,279 +0,0 @@ - - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2005-2006 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. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/admin/avoir.php - \ingroup avoir - \brief Page d'administration/configuration du module Avoir - \version $Revision$ -*/ - -require("./pre.inc.php"); - -$langs->load("admin"); -$langs->load("discount"); - -if (!$user->admin) - accessforbidden(); - - -if ($_GET["action"] == 'set') -{ - $sql = "INSERT INTO ".MAIN_DB_PREFIX."avoir_model_pdf (nom) VALUES ('".$_GET["value"]."')"; - - if ($db->query($sql)) - { - - } -} -if ($_GET["action"] == 'del') -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."avoir_model_pdf WHERE nom='".$_GET["value"]."'"; - - if ($db->query($sql)) - { - - } -} - - -$avoir_addon_var_pdf = $conf->global->AVOIR_ADDON_PDF; - -if ($_GET["action"] == 'setpdf') -{ - if (dolibarr_set_const($db, "AVOIR_ADDON_PDF",$_GET["value"])) - { - // La constante qui a été lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage cohérent - $avoir_addon_var_pdf = $_GET["value"]; - } - - // On active le modele - $sql_del = "delete from ".MAIN_DB_PREFIX."avoir_model_pdf where nom = '".$_GET["value"]."';"; - $db->query($sql_del); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."avoir_model_pdf (nom) VALUES ('".$_GET["value"]."')"; - if ($db->query($sql)) - { - - } -} - -$avoir_addon_var = $conf->global->AVOIR_ADDON; - -if ($_GET["action"] == 'setmod') -{ - // \todo Verifier si module numerotation choisi peut etre activé - // par appel methode canBeActivated - - - - if (dolibarr_set_const($db, "AVOIR_ADDON",$_GET["value"])) - { - // la constante qui a été lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage cohérent - $avoir_addon_var = $_GET["value"]; - } -} - - -/* - * Affiche page - */ - -$dir = DOL_DOCUMENT_ROOT .'/avoir/modules/'; - - -llxHeader('',$langs->trans("DiscountSetup")); - -print_titre($langs->trans("DiscountSetup")); - - -/* - * Module numérotation - */ -print "
"; -print_titre($langs->trans("DiscountsNumberingModules")); - -print ''; -print ''; -print '\n"; -print '\n"; -print '\n"; -print ''; -print ''."\n"; - -clearstatcache(); - -$handle = opendir($dir); -if ($handle) -{ - $var=true; - while (($file = readdir($handle))!==false) - { - if (substr($file, 0, 10) == 'mod_avoir_' && substr($file, strlen($file)-3, 3) == 'php') - { - $file = substr($file, 0, strlen($file)-4); - - require_once(DOL_DOCUMENT_ROOT ."/avoir/modules/".$file.".php"); - - $modAvoir = new $file; - - $var=!$var; - print "\n "; - print "\n \n"; - print "\n \n"; - - print ''; - - - print "\n"; - } - } - closedir($handle); -} -print "
'.$langs->trans("Name")."'.$langs->trans("Description")."'.$langs->trans("Example")."'.$langs->trans("Activated").'
".$file."".$modAvoir->info()."".$modAvoir->getExample()."'; - if ($avoir_addon_var == "$file") - { - $title=''; - if ($modAvoir->getNextValue() != $langs->trans("NotAvailable")) - { - $title=$langs->trans("NextValue").': '.$modAvoir->getNextValue(); - } - print img_tick($title); - } - else - { - print "".$langs->trans("Activate").""; - } - print '

\n"; - - -/* - * PDF - */ - -print_titre($langs->trans("DiscountsPDFModules")); - -$def = array(); - -$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."avoir_model_pdf"; -$resql=$db->query($sql); -if ($resql) -{ - $i = 0; - $num_rows=$db->num_rows($resql); - while ($i < $num_rows) - { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } -} -else -{ - dolibarr_print_error($db); -} - -$dir = DOL_DOCUMENT_ROOT .'/avoir/modules/pdf/'; - -print "\n"; -print "\n"; -print " \n"; -print " \n"; -print ' \n"; -print ' \n"; -print "\n"; - -clearstatcache(); - -$handle=opendir($dir); - -$var=true; -while (($file = readdir($handle))!==false) -{ - if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,10) == 'pdf_avoir_') - { - $name = substr($file, 10, strlen($file) - 24); - $classname = substr($file, 0, strlen($file) -12); - - $var=!$var; - print "\n \n \n \n \n \n '; - } -} -closedir($handle); - -print '
".$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."
"; - print "$name"; - print "\n"; - require_once($dir.$file); - $obj = new $classname($db); - - print $obj->description; - - print "\n"; - - if (in_array($name, $def)) - { - print img_tick(); - print ""; - print ''.$langs->trans("Disable").''; - } - else - { - print " "; - print ""; - print ''.$langs->trans("Activate").''; - } - - print ""; - - if ($avoir_addon_var_pdf == "$name") - { - print img_tick(); - } - else - { - print ''.$langs->trans("Activate").''; - } - print '
'; - -/* - * Repertoire - */ -print '
'; -print_titre($langs->trans("PathToDocuments")); - -print "\n"; -print "\n"; -print " \n"; -print " \n"; -print "\n"; -print "\n \n \n\n"; -print "
".$langs->trans("Name")."".$langs->trans("Value")."
".$langs->trans("Directory")."".$conf->avoir->dir_output."
\n
"; - - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/includes/modules/modAvoir.class.php b/htdocs/includes/modules/modAvoir.class.php deleted file mode 100644 index eeccd35a42f..00000000000 --- a/htdocs/includes/modules/modAvoir.class.php +++ /dev/null @@ -1,173 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2005-2006 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. - * - * $Id$ - * $Source$ - */ - -/** \defgroup avoir Module avoir - \brief Module pour gérer les avoirs clients et/ou fournisseurs -*/ - - -/** - \file htdocs/includes/modules/modAvoir.class.php - \ingroup avoir - \brief Fichier de la classe de description et activation du module Avoir -*/ - -include_once "DolibarrModules.class.php"; - - -/** - \class modAvoir - \brief Classe de description et activation du module Avoir -*/ - -class modAvoir extends DolibarrModules -{ - - /** - * \brief Constructeur. Definit les noms, constantes et boites - * \param DB handler d'accès base - */ - function modAvoir($DB) - { - $this->db = $DB ; - $this->id = 'avoir'; // Same value xxx than in file modXxx.class.php file - $this->numero = 35 ; - - $this->family = "financial"; - $this->name = "Avoir"; - $this->description = "Gestion des avoirs clients"; - - //$this->revision = explode(' ','$Revision$'); - //$this->version = $this->revision[1]; - $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version - - $this->const_name = 'MAIN_MODULE_AVOIR'; - $this->special = 0; - $this->picto='bill'; - - // Dir - $this->dirs = array(); - - // Dépendances - $this->depends = array("modSociete","modComptabilite"); - $this->requiredby = array(); - - // Config pages - $this->config_page_url = "avoir.php"; - - // Constantes - $this->const = array(); - - $this->const[0][0] = "AVOIR_ADDON_PDF"; - $this->const[0][1] = "chaine"; - $this->const[0][2] = "azur"; - $this->const[0][3] = 'Nom du gestionnaire de génération des avoirs en PDF'; - $this->const[0][4] = 0; - - $this->const[1][0] = "AVOIR_ADDON"; - $this->const[1][1] = "chaine"; - $this->const[1][2] = "pluton"; - $this->const[1][3] = 'Nom du gestionnaire de numérotation des avoirs'; - $this->const[1][4] = 0; - - - // Boites - $this->boxes = array(); -/* - $this->boxes[0][0] = "Avoirs"; - $this->boxes[0][1] = "box_avoirs.php"; -*/ - - // Permissions - $this->rights = array(); - $this->rights_class = 'avoir'; - $r=0; - - $r++; - $this->rights[$r][0] = 401; - $this->rights[$r][1] = 'Lire les avoirs'; - $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 1; - $this->rights[$r][4] = 'lire'; - - $r++; - $this->rights[$r][0] = 402; - $this->rights[$r][1] = 'Créer/modifier les avoirs'; - $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'creer'; - - $r++; - $this->rights[$r][0] = 403; - $this->rights[$r][1] = 'Valider les avoirs'; - $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'valider'; - - $r++; - $this->rights[$r][0] = 404; - $this->rights[$r][1] = 'Supprimer les avoirs'; - $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'supprimer'; - - } - - - /** - * \brief Fonction appelée lors de l'activation du module. Insère en base les constantes, boites, permissions du module. - * Définit également les répertoires de données à créer pour ce module. - */ - function init() - { - global $conf; - - // Permissions - $this->remove(); - - // Dir - $this->dirs[0] = $conf->avoir->dir_output; - $this->dirs[1] = $conf->avoir->dir_images; - - $sql = array(); -/* - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."avoir_model_pdf WHERE nom = '".$this->const[0][2]."'", - "INSERT INTO ".MAIN_DB_PREFIX."avoir_model_pdf (nom) VALUES('".$this->const[0][2]."');", - ); -*/ - return $this->_init($sql); - } - - /** - * \brief Fonction appelée lors de la désactivation d'un module. - * Supprime de la base les constantes, boites et permissions du module. - */ - function remove() - { - $sql = array(); - - return $this->_remove($sql); - } -} -?>