Fix: UTF encoding on PDF company if there is no logo.

This commit is contained in:
Laurent Destailleur 2009-02-18 18:18:34 +00:00
parent 6409ef3467
commit 0060695c1b
11 changed files with 49 additions and 34 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -58,7 +58,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
if (eregi('([^\\\/:]+)$',$_FILES["logo"]["name"],$reg))
{
$original_file=$reg[1];
$isimage=image_format_supported($original_file);
if ($isimage >= 0)
{
@ -70,7 +70,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
if (dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->societe->dir_logos.'/'.$original_file,1) > 0)
{
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file);
// Create thumbs of logo
if ($isimage > 0)
{
@ -143,7 +143,7 @@ if ($_GET["action"] == 'addthumb')
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall);
}
else dolibarr_syslog($imgThumbSmall);
// Création de la vignette de la page "Société/Institution"
$imgThumbMini = vignette($conf->societe->dir_logos.'/'.$_GET["file"], 100, 30, '_mini',80);
if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbMini,$reg))
@ -274,11 +274,14 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
print '<table width="100%" class="notopnoleftnoright"><tr><td valign="center">';
print '<input type="file" class="flat" name="logo" size="50">';
print '</td><td valign="middle" align="right">';
if ($mysoc->logo_mini && file_exists($conf->societe->dir_logos.'/thumbs/'.$mysoc->logo_mini))
if ($mysoc->logo_mini)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
print ' &nbsp; ';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
if (file_exists($conf->societe->dir_logos.'/thumbs/'.$mysoc->logo_mini))
{
print ' &nbsp; ';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
}
}
else
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>

View File

@ -58,23 +58,23 @@ class FormFile
global $conf,$langs;
print "\n\n<!-- Start form attach new file -->\n";
if (! $titre) $titre=$langs->trans("AttachANewFile");
print_titre($titre);
print '<form name="userfile" action="'.$url.'" enctype="multipart/form-data" method="POST">';
print '<input type="hidden" name="section" value="'.$sectionid.'">';
print '<table width="100%" class="noborder">';
print '<tr><td width="50%" valign="top">';
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
if (eregi('m$',$maxphp)) $maxphp=$maxphp*1024;
if (eregi('k$',$maxphp)) $maxphp=$maxphp;
// Now $max and $maxphp are in Kb
if ($maxphp > 0) $max=min($max,$maxphp);
if ($max > 0)
{
print '<input type="hidden" name="max_file_size" value="'.($max*1024).'">';
@ -86,13 +86,13 @@ class FormFile
print '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
print (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled="true"':'');
print '>';
if ($addcancel)
{
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
if (! empty($conf->global->MAIN_UPLOAD_DOC))
{
print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb");
@ -108,7 +108,7 @@ class FormFile
print '</form>';
if (empty($sectionid)) print '<br>';
print "\n<!-- End form attach new file -->\n\n";
return 1;
@ -128,7 +128,7 @@ class FormFile
* \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS defini
* \param iconPDF N'affiche que l'icone PDF avec le lien (1/0)
* \param maxfilenamelength Max length for filename shown
* \param noform Do not output html form start and end
* \param noform Do not output html form start and end
* \param param More param on http links
* \remarks Le fichier de facture detaillee est de la forme
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
@ -138,7 +138,7 @@ class FormFile
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
global $langs,$bc,$conf;
$var=true;
@ -273,7 +273,7 @@ class FormFile
else if ($modulepart == 'unpayed')
{
$modellist='';
}
}
else
{
dolibarr_print_error($this->db,'Bad value for modulepart');
@ -284,10 +284,10 @@ class FormFile
$html = new Form($db);
$texte=$langs->trans('Generate');
if (empty($noform)) print '<form action="'.$urlsource.'#builddoc" method="post">';
print '<input type="hidden" name="action" value="builddoc">';
print_titre($langs->trans("BuildDocuments"));
print '<table class="border" width="100%">';
@ -343,7 +343,7 @@ class FormFile
foreach($file_list as $i => $file)
{
$var=!$var;
// Defini chemin relatif par rapport au module pour lien download
$relativepath=$file["name"]; // Cas general
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture...
@ -417,7 +417,7 @@ class FormFile
global $user, $conf, $langs;
global $bc;
global $sortfield, $sortorder;
// Affiche liste des documents existant
if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
else { $bc[true]=''; $bc[false]=''; };
@ -466,7 +466,7 @@ class FormFile
print "</td></tr>\n";
}
}
if (sizeof($filearray) == 0)
if (sizeof($filearray) == 0)
{
print '<tr '.$bc[$var].'><td colspan="4">';
if (empty($textifempty)) print $langs->trans("NoFileFound");

View File

@ -395,9 +395,10 @@ class pdf_edison extends ModelePDFCommandes
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
}
else if (defined("FAC_PDF_INTITULE"))
else
{
$pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L');
$text=$this->emetteur->nom;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('Arial','B',13);

View File

@ -752,9 +752,10 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
}
else if (defined("FAC_PDF_INTITULE"))
else
{
$pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L');
$text=$this->emetteur->nom;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('Arial','B',13);

View File

@ -355,7 +355,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
else
{
$text=$this->emetteur->nom;
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($text), 0, 'L');
}
//*********************Entete****************************
//Nom du Document

View File

@ -925,9 +925,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
}
else if (defined("FAC_PDF_INTITULE"))
else
{
$pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L');
$text=$this->emetteur->nom;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('Arial','B',13);

View File

@ -810,9 +810,10 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(80, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
}
else if (defined("FAC_PDF_INTITULE"))
else
{
$pdf->MultiCell(80, 6, FAC_PDF_INTITULE, 0, 'L');
$text=$this->emetteur->nom;
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}

View File

@ -59,6 +59,7 @@ class ModelePDFPropales extends FPDF
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
$sql.=" WHERE type = '".$type."'";
dolibarr_syslog("modules_propale::liste_modeles sql=".$sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@ -779,9 +779,10 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
}
else if (defined("FAC_PDF_INTITULE"))
else
{
$pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L');
$text=$this->emetteur->nom;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('Arial','B',13);

View File

@ -79,6 +79,8 @@ delete from llx_categorie_association where fk_categorie_mere = fk_categorie_fil
alter table llx_societe add price_level tinyint(4) NULL;
delete from llx_document_model where nom = 'huitre' and type = 'invoice';
-- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet);
-- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);