From: <tim...@us...> - 2010-10-27 13:12:27
|
Revision: 4113 http://web-erp.svn.sourceforge.net/web-erp/?rev=4113&view=rev Author: tim_schofield Date: 2010-10-27 13:12:20 +0000 (Wed, 27 Oct 2010) Log Message: ----------- Corrections to display multi line invoice narratives correctly~ Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/doc/Change.log.html trunk/includes/MiscFunctions.php Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2010-10-27 01:28:50 UTC (rev 4112) +++ trunk/ConfirmDispatch_Invoice.php 2010-10-27 13:12:20 UTC (rev 4113) @@ -1497,7 +1497,7 @@ $j++; echo '<tr> <td>' ._('Invoice Text'). ':</td> - <td><textarea tabindex="'.$j.'" name="InvoiceText" COLS="31" ROWS="5">' . $_POST['InvoiceText'] . '</textarea></td> + <td><textarea tabindex="'.$j.'" name="InvoiceText" COLS="31" ROWS="5">' . reverse_escape($_POST['InvoiceText']) . '</textarea></td> </tr>'; $j++; Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2010-10-27 01:28:50 UTC (rev 4112) +++ trunk/PrintCustTrans.php 2010-10-27 13:12:20 UTC (rev 4113) @@ -325,13 +325,9 @@ $pdf->addTextWrap($FormDesign->PaymentTerms->x, $Page_Height - $FormDesign->PaymentTerms->y, $FormDesign->PaymentTerms->Length, $FormDesign->PaymentTerms->FontSize, _('Payment Terms') . ': ' . $myrow['terms']); // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); // $FontSize=10; - $LeftOvers = $pdf->addTextWrap($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y, $FormDesign->InvoiceText->Length, $FormDesign->InvoiceText->FontSize, $myrow['invtext']); - if (strlen($LeftOvers) > 0) { - $LeftOvers = $pdf->addTextWrap($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y-10, $FormDesign->InvoiceText->Length, $FormDesign->InvoiceText->FontSize, $LeftOvers); - if (strlen($LeftOvers) > 0) { - $LeftOvers = $pdf->addTextWrap($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y-20, $FormDesign->InvoiceText->Length, $FormDesign->InvoiceText->FontSize, $LeftOvers); - /*If there is some of the InvText leftover after 3 lines 200 wide then it is not printed :( */ - } + $LeftOvers=explode('\r\n',DB_escape_string($myrow['invtext'])); + for ($i=0;$i<sizeOf($LeftOvers);$i++) { + $pdf->addText($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y-($i*10), $FormDesign->InvoiceText->FontSize, $LeftOvers[$i]); } $pdf->addText($FormDesign->SubTotalCaption->x, $Page_Height - $FormDesign->SubTotalCaption->y, $FormDesign->SubTotalCaption->FontSize, _('Sub Total')); $LeftOvers = $pdf->addTextWrap($FormDesign->SubTotal->x, $Page_Height - $FormDesign->SubTotal->y, $FormDesign->SubTotal->Length, $FormDesign->SubTotal->FontSize, $DisplaySubTot, 'right'); Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2010-10-27 01:28:50 UTC (rev 4112) +++ trunk/PrintCustTransPortrait.php 2010-10-27 13:12:20 UTC (rev 4113) @@ -441,13 +441,9 @@ $pdf->addTextWrap($Left_Margin+5,$YPos+3,280,$FontSize,_('Payment Terms') . ': ' . $myrow['terms']); $FontSize =8; - $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-5,280,$FontSize,$myrow['invtext']); - if (strlen($LeftOvers)>0){ - $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-24,280,$FontSize,$LeftOvers); - if (strlen($LeftOvers)>0){ - $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-36,280,$FontSize,$LeftOvers); - /*If there is some of the InvText leftover after 3 lines 200 wide then it is not printed :( */ - } + $LeftOvers=explode('\r\n',DB_escape_string($myrow['invtext'])); + for ($i=0;$i<sizeOf($LeftOvers);$i++) { + $pdf->addText($Left_Margin+5, $YPos-8-($i*8), $FontSize, $LeftOvers[$i]); } $FontSize = 10; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-10-27 01:28:50 UTC (rev 4112) +++ trunk/doc/Change.log.html 2010-10-27 13:12:20 UTC (rev 4113) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>27/10/10 Tim: Corrections to display multi line invoice narratives correctly</p> <p>26/10/10 Tim: Discountmatrix.php - Fix discount category bug</p> <p>26/10/10 Tim: Discountmatrix.php - Increase the number of decimal places that can be entered</p> <p>26/10/10 Tim: StockLocTransfer.php - Check there is sufficient stock for the transfer</p> Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2010-10-27 01:28:50 UTC (rev 4112) +++ trunk/includes/MiscFunctions.php 2010-10-27 13:12:20 UTC (rev 4113) @@ -12,6 +12,13 @@ }//prnMsg +function reverse_escape($str) +{ + $search=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); + $replace=array("\\","\0","\n","\r","\x1a","'",'"'); + return str_replace($search,$replace,$str); +} + function getMsg($Msg,$Type='info',$Prefix=''){ $Colour=''; if ($_SESSION['LogSeverity']>0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |