[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon
From: |
Raphaël Bertrand (Résultic) |
Subject: |
Re: [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon |
Date: |
Thu, 05 Jun 2008 18:36:37 +0200 |
User-agent: |
Thunderbird 2.0.0.14 (Windows/20080421) |
Venant juste d'avoir la réponse,
et ayant déjà commencé à le faire,
je vous transmets ce que j'ai fait pour le moment.
Au final, je fais juste appel à une fonction supplémentaire _rotate dans
le module pdf, mais celle-ci peut être mise inline le cas échéant,
n'étant utilisée qu'une seule fois (ou presque).
*Raphaël Bertrand*
Résultic - Management & Informatique
Siège : 11 rue Tronchet - 69006 LYON
Bureaux : 11 pl Maréchal Lyautey - 69006 LYON
Fixe. 08 74 77 00 70
Fax. 08 25 24 85 02
E-Mail : address@hidden
Eldy a écrit :
Raphaël Bertrand (Résultic) a écrit :
Bonjour,
J'ai commencé à travailler sur la task #7349,
en regardant comment je pouvais ajouter le filigrane "Brouillon" sur
les propales dans un premier temps.
J'ai trouvé sur le site FPDF un exemple de watermark:
http://www.fpdf.org/?go=script&id=9
qui utilise les fonctions de la surcouche PDF_rotate:
http://www.fpdf.org/?go=script&id=2
Cependant Dolibarr utilise la librairie FPDI, à travers la classe
ModelePDFPropales (htdocs\includes\modules\propale\modules_propale.php),
et le module pdf correspondant au type de template
(htdocs\includes\modules\propale\pdf_propale_azur.modules.php par
exemple)
Je pense que c'est ici qu'il faut que j'ajoute le watermark, dans la
fonction _pagehead de chacun de ces squelettes, et concernant les
fonctions récupérées, soit les ajouter aux modules pdf sans les
mutualiser, soit les mutualiser dans un fichier autre (une lib)
Merci de me dire ce que vous en pensez.
Je suggère de faire beaucoup plus simple. Il n'est pas nécessaire de
surcharger par une librairie juste pour ce besoin (Dolibarr a déjà pas
mal de dépendances). On peut très bien intégrer un watermark en fond de
page en laissant les lettres droites et en les indentant en hauteur et
largeur comme cela
B
R
O
U
I
L
L
O
N
Et pour cela tu peux te contenter des fonctions de base de FPDF. Le tout
est de mettre la marque en couleur et derrière tout autre texte.
Index: admin/propale.php
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/admin/propale.php,v
retrieving revision 1.69
diff -u -r1.69 propale.php
--- admin/propale.php 12 May 2008 22:52:48 -0000 1.69
+++ admin/propale.php 5 Jun 2008 15:10:26 -0000
@@ -5,6 +5,7 @@
* Copyright (C) 2004 Benoit Mortier <address@hidden>
* Copyright (C) 2004 Eric Seigne <address@hidden>
* Copyright (C) 2005-2007 Regis Houssin <address@hidden>
+ * Copyright (C) 2008 Raphael Bertrand (Resultic) <address@hidden>
*
* 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
@@ -77,6 +78,11 @@
}
}
+if ($_POST["action"] == 'set_PROPALE_DRAFT_WATERMARK')
+{
+ dolibarr_set_const($db,
"PROPALE_DRAFT_WATERMARK",trim($_POST["PROPALE_DRAFT_WATERMARK"]));
+}
+
if ($_POST["action"] == 'set_PROPALE_FREE_TEXT')
{
dolibarr_set_const($db,
"PROPALE_FREE_TEXT",trim($_POST["PROPALE_FREE_TEXT"]));
@@ -378,6 +384,13 @@
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>:
'.yn($module->option_modereg);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>:
'.yn($module->option_condreg);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>:
'.yn($module->option_multilang);
+ //TODO :
$htmltooltip.='<br><b>'.$langs->trans("Escompte").'</b>:
'.yn($module->option_escompte);
+ $htmltooltip.='<br><b>'.$langs->trans("CreditNote").'</b>:
'.yn($module->option_credit_note);
+
$htmltooltip.='<br><b>'.$langs->trans("FreeLegalTextOnProposal").'</b>:
'.yn($module->option_freetext);
+
$htmltooltip.='<br><b>'.$langs->trans("WatermarkOnDraftProposal").'</b>:
'.yn($module->option_draft_watermark);
+
+
+
print '<td align="center">';
print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>';
@@ -488,6 +501,17 @@
print "</td></tr>\n";
print '</form>';
+$var=!$var;
+print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
+print "<input type=\"hidden\" name=\"action\"
value=\"set_PROPALE_DRAFT_WATERMARK\">";
+print '<tr '.$bc[$var].'><td colspan="2">';
+print $langs->trans("WatermarkOnDraftProposal").'<br>';
+print '<input size="50" class="flat" type="text"
name="PROPALE_DRAFT_WATERMARK"
value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
+print '</td><td align="right">';
+print '<input type="submit" class="button"
value="'.$langs->trans("Modify").'">';
+print "</td></tr>\n";
+print '</form>';
+
print '</table>';
Index: includes/modules/facture/pdf_crabe.modules.php
===================================================================
RCS file:
/sources/dolibarr/dolibarr/htdocs/includes/modules/facture/pdf_crabe.modules.php,v
retrieving revision 1.163
diff -u -r1.163 pdf_crabe.modules.php
--- includes/modules/facture/pdf_crabe.modules.php 12 May 2008 23:06:38
-0000 1.163
+++ includes/modules/facture/pdf_crabe.modules.php 5 Jun 2008 14:00:49
-0000
@@ -74,7 +74,7 @@
$this->option_multilang = 1; // Dispo en plusieurs
langues
$this->option_escompte = 1; // Affiche si il y a eu
escompte
$this->option_credit_note = 1; // Gère les avoirs
- $this->option_freetext = 1;
// Support add of a personalised text
+ $this->option_freetext = 1;
// Support add of a personalised text
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1;
Index: includes/modules/propale/pdf_propale_azur.modules.php
===================================================================
RCS file:
/sources/dolibarr/dolibarr/htdocs/includes/modules/propale/pdf_propale_azur.modules.php,v
retrieving revision 1.112
diff -u -r1.112 pdf_propale_azur.modules.php
--- includes/modules/propale/pdf_propale_azur.modules.php 16 Apr 2008
21:55:27 -0000 1.112
+++ includes/modules/propale/pdf_propale_azur.modules.php 5 Jun 2008
16:30:01 -0000
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2007 Laurent Destailleur <address@hidden>
* Copyright (C) 2005-2007 Regis Houssin <address@hidden>
+ * Copyright (C) 2008 Raphael Bertrand (Resultic) <address@hidden>
*
* 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
@@ -74,7 +75,8 @@
$this->option_multilang = 1; // Dispo en plusieurs
langues
$this->option_escompte = 1; // Affiche si il y a eu
escompte
$this->option_credit_note = 1; // Gère les avoirs
- $this->option_freetext = 1;
// Support add of a personalised text
+ $this->option_freetext = 1; //
Support add of a personalised text
+ $this->option_draft_watermark = 1; //Support
add of a watermark on drafts
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1;
@@ -786,7 +788,22 @@
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("companies");
-
+
+ //Affiche le filigrane brouillon - Print Draft Watermark
+ if($object->statut==0 && (!
empty($conf->global->PROPALE_DRAFT_WATERMARK)) )
+ {
+ $watermark_angle=55;
+ $watermark_x=5;
+ $watermark_y=$this->page_hauteur-25;
+ $pdf->SetFont('Arial','B',50);
+ $pdf->SetTextColor(255,192,203);
+
$this->_rotate($pdf,$watermark_angle,$watermark_x,$watermark_y);
+ $pdf->SetXY($watermark_x,$watermark_y);
+
$pdf->Cell(300,25,clean_html($conf->global->PROPALE_DRAFT_WATERMARK),0,2,"C",0);
+ $this->_rotate($pdf,0);
+ }
+
+ //Prepare la suite
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',13);
@@ -1050,6 +1067,37 @@
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
}
+
+ /*
+ * \brief rotate comming content print in PDF
+ * \param pdf Objet PDF
+ * \param angle angle of rotation in degree
+ * \param x x offset for printing (default: current)
+ * \param y y offset for
printing(default: current)
+ * \restiction after a rotation, and before
changing page or pdf, please rotate back to 0°
+ */
+ function _rotate(&$pdf,$angle,$x=-1,$y=-1)
+ {
+ static $angle_act=0;
+
+ if($x==-1)
+ $x=$pdf->x;
+ if($y==-1)
+ $y=$pdf->y;
+ if($angle_act!=0)
+ $pdf->_out('Q');
+ $angle_act=$angle;
+ if($angle!=0)
+ {
+ $angle*=M_PI/180;
+ $c=cos($angle);
+ $s=sin($angle);
+ $cx=$x*$pdf->k;
+ $cy=($pdf->h-$y)*$pdf->k;
+ $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1
%.2F %.2F cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy));
+ }
+ }
+
}
?>
Index: langs/en_US/admin.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/en_US/admin.lang,v
retrieving revision 1.339
diff -u -r1.339 admin.lang
--- langs/en_US/admin.lang 29 May 2008 17:37:10 -0000 1.339
+++ langs/en_US/admin.lang 5 Jun 2008 14:49:51 -0000
@@ -657,6 +657,7 @@
AddDeliveryAddressAbility=Add delivery date ability
UseOptionLineIfNoQuantity=A line of product/service with a zero amount is
considered as an option
FreeLegalTextOnProposal=Free text on commercial proposals
+WatermarkOnDraftProposal=Watermark on draft commercial proposals (any if empty)
##### Orders #####
OrdersSetup=Orders' management setup
OrdersNumberingModules=Orders numbering modules
Index: langs/fr_BE/admin.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/fr_BE/admin.lang,v
retrieving revision 1.22
diff -u -r1.22 admin.lang
--- langs/fr_BE/admin.lang 3 Apr 2008 14:53:15 -0000 1.22
+++ langs/fr_BE/admin.lang 5 Jun 2008 14:48:28 -0000
@@ -473,6 +473,7 @@
ClassifiedInvoicedWithOrder=Propositions facturées classifiées en même temps
que la commande
HideTreadedPropal=Cacher les propositions commerciales traitées dans la liste
FreeLegalTextOnProposal=Mention complémentaire sur les propositions
+WatermarkOnDraftProposal=Filigrane sur les brouillons de propositions (aucun
si vide)
##### Orders #####=
OrdersSetup=Configuration de la gestion des commandes
OrdersNumberingModules=Module de numérotation des commandes
Index: langs/fr_FR/admin.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/fr_FR/admin.lang,v
retrieving revision 1.364
diff -u -r1.364 admin.lang
--- langs/fr_FR/admin.lang 29 May 2008 17:37:10 -0000 1.364
+++ langs/fr_FR/admin.lang 5 Jun 2008 14:49:53 -0000
@@ -655,6 +655,7 @@
AddDeliveryAddressAbility=Possibilité de sélectionner une adresse de livraison
UseOptionLineIfNoQuantity=Une ligne de produit/service ayant une quantité
nulle est considérée comme une option
FreeLegalTextOnProposal=Mention complémentaire sur les propositions
+WatermarkOnDraftProposal=Filigrane sur les brouillons de propositions (aucun
si vide)
##### Orders #####
OrdersSetup=Configuration du module Commandes
OrdersNumberingModules=Modules de numérotation des commandes
- [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon, Raphaël Bertrand (Résultic), 2008/06/05
- Re: [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon, Eldy, 2008/06/05
- Re: [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon,
Raphaël Bertrand (Résultic) <=
- Re: [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon, Raphaël Bertrand (Résultic), 2008/06/06
- Re: [Dolibarr-dev] [Task #7349] Ajout filigrane Brouillon, Raphaël Bertrand (Résultic), 2008/06/06
- [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, Raphaël Bertrand (Résultic), 2008/06/09
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, Eldy, 2008/06/09
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, paul POULAIN, 2008/06/09
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, Marc-Henri PAMISEUX, 2008/06/09
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, Lionel Chamussy, 2008/06/10
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, paul POULAIN, 2008/06/10
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, paul POULAIN, 2008/06/10
- Re: [Dolibarr-dev] [Task #7349] Patch + Correction mise en page adresse contact sur PDF, Raphaël Bertrand (Résultic), 2008/06/10