Maxi debug for UTF8 support

This commit is contained in:
Laurent Destailleur 2008-10-28 20:05:23 +00:00
parent 767185b9b6
commit 7deb33c52d
45 changed files with 1485 additions and 1375 deletions

View File

@ -69,11 +69,21 @@ if ($_GET["action"] == 'specimen')
$obj = new $classname($db); $obj = new $classname($db);
if ($obj->write_file($commande) > 0) if ($obj->write_file($commande,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
return; return;
} }
else
{
$mesg='<div class="error">'.$obj->error.'</div>';
dolibarr_syslog($obj->error, LOG_ERR);
}
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }

View File

@ -55,11 +55,21 @@ if ($_GET["action"] == 'specimen')
$obj = new $classname($db); $obj = new $classname($db);
if ($obj->write_file($don) > 0) if ($obj->write_file($don,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=don&file=SPECIMEN.html"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=don&file=SPECIMEN.html");
return; return;
} }
else
{
$mesg='<div class="error">'.$obj->error.'</div>';
dolibarr_syslog($obj->error, LOG_ERR);
}
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }

View File

@ -78,10 +78,16 @@ if ($_GET["action"] == 'specimen')
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
return; return;
} }
else
{
$mesg='<div class="error">'.$obj->error.'</div>';
dolibarr_syslog($obj->error, LOG_ERR);
}
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }

View File

@ -78,10 +78,16 @@ if ($_GET["action"] == 'specimen')
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
return; return;
} }
else
{
$mesg='<div class="error">'.$obj->error.'</div>';
dolibarr_syslog($obj->error, LOG_ERR);
}
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }

View File

@ -21,11 +21,11 @@
*/ */
/** /**
\file htdocs/admin/fournisseur.php \file htdocs/admin/fournisseur.php
\ingroup fournisseur \ingroup fournisseur
\brief Page d'administration-configuration du module Fournisseur \brief Page d'administration-configuration du module Fournisseur
\version $Id$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
@ -38,7 +38,7 @@ $langs->load("other");
$langs->load("orders"); $langs->load("orders");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
/* /*
@ -54,92 +54,98 @@ if ($_POST["action"] == 'updateMask')
if ($_GET["action"] == 'specimen') if ($_GET["action"] == 'specimen')
{ {
$modele=$_GET["module"]; $modele=$_GET["module"];
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
// Charge le modele // Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/";
$file = "pdf_".$modele.".modules.php"; $file = "pdf_".$modele.".modules.php";
if (file_exists($dir.$file)) if (file_exists($dir.$file))
{
$classname = "pdf_".$modele;
require_once($dir.$file);
$obj = new $classname($db);
if ($obj->write_file($commande,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf"); $classname = "pdf_".$modele;
return; require_once($dir.$file);
$obj = new $classname($db);
if ($obj->write_file($commande,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
return;
}
else
{
$mesg='<div class="error">'.$obj->error.'</div>';
dolibarr_syslog($obj->error, LOG_ERR);
}
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
}
} }
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$type='supplier_order'; $type='supplier_order';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'del') if ($_GET["action"] == 'del')
{ {
$type='supplier_order'; $type='supplier_order';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'setdoc') if ($_GET["action"] == 'setdoc')
{ {
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"])) if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"]))
{ {
$conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $_GET["value"]; $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $_GET["value"];
} }
// On active le modele // On active le modele
$type='supplier_order'; $type='supplier_order';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
$result1=$db->query($sql_del); $result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql); $result2=$db->query($sql);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
} }
else else
{ {
$db->rollback(); $db->rollback();
} }
} }
if ($_GET["action"] == 'setmod') if ($_GET["action"] == 'setmod')
{ {
// \todo Verifier si module numerotation choisi peut etre activ<69> // \todo Verifier si module numerotation choisi peut etre activ<69>
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"]); dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"]);
} }
if ($_POST["action"] == 'addcat') if ($_POST["action"] == 'addcat')
{ {
$fourn = new Fournisseur($db); $fourn = new Fournisseur($db);
$fourn->CreateCategory($user,$_POST["cat"]); $fourn->CreateCategory($user,$_POST["cat"]);
} }
// d<>fini les constantes du mod<6F>le orchidee // d<>fini les constantes du mod<6F>le orchidee
@ -183,55 +189,55 @@ clearstatcache();
$handle = opendir($dir); $handle = opendir($dir);
if ($handle) if ($handle)
{ {
$var=true; $var=true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php') if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php')
{ {
$file = substr($file, 0, strlen($file)-4); $file = substr($file, 0, strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php");
$module = new $file; $module = new $file;
if ($module->isEnabled()) if ($module->isEnabled())
{ {
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Examples // Examples
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n"; print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
print '<td align="center">'; print '<td align="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file") if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file")
{ {
print img_tick($langs->trans("Activated")); print img_tick($langs->trans("Activated"));
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.$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>';
$commande=new CommandeFournisseur($db); $commande=new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.='<b>'.$langs->trans("Version").'</b>: '.$module->getVersion().'<br>'; $htmltooltip.='<b>'.$langs->trans("Version").'</b>: '.$module->getVersion().'<br>';
$facture->type=0; $facture->type=0;
$nextval=$module->getNextValue($mysoc,$commande); $nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {
$htmltooltip.='<b>'.$langs->trans("NextValue").'</b>: '; $htmltooltip.='<b>'.$langs->trans("NextValue").'</b>: ';
if ($nextval) if ($nextval)
{ {
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} }
@ -241,15 +247,15 @@ if ($handle)
} }
} }
print '<td align="center">'; print '<td align="center">';
print $html->textwithhelp('',$htmltooltip,1,0); print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
} }
closedir($handle); closedir($handle);
} }
print '</table><br>'; print '</table><br>';
@ -302,120 +308,120 @@ $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_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print "</td>\n";
// Activ<69>
if (in_array($name, $def))
{ {
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print "</td>\n";
// Activ<69>
if (in_array($name, $def))
{
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'">';
print img_tick($langs->trans("Disable")); print img_tick($langs->trans("Disable"));
print '</a>'; print '</a>';
} }
else else
{ {
print img_tick($langs->trans("Enabled")); print img_tick($langs->trans("Enabled"));
} }
print "</td>"; print "</td>";
} }
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
print "</td>"; print "</td>";
} }
// Defaut // Defaut
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
{ {
print img_tick($langs->trans("Default")); print img_tick($langs->trans("Default"));
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'" alt="'.$langs->trans("Default").'">'.$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>';
// 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><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">';
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
} }
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><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">';
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
} }
closedir($handle); closedir($handle);
print '</table><br/>'; print '</table><br/>';
/* Obsolete. Les categories de fournisseurs sont gerees dans la table llx_categories /* Obsolete. Les categories de fournisseurs sont gerees dans la table llx_categories
sur le meme principe que les categories clients et produits sur le meme principe que les categories clients et produits
print_titre($langs->trans("Categories")); print_titre($langs->trans("Categories"));
$sql = "SELECT rowid, label"; $sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie"; $sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie";
$sql.= " ORDER BY label ASC"; $sql.= " ORDER BY label ASC";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
print '<form action="fournisseur.php" method="POST"><table class="liste" width="100%">'; print '<form action="fournisseur.php" method="POST"><table class="liste" width="100%">';
print '<input type="hidden" name="action" value="addcat">'; print '<input type="hidden" name="action" value="addcat">';
print '<tr class="liste_titre"><td>'; print '<tr class="liste_titre"><td>';
print $langs->trans("Num").'</td><td>'.$langs->trans("Name"); print $langs->trans("Num").'</td><td>'.$langs->trans("Name");
print "</td></tr>\n"; print "</td></tr>\n";
$var=True; $var=True;
print "<tr $bc[$var]><td>&nbsp;</td>"; print "<tr $bc[$var]><td>&nbsp;</td>";
print '<td><input type="text" name="cat">&nbsp;'; print '<td><input type="text" name="cat">&nbsp;';
print '<input type="submit" value="'.$langs->trans("Add").'">'; print '<input type="submit" value="'.$langs->trans("Add").'">';
print "</td></tr>\n"; print "</td></tr>\n";
while ($obj = $db->fetch_object($resql)) while ($obj = $db->fetch_object($resql))
{ {
$var=!$var; $var=!$var;
print "<tr $bc[$var]>\n"; print "<tr $bc[$var]>\n";
print '<td width="10%">'.$obj->rowid.'</td>'; print '<td width="10%">'.$obj->rowid.'</td>';
print '<td width="90%"><a href="liste.php?cat='.$obj->rowid.'">'.stripslashes($obj->label).'</a></td>'; print '<td width="90%"><a href="liste.php?cat='.$obj->rowid.'">'.stripslashes($obj->label).'</a></td>';
print "</tr>\n"; print "</tr>\n";
} }
print "</table></form>\n"; print "</table></form>\n";
$db->free($resql); $db->free($resql);
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
*/ */
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -70,11 +70,21 @@ if ($_GET["action"] == 'specimen')
$module = new $classname($db); $module = new $classname($db);
if ($module->write_file($propal) > 0) if ($module->write_file($propal,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
return; return;
} }
else
{
$mesg='<div class="error">'.$module->error.'</div>';
dolibarr_syslog($module->error, LOG_ERR);
}
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }

View File

@ -77,7 +77,7 @@ class CommActionRapport
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -15,15 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/comm/pre.inc.php \file htdocs/comm/pre.inc.php
\ingroup commercial \ingroup commercial
\brief Fichier de gestion du menu gauche de l'espace commercial \brief Fichier de gestion du menu gauche de l'espace commercial
\version $Revision$ \version $Id$
*/ */
require("../main.inc.php"); require("../main.inc.php");

View File

@ -22,10 +22,10 @@
*/ */
/** /**
\file htdocs/comm/propal.php * \file htdocs/comm/propal.php
\ingroup propale * \ingroup propale
\brief Page liste des propales (vision commercial) * \brief Page liste des propales (vision commercial)
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");

View File

@ -18,10 +18,10 @@
*/ */
/** /**
\file htdocs/commande/index.php * \file htdocs/commande/index.php
\ingroup commande * \ingroup commande
\brief Page acceuil espace commandes * \brief Page acceuil espace commandes
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -42,6 +42,11 @@ if ($user->societe_id > 0)
} }
/*
* View
*/
$commandestatic=new Commande($db); $commandestatic=new Commande($db);
$html = new Form($db); $html = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);

View File

@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/compta/paiement/cheque/fiche.php \file htdocs/compta/paiement/cheque/fiche.php
\ingroup facture \ingroup facture
\brief Onglet paiement cheque \brief Onglet paiement cheque
\version $Id$ \version $Id$
*/ */
require('./pre.inc.php'); require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
@ -56,81 +56,81 @@ $offset = $limit * $page ;
if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque->cheque) if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque->cheque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$result = $remisecheque->Create($user, $_GET["accountid"]); $result = $remisecheque->Create($user, $_GET["accountid"]);
if ($result > 0) if ($result > 0)
{ {
Header("Location: fiche.php?id=".$remisecheque->id); Header("Location: fiche.php?id=".$remisecheque->id);
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$remisecheque->error.'</div>'; $mesg='<div class="error">'.$remisecheque->error.'</div>';
} }
} }
if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $user->rights->banque) if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $user->rights->banque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$remisecheque->id = $_GET["id"]; $remisecheque->id = $_GET["id"];
$result = $remisecheque->RemoveCheck($_GET["lineid"]); $result = $remisecheque->RemoveCheck($_GET["lineid"]);
if ($result === 0) if ($result === 0)
{ {
Header("Location: fiche.php?id=".$remisecheque->id); Header("Location: fiche.php?id=".$remisecheque->id);
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$paiement->error.'</div>'; $mesg='<div class="error">'.$paiement->error.'</div>';
} }
} }
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->banque) if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->banque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$remisecheque->id = $_GET["id"]; $remisecheque->id = $_GET["id"];
$result = $remisecheque->Delete(); $result = $remisecheque->Delete();
if ($result == 0) if ($result == 0)
{ {
Header("Location: index.php"); Header("Location: index.php");
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$paiement->error.'</div>'; $mesg='<div class="error">'.$paiement->error.'</div>';
} }
} }
if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque) if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$remisecheque->Fetch($_GET["id"]); $remisecheque->Fetch($_GET["id"]);
$result = $remisecheque->Validate($user); $result = $remisecheque->Validate($user);
if ($result == 0) if ($result == 0)
{ {
Header("Location: fiche.php?id=".$remisecheque->id); Header("Location: fiche.php?id=".$remisecheque->id);
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$paiement->error.'</div>'; $mesg='<div class="error">'.$paiement->error.'</div>';
} }
} }
if ($_POST['action'] == 'builddoc' && $user->rights->banque) if ($_POST['action'] == 'builddoc' && $user->rights->banque)
{ {
$remisecheque = new RemiseCheque($db); $remisecheque = new RemiseCheque($db);
$result = $remisecheque->Fetch($_GET["id"]); $result = $remisecheque->Fetch($_GET["id"]);
if ($result == 0) if ($result == 0)
{ {
$result = $remisecheque->GeneratePdf($_POST["model"]); $result = $remisecheque->GeneratePdf($_POST["model"], $langs);
Header("Location: fiche.php?id=".$remisecheque->id); Header("Location: fiche.php?id=".$remisecheque->id);
exit; exit;
} }
else else
{ {
$mesg='<div class="error">'.$paiement->error.'</div>'; $mesg='<div class="error">'.$paiement->error.'</div>';
} }
} }
@ -145,13 +145,13 @@ $formfile = new FormFile($db);
if ($_GET['action'] == 'new') if ($_GET['action'] == 'new')
{ {
$h=0; $h=0;
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?action=new'; $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?action=new';
$head[$h][1] = $langs->trans("MenuChequeDeposits"); $head[$h][1] = $langs->trans("MenuChequeDeposits");
$hselected = $h; $hselected = $h;
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques")); dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques"));
} }
else else
{ {
@ -179,8 +179,8 @@ else
dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques")); dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques"));
/* /*
* Confirmation de la suppression du bordereau * Confirmation de la suppression du bordereau
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), 'Etes-vous sûr de vouloir supprimer ce bordereau ?', 'confirm_delete'); $html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), 'Etes-vous sûr de vouloir supprimer ce bordereau ?', 'confirm_delete');
@ -188,8 +188,8 @@ else
} }
/* /*
* Confirmation de la validation du bordereau * Confirmation de la validation du bordereau
*/ */
if ($_GET['action'] == 'valide') if ($_GET['action'] == 'valide')
{ {
$facid = $_GET['facid']; $facid = $_GET['facid'];
@ -310,7 +310,7 @@ else
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);
print '</td></tr>'; print '</td></tr>';
// Nb of cheques // Nb of cheques
print '<tr><td>'.$langs->trans('NbOfCheques').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('NbOfCheques').'</td><td colspan="2">';
print $remisecheque->nbcheque; print $remisecheque->nbcheque;
print '</td></tr>'; print '</td></tr>';
@ -400,12 +400,12 @@ print '</div>';
if ($_GET['action'] != 'new') if ($_GET['action'] != 'new')
{ {
if ($remisecheque->statut == 1) if ($remisecheque->statut == 1)
{ {
$dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number); $dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number);
$gen = array('Blochet'); $gen = array('Blochet');
$formfile->show_documents("remisecheque","",$dir,'',$gen,0); $formfile->show_documents("remisecheque","",$dir,'',$gen,0);
} }
} }
/* /*
@ -416,17 +416,17 @@ print '<div class="tabsAction">';
if ($user->societe_id == 0 && sizeof($accounts) == 1 && $_GET['action'] == 'new') if ($user->societe_id == 0 && sizeof($accounts) == 1 && $_GET['action'] == 'new')
{ {
print '<a class="butAction" href="fiche.php?action=create&amp;accountid='.$account_id.'">'.$langs->trans('NewCheckReceipt').'</a>'; print '<a class="butAction" href="fiche.php?action=create&amp;accountid='.$account_id.'">'.$langs->trans('NewCheckReceipt').'</a>';
} }
if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '') if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '')
{ {
print '<a class="butAction" href="fiche.php?id='.$_GET['id'].'&amp;facid='.$objp->facid.'&amp;action=valide">'.$langs->trans('Valid').'</a>'; print '<a class="butAction" href="fiche.php?id='.$_GET['id'].'&amp;facid='.$objp->facid.'&amp;action=valide">'.$langs->trans('Valid').'</a>';
} }
if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '') if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '')
{ {
print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>';
} }
print '</div>'; print '</div>';

View File

@ -1,59 +0,0 @@
Liste des termes a employer
http://fr.wikipedia.org/wiki/Charpente
dans la section termes utilisés :
Utilisé
=======
Blochet
Libre :
=======
Aisselier
Arbalétrier ou poutre
Arêtier
Chevêtre
Chevron
Chevron ou faux comble
Comble
Comble à surcroît
Comble brisé dit à la Mansart
Contrefiche
Coyer
Coyau
Dé
Échantignole
Enrayure
Entrait moisé
Entrait ou Tirant
Entrait retroussé ou faux entrait
Faîtage
Faîte
Faux-entrait
Ferme
Ferme à une pente ou appentis
Gousset
Hourdis
Jambe de force
Jambe de force moisée
Jambette
Lien de faîtage
Lierne ou sous faîte
Linçoir
Moise
Noue
Panne
Panne faîtière
Pignon
Poinçon
Portée
Poutre
Sablière
Solive
Solive boiteuse
Solive d'enchevêtrure
Sous faîte
Trémie

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007-2008 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
@ -15,31 +15,28 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/compta/paiement/cheque/remisecheque.class.php * \file htdocs/compta/paiement/cheque/remisecheque.class.php
\ingroup compta * \ingroup compta
\brief Fichier de la classe des bordereau de remise de cheque * \brief Fichier de la classe des bordereau de remise de cheque
\version $Revision$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/** /**
\class RemiseCheque * \class RemiseCheque
\brief Classe permettant la gestion des remises de cheque * \brief Classe permettant la gestion des remises de cheque
*/ */
class RemiseCheque extends CommonObject class RemiseCheque extends CommonObject
{ {
var $db; var $db;
var $error; var $error;
var $element='chequereceipt'; var $element='chequereceipt';
var $table_element='bordereau_cheque'; var $table_element='bordereau_cheque';
var $id; var $id;
var $num; var $num;
@ -48,23 +45,22 @@ class RemiseCheque extends CommonObject
var $errno; var $errno;
/** /**
* \brief Constructeur de la classe * \brief Constructeur de la classe
* \param DB handler accès base de données * \param DB handler accès base de données
* \param id id compte (0 par defaut) * \param id id compte (0 par defaut)
*/ */
function RemiseCheque($DB,$langs='') function RemiseCheque($DB)
{ {
$this->db = $DB; $this->db = $DB;
$this->langs = $langs; $this->next_id = 0;
$this->next_id = 0; $this->previous_id = 0;
$this->previous_id = 0; }
}
/** /**
\brief Load record \brief Load record
\param id Id record \param id Id record
\param ref Ref record \param ref Ref record
*/ */
function Fetch($id,$ref='') function Fetch($id,$ref='')
{ {
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author,bc.fk_bank_account,bc.amount,bc.number,bc.statut,bc.nbcheque"; $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author,bc.fk_bank_account,bc.amount,bc.number,bc.statut,bc.nbcheque";
@ -116,7 +112,7 @@ class RemiseCheque extends CommonObject
\param user Utilisateur qui effectue l'operation \param user Utilisateur qui effectue l'operation
\param account_id Compte bancaire concerne \param account_id Compte bancaire concerne
\return int <0 if KO, >0 if OK \return int <0 if KO, >0 if OK
*/ */
function Create($user, $account_id) function Create($user, $account_id)
{ {
$this->errno = 0; $this->errno = 0;
@ -228,343 +224,357 @@ class RemiseCheque extends CommonObject
} }
/** /**
\brief Supprime la remise en base \brief Supprime la remise en base
\param user utilisateur qui effectue l'operation \param user utilisateur qui effectue l'operation
*/ */
function Delete($user='') function Delete($user='')
{ {
$this->errno = 0; $this->errno = 0;
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid = $this->id;"; $sql .= " WHERE rowid = $this->id;";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ( $resql ) if ( $resql )
{ {
$num = $this->db->affected_rows($resql); $num = $this->db->affected_rows($resql);
if ($num <> 1) if ($num <> 1)
{ {
$this->errno = -2; $this->errno = -2;
dolibarr_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)"); dolibarr_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)");
} }
if ( $this->errno === 0) if ( $this->errno === 0)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bank"; $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
$sql.= " SET fk_bordereau=0"; $sql.= " SET fk_bordereau=0";
$sql.= " WHERE fk_bordereau='".$this->id."';"; $sql.= " WHERE fk_bordereau='".$this->id."';";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (!$resql)
{ {
$this->errno = -1028; $this->errno = -1028;
dolibarr_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)"); dolibarr_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)");
} }
} }
} }
if ($this->errno === 0) if ($this->errno === 0)
{ {
$this->db->commit(); $this->db->commit();
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
dolibarr_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)"); dolibarr_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)");
} }
return $this->errno; return $this->errno;
} }
/** /**
* \brief Validate receipt * \brief Validate receipt
* \param user User * \param user User
*/ */
function Validate($user) function Validate($user)
{ {
$this->errno = 0; $this->errno = 0;
$this->db->begin(); $this->db->begin();
$num=$this->getNextNumber(); $num=$this->getNextNumber();
if ($this->errno === 0) if ($this->errno === 0)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET statut=1, number='".$num."'"; $sql.= " SET statut=1, number='".$num."'";
$sql .= " WHERE rowid = $this->id AND statut=0;"; $sql .= " WHERE rowid = $this->id AND statut=0;";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ( $resql ) if ( $resql )
{ {
$num = $this->db->affected_rows($resql); $num = $this->db->affected_rows($resql);
if ($num == 1) if ($num == 1)
{ {
$this->statut = 1; $this->statut = 1;
} }
else else
{ {
$this->errno = -1029; $this->errno = -1029;
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)"); dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
} }
} }
else else
{ {
$this->errno = -1033; $this->errno = -1033;
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)"); dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
} }
} }
if ($this->errno === 0) if ($this->errno === 0)
{ {
$this->GeneratePdf(); $this->GeneratePdf();
} }
if ($this->errno === 0) if ($this->errno === 0)
{ {
$this->db->commit(); $this->db->commit();
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
dolibarr_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR); dolibarr_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR);
} }
return $this->errno; return $this->errno;
} }
/** /**
* Old module for cheque receipt numbering * Old module for cheque receipt numbering
* *
* @return string * @return string
*/ */
function getNextNumber() function getNextNumber()
{ {
$num=0; $num=0;
// We use +0 to convert varchar to number // We use +0 to convert varchar to number
$sql = "SELECT MAX(number+0) FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql = "SELECT MAX(number+0) FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$num = $row[0]; $num = $row[0];
$this->db->free($resql); $this->db->free($resql);
} }
else else
{ {
$this->errno = -1034; $this->errno = -1034;
dolibarr_syslog("Remisecheque::Validate Erreur SELECT ($this->errno)"); dolibarr_syslog("Remisecheque::Validate Erreur SELECT ($this->errno)");
} }
$num++; $num++;
return $num; return $num;
} }
/** /**
* \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord * \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord
* \param user Objet user * \param user Objet user
* \return int <0 si ko, >0 si ok * \return int <0 si ko, >0 si ok
*/ */
function load_board($user) function load_board($user)
{ {
global $conf; global $conf;
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$sql = "SELECT b.rowid,".$this->db->pdate("b.datev")." as datefin"; $sql = "SELECT b.rowid,".$this->db->pdate("b.datev")." as datefin";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_bordereau = 0"; $sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_bordereau = 0";
$sql.= " AND b.amount > 0"; $sql.= " AND b.amount > 0";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $this->nbtodo++;
if ($obj->datefin < (time() - $conf->bank->cheque->warning_delay)) $this->nbtodolate++; if ($obj->datefin < (time() - $conf->bank->cheque->warning_delay)) $this->nbtodolate++;
} }
return 1; return 1;
} }
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
} }
/** /**
\brief Génère le fichier PDF * \brief Génère le fichier PDF
\param model Nom du modele * \param model Nom du modele
\return int <0 si KO, 0 si OK * \return int <0 si KO, 0 si OK
\TODO Finir la gestion multi modèle */
*/ function GeneratePdf($model='blochet', $outputlangs)
function GeneratePdf($model='Blochet') {
{ require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php");
require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/cheque/pdf/pdf_".$model.".class.php");
require_once(DOL_DOCUMENT_ROOT ."/compta/paiement/cheque/pdf/pdf_blochet.class.php");
$result = $this->Fetch($this->id); $result = $this->Fetch($this->id);
$pdf = new BordereauChequeBlochet($db); $class='BordereauCheque'.ucfirst($model);
$pdf = new $class($db);
$sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq "; $sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq ";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba "; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba ";
$sql.= " , ".MAIN_DB_PREFIX."bordereau_cheque as bc"; $sql.= " , ".MAIN_DB_PREFIX."bordereau_cheque as bc";
$sql.= " WHERE b.fk_account = ba.rowid AND b.fk_bordereau = bc.rowid"; $sql.= " WHERE b.fk_account = ba.rowid AND b.fk_bordereau = bc.rowid";
$sql.= " AND bc.rowid = ".$this->id; $sql.= " AND bc.rowid = ".$this->id;
$sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;"; $sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$i = 0; $i = 0;
while ( $objp = $this->db->fetch_object($result) ) while ( $objp = $this->db->fetch_object($result) )
{
$pdf->lines[$i]->bank_chq = $objp->banque;
$pdf->lines[$i]->emetteur_chq = $objp->emetteur;
$pdf->lines[$i]->amount_chq = $objp->amount;
$pdf->lines[$i]->num_chq = $objp->num_chq;
$i++;
}
}
$pdf->nbcheque = $this->nbcheque;
$pdf->number = $this->number;
$pdf->amount = $this->amount;
$pdf->date = $this->date_bordereau;
$account = new Account($this->db);
$account->fetch($this->account_id);
$pdf->account = &$account;
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number, $outputlangs) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
return 1;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("Error");
dolibarr_print_error($db,$pdf->pdferror());
return 0;
}
}
/**
\brief Mets a jour le montant total
\return int, 0 en cas de succes
*/
function UpdateAmount()
{
$this->errno = 0;
$this->db->begin();
$total = 0;
$nb = 0;
$sql = "SELECT amount ";
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
$sql.= " WHERE fk_bordereau = $this->id;";
$resql = $this->db->query($sql);
if ( $resql )
{
while ( $row = $this->db->fetch_row($resql) )
{ {
$pdf->lines[$i]->bank_chq = $objp->banque; $total += $row[0];
$pdf->lines[$i]->emetteur_chq = $objp->emetteur; $nb++;
$pdf->lines[$i]->amount_chq = $objp->amount;
$pdf->lines[$i]->num_chq = $objp->num_chq;
$i++;
}
}
$pdf->nbcheque = $this->nbcheque;
$pdf->number = $this->number;
$pdf->amount = $this->amount;
$pdf->date = $this->date_bordereau;
$account = new Account($this->db);
$account->fetch($this->account_id);
$pdf->account = &$account;
$pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number );
}
/**
\brief Mets a jour le montant total
\return int, 0 en cas de succes
*/
function UpdateAmount()
{
$this->errno = 0;
$this->db->begin();
$total = 0;
$nb = 0;
$sql = "SELECT amount ";
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
$sql.= " WHERE fk_bordereau = $this->id;";
$resql = $this->db->query($sql);
if ( $resql )
{
while ( $row = $this->db->fetch_row($resql) )
{
$total += $row[0];
$nb++;
} }
$this->db->free($resql); $this->db->free($resql);
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET amount='".price2num($total)."'"; $sql.= " SET amount='".price2num($total)."'";
$sql.= " ,nbcheque=".$nb; $sql.= " ,nbcheque=".$nb;
$sql.= " WHERE rowid='".$this->id."';"; $sql.= " WHERE rowid='".$this->id."';";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (!$resql)
{ {
$this->errno = -1030; $this->errno = -1030;
dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR UPDATE ($this->errno)"); dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR UPDATE ($this->errno)");
} }
} }
else else
{ {
$this->errno = -1031; $this->errno = -1031;
dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR SELECT ($this->errno)"); dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR SELECT ($this->errno)");
} }
if ($this->errno === 0) if ($this->errno === 0)
{ {
$this->db->commit(); $this->db->commit();
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
dolibarr_syslog("RemiseCheque::UpdateAmount ROLLBACK ($this->errno)"); dolibarr_syslog("RemiseCheque::UpdateAmount ROLLBACK ($this->errno)");
} }
return $this->errno; return $this->errno;
} }
/** /**
\brief Insère la remise en base \brief Insère la remise en base
\param user utilisateur qui effectue l'operation \param user utilisateur qui effectue l'operation
\param account_id Compte bancaire concerne \param account_id Compte bancaire concerne
*/ */
function RemoveCheck($account_id) function RemoveCheck($account_id)
{ {
$this->errno = 0; $this->errno = 0;
if ($this->id > 0) if ($this->id > 0)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bank"; $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
$sql.= " SET fk_bordereau = 0 "; $sql.= " SET fk_bordereau = 0 ";
$sql.= " WHERE rowid = '".$account_id."' AND fk_bordereau='".$this->id."';"; $sql.= " WHERE rowid = '".$account_id."' AND fk_bordereau='".$this->id."';";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->UpdateAmount(); $this->UpdateAmount();
} }
else else
{ {
$this->errno = -1032; $this->errno = -1032;
dolibarr_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)"); dolibarr_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)");
} }
} }
return 0; return 0;
} }
/** /**
\brief Charge les propriétés ref_previous et ref_next \brief Charge les propriétés ref_previous et ref_next
\return int <0 si ko, 0 si ok \return int <0 si ko, 0 si ok
*/ */
function load_previous_next_id() function load_previous_next_id()
{ {
$this->errno = 0; $this->errno = 0;
$sql = "SELECT MAX(rowid)"; $sql = "SELECT MAX(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE rowid < '".$this->id."'"; $sql.= " WHERE rowid < '".$this->id."'";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if (! $result) if (! $result)
{ {
$this->errno = -1035; $this->errno = -1035;
} }
$row = $this->db->fetch_row($result); $row = $this->db->fetch_row($result);
$this->previous_id = $row[0]; $this->previous_id = $row[0];
$sql = "SELECT MIN(rowid)"; $sql = "SELECT MIN(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE rowid > '".$this->id."'"; $sql.= " WHERE rowid > '".$this->id."'";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if (! $result) if (! $result)
{ {
$this->errno = -1035; $this->errno = -1035;
} }
$row = $this->db->fetch_row($result); $row = $this->db->fetch_row($result);
$this->next_id = $row[0]; $this->next_id = $row[0];
return $this->errno; return $this->errno;
} }
/** /**
@ -591,21 +601,21 @@ class RemiseCheque extends CommonObject
} }
/** /**
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée) * \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
* \return string Libelle * \return string Libelle
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
{ {
return $this->LibStatut($this->statut,$mode); return $this->LibStatut($this->statut,$mode);
} }
/** /**
* \brief Renvoi le libellé d'un statut donne * \brief Renvoi le libellé d'un statut donne
* \param status Statut * \param status Statut
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
* \return string Libellé du statut * \return string Libellé du statut
*/ */
function LibStatut($status,$mode=0) function LibStatut($status,$mode=0)
{ {
global $langs; // TODO Renvoyer le libellé anglais et faire traduction a affichage global $langs; // TODO Renvoyer le libellé anglais et faire traduction a affichage

View File

@ -20,27 +20,27 @@
*/ */
/** /**
\file htdocs/compta/paiement/rapport.php \file htdocs/compta/paiement/rapport.php
\ingroup facture \ingroup facture
\brief Rapports de paiements \brief Rapports de paiements
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/rapport/pdf_paiement.class.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/rapport/pdf_paiement.class.php");
// Sécurité accés // Sécurité accés
if (! $user->rights->facture->lire) if (! $user->rights->facture->lire)
accessforbidden(); accessforbidden();
$dir = $conf->compta->dir_output.'/payments'; $dir = $conf->compta->dir_output.'/payments';
$socid=0; $socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
$dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta'; $dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta';
} }
$year = $_GET["year"]; $year = $_GET["year"];
@ -51,12 +51,27 @@ if (! $year) { $year=date("Y"); }
*/ */
if ($_POST["action"] == 'gen') if ($_POST["action"] == 'gen')
{ {
$rap = new pdf_paiement($db); $rap = new pdf_paiement($db);
$rap->write_file($dir, $_POST["remonth"], $_POST["reyear"]);
$year = $_POST["reyear"]; // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("Erreur dans commande_pdf_create");
dolibarr_print_error($db,$obj->pdferror());
}
$year = $_POST["reyear"];
} }
llxHeader(); llxHeader();
/* /*
@ -75,28 +90,28 @@ $syear = date("Y", time());
print '<select name="remonth">'; print '<select name="remonth">';
for ($month = 1 ; $month < 13 ; $month++) for ($month = 1 ; $month < 13 ; $month++)
{ {
if ($month == $cmonth) if ($month == $cmonth)
{ {
print "<option value=\"$month\" selected=\"true\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B"); print "<option value=\"$month\" selected=\"true\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
} }
else else
{ {
print "<option value=\"$month\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B"); print "<option value=\"$month\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
} }
} }
print "</select>"; print "</select>";
print '<select name="reyear">'; print '<select name="reyear">';
for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++) for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
{ {
if ($formyear == $syear) if ($formyear == $syear)
{ {
print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>"; print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>";
} }
else else
{ {
print "<option value=\"$formyear\">".$formyear."</option>"; print "<option value=\"$formyear\">".$formyear."</option>";
} }
} }
print "</select>\n"; print "</select>\n";
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
@ -109,46 +124,46 @@ clearstatcache();
$found=0; $found=0;
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle=opendir($dir); $handle=opendir($dir);
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{
if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file))
{ {
if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file))
{
$found=1; $found=1;
print '<a href="rapport.php?year='.$file.'">'.$file.'</a> '; print '<a href="rapport.php?year='.$file.'">'.$file.'</a> ';
}
} }
}
} }
if ($year) if ($year)
{ {
if (is_dir($dir.'/'.$year)) if (is_dir($dir.'/'.$year))
{
$handle=opendir($dir.'/'.$year);
if ($found) print '<br>';
print '<br>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
while (($file = readdir($handle))!==false)
{ {
$handle=opendir($dir.'/'.$year);
if ($found) print '<br>';
print '<br>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
while (($file = readdir($handle))!==false)
{
if (eregi('^payment',$file)) if (eregi('^payment',$file))
{ {
$var=!$var; $var=!$var;
$tfile = $dir . '/'.$year.'/'.$file; $tfile = $dir . '/'.$year.'/'.$file;
$relativepath = $year.'/'.$file; $relativepath = $year.'/'.$file;
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>'; print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>'; print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>';
print '<td align="right">'.dolibarr_print_date(filemtime($tfile),"dayhour").'</td></tr>'; print '<td align="right">'.dolibarr_print_date(filemtime($tfile),"dayhour").'</td></tr>';
} }
}
print '</table>';
} }
print '</table>';
}
} }
$db->close(); $db->close();

View File

@ -62,11 +62,14 @@ $staticcontratligne=new ContratLigne($db);
* View * View
*/ */
$now=mktime();
$form=new Form($db); $form=new Form($db);
llxHeader(); llxHeader();
$sql = "SELECT s.rowid as socid, s.nom, c.rowid as cid,"; $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
$sql.= " s.rowid as socid, s.nom,";
$sql.= " cd.rowid, cd.description, cd.statut, p.rowid as pid, p.label as label,"; $sql.= " cd.rowid, cd.description, cd.statut, p.rowid as pid, p.label as label,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_ouverture_prevue,"; $sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_ouverture_prevue,";
@ -165,14 +168,19 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
print '</form>'; print '</form>';
$now=mktime();
$var=True; $var=True;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td><a href="fiche.php?id='.$obj->cid.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'</a></td>'; print '<td>';
$contractstatic=new Contrat($db);
$contractstatic->id=$obj->cid;
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
print $contractstatic->getNomUrl(1);
//'<a href="fiche.php?id='.$obj->cid.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'</a>';
print '</td>';
print '<td>'; print '<td>';
if ($obj->pid) if ($obj->pid)
{ {
@ -202,9 +210,17 @@ if ($resql)
else print '&nbsp;&nbsp;&nbsp;&nbsp;'; else print '&nbsp;&nbsp;&nbsp;&nbsp;';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->cid.'&line='.$obj->rowid.'">'; if ($obj->cstatut == 0)
print $staticcontratligne->LibStatut($obj->statut,5); {
print '</a></td>'; print $contractstatic->LibStatut(0,5);
}
else
{
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->cid.'&line='.$obj->rowid.'">';
print $staticcontratligne->LibStatut($obj->statut,5);
print '</a>';
}
print '</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/fourn/commande/index.php * \file htdocs/fourn/commande/index.php
\ingroup commande * \ingroup commande
\brief Page accueil commandes fournisseurs * \brief Page accueil commandes fournisseurs
\version $Revision$ * \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
@ -40,6 +40,7 @@ $result = restrictedArea($user, 'commande_fournisseur', $orderid,'');
llxHeader('',$langs->trans("SuppliersOrdersArea")); llxHeader('',$langs->trans("SuppliersOrdersArea"));
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$userstatic=new User($db);
print_barre_liste($langs->trans("SuppliersOrdersArea"), $page, "index.php", "", $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("SuppliersOrdersArea"), $page, "index.php", "", $sortfield, $sortorder, '', $num);
@ -64,7 +65,9 @@ if ($resql)
$i = 0; $i = 0;
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td><td align="center">'.$langs->trans("Nb").'</td><td>&nbsp;</td>';
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
print '<td align="right">'.$langs->trans("Nb").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
@ -75,8 +78,7 @@ if ($resql)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.$commande->statuts[$row[1]].'</td>'; print '<td>'.$commande->statuts[$row[1]].'</td>';
print '<td align="center">'.$row[0].'</td>'; print '<td align="right"><a href="liste.php?statut='.$row[1].'">'.$row[0].' '.$commande->LibStatut($row[1],3).'</a></td>';
print '<td align="center"><a href="liste.php?statut='.$row[1].'">'.$commande->LibStatut($row[1],3).'</a></td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
@ -93,11 +95,11 @@ else
print '</td><td width="70%" valign="top" class="notopnoleft">'; print '</td><td width="70%" valign="top" class="notopnoleft">';
$sql = "SELECT u.name, u.firstname"; $sql = "SELECT u.rowid, u.name, u.firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
$sql .= " , ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= " ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd";
$sql .= " WHERE u.rowid = ur.fk_user"; $sql.= " WHERE u.rowid = ur.fk_user AND ur.fk_id = rd.id";
$sql .= " AND ur.fk_id = 184"; $sql.= " AND module='fournisseur' AND perms='commande' AND subperms='approuver'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -106,17 +108,22 @@ if ($resql)
$i = 0; $i = 0;
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre"><td>Personnes habilitées à approuver les commandes</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("UserWithApproveOrderGrant").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_row($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.$row[1].' '.$row[0].'</td>'; print '<td>';
$userstatic->id=$obj->rowid;
$userstatic->nom=$obj->name;
$userstatic->prenom=$obj->firstname;
print $userstatic->getNomUrl(1);
print '</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -15,30 +15,31 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php \file htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php
\ingroup banque \ingroup banque
\brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les bordereau de remise de cheque \brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les bordereau de remise de cheque
\version $Revision$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
/** /**
\class BordereauChequeBlochet * \class BordereauChequeBlochet
\brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les bordereau de remise de cheque * \brief Classe permettant de g�n�rer les bordereau de remise de cheque
*/ */
class BordereauChequeBlochet extends FPDF
class BordereauChequeBlochet
{ {
var $error='';
var $emetteur; // Objet societe qui emet var $emetteur; // Objet societe qui emet
/** /**
\brief Constructeur * \brief Constructeur
*/ */
function BordereauChequeBlochet($db) function BordereauChequeBlochet($db)
{ {
@ -49,7 +50,6 @@ class BordereauChequeBlochet
$this->db = $db; $this->db = $db;
$this->name = "blochet"; $this->name = "blochet";
$this->description = $langs->transnoentities("CheckReceipt");
$this->tab_top = 60; $this->tab_top = 60;
@ -68,6 +68,13 @@ class BordereauChequeBlochet
$this->tab_height = 200; //$this->line_height * $this->line_per_page; $this->tab_height = 200; //$this->line_height * $this->line_per_page;
} }
/**
* \brief Renvoi le dernier message d'erreur de création de propale
*/
function pdferror()
{
return $this->error;
}
/** /**
\brief Generate Header \brief Generate Header
@ -75,22 +82,22 @@ class BordereauChequeBlochet
\param page current page number \param page current page number
\param pages number of pages \param pages number of pages
*/ */
function Header(&$pdf, $page, $pages) function Header(&$pdf, $page, $pages, $outputlangs)
{ {
global $langs; global $langs;
$title = $this->description; $title = $outputlangs->transnoentities("CheckReceipt");
$pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','B',10);
$pdf->Text(10, 10, $title); $pdf->Text(10, 10, $title);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(10, 19, $langs->transnoentities("Numero")); $pdf->Text(10, 19, $outputlangs->transnoentities("Numero"));
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(10, 27, $langs->transnoentities("Date") ); $pdf->Text(10, 27, $outputlangs->transnoentities("Date") );
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(10, 35, $langs->transnoentities("Owner")); $pdf->Text(10, 35, $outputlangs->transnoentities("Owner"));
$pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','B',10);
$pdf->Text(32, 35, $this->account->proprio); $pdf->Text(32, 35, $this->account->proprio);
@ -103,7 +110,7 @@ class BordereauChequeBlochet
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(10, 43, "Compte"); $pdf->Text(10, 43, $outputlangs->transnoentities("Account"));
$pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','B',10);
$pdf->Text(32, 43, $this->account->code_banque); $pdf->Text(32, 43, $this->account->code_banque);
@ -112,7 +119,7 @@ class BordereauChequeBlochet
$pdf->Text(104, 43, $this->account->cle_rib); $pdf->Text(104, 43, $this->account->cle_rib);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(114, 19, "Signature"); $pdf->Text(114, 19, $outputlangs->transnoentities("Sign"));
$pdf->Rect(9, 47, 192, 7); $pdf->Rect(9, 47, 192, 7);
$pdf->line(55, 47, 55, 54); $pdf->line(55, 47, 55, 54);
@ -120,7 +127,7 @@ class BordereauChequeBlochet
$pdf->line(170, 47, 170, 54); $pdf->line(170, 47, 170, 54);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->Text(10, 52, "Nombre de ch<63>que"); $pdf->Text(10, 52, $outputlangs->transnoentities("ChequeNumber"));
$pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','B',10);
$pdf->Text(57, 52, $this->nbcheque); $pdf->Text(57, 52, $this->nbcheque);
@ -134,16 +141,16 @@ class BordereauChequeBlochet
// Tableau // Tableau
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->Text(11,$this->tab_top + 6,$langs->transnoentities("Num")); $pdf->Text(11,$this->tab_top + 6,$outputlangs->transnoentities("Num"));
$pdf->line(30, $this->tab_top, 30, $this->tab_top + $this->tab_height + 10); $pdf->line(30, $this->tab_top, 30, $this->tab_top + $this->tab_height + 10);
$pdf->Text(31,$this->tab_top + 6,$langs->transnoentities("Bank")); $pdf->Text(31,$this->tab_top + 6,$outputlangs->transnoentities("Bank"));
$pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10); $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10);
$pdf->Text(101, $this->tab_top + 6, $langs->transnoentities("CheckTransmitter")); $pdf->Text(101, $this->tab_top + 6, $outputlangs->transnoentities("CheckTransmitter"));
$pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10); $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY (180, $this->tab_top); $pdf->SetXY (180, $this->tab_top);
$pdf->MultiCell(20, 10, $langs->transnoentities("Amount"), 0, 'R'); $pdf->MultiCell(20, 10, $outputlangs->transnoentities("Amount"), 0, 'R');
$pdf->line(9, $this->tab_top + 10, 201, $this->tab_top + 10 ); $pdf->line(9, $this->tab_top + 10, 201, $this->tab_top + 10 );
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
@ -162,7 +169,7 @@ class BordereauChequeBlochet
} }
function Body(&$pdf, $page) function Body(&$pdf, $page, $outputlangs)
{ {
// x=10 - Num // x=10 - Num
// x=30 - Banque // x=30 - Banque
@ -191,15 +198,27 @@ class BordereauChequeBlochet
$yp = $yp + $this->line_height; $yp = $yp + $this->line_height;
} }
} }
/** /**
\brief Fonction g<EFBFBD>n<EFBFBD>rant le rapport sur le disque * \brief Fonction generant le rapport sur le disque
\param _dir repertoire * \param _dir Directory
\param month mois du rapport * \param number Number
\param year annee du rapport * \param outputlangs Lang output object
*/ */
function write_file($_dir, $number) function write_file($_dir, $number, $outputlangs)
{ {
global $langs; global $user,$conf,$langs,$mysoc;
if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->setPhpLang();
$dir = $_dir . "/".get_exdir($number); $dir = $_dir . "/".get_exdir($number);
@ -252,9 +271,9 @@ class BordereauChequeBlochet
$pdf->AddPage(); $pdf->AddPage();
$this->Header($pdf, 1, $pages); $this->Header($pdf, 1, $pages, $outputlangs);
$this->Body($pdf, 1); $this->Body($pdf, 1, $outputlangs);
$pdf->Output($_file); $pdf->Output($_file);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))

