From c3c894f0409e9f822a7e865d495e37d03893b3e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jun 2009 01:09:32 +0000 Subject: [PATCH] New: Can add a free text on bank cheque receipts --- ChangeLog | 1 + htdocs/admin/bank.php | 107 ++++++++++++++++++ .../modules/cheque/pdf/pdf_blochet.class.php | 74 ++++++++++++ htdocs/includes/modules/modBanque.class.php | 4 + htdocs/langs/en_US/admin.lang | 3 + htdocs/langs/fr_FR/admin.lang | 3 + 6 files changed, 192 insertions(+) create mode 100644 htdocs/admin/bank.php diff --git a/ChangeLog b/ChangeLog index 36a52cdf2bc..5f5397c20c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ English Dolibarr changelog ***** Changelog for 2.7 compared to 2.6 ***** For users: +- New: Can add a free text on bank cheque receipts - New: Price level can be defined also for prospects. - New: Add a help and support center. - New: Can export commercial proposals. diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php new file mode 100644 index 00000000000..0c06f9f429c --- /dev/null +++ b/htdocs/admin/bank.php @@ -0,0 +1,107 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +/** + * \file htdocs/admin/bank.php + * \ingroup bank + * \brief Page to setup the bank module + * \version $Id$ + */ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT.'/facture.class.php'); + +$langs->load("admin"); +$langs->load("companies"); +$langs->load("bills"); +$langs->load("other"); + +if (!$user->admin) + accessforbidden(); + +$typeconst=array('yesno','texte','chaine'); + + +/* + * Actions + */ + +if ($_POST["action"] == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') +{ + dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",trim($_POST["BANK_CHEQUERECEIPT_FREE_TEXT"]),'chaine',0,'',$conf->entity); +} + + +/* + * view + */ + +llxHeader("",""); + +$html=new Form($db); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup'); +print '
'; + + +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$var=! $var; +print ''; +print ''; +print ''; +print '\n"; +print ''; + +/* +$var=!$var; +print ""; +print ''; +print ""; +print '\n"; +print ''; +*/ + +print '
'.$langs->trans("Parameter").'  
'; +print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; +print ''; +print '
'; +print ''; +print "
'; +print $langs->trans("WatermarkOnDraftChequeReceipt").'
'; +print ''; +print '
'; +print ''; +print "
'; + + + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php index 315e2574bf4..b0fcd79e38c 100644 --- a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php @@ -130,6 +130,17 @@ class BordereauChequeBlochet extends FPDF $pagenb=0; $pdf->SetDrawColor(128,128,128); + $pdf->SetDrawColor(128,128,128); + $pdf->SetTitle($outputlangs->convToOutputCharset($fac->ref)); + $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname)); + $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); + if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); + + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetAutoPageBreak(1,0); + $pages = intval($lignes / $this->line_per_page); @@ -150,6 +161,12 @@ class BordereauChequeBlochet extends FPDF $this->Body($pdf, 1, $outputlangs); + // Pied de page + $this->_pagefoot($pdf,'',$outputlangs); + $pdf->AliasNbPages(); + + $pdf->Close(); + $pdf->Output($_file); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -292,6 +309,63 @@ class BordereauChequeBlochet extends FPDF } } + + /** + * \brief Show footer of page + * \param pdf Object PDF + * \param object Object invoice + * \param outputlang Object lang for output + * \remarks Need this->emetteur object + */ + function _pagefoot(&$pdf,$object,$outputlangs) + { + global $conf; + + //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur); + $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; + $marge_basse=$this->marge_basse; + $marge_gauche=$this->marge_gauche; + $page_hauteur=$this->page_hauteur; + + // Line of free text + $ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):""; + + $pdf->SetFont('Arial','',7); + $pdf->SetDrawColor(224,224,224); + + // On positionne le debut du bas de page selon nbre de lignes de ce bas de page + $nbofligne=dol_nboflines_bis($ligne); + //print 'e'.$ligne.'t'.dol_nboflines($ligne);exit; + $posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0); + + if ($ligne) // Free text + { + $pdf->SetXY($marge_gauche,-$posy); + $pdf->MultiCell(20000, 3, $ligne, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. + $posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell + } + + $pdf->SetY(-$posy); + $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy); + $posy--; + + if ($ligne1) + { + $pdf->SetXY($marge_gauche,-$posy); + $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); + } + + if ($ligne2) + { + $posy-=3; + $pdf->SetXY($marge_gauche,-$posy); + $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); + } + + $pdf->SetXY(-20,-$posy); + $pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); + } + } ?> diff --git a/htdocs/includes/modules/modBanque.class.php b/htdocs/includes/modules/modBanque.class.php index 03e1049b9dc..3d5a16a0402 100644 --- a/htdocs/includes/modules/modBanque.class.php +++ b/htdocs/includes/modules/modBanque.class.php @@ -67,6 +67,10 @@ class modBanque extends DolibarrModules // Data directories to create when module is enabled $this->dirs = array("/banque/temp"); + // Config pages + //------------- + $this->config_page_url = array("bank.php"); + // Dependancies $this->depends = array(); $this->requiredby = array("modComptabilite","modAccounting"); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4801aff4e25..52e64fdfffd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1064,3 +1064,6 @@ WebServicesSetup=Webservices module setup WebServicesDesc=By enabling this module, Dolibarr become a web service server to provide miscellaneous web services. WSDLCanBeDownloadedHere=WSDL descriptor file of provided serviceses can be download here EndPointIs=SOAP clients must send their requests to the Dolibarr endpoint available at Url +##### Bank ##### +BankSetupModule=Bank module setup +FreeLegalTextOnChequeReceipts=Free text on cheque receipts diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 9f83673053b..951291efc74 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1063,3 +1063,6 @@ WebServicesSetup=Configuration du module Webservices WebServicesDesc=En activant ce module, Dolibarr devient aussi serveur de web services offrant des web services divers. WSDLCanBeDownloadedHere=Le descripteur WSDL des services fournis peut etre récupéré ici EndPointIs=Les clients SOAP doivent envoyer leur requetes vers l'endpoint Dolibarr à l'URL +##### Bank ##### +BankSetupModule=Configuration du module Banque +FreeLegalTextOnChequeReceipts=Mention complémentaire sur les bordereaux de remises de chèques \ No newline at end of file