Uniformisation du code: Tous les modules de génération de document PDF s'active dans la table llx_document_model plutot que les n tables llx_xxxx_model_pdf.

Cela réduit le nombres de tables et permet plus de mutualisation du code. Ainsi, tous les modules peuvent avoir maintenant plusieurs modèle actifs, et 1 modèle défaut.
This commit is contained in:
Laurent Destailleur 2006-04-28 22:54:02 +00:00
parent 1222d9a1d9
commit ad4c4e7acd
29 changed files with 946 additions and 659 deletions

View File

@ -32,6 +32,7 @@ require("./pre.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills"); $langs->load("bills");
$langs->load("other");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
@ -43,48 +44,50 @@ if (!$user->admin)
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."avoir_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $type='creditnote';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'del') if ($_GET["action"] == 'del')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."avoir_model_pdf WHERE nom='".$_GET["value"]."'"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'setdoc')
$avoir_addon_var_pdf = $conf->global->AVOIR_ADDON_PDF;
if ($_GET["action"] == 'setpdf')
{ {
$db->begin();
if (dolibarr_set_const($db, "AVOIR_ADDON_PDF",$_GET["value"])) if (dolibarr_set_const($db, "AVOIR_ADDON_PDF",$_GET["value"]))
{ {
// La constante qui a été lue en avant du nouveau set // La constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent // on passe donc par une variable pour avoir un affichage cohérent
$avoir_addon_var_pdf = $_GET["value"]; $conf->global->AVOIR_ADDON_PDF = $_GET["value"];
} }
// On active le modele // On active le modele
$sql_del = "delete from ".MAIN_DB_PREFIX."avoir_model_pdf where nom = '".$_GET["value"]."';"; $type='creditnote';
$db->query($sql_del); $sql_del = "delete from ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."avoir_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql)) $result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit();
}
else
{
$db->rollback();
} }
} }
$avoir_addon_var = $conf->global->AVOIR_ADDON;
if ($_GET["action"] == 'setmod') if ($_GET["action"] == 'setmod')
{ {
// \todo Verifier si module numerotation choisi peut etre activé // \todo Verifier si module numerotation choisi peut etre activé
@ -96,7 +99,7 @@ if ($_GET["action"] == 'setmod')
{ {
// la constante qui a été lue en avant du nouveau set // la constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent // on passe donc par une variable pour avoir un affichage cohérent
$avoir_addon_var = $_GET["value"]; $conf->global->AVOIR_ADDON = $_GET["value"];
} }
} }
@ -105,10 +108,11 @@ if ($_GET["action"] == 'setmod')
* Affiche page * Affiche page
*/ */
$dir = DOL_DOCUMENT_ROOT .'/avoir/modules/';
llxHeader("",""); llxHeader("","");
$dir = DOL_DOCUMENT_ROOT .'/avoir/modules/';
$html=new Form($db);
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/facture.php"; $head[$h][0] = DOL_URL_ROOT."/admin/facture.php";
@ -134,11 +138,14 @@ print '<td>'.$langs->trans("Name")."</td>\n";
print '<td>'.$langs->trans("Description")."</td>\n"; print '<td>'.$langs->trans("Description")."</td>\n";
print '<td nowrap>'.$langs->trans("Example")."</td>\n"; print '<td nowrap>'.$langs->trans("Example")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
clearstatcache(); clearstatcache();
$handle = opendir($dir); $handle = opendir($dir);
$var=true;
if ($handle) if ($handle)
{ {
$var=true; $var=true;
@ -150,29 +157,36 @@ if ($handle)
require_once(DOL_DOCUMENT_ROOT ."/avoir/modules/".$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/avoir/modules/".$file.".php");
$modAvoir = new $file; $module = new $file;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>"; print "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>";
print "\n <td>".$modAvoir->info()."</td>\n"; print "\n <td>".$module->info()."</td>\n";
print "\n <td nowrap>".$modAvoir->getExample()."</td>\n";
// Affiche example
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
print '<td align="center">'; print '<td align="center">';
if ($avoir_addon_var == "$file") if ($conf->global->FACTURE_ADDON == "$file")
{ {
$title=''; print img_tick($langs->trans("Activated"));
if ($modAvoir->getNextValue() != $langs->trans("NotAvailable"))
{
$title=$langs->trans("NextValue").': '.$modAvoir->getNextValue();
}
print img_tick($title);
} }
else else
{ {
print "<a href=\"avoir.php?action=setmod&amp;value=".$file."\">".$langs->trans("Activate")."</a>"; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
} }
print '</td>'; print '</td>';
// Info
$htmltooltip='';
$nextval=$module->getNextValue();
if ($nextval != $langs->trans("NotAvailable"))
{
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
print ($htmltooltip?img_help(0):'');
print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -183,14 +197,16 @@ print "</table><br>\n";
/* /*
* PDF * Modeles de documents
*/ */
print_titre($langs->trans("DiscountsPDFModules")); print_titre($langs->trans("DiscountsPDFModules"));
// Defini tableau def de modele invoice
$def = array(); $def = array();
$sql = "SELECT nom";
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."avoir_model_pdf"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = 'creditnote'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -214,8 +230,9 @@ print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n"; print "<tr class=\"liste_titre\">\n";
print " <td width=\"140\">".$langs->trans("Name")."</td>\n"; print " <td width=\"140\">".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Description")."</td>\n"; print " <td>".$langs->trans("Description")."</td>\n";
print ' <td align="center" colspan="2">'.$langs->trans("Activated")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
print ' <td align="center">'.$langs->trans("Default")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -236,35 +253,53 @@ while (($file = readdir($handle))!==false)
print "</td>\n <td>\n"; print "</td>\n <td>\n";
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
print $obj->description; print $obj->description;
print '</td>';
print "</td>\n <td align=\"center\">\n"; // Activé
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print img_tick(); print "<td align=\"center\">\n";
print "</td>\n <td>"; if ($conf->global->FACTURE_AVOIR_ADDON_PDF != "$name")
print '<a href="avoir.php?action=del&amp;value='.$name.'">'.$langs->trans("Disable").'</a>'; {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable"));
print '</a>';
} }
else else
{ {
print "&nbsp;"; print img_tick($langs->trans("Enabled"));
print "</td>\n <td>";
print '<a href="avoir.php?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
} }
print "</td>";
print "</td>\n <td align=\"center\">";
if ($avoir_addon_var_pdf == "$name")
{
print img_tick();
} }
else else
{ {
print '<a href="avoir.php?action=setpdf&amp;value='.$name.'">'.$langs->trans("Activate").'</a>'; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>";
} }
print '</td></tr>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->FACTURE_AVOIR_ADDON_PDF == "$name")
{
print img_tick($langs->trans("Default"));
}
else
{
print '<a href="propale.php?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
}
print '</td>';
// Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($obj->type?$obj->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$obj->page_largeur;
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$obj->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($obj->option_logo);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print '</tr>';
} }
} }
closedir($handle); closedir($handle);

