dbut de l'ajout du module "avoir"
This commit is contained in:
parent
0d5b19e0b0
commit
0327c1bb82
279
htdocs/admin/avoir.php
Normal file
279
htdocs/admin/avoir.php
Normal file
@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.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$
|
||||
* $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 "<br>";
|
||||
print_titre($langs->trans("DiscountsNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name")."</td>\n";
|
||||
print '<td>'.$langs->trans("Description")."</td>\n";
|
||||
print '<td nowrap>'.$langs->trans("Example")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||
print '</tr>'."\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 "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>";
|
||||
print "\n <td>".$modAvoir->info()."</td>\n";
|
||||
print "\n <td nowrap>".$modAvoir->getExample()."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($avoir_addon_var == "$file")
|
||||
{
|
||||
$title='';
|
||||
if ($modAvoir->getNextValue() != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$title=$langs->trans("NextValue").': '.$modAvoir->getNextValue();
|
||||
}
|
||||
print img_tick($title);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<a href=\"avoir.php?action=setmod&value=".$file."\">".$langs->trans("Activate")."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
print "</table><br>\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 "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print " <td width=\"140\">".$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print ' <td align="center" colspan="2">'.$langs->trans("Activated")."</td>\n";
|
||||
print ' <td align="center">'.$langs->trans("Default")."</td>\n";
|
||||
print "</tr>\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 "<tr ".$bc[$var].">\n <td>";
|
||||
print "$name";
|
||||
print "</td>\n <td>\n";
|
||||
require_once($dir.$file);
|
||||
$obj = new $classname($db);
|
||||
|
||||
print $obj->description;
|
||||
|
||||
print "</td>\n <td align=\"center\">\n";
|
||||
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print img_tick();
|
||||
print "</td>\n <td>";
|
||||
print '<a href="avoir.php?action=del&value='.$name.'">'.$langs->trans("Disable").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
print "</td>\n <td>";
|
||||
print '<a href="avoir.php?action=set&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
|
||||
print "</td>\n <td align=\"center\">";
|
||||
|
||||
if ($avoir_addon_var_pdf == "$name")
|
||||
{
|
||||
print img_tick();
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="avoir.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
* Repertoire
|
||||
*/
|
||||
print '<br>';
|
||||
print_titre($langs->trans("PathToDocuments"));
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print " <td>".$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Value")."</td>\n";
|
||||
print "</tr>\n";
|
||||
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("Directory")."</td>\n <td>".$conf->avoir->dir_output."</td>\n</tr>\n";
|
||||
print "</table>\n<br>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
@ -270,7 +270,7 @@ print '</table>';
|
||||
* Repertoire
|
||||
*/
|
||||
print '<br>';
|
||||
print_titre("Chemins d'accés aux documents");
|
||||
print_titre($langs->trans("PathToDocuments"));
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
|
||||
@ -73,19 +73,23 @@ class modAvoir extends DolibarrModules
|
||||
$this->requiredby = array();
|
||||
|
||||
// Config pages
|
||||
//$this->config_page_url = "avoir.php";
|
||||
$this->config_page_url = "avoir.php";
|
||||
|
||||
// Constantes
|
||||
$this->const = array();
|
||||
/*
|
||||
$this->const[0][0] = "FACTURE_ADDON_PDF";
|
||||
$this->const[0][1] = "chaine";
|
||||
$this->const[0][2] = "bulot";
|
||||
|
||||
$this->const[1][0] = "FACTURE_ADDON";
|
||||
$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();
|
||||
|
||||
@ -76,12 +76,20 @@ class modCommande extends DolibarrModules
|
||||
$this->const[0][0] = "COMMANDE_ADDON_PDF";
|
||||
$this->const[0][1] = "chaine";
|
||||
$this->const[0][2] = "azur";
|
||||
$this->const[0][3] = 'Nom du gestionnaire de génération des commandes en PDF';
|
||||
$this->const[0][4] = 0;
|
||||
|
||||
$this->const[1][0] = "COM_ADD_PROD_DESC";
|
||||
$this->const[1][0] = "COMMANDE_ADDON";
|
||||
$this->const[1][1] = "chaine";
|
||||
$this->const[1][2] = "0";
|
||||
$this->const[1][3] = "Mettre à 1 pour voir la description d\'un produit dans une commande";
|
||||
$this->const[1][4] = 1;
|
||||
$this->const[1][2] = "mod_commande_jade";
|
||||
$this->const[1][3] = 'Nom du gestionnaire de numérotation des commandes';
|
||||
$this->const[1][4] = 0;
|
||||
|
||||
$this->const[2][0] = "COM_ADD_PROD_DESC";
|
||||
$this->const[2][1] = "chaine";
|
||||
$this->const[2][2] = "0";
|
||||
$this->const[2][3] = "Mettre à 1 pour voir la description d\'un produit dans une commande";
|
||||
$this->const[2][4] = 1;
|
||||
|
||||
// Boites
|
||||
$this->boxes = array();
|
||||
|
||||
@ -220,6 +220,10 @@ Permission302=Delete bar codes
|
||||
Permission331=Read bookmarks
|
||||
Permission332=Create/modify bookmarks
|
||||
Permission333=Delete bookmarks
|
||||
Permission401=Read discounts
|
||||
Permission402=Create/modify discounts
|
||||
Permission403=Validate discounts
|
||||
Permission404=Delete discounts
|
||||
Permission700=Read donations
|
||||
Permission701=Create/modify donations
|
||||
Permission702=Delete donations
|
||||
@ -427,4 +431,8 @@ ExternalRSSSetup=External RSS imports setup
|
||||
NewRSS=New RSS
|
||||
##### Mailing #####
|
||||
MailingSetup=Mailing module setup
|
||||
MailingEMailFrom=Sender EMail (From) for emails sent by emailing module
|
||||
MailingEMailFrom=Sender EMail (From) for emails sent by emailing module
|
||||
##### Discount setup #####
|
||||
DiscountSetup=Discount module setup
|
||||
DiscountsNumberingModules=Discount numbering modules
|
||||
DiscountsPDFModules=Discount PDF modules
|
||||
@ -220,6 +220,10 @@ Permission302=Supprimer les codes barres
|
||||
Permission331=Lire les bookmarks
|
||||
Permission332=Créer/modifier les bookmarks
|
||||
Permission333=Supprimer les bookmarks
|
||||
Permission401=Consulter les avoirs
|
||||
Permission402=Créer/modifier les avoirs
|
||||
Permission403=Valider les avoirs
|
||||
Permission404=Supprimer les avoirs
|
||||
Permission700=Consulter les dons
|
||||
Permission701=Créer/modifier les dons
|
||||
Permission702=Supprimer les dons
|
||||
@ -428,4 +432,8 @@ NewRSS=Syndication d'un nouveau flux RSS
|
||||
##### Mailing #####
|
||||
MailingSetup=Configuration du module EMailing
|
||||
MailingEMailFrom=Email emetteur (From) des mails envoyés par EMailing
|
||||
##### Discount setup #####
|
||||
DiscountSetup=Configuration du module Avoirs
|
||||
DiscountsNumberingModules=Modules de numérotation des avoirs
|
||||
DiscountsPDFModules=Modules d'avoirs PDF
|
||||
|
||||
|
||||
@ -83,3 +83,10 @@ ALTER TABLE `llx_commande` ADD `date_livraison` DATE;
|
||||
|
||||
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn);
|
||||
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid);
|
||||
|
||||
create table llx_avoir_model_pdf
|
||||
(
|
||||
nom varchar(50) PRIMARY KEY,
|
||||
libelle varchar(255),
|
||||
description text
|
||||
)type=innodb;
|
||||
30
mysql/tables/llx_avoir_model_pdf.sql
Normal file
30
mysql/tables/llx_avoir_model_pdf.sql
Normal file
@ -0,0 +1,30 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2001-2003 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$
|
||||
-- $Source$
|
||||
--
|
||||
-- Liste des modeles d'avoir pdf disponibles
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_avoir_model_pdf
|
||||
(
|
||||
nom varchar(50) PRIMARY KEY,
|
||||
libelle varchar(255),
|
||||
description text
|
||||
)type=innodb;
|
||||
Loading…
Reference in New Issue
Block a user