View File

@ -161,10 +161,10 @@ class ModeleNumRefCommandes
\brief Crée un bon de commande sur disque en fonction d'un modèle \brief Crée un bon de commande sur disque en fonction d'un modèle
\param db objet base de donnée \param db objet base de donnée
\param id id de la propale à créer \param id id de la propale à créer
\param modele force le modele à utiliser ('' par defaut) \param modele force le modele à utiliser ('' to not force)
\param outputlangs objet lang a utiliser pour traduction \param outputlangs objet lang a utiliser pour traduction
*/ */
function commande_pdf_create($db, $id, $modele='', $outputlangs='') function commande_pdf_create($db, $id, $modele, $outputlangs)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("orders"); $langs->load("orders");
@ -203,14 +203,19 @@ function commande_pdf_create($db, $id, $modele='', $outputlangs='')
$obj = new $classname($db); $obj = new $classname($db);
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($id, $outputlangs) > 0) if ($obj->write_file($id, $outputlangs) > 0)
{ {
$outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
commande_delete_preview($db, $id); commande_delete_preview($db, $id);
return 1; return 1;
} }
else else
{ {
$outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("Erreur dans commande_pdf_create"); dolibarr_syslog("Erreur dans commande_pdf_create");
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;

View File

@ -90,7 +90,7 @@ class pdf_edison extends ModelePDFCommandes
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -110,7 +110,7 @@ class pdf_einstein extends ModelePDFCommandes
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -159,7 +159,7 @@ class ModeleNumRefDons
\param outputlangs objet lang a utiliser pour traduction \param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK \return int 0 si KO, 1 si OK
*/ */
function don_create($db, $id, $message='', $modele='', $outputlangs='') function don_create($db, $id, $message, $modele, $outputlangs)
{ {
global $conf, $langs; global $conf, $langs;
$langs->load("bills"); $langs->load("bills");
@ -192,19 +192,23 @@ function don_create($db, $id, $message='', $modele='', $outputlangs='')
$obj->message = $message; $obj->message = $message;
if ( $obj->write_file($id,$outputlangs) > 0) // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($id,$outputlangs) > 0)
{ {
// Succès de la création de la facture. On génère le fichier meta // Succès de la création de la facture. On génère le fichier meta
don_meta_create($db, $id); don_meta_create($db, $id);
// et on supprime l'image correspondant au preview // et on supprime l'image correspondant au preview
don_delete_preview($db, $id); don_delete_preview($db, $id);
$outputlangs->charset_output=$sav_charset_output;
return 1; return 1;
} }
else else
{ {
dolibarr_syslog("Erreur dans don_create"); $outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("Erreur dans don_create");
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;
} }

View File

@ -88,10 +88,10 @@ class ModelePdfExpedition extends DolibarrPdfBarCode
\brief Cree un bon d'expedition sur disque \brief Cree un bon d'expedition sur disque
\param db objet base de donnee \param db objet base de donnee
\param id id de la expedition a creer \param id id de la expedition a creer
\param modele force le modele a utiliser ('' par defaut) \param modele force le modele a utiliser ('' to not force)
\param outputlangs objet lang a utiliser pour traduction \param outputlangs objet lang a utiliser pour traduction
*/ */
function expedition_pdf_create($db, $id, $modele='', $outputlangs='') function expedition_pdf_create($db, $id, $modele, $outputlangs)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("sendings"); $langs->load("sendings");
@ -134,14 +134,19 @@ function expedition_pdf_create($db, $id, $modele='', $outputlangs='')
$result=$expedition->fetch($id); $result=$expedition->fetch($id);
$result=$expedition->fetch_object($expedition->origin); $result=$expedition->fetch_object($expedition->origin);
if ($obj->write_file($expedition, $langs) > 0) // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($expedition, $langs) > 0)
{ {
$outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
// expedition_delete_preview($db, $id); //expedition_delete_preview($db, $id);
return 1; return 1;
} }
else else
{ {
$outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("Erreur dans expedition_pdf_create"); dolibarr_syslog("Erreur dans expedition_pdf_create");
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;

View File

@ -80,7 +80,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -122,7 +122,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -19,159 +19,159 @@
*/ */
/** /**
\file htdocs/includes/modules/export/modules_export.php \file htdocs/includes/modules/export/modules_export.php
\ingroup export \ingroup export
\brief Fichier contenant la classe mère de generation des exports \brief Fichier contenant la classe mère de generation des exports
\version $Id$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
/** /**
\class ModeleExports \class ModeleExports
\brief Classe mère des modèles de format d'export \brief Classe mère des modèles de format d'export
*/ */
class ModeleExports class ModeleExports
{ {
var $error=''; var $error='';
var $driverlabel; var $driverlabel;
var $driverversion; var $driverversion;
var $libabel; var $libabel;
var $libversion; var $libversion;
/** /**
* \brief Constructeur * \brief Constructeur
*/ */
function ModeleExports() function ModeleExports()
{ {
} }
/** /**
* \brief Charge en memoire et renvoie la liste des modèles actifs * \brief Charge en memoire et renvoie la liste des modèles actifs
* \param db Handler de base * \param db Handler de base
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
dolibarr_syslog("ModeleExport::loadFormat"); dolibarr_syslog("ModeleExport::loadFormat");
$dir=DOL_DOCUMENT_ROOT."/includes/modules/export/"; $dir=DOL_DOCUMENT_ROOT."/includes/modules/export/";
$handle=opendir($dir); $handle=opendir($dir);
// Recherche des fichiers drivers exports disponibles // Recherche des fichiers drivers exports disponibles
$var=True; $var=True;
$i=0; $i=0;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (eregi("^export_(.*)\.modules\.php",$file,$reg)) if (eregi("^export_(.*)\.modules\.php",$file,$reg))
{ {
$moduleid=$reg[1]; $moduleid=$reg[1];
// Chargement de la classe // Chargement de la classe
$file = $dir."/export_".$moduleid.".modules.php"; $file = $dir."/export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid); $classname = "Export".ucfirst($moduleid);
require_once($file); require_once($file);
$module = new $classname($db); $module = new $classname($db);
// Driver properties // Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel(); $this->driverlabel[$module->id]=$module->getDriverLabel();
$this->driverversion[$module->id]=$module->getDriverVersion(); $this->driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib // If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel(); $this->liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion(); $this->libversion[$module->id]=$module->getLibVersion();
$i++; $i++;
} }
} }
return array_keys($this->driverlabel); return array_keys($this->driverlabel);
} }
/** /**
* \brief Renvoi libelle d'un driver export * \brief Renvoi libelle d'un driver export
*/ */
function getDriverLabel($key) function getDriverLabel($key)
{ {
return $this->driverlabel[$key]; return $this->driverlabel[$key];
} }
/** /**
* \brief Renvoi version d'un driver export * \brief Renvoi version d'un driver export
*/ */
function getDriverVersion($key) function getDriverVersion($key)
{ {
return $this->driverversion[$key]; return $this->driverversion[$key];
} }
/** /**
* \brief Renvoi libelle de librairie externe du driver * \brief Renvoi libelle de librairie externe du driver
*/ */
function getLibLabel($key) function getLibLabel($key)
{ {
return $this->liblabel[$key]; return $this->liblabel[$key];
} }
/** /**
* \brief Renvoi version de librairie externe du driver * \brief Renvoi version de librairie externe du driver
*/ */
function getLibVersion($key) function getLibVersion($key)
{ {
return $this->libversion[$key]; return $this->libversion[$key];
} }
/** /**
* \brief Lance la generation du fichier * \brief Lance la generation du fichier
* \remarks Les tableaux array_export_xxx sont déjà chargées pour le bon datatoexport * \remarks Les tableaux array_export_xxx sont déjà chargées pour le bon datatoexport
* aussi le parametre datatoexport est inutilisé * aussi le parametre datatoexport est inutilisé
*/ */
function build_file($model, $datatoexport, $array_selected) function build_file($model, $datatoexport, $array_selected)
{ {
global $langs; global $langs;
dolibarr_syslog("Export::build_file $model, $datatoexport, $array_selected"); dolibarr_syslog("Export::build_file $model, $datatoexport, $array_selected");
// Creation de la classe d'export du model ExportXXX // Creation de la classe d'export du model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
$file = "export_".$model.".modules.php"; $file = "export_".$model.".modules.php";
$classname = "Export".$model; $classname = "Export".$model;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
// Execute requete export // Execute requete export
$sql=$this->array_export_sql[0]; $sql=$this->array_export_sql[0];
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
// Genere en-tete // Genere en-tete
$obj->write_header(); $obj->write_header();
// Genere ligne de titre // Genere ligne de titre
$obj->write_title(); $obj->write_title();
while ($objp = $this->db->fetch_object($resql)) while ($objp = $this->db->fetch_object($resql))
{ {
$var=!$var; $var=!$var;
$obj->write_record($objp,$array_selected); $obj->write_record($objp,$array_selected);
} }
// Genere en-tete // Genere en-tete
$obj->write_footer(); $obj->write_footer();
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dolibarr_syslog("Error: sql=$sql ".$this->error); dolibarr_syslog("Error: sql=$sql ".$this->error);
return -1; return -1;
} }
} }
} }

View File

@ -162,11 +162,11 @@ class ModeleNumRefFactures
\param db objet base de donnee \param db objet base de donnee
\param id id de la facture a creer \param id id de la facture a creer
\param message message \param message message
\param modele force le modele a utiliser ('' par defaut) \param modele force le modele a utiliser ('' to not force)
\param outputlangs objet lang a utiliser pour traduction \param outputlangs objet lang a utiliser pour traduction
\return int <0 si KO, >0 si OK \return int <0 si KO, >0 si OK
*/ */
function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='') function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("bills"); $langs->load("bills");
@ -197,19 +197,23 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
$obj = new $classname($db); $obj = new $classname($db);
$obj->message = $message; $obj->message = $message;
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($id, $outputlangs) > 0) if ($obj->write_file($id, $outputlangs) > 0)
{ {
// Success in building document. We build meta file. // Success in building document. We build meta file.
facture_meta_create($db, $id); facture_meta_create($db, $id);
// et on supprime l'image correspondant au preview // et on supprime l'image correspondant au preview
facture_delete_preview($db, $id); facture_delete_preview($db, $id);
$outputlangs->charset_output=$sav_charset_output;
return 1; return 1;
} }
else else
{ {
dolibarr_print_error('',"facture_pdf_create Error: ".$obj->error); $outputlangs->charset_output=$sav_charset_output;
dolibarr_print_error($db,"facture_pdf_create Error: ".$obj->error);
return -1; return -1;
} }

View File

@ -111,7 +111,7 @@ class pdf_crabe extends ModelePDFFactures
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -95,7 +95,7 @@ class pdf_huitre extends ModelePDFFactures
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -99,7 +99,7 @@ class pdf_oursin extends ModelePDFFactures
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -19,132 +19,132 @@
*/ */
/** /**
\file htdocs/includes/modules/fichinter/modules_fichinter.php \file htdocs/includes/modules/fichinter/modules_fichinter.php
\ingroup ficheinter \ingroup ficheinter
\brief Fichier contenant la classe mère de generation des fiches interventions en PDF \brief Fichier contenant la classe mère de generation des fiches interventions en PDF
et la classe mère de numérotation des fiches interventions et la classe mère de numérotation des fiches interventions
\version $Id$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php'); require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
/** /**
\class ModelePDFFicheinter \class ModelePDFFicheinter
\brief Classe mère des modèles de fiche intervention \brief Classe mère des modèles de fiche intervention
*/ */
class ModelePDFFicheinter extends FPDF class ModelePDFFicheinter extends FPDF
{ {
var $error=''; var $error='';
/** /**
\brief Constructeur \brief Constructeur
*/ */
function ModelePDFFicheinter() function ModelePDFFicheinter()
{ {
} }
/** /**
\brief Renvoi le dernier message d'erreur de création de fiche intervention \brief Renvoi le dernier message d'erreur de création de fiche intervention
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
* \brief Renvoi la liste des modèles actifs * \brief Renvoi la liste des modèles actifs
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='ficheinter'; $type='ficheinter';
$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."document_model"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'"; $sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$liste[$row[0]]=$row[1]; $liste[$row[0]]=$row[1];
$i++; $i++;
} }
} }
else else
{ {
return -1; return -1;
} }
return $liste; return $liste;
} }
} }
/** /**
\class ModeleNumRefFicheinter \class ModeleNumRefFicheinter
\brief Classe mère des modèles de numérotation des références de fiches d'intervention \brief Classe mère des modèles de numérotation des références de fiches d'intervention
*/ */
class ModeleNumRefFicheinter class ModeleNumRefFicheinter
{ {
var $error=''; var $error='';
/** \brief Return if a module can be used or not /** \brief Return if a module can be used or not
* \return boolean true if module can be used * \return boolean true if module can be used
*/ */
function isEnabled() function isEnabled()
{ {
return true; return true;
} }
/** \brief Renvoi la description par defaut du modele de numérotation /** \brief Renvoi la description par defaut du modele de numérotation
* \return string Texte descripif * \return string Texte descripif
*/ */
function info() function info()
{ {
global $langs; global $langs;
$langs->load("ficheinter"); $langs->load("ficheinter");
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
/** \brief Renvoi un exemple de numérotation /** \brief Renvoi un exemple de numérotation
* \return string Example * \return string Example
*/ */
function getExample() function getExample()
{ {
global $langs; global $langs;
$langs->load("ficheinter"); $langs->load("ficheinter");
return $langs->trans("NoExample"); return $langs->trans("NoExample");
} }
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de /** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
* de conflits qui empechera cette numérotation de fonctionner. * de conflits qui empechera cette numérotation de fonctionner.
* \return boolean false si conflit, true si ok * \return boolean false si conflit, true si ok
*/ */
function canBeActivated() function canBeActivated()
{ {
return true; return true;
} }
/** \brief Renvoi prochaine valeur attribuée /** \brief Renvoi prochaine valeur attribuée
* \return string Valeur * \return string Valeur
*/ */
function getNextValue() function getNextValue()
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
/** \brief Renvoi version du module numerotation /** \brief Renvoi version du module numerotation
* \return string Valeur * \return string Valeur
*/ */
function getVersion() function getVersion()
{ {
global $langs; global $langs;
@ -159,13 +159,13 @@ class ModeleNumRefFicheinter
/** /**
\brief Crée une fiche intervention sur disque en fonction du modèle de FICHEINTER_ADDON_PDF \brief Crée une fiche intervention sur disque en fonction du modèle de FICHEINTER_ADDON_PDF
\param db objet base de donnée \param db objet base de donnée
\param object Object fichinter \param object Object fichinter
\param modele force le modele à utiliser ('' par defaut) \param modele force le modele à utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction \param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK \return int 0 si KO, 1 si OK
*/ */
function fichinter_create($db, $object, $modele='', $outputlangs='') function fichinter_create($db, $object, $modele='', $outputlangs='')
{ {
global $conf,$langs; global $conf,$langs;
@ -198,12 +198,18 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
$obj = new $classname($db); $obj = new $classname($db);
dolibarr_syslog("fichinter_create build PDF", LOG_DEBUG); dolibarr_syslog("fichinter_create build PDF", LOG_DEBUG);
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object,$outputlangs) > 0) if ($obj->write_file($object,$outputlangs) > 0)
{ {
$outputlangs->charset_output=$sav_charset_output;
return 1; return 1;
} }
else else
{ {
$outputlangs->charset_output=$sav_charset_output;
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;
} }
@ -216,53 +222,53 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
} }
/** /**
\brief Supprime l'image de prévisualitation, pour le cas de régénération de propal \brief Supprime l'image de prévisualitation, pour le cas de régénération de propal
\param db objet base de donnée \param db objet base de donnée
\param propalid id de la propal à effacer \param propalid id de la propal à effacer
\param propalref référence de la propal si besoin \param propalref référence de la propal si besoin
*/ */
function fichinter_delete_preview($db, $fichinterid, $fichinterref='') function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
{ {
global $langs,$conf; global $langs,$conf;
if (!$fichinterref) if (!$fichinterref)
{ {
$fichinter = new Fichinter($db,"",$fichinterid); $fichinter = new Fichinter($db,"",$fichinterid);
$fichinter->fetch($fichinterid); $fichinter->fetch($fichinterid);
$fichinterref = $fichinter->ref; $fichinterref = $fichinter->ref;
} }
if ($conf->fichinter->dir_output) if ($conf->fichinter->dir_output)
{ {
$fichinterref = sanitizeFileName($fichinterref); $fichinterref = sanitizeFileName($fichinterref);
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ; $dir = $conf->fichinter->dir_output . "/" . $fichinterref ;
$file = $dir . "/" . $fichinterref . ".pdf.png"; $file = $dir . "/" . $fichinterref . ".pdf.png";
$multiple = $file . "."; $multiple = $file . ".";
if ( file_exists( $file ) && is_writable( $file ) ) if ( file_exists( $file ) && is_writable( $file ) )
{ {
if ( ! unlink($file) ) if ( ! unlink($file) )
{ {
$this->error=$langs->trans("ErrorFailedToOpenFile",$file); $this->error=$langs->trans("ErrorFailedToOpenFile",$file);
return 0; return 0;
} }
} }
else else
{ {
for ($i = 0; $i < 20; $i++) for ($i = 0; $i < 20; $i++)
{ {
$preview = $multiple.$i; $preview = $multiple.$i;
if ( file_exists( $preview ) && is_writable( $preview ) ) if ( file_exists( $preview ) && is_writable( $preview ) )
{ {
if ( ! unlink($preview) ) if ( ! unlink($preview) )
{ {
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview); $this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
return 0; return 0;
} }
} }
} }
} }
} }
} }
?> ?>

View File

@ -84,7 +84,7 @@ class pdf_soleil extends ModelePDFFicheinter
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -155,7 +155,14 @@ class ModeleNumRefDeliveryOrder
/**
* \brief Create object on disk
* \param db objet base de donnée
* \param deliveryid id object
* \param modele force le modele à utiliser ('' to not force)
* \param outputlangs objet lang a utiliser pour traduction
* \return int 0 si KO, 1 si OK
*/
function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs='') function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs='')
{ {
global $langs; global $langs;
@ -185,14 +192,20 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
$obj = new $classname($db); $obj = new $classname($db);
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($deliveryid,$outputlangs) > 0) if ($obj->write_file($deliveryid,$outputlangs) > 0)
{ {
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
delivery_order_delete_preview($db, $deliveryid); delivery_order_delete_preview($db, $deliveryid);
$outputlangs->charset_output=$sav_charset_output;
return 1; return 1;
} }
else else
{ {
$outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("Erreur dans delivery_order_pdf_create"); dolibarr_syslog("Erreur dans delivery_order_pdf_create");
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;

View File

@ -91,7 +91,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("bills"); $outputlangs->load("bills");

View File

@ -114,7 +114,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");

View File

@ -156,11 +156,11 @@ class ModeleNumRefPropales
\brief Crée une propale sur disque en fonction du modèle de PROPALE_ADDON_PDF \brief Crée une propale sur disque en fonction du modèle de PROPALE_ADDON_PDF
\param db objet base de donnée \param db objet base de donnée
\param id id de la propale à créer \param id id de la propale à créer
\param modele force le modele à utiliser ('' par defaut) \param modele force le modele à utiliser ('' to not force)
\param outputlangs objet lang a utiliser pour traduction \param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK \return int 0 si KO, 1 si OK
*/ */
function propale_pdf_create($db, $id, $modele='', $outputlangs='') function propale_pdf_create($db, $id, $modele, $outputlangs)
{ {
global $langs; global $langs;
$langs->load("propale"); $langs->load("propale");
@ -200,15 +200,20 @@ function propale_pdf_create($db, $id, $modele='', $outputlangs='')
$obj = new $classname($db); $obj = new $classname($db);
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($id, $outputlangs) > 0) if ($obj->write_file($id, $outputlangs) > 0)
{ {
$outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
propale_delete_preview($db, $id); propale_delete_preview($db, $id);
return 1; return 1;
} }
else else
{ {
dolibarr_syslog("Erreur dans propale_pdf_create"); $outputlangs->charset_output=$sav_charset_output;
dolibarr_syslog("modules_propale::propale_pdf_create error");
dolibarr_print_error($db,$obj->pdferror()); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;
} }

View File

@ -20,11 +20,11 @@
*/ */
/** /**
\file htdocs/includes/modules/propale/pdf_propale_azur.modules.php * \file htdocs/includes/modules/propale/pdf_propale_azur.modules.php
\ingroup propale * \ingroup propale
\brief Fichier de la classe permettant de générer les propales au modèle Azur * \brief Fichier de la classe permettant de générer les propales au modèle Azur
\author Laurent Destailleur * \author Laurent Destailleur
\version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php");
@ -33,8 +33,8 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/** /**
\class pdf_propale_azur * \class pdf_propale_azur
\brief Classe permettant de générer les propales au modèle Azur * \brief Classe permettant de générer les propales au modèle Azur
*/ */
class pdf_propale_azur extends ModelePDFPropales class pdf_propale_azur extends ModelePDFPropales
@ -43,8 +43,8 @@ class pdf_propale_azur extends ModelePDFPropales
/** /**
\brief Constructeur * \brief Constructeur
\param db Handler accès base de donnée * \param db Handler accès base de donnée
*/ */
function pdf_propale_azur($db) function pdf_propale_azur($db)
{ {
@ -99,18 +99,19 @@ class pdf_propale_azur extends ModelePDFPropales
} }
/** /**
\brief Fonction générant la propale sur le disque * \brief Fonction générant la propale sur le disque
\param propale Objet propal à générer (ou id si ancienne methode) * \param propale Objet propal à générer (ou id si ancienne methode)
\param outputlangs Lang object for output language * \param outputlangs Lang object for output language
\return int 1=ok, 0=ko * \return int 1=ok, 0=ko
*/ */
function write_file($propale,$outputlangs='') function write_file($propale,$outputlangs)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because FPDF expect text to be encoded in ISO // Force output charset to ISO, because FPDF expect text to be encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");
@ -400,6 +401,7 @@ class pdf_propale_azur extends ModelePDFPropales
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$outputlangs->charset_output=$sav_charset_output;
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 1; // Pas d'erreur return 1; // Pas d'erreur
} }

View File

@ -94,8 +94,9 @@ class pdf_propale_jaune extends ModelePDFPropales
global $user,$langs,$conf; global $user,$langs,$conf;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because FPDF expect text to be encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("dict"); $outputlangs->load("dict");
@ -158,7 +159,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject("Proposition commerciale"); $pdf->SetSubject($outputlangs->transnoentities("CommercialProposal"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
@ -227,7 +228,7 @@ class pdf_propale_jaune extends ModelePDFPropales
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
/* /*
* *
*/ */
@ -271,7 +272,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->Output($file); $pdf->Output($file);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
return 1; return 1;
@ -279,7 +280,7 @@ class pdf_propale_jaune extends ModelePDFPropales
} }
} }
function _tableau(&$pdf, $tab_top, $tab_height, $nexY) function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
{ {
global $langs,$conf; global $langs,$conf;
$langs->load("main"); $langs->load("main");
@ -288,26 +289,26 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetFont('Arial','',11); $pdf->SetFont('Arial','',11);
$pdf->SetXY(10,$tab_top); $pdf->SetXY(10,$tab_top);
$pdf->MultiCell(20,10,$langs->transnoentities("Ref"),0,'C',1); $pdf->MultiCell(20,10,$outputlangs->transnoentities("Ref"),0,'C',1);
$pdf->SetXY(30,$tab_top); $pdf->SetXY(30,$tab_top);
$pdf->MultiCell(102,10,$langs->transnoentities("Designation"),0,'L',1); $pdf->MultiCell(102,10,$outputlangs->transnoentities("Designation"),0,'L',1);
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height); $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
$pdf->SetXY(132,$tab_top); $pdf->SetXY(132,$tab_top);
$pdf->MultiCell(12, 10,$langs->transnoentities("VAT"),0,'C',1); $pdf->MultiCell(12, 10,$outputlangs->transnoentities("VAT"),0,'C',1);
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
$pdf->SetXY(144,$tab_top); $pdf->SetXY(144,$tab_top);
$pdf->MultiCell(10,10,$langs->transnoentities("Qty"),0,'C',1); $pdf->MultiCell(10,10,$outputlangs->transnoentities("Qty"),0,'C',1);
$pdf->line(154, $tab_top, 154, $tab_top + $tab_height); $pdf->line(154, $tab_top, 154, $tab_top + $tab_height);
$pdf->SetXY(154,$tab_top); $pdf->SetXY(154,$tab_top);
$pdf->MultiCell(22,10,$langs->transnoentities("PriceU"),0,'R',1); $pdf->MultiCell(22,10,$outputlangs->transnoentities("PriceU"),0,'R',1);
$pdf->line(176, $tab_top, 176, $tab_top + $tab_height); $pdf->line(176, $tab_top, 176, $tab_top + $tab_height);
$pdf->SetXY(176,$tab_top); $pdf->SetXY(176,$tab_top);
$pdf->MultiCell(24,10,$langs->transnoentities("Total"),0,'R',1); $pdf->MultiCell(24,10,$outputlangs->transnoentities("Total"),0,'R',1);
$pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->Rect(10, $tab_top, 190, $tab_height);
@ -315,6 +316,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
} }
function _pagehead(&$pdf, $propale, $outputlangs) function _pagehead(&$pdf, $propale, $outputlangs)
{ {
//Affiche le filigrane brouillon - Print Draft Watermark //Affiche le filigrane brouillon - Print Draft Watermark
@ -356,20 +358,20 @@ class pdf_propale_jaune extends ModelePDFPropales
{ {
$pdf->SetX(12); $pdf->SetX(12);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "T<EFBFBD>l : ".FAC_PDF_TEL); $pdf->MultiCell(76, 5, $outputlangs->trans("Tel")." : ".FAC_PDF_TEL);
} }
if (defined("MAIN_INFO_SIREN")) if (defined("MAIN_INFO_SIREN"))
{ {
$pdf->SetX(12); $pdf->SetX(12);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN); $pdf->MultiCell(76, 5, $outputlangs->trans("SIREN")." : ".MAIN_INFO_SIREN);
} }
$pdf->rect(10, 40, 80, 40); $pdf->rect(10, 40, 80, 40);
$pdf->SetXY(10,5); $pdf->SetXY(10,5);
$pdf->SetFont('Arial','B',16); $pdf->SetFont('Arial','B',16);
$pdf->SetTextColor(0,0,200); $pdf->SetTextColor(0,0,200);
$pdf->MultiCell(200, 20, "PROPOSITION COMMERCIALE", '' , 'C'); $pdf->MultiCell(200, 20, $outputlangs->transnoentities("CommercialProposal"), '' , 'C');
/* /*
* Adresse Client * Adresse Client

View File

@ -43,7 +43,6 @@ class pdf_paiement extends FPDF
$langs->load("bills"); $langs->load("bills");
$this->db = $db; $this->db = $db;
$this->description = $langs->transnoentities("ListOfCustomerPayments");
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf'; $this->type = 'pdf';
@ -62,43 +61,45 @@ class pdf_paiement extends FPDF
$this->tab_height = 230; //$this->line_height * $this->line_per_page; $this->tab_height = 230; //$this->line_height * $this->line_per_page;
} }
/** /**
\brief Generate Header \brief Generate Header
\param pdf pdf object \param pdf pdf object
\param page current page number \param page current page number
\param pages number of pages \param pages number of pages
*/ */
function Header(&$pdf, $page, $pages) function Header(&$pdf, $page, $pages, $outputlangs)
{ {
global $langs; global $langs;
$title=$this->description.' - '.dolibarr_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y"); $title=$outputlangs->transnoentities("ListOfCustomerPayments");
$title.=' - '.dolibarr_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y");
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);
$pdf->Text(76, 10, $title); $pdf->Text(76, 10, $title);
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);
$pdf->Text(11, 16, $langs->transnoentities("Date")." : ".dolibarr_print_date(time(),"day")); $pdf->Text(11, 16, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date(time(),"day"));
$pdf->SetFont('Arial','',12); $pdf->SetFont('Arial','',12);
$pdf->Text(11, 22, $langs->transnoentities("Page")." : ".$page); $pdf->Text(11, 22, $outputlangs->transnoentities("Page")." : ".$page);
$pdf->SetFont('Arial','',12); $pdf->SetFont('Arial','',12);
$pdf->Text(11,$this->tab_top + 6,'Date'); $pdf->Text(11,$this->tab_top + 6,'Date');
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
$pdf->Text(42, $this->tab_top + 6, $langs->transnoentities("PaymentMode")); $pdf->Text(42, $this->tab_top + 6, $outputlangs->transnoentities("PaymentMode"));
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10); $pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
$pdf->Text(82, $this->tab_top + 6, $langs->transnoentities("Invoice")); $pdf->Text(82, $this->tab_top + 6, $outputlangs->transnoentities("Invoice"));
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10); $pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
$pdf->Text(122, $this->tab_top + 6, $langs->transnoentities("AmountInvoice")); $pdf->Text(122, $this->tab_top + 6, $outputlangs->transnoentities("AmountInvoice"));
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10); $pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY (160, $this->tab_top); $pdf->SetXY (160, $this->tab_top);
$pdf->MultiCell(40, 10, $langs->transnoentities("AmountPayment"), 0, 'R'); $pdf->MultiCell(40, 10, $outputlangs->transnoentities("AmountPayment"), 0, 'R');
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 ); $pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
@ -106,7 +107,7 @@ class pdf_paiement extends FPDF
} }
function Body(&$pdf, $page, $lines) function Body(&$pdf, $page, $lines, $outputlangs)
{ {
$pdf->SetFont('Arial','', 9); $pdf->SetFont('Arial','', 9);
$oldprowid = 0; $oldprowid = 0;
@ -163,13 +164,13 @@ class pdf_paiement extends FPDF
\param month mois du rapport \param month mois du rapport
\param year annee du rapport \param year annee du rapport
*/ */
function write_file($_dir, $month, $year, $outputlangs='') function write_file($_dir, $month, $year, $outputlangs)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because FPDF expect text to be encoded in ISO // Force output charset to ISO, because FPDF expect text to be encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->setPhpLang(); $outputlangs->setPhpLang();
@ -274,9 +275,9 @@ class pdf_paiement extends FPDF
$pdf->AddPage(); $pdf->AddPage();
$this->Header($pdf, 1, $pages); $this->Header($pdf, 1, $pages, $outputlangs);
$this->Body($pdf, 1, $lines); $this->Body($pdf, 1, $lines, $outputlangs);
$pdf->Output($_file); $pdf->Output($_file);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))