View File

@ -33,9 +33,10 @@
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills");
$langs->load("other");
$langs->load("orders"); $langs->load("orders");
llxHeader();
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
@ -45,50 +46,76 @@ if (!$user->admin)
* Actions * Actions
*/ */
if ($_GET["action"] == 'setmod')
{
dolibarr_set_const($db,'COMMANDE_ADDON',$_GET["value"]);
}
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $type='order';
$resql=$db->query($sql); $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
if (! $resql) if ($db->query($sql))
{ {
dolibarr_print_error($db);
} }
} }
if ($_GET["action"] == 'setpdf')
{
dolibarr_set_const($db,'COMMANDE_ADDON_PDF',$_GET["value"]);
// On active le modele
$sql_del = "delete from ".MAIN_DB_PREFIX."commande_model_pdf where nom = '".$_GET["value"]."';";
$resql=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_model_pdf (nom) VALUES ('".$_GET["value"]."')";
$resql=$db->query($sql);
if (! $resql)
{
dolibarr_print_error($db);
}
}
if ($_GET["action"] == 'del') if ($_GET["action"] == 'del')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_model_pdf WHERE nom='".$_GET["value"]."'"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'";
$resql=$db->query($sql); if ($db->query($sql))
if (! $resql)
{ {
dolibarr_print_error($db);
} }
} }
if ($_GET["action"] == 'setdoc')
{
$db->begin();
if (dolibarr_set_const($db, "COMMANDE_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
$conf->global->COMMANDE_ADDON_PDF = $_GET["value"];
}
// On active le modele
$type='order';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql);
if ($result1 && $result2)
{
$db->commit();
}
else
{
$db->rollback();
}
}
if ($_GET["action"] == 'setmod')
{
// \todo Verifier si module numerotation choisi peut etre activé
// par appel methode canBeActivated
if (dolibarr_set_const($db, "COMMANDE_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
$conf->global->COMMANDE_ADDON = $_GET["value"];
}
}
/* /*
* Affichage page * Affichage page
*/ */
llxHeader();
$dir = "../includes/modules/commande/"; $dir = "../includes/modules/commande/";
$html=new Form($db);
print_titre($langs->trans("OrdersSetup")); print_titre($langs->trans("OrdersSetup"));
@ -98,9 +125,11 @@ print_titre($langs->trans("OrdersNumberingModules"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="100">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>'; print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -119,27 +148,37 @@ if ($handle)
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
$modCommande = new $file; $module = new $file;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$modCommande->nom."</td><td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $modCommande->info(); print $module->info();
print '</td>'; print '</td>';
print '<td align="center" nowrap>'; // Examples
print $modCommande->getExample(); print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '</td>';
print '<td align="center">';
if ($conf->global->COMMANDE_ADDON == "$file") if ($conf->global->COMMANDE_ADDON == "$file")
{ {
print '<td align="center">'; print img_tick($langs->trans("Activated"));
print img_tick();
print '</td>';
} }
else else
{ {
print '<td align="center"><a href="commande.php?action=setmod&amp;value='.$file.'">'.$langs->trans("Activate").'</a></td>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Activate").'</a>';
} }
print '</td>';
// Info
$htmltooltip='';
$nextval=$module->getNextValue();
if ($nextval != $langs->trans("NotAvailable"))
{
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
print ($htmltooltip?img_help(0):'');
print '</td>';
print '</tr>'; print '</tr>';
} }
@ -147,26 +186,19 @@ if ($handle)
closedir($handle); closedir($handle);
} }
print '</table>'; print '</table><br>';
/* /*
* PDF * Modeles de documents
*/ */
print '<br>';
print_titre($langs->trans("OrdersModelModule")); print_titre($langs->trans("OrdersModelModule"));
print "<table class=\"noborder\" width=\"100%\">\n"; // Defini tableau def de modele propal
print "<tr class=\"liste_titre\">\n"; $type='order';
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Description")."</td>\n";
print ' <td align="center" width="100">'.$langs->trans("Activated")."</td>\n";
print ' <td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print "</tr>\n";
clearstatcache();
$def = array(); $def = array();
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."commande_model_pdf"; $sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -174,8 +206,8 @@ if ($resql)
$num_rows=$db->num_rows($resql); $num_rows=$db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows)
{ {
$obj = $db->fetch_object($resql); $array = $db->fetch_array($resql);
array_push($def, $obj->nom); array_push($def, $array[0]);
$i++; $i++;
} }
} }
@ -183,8 +215,23 @@ else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
$dir = "../includes/modules/commande/";
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Description")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n";
clearstatcache();
$handle=opendir($dir); $handle=opendir($dir);
$var=True;
$var=true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
@ -197,40 +244,56 @@ while (($file = readdir($handle))!==false)
print "$name"; print "$name";
print "</td>\n <td>\n"; print "</td>\n <td>\n";
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $module = new $classname($db);
print $module->description;
print $obj->description;
print "</td>\n"; print "</td>\n";
// Activé // Activé
print "<td align=\"center\">\n";
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print img_tick().' '; print "<td align=\"center\">\n";
if ($conf->global->COMMANDE_ADDON_PDF != "$name") if ($conf->global->COMMANDE_ADDON_PDF != "$name")
{ {
print '<a href="commande.php?action=del&amp;value='.$name.'">'.$langs->trans("Disable").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
} print img_tick($langs->trans("Disable"));
print '</a>';
} }
else else
{ {
print '<a href="commande.php?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>'; print img_tick($langs->trans("Enabled"));
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>";
} }
print "</td>\n";
// Defaut // Defaut
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->COMMANDE_ADDON_PDF == "$name") if ($conf->global->COMMANDE_ADDON_PDF == "$name")
{ {
print img_tick(); print img_tick($langs->trans("Default"));
} }
else else
{ {
print '<a href="commande.php?action=setpdf&amp;value='.$name.'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
} }
print '</td></tr>'; print '</td>';
// Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print "</tr>\n";
} }
} }
closedir($handle); closedir($handle);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
@ -33,110 +33,92 @@
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills");
$langs->load("other");
$langs->load("sendings"); $langs->load("sendings");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
// positionne la variable pour le test d'affichage de l'icone
$expedition_addon_var_pdf = EXPEDITION_ADDON_PDF;
$expedition_default = EXPEDITION_ADDON;
/* /*
* Actions * Actions
*/ */
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$file = DOL_DOCUMENT_ROOT . '/expedition/mods/methode_expedition_'.$_GET["value"].'.modules.php'; $type='shipping';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql))
{
$classname = 'methode_expedition_'.$_GET["value"]; }
require_once($file);
$obj = new $classname($db);
$obj->Active($_GET["statut"]);
Header("Location: expedition.php");
} }
if ($_GET["action"] == 'setpdf') if ($_GET["action"] == 'del')
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'";
if ($db->query($sql))
{
}
}
if ($_GET["action"] == 'setdoc')
{ {
$db->begin(); $db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON_PDF';"; if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$_GET["value"]))
$resql=$db->query($sql);
if ($resql)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON_PDF','".$_GET["value"]."',0)"; // La constante qui a été lue en avant du nouveau set
$resql=$db->query($sql);
if ($resql)
{
// la constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent // on passe donc par une variable pour avoir un affichage cohérent
$expedition_addon_var_pdf = $value; $conf->global->EXPEDITION_ADDON_PDF = $_GET["value"];
}
// On active le modele
$type='shipping';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql);
if ($result1 && $result2)
{
$db->commit(); $db->commit();
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} }
else else
{ {
$db->rollback(); $db->rollback();
dolibarr_print_error($db);
}
}
else
{
$db->rollback();
dolibarr_print_error($db);
} }
} }
if ($_GET["action"] == 'setdef') if ($_GET["action"] == 'setmod')
{ {
$db->begin(); // \todo Verifier si module numerotation choisi peut etre activé
// par appel methode canBeActivated
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'EXPEDITION_ADDON';";
$resql=$db->query($sql); if (dolibarr_set_const($db, "EXPEDITION_ADDON",$_GET["value"]))
if ($resql)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES ('EXPEDITION_ADDON','".$_GET["value"]."',0)";
$resql=$db->query($sql);
if ($resql)
{ {
// la constante qui a été lue en avant du nouveau set // la constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent // on passe donc par une variable pour avoir un affichage cohérent
$expedition_default = $_GET["value"]; $conf->global->EXPEDITION_ADDON = $_GET["value"];
$db->commit();
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
$db->rollback();
dolibarr_print_error($db);
}
}
else
{
$db->rollback();
dolibarr_print_error($db);
} }
} }
/* /*
* *
*/ */
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE statut = 1";
$db->fetch_all_rows($sql, $mods);
llxHeader(); llxHeader();
$dir = DOL_DOCUMENT_ROOT."/expedition/mods/"; $dir = DOL_DOCUMENT_ROOT."/expedition/mods/";
$html=new Form($db);
// Méthode de livraison // Méthode de livraison
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE statut = 1";
$db->fetch_all_rows($sql, $mods);
print_titre($langs->trans("SendingsSetup")); print_titre($langs->trans("SendingsSetup"));
@ -148,11 +130,13 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">'.$langs->trans("Active").'</td>'; print '<td align="center" width="60">'.$langs->trans("Active").'</td>';
print '<td align="center">'.$langs->trans("Default").'</td>'; print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
if(is_dir($dir)) { if(is_dir($dir))
{
$handle=opendir($dir); $handle=opendir($dir);
$var=true; $var=true;
@ -180,28 +164,32 @@ if(is_dir($dir)) {
{ {
print img_tick(); print img_tick();
print '</td><td align="center">'; print '</td><td align="center">';
print '<a href="expedition.php?action=set&amp;statut=0&amp;value='.$name.'">'.$langs->trans("Disable").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;statut=0&amp;value='.$name.'">'.$langs->trans("Disable").'</a>';
} }
else else
{ {
print '&nbsp;</td><td align="center">'; print '&nbsp;</td><td align="center">';
print '<a href="expedition.php?action=set&amp;statut=1&amp;value='.$name.'">'.$langs->trans("Activate").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;statut=1&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
} }
print '</td>'; print '</td>';
// Default // Default
print '<td align="center">'; print '<td align="center">';
if ($expedition_default == "$name") if ($conf->global->EXPEDITION_ADDON == "$name")
{ {
print img_tick(); print img_tick();
} }
else else
{ {
print '<a href="expedition.php?action=setdef&amp;value='.$name.'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$name.'">'.$langs->trans("Default").'</a>';
} }
print '</td>'; print '</td>';
// Info
print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
} }
} }
@ -213,16 +201,43 @@ else
} }
print '</table>'; print '</table>';
/*
* Modeles de documents
*/
print '<br>'; print '<br>';
// PDF
print_titre($langs->trans("SendingsReceiptModel")); print_titre($langs->trans("SendingsReceiptModel"));
// Defini tableau def de modele invoice
$type="shipping";
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$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);
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td align="center" colspan="2">'.$langs->trans("Active").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -249,22 +264,52 @@ if(is_dir($dir))
$obj = new $classname(); $obj = new $classname();
print $obj->description; print $obj->description;
print '</td>';
// Activ
print '</td><td align="center">'; if (in_array($name, $def))
if ($expedition_addon_var_pdf == "$name")
{ {
print img_tick(); print "<td align=\"center\">\n";
if ($conf->global->EXPEDITION_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable"));
print '</a>';
} }
else else
{ {
print "&nbsp;"; print img_tick($langs->trans("Enabled"));
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>";
} }
print "</td><td>\n"; // Defaut
print "<td align=\"center\">";
if ($conf->global->EXPEDITION_ADDON_PDF == "$name")
{
print img_tick($langs->trans("Default"));
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
}
print '</td>';
print '<a href="expedition.php?action=setpdf&amp;value='.$name.'">'.$langs->trans("Activate").'</a>'; // Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -33,35 +33,82 @@ require("./pre.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills"); $langs->load("bills");
$langs->load("other");
if (!$user->admin) if (!$user->admin)
accessforbidden(); 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'); $typeconst=array('yesno','texte','chaine');
/*
* Actions
*/
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$type='invoice';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql))
{
}
}
if ($_GET["action"] == 'del')
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'";
if ($db->query($sql))
{
}
}
if ($_GET["action"] == 'setdoc')
{
$db->begin();
if (dolibarr_set_const($db, "FACTURE_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
$conf->global->FACTURE_ADDON_PDF = $_GET["value"];
}
// On active le modele
$type='invoice';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql);
if ($result1 && $result2)
{
$db->commit();
}
else
{
$db->rollback();
}
}
if ($_GET["action"] == 'setmod')
{
// \todo Verifier si module numerotation choisi peut etre activé
// par appel methode canBeActivated
if (dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"])) if (dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"]))
$facture_addon_var = $_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
$conf->global->FACTURE_ADDON = $_GET["value"];
}
} }
if ($_POST["action"] == 'setribchq') 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_RIB_NUMBER",$_POST["rib"])) $conf->global->FACTURE_RIB_NUMBER = $_POST["rib"];
if (dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"])) $facture_chq_number_var = $_POST["chq"]; if (dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"])) $conf->global->FACTURE_CHQ_NUMBER = $_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') if ($_POST["action"] == 'setforcedate')
@ -92,12 +139,11 @@ if ($_GET["action"] == 'delete')
* Affiche page * Affiche page
*/ */
llxHeader("","");
$dir = "../includes/modules/facture/"; $dir = "../includes/modules/facture/";
$html=new Form($db); $html=new Form($db);
llxHeader("","");
$h = 0; $h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/facture.php"; $head[$h][0] = DOL_URL_ROOT."/admin/facture.php";
@ -123,13 +169,14 @@ print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td nowrap>'.$langs->trans("Example").'</td>'; print '<td nowrap>'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'; print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
clearstatcache(); clearstatcache();
$handle=opendir($dir); $handle=opendir($dir);
$var=True; $var=true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
@ -145,29 +192,37 @@ while (($file = readdir($handle))!==false)
$classname = "mod_facture_".$file; $classname = "mod_facture_".$file;
require_once($dir.$filebis); require_once($dir.$filebis);
$obj = new $classname($db); $module = new $classname($db);
print $obj->info(); print $module->info();
print '</td>'; print '</td>';
// Affiche example // Affiche example
print '<td>'.$obj->getExample().'</td>'; print '<td nowrap="nowrap">'.$module->getExample().'</td>';
print '<td align="center">'; print '<td align="center">';
if ($facture_addon_var == "$file") if ($conf->global->FACTURE_ADDON == "$file")
{ {
$title=''; print img_tick($langs->trans("Activated"));
if ($obj->getNextValue() != $langs->trans("NotAvailable"))
{
$title=$langs->trans("NextValue").': '.$obj->getNextValue();
}
print img_tick($title);
} }
else else
{ {
print '<a href="facture.php?action=set&amp;value='.$file.'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
} }
print "</td></tr>\n"; print '</td>';
// Info
$htmltooltip='';
$nextval=$module->getNextValue();
if ($nextval != $langs->trans("NotAvailable"))
{
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
print ($htmltooltip?img_help(0):'');
print '</td>';
print "</tr>\n";
} }
} }
closedir($handle); closedir($handle);
@ -176,10 +231,32 @@ print '</table>';
/* /*
* PDF * Modeles de documents
*/ */
print '<br>'; print '<br>';
print_titre("Modèles de facture pdf"); print_titre($langs->trans("BillsPDFModules"));
// Defini tableau def de modele invoice
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = 'invoice'";
$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);
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -187,6 +264,7 @@ print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'; print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -206,26 +284,56 @@ while (($file = readdir($handle))!==false)
echo "$name"; echo "$name";
print "</td><td>\n"; print "</td><td>\n";
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $module = new $classname($db);
print $module->description;
print '</td>';
print $obj->description; // Activé
if (in_array($name, $def))
print '</td><td align="center">';
if ($facture_addon_var_pdf == "$name")
{ {
print '&nbsp;'; print "<td align=\"center\">\n";
print '</td><td align="center">'; if ($conf->global->FACTURE_ADDON_PDF != "$name")
print img_tick(); {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable"));
print '</a>';
} }
else else
{ {
print '&nbsp;'; print img_tick($langs->trans("Enabled"));
print '</td><td align="center">'; }
print '<a href="facture.php?action=setpdf&amp;value='.$name.'">'.$langs->trans("Default").'</a>'; print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>";
} }
print "</td></tr>\n";
// Defaut
print "<td align=\"center\">";
if ($conf->global->FACTURE_ADDON_PDF == "$name")
{
print img_tick($langs->trans("Default"));
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
}
print '</td>';
// Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print "</tr>\n";
} }
} }
closedir($handle); closedir($handle);
@ -269,7 +377,7 @@ if ($db->query($sql))
$var=!$var; $var=!$var;
$row = $db->fetch_row($i); $row = $db->fetch_row($i);
if ($facture_rib_number_var == $row[0]) if ($conf->global->FACTURE_RIB_NUMBER == $row[0])
{ {
print '<option value="'.$row[0].'" selected="true">'.$row[1].'</option>'; print '<option value="'.$row[0].'" selected="true">'.$row[1].'</option>';
} }
@ -307,7 +415,7 @@ if ($db->query($sql))
$var=!$var; $var=!$var;
$row = $db->fetch_row($i); $row = $db->fetch_row($i);
if ($facture_chq_number_var == $row[0]) if ($conf->global->FACTURE_CHQ_NUMBER == $row[0])
{ {
print '<option value="'.$row[0].'" selected="true">'.$row[1].'</option>'; print '<option value="'.$row[0].'" selected="true">'.$row[1].'</option>';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* *
@ -32,34 +32,73 @@
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills");
$langs->load("other");
$langs->load("interventions"); $langs->load("interventions");
llxHeader();
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$ficheinter_addon_var_pdf = FICHEINTER_ADDON_PDF; /*
* Actions
*/
if ($_GET["action"] == 'set')
if ($_GET["action"] == 'setpdf')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'FICHEINTER_ADDON_PDF' ;"; $type='ficheinter';
$db->query($sql);$sql =''; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('FICHEINTER_ADDON_PDF','".$_GET["value"]."',0) ; ";
if ($db->query($sql)) if ($db->query($sql))
{ {
// la constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent
$ficheinter_addon_var_pdf = $_GET["value"];
} }
} }
$dir = "../includes/modules/fichinter/"; if ($_GET["action"] == 'del')
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'";
if ($db->query($sql))
{
}
}
if ($_GET["action"] == 'setdoc')
{
$db->begin();
if (dolibarr_set_const($db, "FICHEINTER_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
$conf->global->FICHEINTER_ADDON_PDF = $_GET["value"];
}
// On active le modele
$type='ficheinter';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql);
if ($result1 && $result2)
{
$db->commit();
}
else
{
$db->rollback();
}
}
/*
* Affichage page
*/
llxHeader();
$dir = "../includes/modules/fichinter/";
$html=new Form($db);
print_titre($langs->trans("InterventionsSetup")); print_titre($langs->trans("InterventionsSetup"));
@ -67,12 +106,37 @@ print "<br>";
print_titre($langs->trans("TemplatePDFInterventions")); print_titre($langs->trans("TemplatePDFInterventions"));
// Defini tableau def des modeles
$type='ficheinter';
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$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);
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
print '<td>&nbsp;</td>'; print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -93,26 +157,56 @@ while (($file = readdir($handle))!==false)
echo "$name"; echo "$name";
print "</td><td>\n"; print "</td><td>\n";
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname(); $module = new $classname();
print $module->description;
print '</td>';
print $obj->description; // Activé
if (in_array($name, $def))
print '</td><td align="center">';
if ($ficheinter_addon_var_pdf == "$name")
{ {
print img_tick(); print "<td align=\"center\">\n";
if ($conf->global->FICHEINTER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable"));
print '</a>';
} }
else else
{ {
print "&nbsp;"; print img_tick($langs->trans("Enabled"));
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>";
} }
print "</td><td>\n"; // Defaut
print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{
print img_tick($langs->trans("Default"));
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
}
print '</td>';
print '<a href="fichinter.php?action=setpdf&value='.$name.'">'.$langs->trans("Activate").'</a>'; // Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print '</td></tr>'; print '</tr>';
} }
} }
closedir($handle); closedir($handle);

