Browse Source

New: Can add a free text on bank cheque receipts

Laurent Destailleur 16 years ago
parent
commit
c3c894f040

+ 1 - 0
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.

+ 107 - 0
htdocs/admin/bank.php

@@ -0,0 +1,107 @@
+<?php
+/* Copyright (C) 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
+ * 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='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
+print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup');
+print '<br>';
+
+
+print '<table class="noborder" width="100%">';
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans("Parameter").'</td>';
+print '<td align="center" width="60">&nbsp;</td>';
+print '<td width="80">&nbsp;</td>';
+print "</tr>\n";
+$var=true;
+
+$var=! $var;
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
+print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
+print '<tr '.$bc[$var].'><td colspan="2">';
+print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
+print '<textarea name="BANK_CHEQUERECEIPT_FREE_TEXT" class="flat" cols="100">'.$conf->global->BANK_CHEQUERECEIPT_FREE_TEXT.'</textarea>';
+print '</td><td align="right">';
+print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
+print "</td></tr>\n";
+print '</form>';
+
+/*
+$var=!$var;
+print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
+print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+print "<input type=\"hidden\" name=\"action\" value=\"set_BANK_CHEQUERECEIPT_DRAFT_WATERMARK\">";
+print '<tr '.$bc[$var].'><td colspan="2">';
+print $langs->trans("WatermarkOnDraftChequeReceipt").'<br>';
+print '<input size="50" class="flat" type="text" name="BANK_CHEQUERECEIPT_DRAFT_WATERMARK" value="'.$conf->global->BANK_CHEQUERECEIPT_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>';
+
+
+
+$db->close();
+
+llxFooter('$Date$ - $Revision$');
+?>

+ 74 - 0
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);
+	}
+
 }
 
 ?>

+ 4 - 0
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");

+ 3 - 0
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

+ 3 - 0
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