View File

@ -31,115 +31,115 @@ require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
/** /**
\class ModelePDFSuppliersorders \class ModelePDFSuppliersorders
\brief Classe mère des modèles de commandes fournisseurs \brief Classe mère des modèles de commandes fournisseurs
*/ */
class ModelePDFSuppliersOrders extends FPDF class ModelePDFSuppliersOrders extends FPDF
{ {
var $error=''; var $error='';
/** /**
\brief Renvoi le dernier message d'erreur de création de PDF de commande \brief Renvoi le dernier message d'erreur de création de PDF de commande
*/ */
function pdferror() function pdferror()
{ {
return $this->error; return $this->error;
} }
/** /**
* \brief Renvoi la liste des modèles actifs * \brief Renvoi la liste des modèles actifs
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
$type='supplier_order'; $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."document_model"; $sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'"; $sql.=" WHERE type = '".$type."'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$liste[$row[0]]=$row[1]; $liste[$row[0]]=$row[1];
$i++; $i++;
} }
} }
else else
{ {
$this->error=$db->error(); $this->error=$db->error();
return -1; return -1;
} }
return $liste; return $liste;
} }
} }
/** /**
\class ModeleNumRefSuppliersOrders \class ModeleNumRefSuppliersOrders
\brief Classe mère des modèles de numérotation des références de commandes fournisseurs \brief Classe mère des modèles de numérotation des références de commandes fournisseurs
*/ */
class ModeleNumRefSuppliersOrders class ModeleNumRefSuppliersOrders
{ {
var $error=''; var $error='';
/** \brief Return if a module can be used or not /** \brief Return if a module can be used or not
* \return boolean true if module can be used * \return boolean true if module can be used
*/ */
function isEnabled() function isEnabled()
{ {
return true; return true;
} }
/** \brief Renvoi la description par defaut du modele de numérotation /** \brief Renvoi la description par defaut du modele de numérotation
* \return string Texte descripif * \return string Texte descripif
*/ */
function info() function info()
{ {
global $langs; global $langs;
$langs->load("orders"); $langs->load("orders");
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
/** \brief Renvoi un exemple de numérotation /** \brief Renvoi un exemple de numérotation
* \return string Example * \return string Example
*/ */
function getExample() function getExample()
{ {
global $langs; global $langs;
$langs->load("orders"); $langs->load("orders");
return $langs->trans("NoExample"); return $langs->trans("NoExample");
} }
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de /** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
* de conflits qui empechera cette numérotation de fonctionner. * de conflits qui empechera cette numérotation de fonctionner.
* \return boolean false si conflit, true si ok * \return boolean false si conflit, true si ok
*/ */
function canBeActivated() function canBeActivated()
{ {
return true; return true;
} }
/** \brief Renvoi prochaine valeur attribuée /** \brief Renvoi prochaine valeur attribuée
* \return string Valeur * \return string Valeur
*/ */
function getNextValue() function getNextValue()
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
/** \brief Renvoi version du module numerotation /** \brief Renvoi version du module numerotation
* \return string Valeur * \return string Valeur
*/ */
function getVersion() function getVersion()
{ {
global $langs; global $langs;
@ -153,77 +153,91 @@ class ModeleNumRefSuppliersOrders
} }
function supplier_order_pdf_create($db, $comid, $modele='',$outputlangs='') /**
* \brief Create object on disk
* \param db objet base de donnée
* \param deliveryid id object
* \param modele force le modele à utiliser ('' to not force)
* \param outputlangs objet lang a utiliser pour traduction
* \return int 0 si KO, 1 si OK
*/
function supplier_order_pdf_create($db, $comid, $modele,$outputlangs)
{ {
global $langs; global $langs;
$langs->load("suppliers"); $langs->load("suppliers");
$dir = DOL_DOCUMENT_ROOT."//includes/modules/supplier_order/pdf/"; $dir = DOL_DOCUMENT_ROOT."//includes/modules/supplier_order/pdf/";
// Positionne modele sur le nom du modele de commande fournisseur à utiliser // Positionne modele sur le nom du modele de commande fournisseur à utiliser
if (! strlen($modele)) if (! strlen($modele))
{ {
if (defined("COMMANDE_SUPPLIER_ADDON_PDF") && COMMANDE_SUPPLIER_ADDON_PDF) if (defined("COMMANDE_SUPPLIER_ADDON_PDF") && COMMANDE_SUPPLIER_ADDON_PDF)
{ {
$modele = COMMANDE_SUPPLIER_ADDON_PDF; $modele = COMMANDE_SUPPLIER_ADDON_PDF;
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_PDF_NotDefined"); print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_PDF_NotDefined");
return 0; return 0;
} }
} }
// Charge le modele // Charge le modele
$file = "pdf_".$modele.".modules.php"; $file = "pdf_".$modele.".modules.php";
if (file_exists($dir.$file)) if (file_exists($dir.$file))
{ {
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
if ($obj->write_file($comid,$outputlangs) > 0) // We save charset_output to restore it because write_file can change it if needed for
{ // output format that does not support UTF8.
// on supprime l'image correspondant au preview $sav_charset_output=$outputlangs->charset_output;
supplier_order_delete_preview($db, $comid); if ($obj->write_file($comid,$outputlangs) > 0)
return 1; {
} // on supprime l'image correspondant au preview
else supplier_order_delete_preview($db, $comid);
{
dolibarr_syslog("Erreur dans supplier_order_pdf_create"); $outputlangs->charset_output=$sav_charset_output;
dolibarr_print_error($db,$obj->pdferror()); return 1;
return 0; }
} else
} {
else $outputlangs->charset_output=$sav_charset_output;
{ dolibarr_syslog("Erreur dans supplier_order_pdf_create");
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); dolibarr_print_error($db,$obj->pdferror());
return 0; return 0;
} }
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
return 0;
}
} }
function supplier_order_delete_preview($db, $propalid) function supplier_order_delete_preview($db, $propalid)
{ {
global $langs,$conf; global $langs,$conf;
$comfourn = new CommandeFournisseur($db,"",$propalid); $comfourn = new CommandeFournisseur($db,"",$propalid);
$comfourn->fetch($propalid); $comfourn->fetch($propalid);
$client = new Societe($db); $client = new Societe($db);
$client->fetch($comfourn->socid); $client->fetch($comfourn->socid);
if ($conf->fournisseur->commande->dir_output) if ($conf->fournisseur->commande->dir_output)
{ {
$comfournref = sanitizeFileName($comfourn->ref); $comfournref = sanitizeFileName($comfourn->ref);
$dir = $conf->commande->dir_output . "/" . $comfournref ; $dir = $conf->commande->dir_output . "/" . $comfournref ;
$file = $dir . "/" . $comfournref . ".pdf.png"; $file = $dir . "/" . $comfournref . ".pdf.png";
if ( file_exists( $file ) && is_writable( $file ) ) if ( file_exists( $file ) && is_writable( $file ) )
{ {
if ( ! unlink($file) ) if ( ! unlink($file) )
{ {
$this->error=$langs->trans("ErrorFailedToOpenFile",$file); $this->error=$langs->trans("ErrorFailedToOpenFile",$file);
return 0; return 0;
} }
} }
} }
} }
?> ?>

View File

@ -112,7 +112,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// Force output charset to ISO, because, FPDF expect text encoded in ISO // Force output charset to ISO, because, FPDF expect text encoded in ISO
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1'; $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main"); $outputlangs->load("main");
$outputlangs->load("companies"); $outputlangs->load("companies");

View File

@ -156,7 +156,7 @@ if ($_POST["action"] == "set")
$requestnb++; $requestnb++;
if ($conf->character_set_client == "UTF-8") if ($conf->character_set_client == "UTF-8")
{ {
$buffer=utf8_encode ($buffer); $buffer=utf8_encode($buffer);
} }
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
@ -268,7 +268,7 @@ if ($_POST["action"] == "set")
$requestnb++; $requestnb++;
if ($conf->character_set_client == "UTF-8") if ($conf->character_set_client == "UTF-8")
{ {
$buffer=utf8_encode ($buffer); $buffer=utf8_encode($buffer);
} }
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);

View File

@ -97,6 +97,7 @@ OrderMode=Order method
AuthorRequest=Request author AuthorRequest=Request author
UseCustomerContactAsOrderRecipientIfExist=Use customer contact address if defined instead of third party address as order recipient address UseCustomerContactAsOrderRecipientIfExist=Use customer contact address if defined instead of third party address as order recipient address
RunningOrders=Orders on process RunningOrders=Orders on process
UserWithApproveOrderGrant=Useres granted with "approve orders" permission.
Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constant COMMANDE_SUPPLIER_ADDON not defined Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constant COMMANDE_SUPPLIER_ADDON not defined
Error_COMMANDE_ADDON_NotDefined=Constant COMMANDE_ADDON not defined Error_COMMANDE_ADDON_NotDefined=Constant COMMANDE_ADDON not defined

View File

@ -97,6 +97,7 @@ OrderMode=M
AuthorRequest=Auteur/Demandeur AuthorRequest=Auteur/Demandeur
UseCustomerContactAsOrderRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des commandes UseCustomerContactAsOrderRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des commandes
RunningOrders=Commandes en cours RunningOrders=Commandes en cours
UserWithApproveOrderGrant=Utilisateurs habilités à approuver les commandes
Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constante COMMANDE_SUPPLIER_ADDON non définie Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constante COMMANDE_SUPPLIER_ADDON non définie
Error_COMMANDE_ADDON_NotDefined=Constante COMMANDE_ADDON non définie Error_COMMANDE_ADDON_NotDefined=Constante COMMANDE_ADDON non définie

View File

@ -788,8 +788,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{ {
print "<head>\n"; print "<head>\n";
print $langs->lang_header(); print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$conf->character_set_client."\">\n";
print $head;
// Affiche meta // Affiche meta
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots

View File

@ -456,17 +456,6 @@ class Translate {
return $langs_available; return $langs_available;
} }
/**
* \brief Exp<EFBFBD>die le header correct et retourne le d<EFBFBD>but de la page html
* [en] Send header and return a string of html start page
* \return string html header avec charset
*/
function lang_header()
{
$texte = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$this->charset_output."\">\n";
return $texte;
}
/** /**
* \brief Renvoi si le fichier $filename existe dans la version de la langue courante ou alternative * \brief Renvoi si le fichier $filename existe dans la version de la langue courante ou alternative