View File

@ -33,22 +33,29 @@
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("bills");
$langs->load("propal"); $langs->load("propal");
$langs->load("other");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
/*
* Actions
*/
if ($_POST["action"] == 'nbprod') if ($_POST["action"] == 'nbprod')
{ {
dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]); dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]);
Header("Location: propale.php"); Header("Location: propale.php");
exit; exit;
} }
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $type='propal';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql)) if ($db->query($sql))
{ {
@ -56,51 +63,51 @@ if ($_GET["action"] == 'set')
} }
if ($_GET["action"] == 'del') if ($_GET["action"] == 'del')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom='".$_GET["value"]."'"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom='".$_GET["value"]."'";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'setdoc')
$propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF;
if ($_GET["action"] == 'setpdf')
{ {
$db->begin();
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"])) if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"]))
{ {
// La constante qui a été lue en avant du nouveau set // La constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent // on passe donc par une variable pour avoir un affichage cohérent
$propale_addon_var_pdf = $_GET["value"]; $conf->global->PROPALE_ADDON_PDF = $_GET["value"];
} }
// On active le modele // On active le modele
$sql_del = "delete from ".MAIN_DB_PREFIX."propal_model_pdf where nom = '".$_GET["value"]."';"; $type='propal';
$db->query($sql_del); $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model where nom = '".$_GET["value"]."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql)) $result2=$db->query($sql);
if ($result1 && $result2)
{ {
$db->commit();
}
else
{
$db->rollback();
} }
} }
$propale_addon_var = $conf->global->PROPALE_ADDON;
if ($_GET["action"] == 'setmod') if ($_GET["action"] == 'setmod')
{ {
// \todo Verifier si module numerotation choisi peut etre activé // \todo Verifier si module numerotation choisi peut etre activé
// par appel methode canBeActivated // par appel methode canBeActivated
if (dolibarr_set_const($db, "PROPALE_ADDON",$_GET["value"])) if (dolibarr_set_const($db, "PROPALE_ADDON",$_GET["value"]))
{ {
// la constante qui a été lue en avant du nouveau set // la constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent // on passe donc par une variable pour avoir un affichage cohérent
$propale_addon_var = $_GET["value"]; $conf->global->PROPALE_ADDON = $_GET["value"];
} }
} }
@ -109,14 +116,14 @@ if ($_GET["action"] == 'setmod')
* Affiche page * Affiche page
*/ */
$dir = "../includes/modules/propale/";
llxHeader('',$langs->trans("PropalSetup")); llxHeader('',$langs->trans("PropalSetup"));
print_titre($langs->trans("PropalSetup")); $dir = "../includes/modules/propale/";
$html=new Form($db);
print_titre($langs->trans("PropalSetup"));
/* /*
* Module numérotation * Module numérotation
*/ */
@ -129,6 +136,7 @@ print '<td>'.$langs->trans("Name")."</td>\n";
print '<td>'.$langs->trans("Description")."</td>\n"; print '<td>'.$langs->trans("Description")."</td>\n";
print '<td nowrap>'.$langs->trans("Example")."</td>\n"; print '<td nowrap>'.$langs->trans("Example")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>'; print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
clearstatcache(); clearstatcache();
@ -145,29 +153,36 @@ if ($handle)
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$file.".php");
$modPropale = new $file; $module = new $file;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>"; print "<tr ".$bc[$var].">\n <td width=\"140\">".$file."</td>";
print "\n <td>".$modPropale->info()."</td>\n"; print "\n <td>".$module->info()."</td>\n";
print "\n <td nowrap>".$modPropale->getExample()."</td>\n";
// Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '<td align="center">'; print '<td align="center">';
if ($propale_addon_var == "$file") if ($conf->global->PROPALE_ADDON == "$file")
{ {
$title=''; print img_tick($langs->trans("Activated"));
if ($modPropale->getNextValue() != $langs->trans("NotAvailable"))
{
$title=$langs->trans("NextValue").': '.$modPropale->getNextValue();
}
print img_tick($title);
} }
else else
{ {
print "<a href=\"propale.php?action=setmod&amp;value=".$file."\">".$langs->trans("Activate")."</a>"; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Activate").'</a>';
} }
print '</td>'; print '</td>';
// Info
$htmltooltip='';
$nextval=$module->getNextValue();
if ($nextval != $langs->trans("NotAvailable"))
{
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
}
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
print ($htmltooltip?img_help(0):'');
print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -178,14 +193,16 @@ print "</table><br>\n";
/* /*
* PDF * Modeles de documents
*/ */
print_titre($langs->trans("ProposalsPDFModules")); print_titre($langs->trans("ProposalsPDFModules"));
// Defini tableau def de modele propal
$def = array(); $def = array();
$sql = "SELECT nom";
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."propal_model_pdf"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = 'propal'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -209,8 +226,9 @@ print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n"; print "<tr class=\"liste_titre\">\n";
print " <td width=\"140\">".$langs->trans("Name")."</td>\n"; print " <td width=\"140\">".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Description")."</td>\n"; print " <td>".$langs->trans("Description")."</td>\n";
print ' <td align="center" colspan="2">'.$langs->trans("Activated")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
print ' <td align="center">'.$langs->trans("Default")."</td>\n"; print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n"; print "</tr>\n";
clearstatcache(); clearstatcache();
@ -231,35 +249,55 @@ while (($file = readdir($handle))!==false)
print "</td>\n <td>\n"; print "</td>\n <td>\n";
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
print $obj->description; print $obj->description;
print '</td>';
print "</td>\n <td align=\"center\">\n"; // Activé
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print img_tick(); print "<td align=\"center\">\n";
print "</td>\n <td>"; if ($conf->global->PROPALE_ADDON_PDF != "$name")
print '<a href="propale.php?action=del&amp;value='.$name.'">'.$langs->trans("Disable").'</a>'; {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable"));
print '</a>';
} }
else else
{ {
print "&nbsp;"; print img_tick($langs->trans("Enabled"));
print "</td>\n <td>";
print '<a href="propale.php?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
} }
print "</td>";
print "</td>\n <td align=\"center\">";
if ($propale_addon_var_pdf == "$name")
{
print img_tick();
} }
else else
{ {
print '<a href="propale.php?action=setpdf&amp;value='.$name.'">'.$langs->trans("Activate").'</a>'; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>";
} }
print '</td></tr>';
// Defaut
print "<td align=\"center\">";
if ($conf->global->PROPALE_ADDON_PDF == "$name")
{
print img_tick($langs->trans("Default"));
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
}
print '</td>';
// Info
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($obj->type?$obj->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$obj->page_largeur;
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$obj->page_hauteur;
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($obj->option_logo);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($obj->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($obj->option_condreg);
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
print "</tr>\n";
} }
} }
closedir($handle); closedir($handle);
@ -303,7 +341,9 @@ print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
print '<br>';
$db->close(); $db->close();
llxFooter(); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -57,9 +57,11 @@ class ModelePDFCommandesSuppliers extends FPDF
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='supplier_order';
$liste=array(); $liste=array();
$sql ="SELECT nom as id, nom as lib"; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."commande_fournisseur_model_pdf"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -68,7 +68,7 @@ class Form
{ {
global $conf; global $conf;
$s =''; $s ='';
if ($conf->use_javascript) if ($conf->use_javascript && $htmltooltip)
{ {
$s.=' onmouseover="showtip(\''.$htmltooltip.'\')"'; $s.=' onmouseover="showtip(\''.$htmltooltip.'\')"';
$s.=' onMouseout="hidetip()"'; $s.=' onMouseout="hidetip()"';

View File

@ -57,9 +57,11 @@ class ModelePDFCommandes extends FPDF
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='order';
$liste=array(); $liste=array();
$sql ="SELECT nom as id, nom as lib"; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."commande_model_pdf"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -22,9 +22,9 @@
*/ */
/** /**
\file htdocs/includes/modules/commande/pdf_rouge.modules.php \file htdocs/includes/modules/commande/pdf_edison.modules.php
\ingroup propale \ingroup commande
\brief Fichier de la classe permettant de générer les commandes au modèle Rouge \brief Fichier de la classe permettant de générer les commandes au modèle Edison
\version $Revision$ \version $Revision$
*/ */
@ -32,23 +32,24 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php
/** /**
\class pdf_propale_rouge \class pdf_edison
\brief Classe permettant de générer les commandes au modèle Rouge \brief Classe permettant de générer les commandes au modèle Edison
*/ */
class pdf_rouge extends ModelePDFCommandes class pdf_edison extends ModelePDFCommandes
{ {
/** \brief Constructeur /** \brief Constructeur
\param db handler accès base de donnée \param db handler accès base de donnée
*/ */
function pdf_rouge($db=0) function pdf_edison($db=0)
{ {
$this->db = $db; $this->db = $db;
$this->name = "rouge"; $this->name = "edison";
$this->description = "Modèle de commande simple"; $this->description = "Modèle de commande simple";
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -21,9 +21,9 @@
*/ */
/** /**
\file htdocs/includes/modules/commande/pdf_azur.modules.php \file htdocs/includes/modules/commande/pdf_einstein.modules.php
\ingroup propale \ingroup commande
\brief Fichier de la classe permettant de générer les commandes au modèle Azur \brief Fichier de la classe permettant de générer les commandes au modèle Einstein
\author Laurent Destailleur \author Laurent Destailleur
\version $Revision$ \version $Revision$
\version $Revision$ \version $Revision$
@ -34,26 +34,27 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
/** /**
\class pdf_propale_azur \class pdf_einstein
\brief Classe permettant de générer les commandes au modèle Azur \brief Classe permettant de générer les commandes au modèle Einstein
*/ */
class pdf_azur extends ModelePDFCommandes class pdf_einstein extends ModelePDFCommandes
{ {
/** /**
\brief Constructeur \brief Constructeur
\param db Handler accès base de donnée \param db Handler accès base de donnée
*/ */
function pdf_azur($db) function pdf_einstein($db)
{ {
global $conf,$langs; global $conf,$langs;
$this->db = $db; $this->db = $db;
$this->name = "azur"; $this->name = "einstein";
$this->description = "Modèle de commandes complet (logo...)"; $this->description = "Modèle de commandes complet (logo...)";
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
@ -66,8 +67,6 @@ class pdf_azur extends ModelePDFCommandes
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA
$this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;

View File

@ -58,8 +58,11 @@ class ModeleDon extends FPDF
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='donation';
$liste=array(); $liste=array();
$sql =""; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -53,6 +53,7 @@ class pdf_crabe extends ModelePDFFactures
$this->description = "Modèle de facture complet (Gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, logo...)"; $this->description = "Modèle de facture complet (Gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, logo...)";
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
@ -65,8 +66,6 @@ class pdf_crabe extends ModelePDFFactures
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA
$this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;

View File

@ -62,8 +62,11 @@ class ModelePDFFicheinter extends FPDF
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='ficheinter';
$liste=array(); $liste=array();
$sql =""; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -153,8 +153,8 @@ class modPropale extends DolibarrModules
$this->dirs[1] = $conf->propal->dir_images; $this->dirs[1] = $conf->propal->dir_images;
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom = '".$this->const[0][2]."'", "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."'",
"INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES('".$this->const[0][2]."');", "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES('".$this->const[0][2]."','propal')",
); );
return $this->_init($sql); return $this->_init($sql);

View File

@ -54,9 +54,11 @@ class ModelePDFPropales extends FPDF
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='propal';
$liste=array(); $liste=array();
$sql ="SELECT nom as id, nom as lib"; $sql ="SELECT nom as id, nom as lib";
$sql.=" FROM ".MAIN_DB_PREFIX."propal_model_pdf"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -54,6 +54,7 @@ class pdf_propale_azur extends ModelePDFPropales
$this->description = "Modèle de propositions commerciales complet (logo...)"; $this->description = "Modèle de propositions commerciales complet (logo...)";
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf';
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
@ -66,8 +67,6 @@ class pdf_propale_azur extends ModelePDFPropales
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA
$this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;

View File

@ -375,16 +375,24 @@ ErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to
BillsSetup=Invoices module setup BillsSetup=Invoices module setup
BillsDate=Invoices date BillsDate=Invoices date
BillsNumberingModule=Invoices numbering module BillsNumberingModule=Invoices numbering module
BillsPDFModules=Invoice documents models
DiscountSetup=Credit note module setup
DiscountsNumberingModules=Credit note numbering modules
DiscountsPDFModules=Credit note document models
Discounts=Discounts
##### Proposals ##### ##### Proposals #####
PropalSetup=Commercial proposals module setup PropalSetup=Commercial proposals module setup
CreateForm=Create forms CreateForm=Create forms
NumberOfProductLines=Number of product lines NumberOfProductLines=Number of product lines
PathToDocuments=Path to documents PathToDocuments=Path to documents
ProposalsNumberingModules=Commercial proposal numbering modules ProposalsNumberingModules=Commercial proposal numbering modules
ProposalsPDFModules=Commercial proposal PDF modules ProposalsPDFModules=Commercial proposal documents models
##### Orders ##### ##### Orders #####
OrdersSetup=Orders' management setup OrdersSetup=Orders' management setup
OrdersNumberingModules=Orders numbering modules OrdersNumberingModules=Orders numbering modules
OrdersModelModule=Order documents models
##### Fiche inter #####
TemplatePDFInterventions=Intervention card documents models
##### Clicktodial ##### ##### Clicktodial #####
ClickToDialSetup=Click To Dial module setup ClickToDialSetup=Click To Dial module setup
##### Bookmark4u ##### ##### Bookmark4u #####
@ -455,8 +463,3 @@ NewRSS=New RSS
##### Mailing ##### ##### Mailing #####
MailingSetup=Mailing module setup 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
Discounts=Discounts

View File

@ -6,7 +6,6 @@ NewIntervention=New intervention
EditIntervention=Editer intervention EditIntervention=Editer intervention
AddIntervention=Add intervention AddIntervention=Add intervention
ListOfInterventions=List of interventions ListOfInterventions=List of interventions
TemplatePDFInterventions=PDF template for intervention cards
LastInterventions=Last %s interventions LastInterventions=Last %s interventions
AllInterventions=All interventions AllInterventions=All interventions
CreateDaftIntervention=Create draft CreateDaftIntervention=Create draft

View File

@ -47,6 +47,9 @@ CanceledBy=Canceled by %s
ClosedBy=Closed by %s ClosedBy=Closed by %s
FileWasRemoved=File was deleted FileWasRemoved=File was deleted
FeatureNotYetAvailable=Feature not yet available in this version FeatureNotYetAvailable=Feature not yet available in this version
FeaturesSupported=Features not supported
Width=Width
Height=Height
##### Webcal ##### ##### Webcal #####
LoginWebcal=Login for Webcalendar LoginWebcal=Login for Webcalendar
AddCalendarEntry=Add entry in calendar AddCalendarEntry=Add entry in calendar

View File

@ -375,16 +375,24 @@ ErrorConnectOkButWrongDatabase=La connexion a r
BillsSetup=Configuration du module Factures BillsSetup=Configuration du module Factures
BillsDate=Date des factures BillsDate=Date des factures
BillsNumberingModule=Module de numérotation des factures BillsNumberingModule=Module de numérotation des factures
BillsPDFModules=Modèle de document de factures
DiscountSetup=Configuration du module Avoirs
DiscountsNumberingModules=Modules de numérotation des avoirs
DiscountsPDFModules=Modèles de documents des avoirs
Discounts=Avoirs
##### Proposals ##### ##### Proposals #####
PropalSetup=Configuration du module Propositions Commerciales PropalSetup=Configuration du module Propositions Commerciales
CreateForm=Création formulaire CreateForm=Création formulaire
NumberOfProductLines=Nombre de lignes produits NumberOfProductLines=Nombre de lignes produits
PathToDocuments=Chemins d'accès aux documents PathToDocuments=Chemins d'accès aux documents
ProposalsNumberingModules=Modules de numérotation des propositions commerciales ProposalsNumberingModules=Modules de numérotation des propositions commerciales
ProposalsPDFModules=Modules de propositions commerciales PDF ProposalsPDFModules=Modèles de documents de propositions commerciales
##### Orders ##### ##### Orders #####
OrdersSetup=Configuration du module Commandes OrdersSetup=Configuration du module Commandes
OrdersNumberingModules=Modules de numérotation des commandes OrdersNumberingModules=Modules de numérotation des commandes
OrdersModelModule=Modèles de document des commandes
##### Fiche inter #####
TemplatePDFInterventions=Modèle de documents des fiches d'interventions
##### Clicktodial ##### ##### Clicktodial #####
ClickToDialSetup=Configuration du module Click To Dial ClickToDialSetup=Configuration du module Click To Dial
##### Bookmark4u ##### ##### Bookmark4u #####
@ -455,9 +463,5 @@ NewRSS=Syndication d'un nouveau flux RSS
##### Mailing ##### ##### Mailing #####
MailingSetup=Configuration du module EMailing MailingSetup=Configuration du module EMailing
MailingEMailFrom=Email emetteur (From) des mails envoyés par 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=Modèles d'avoirs PDF
Discounts=Avoirs

View File

@ -6,7 +6,6 @@ NewIntervention=Nouvelle intervention
AddIntervention=Créer intervention AddIntervention=Créer intervention
ListOfInterventions=Liste des interventions ListOfInterventions=Liste des interventions
EditIntervention=Editer EditIntervention=Editer
TemplatePDFInterventions=Modèle PDF des fiches d'interventions
LastInterventions=Les %s dernières interventions LastInterventions=Les %s dernières interventions
AllInterventions=Toutes les interventions AllInterventions=Toutes les interventions
CreateDaftIntervention=Créer brouillon CreateDaftIntervention=Créer brouillon

View File

@ -47,6 +47,9 @@ CanceledBy=Annul
ClosedBy=Cloturé par %s ClosedBy=Cloturé par %s
FileWasRemoved=Le fichier a été supprimé FileWasRemoved=Le fichier a été supprimé
FeatureNotYetAvailable=Fonctionnalité pas encore disponible dans cette version FeatureNotYetAvailable=Fonctionnalité pas encore disponible dans cette version
FeaturesSupported=Fonctionnalités supportées
Width=Largeur
Height=Hauteur
##### Webcal ##### ##### Webcal #####
LoginWebcal=Login Webcalendar LoginWebcal=Login Webcalendar
AddCalendarEntry=Ajouter entrée dans le calendrier AddCalendarEntry=Ajouter entrée dans le calendrier

View File

@ -707,11 +707,12 @@ function img_disable($alt = "default")
\brief Affiche logo help avec curseur "?" \brief Affiche logo help avec curseur "?"
\return string Retourne tag img \return string Retourne tag img
*/ */
function img_help() function img_help($usehelpcursor=1)
{ {
global $conf,$langs; global $conf,$langs;
return '<img style="cursor: help;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/help.png" border="0" alt="" title="">'; return '<img '.($usehelpcursor?'style="cursor: help;" ':'').' src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/help.png" border="0" alt="" title="">';
} }
/** /**
\brief Affiche picto calendrier "?" \brief Affiche picto calendrier "?"
\return string Retourne tag img \return string Retourne tag img

View File

@ -6,7 +6,7 @@
-- --
drop table llx_commande_model_pdf if exist; drop table if exists llx_commande_model_pdf;
alter table llx_commande add column note_public text after note; alter table llx_commande add column note_public text after note;
@ -62,7 +62,7 @@ update llx_actioncomm set datec = datea where datec is null;
update llx_actioncomm set datep = datea where datep is null; update llx_actioncomm set datep = datea where datep is null;
drop table llx_expedition_model_pdf if exists; drop table if exists llx_expedition_model_pdf;
create table llx_product_det create table llx_product_det

View File

@ -1,30 +0,0 @@
-- ===================================================================
-- 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;

View File

@ -1,30 +0,0 @@
-- ===================================================================
-- 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 de commande pdf disponibles
--
-- ===================================================================
create table llx_commande_model_pdf
(
nom varchar(50) PRIMARY KEY,
libelle varchar(255),
description text
)type=innodb;

View File

@ -1,30 +0,0 @@
-- ===================================================================
-- 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 de bon de livraison pdf disponibles
--
-- ===================================================================
create table llx_expedition_model_pdf
(
nom varchar(50) PRIMARY KEY,
libelle varchar(255),
description text
)type=innodb;

View File

@ -1,30 +0,0 @@
-- ===================================================================
-- 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 de propale pdf disponibles
--
-- ===================================================================
create table llx_propal_model_pdf
(
nom varchar(50) PRIMARY KEY,
libelle varchar(255),
description text
)type=innodb;