Company name overwrites address text

Hello, we use many long names in company names, what happens is when we generate the pdf, sometimes the name is written on 2 lines, but in that case the address gets overwritten.

Please see attached image. Is there a way to solve this ?

Rgds
Saxa

!

[quote_text.jpg|512x240]
(upload://bwTlTflNkI0MFnxaEVDOXV0KawJ.jpeg)

That has been fixed. Update your dolibarr.

I’m running latest stable 3.1.1 version.

Is there a solution for that problem in release 3.1.1 ?

Hi, I have upgraded to 3.2 but the same overwriting problem still exists.

3.3.0 alpha works just fine

There are also someother two problems as shown below. (Version 3.2)

SnapShot.jpg

No help for the below bug?

SnapShot-20120720.jpg

Ok I thought that 3.2 would fix that. I have not upgraded yet, so there is another reason for me to not to upgrade and wait maybe for 3.2.1.

Here is the code that can be applied to the propale pdf generation. It should go into the _pagehead() method.

cat fix_propale_name_overwrite_address_in_3.1.1.patch
--- /srv/dolibarr-backup-20120605/htdocs/includes/modules/propale/pdf_propale_azur.modules.php  2012-06-05 16:26:08.400179328 -0300
+++ /srv/dolibarr/htdocs/includes/modules/propale/pdf_propale_azur.modules.php  2012-07-21 10:00:03.632132576 -0300
@@ -1021,10 +1021,20 @@
                        $pdf->SetXY($posx+2,$posy+3);
                        $pdf->SetFont('','B', $default_font_size);
                        $pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
+

                        // Show recipient information
                        $pdf->SetFont('','', $default_font_size - 1);
-                       $pdf->SetXY($posx+2,$posy+8);
+
+                       // Check if the company name is longer than 35 char. If yes, set the address pos to start lower.
+                       if ( strlen ($carac_client_name) > 35 ) {
+                               $pdf->SetXY($posx+2,$posy+12);
+                       }
+                       else
+                       {
+                               $pdf->SetXY($posx+2,$posy+8);
+                       }
+
                        $pdf->MultiCell(86,4, $carac_client, 0, 'L');
                }
        }

What it does is to check if the name of the company is longer than 35 char. If it is, it sets the SetXY to start lower so the name does not overwrite the address or other data.
It still has room to be improved, because if the name is written in 3 lines then it will overwrite the address again, so there should be done some way to set the Y parameter dinamically according to the number of rows written by the customers name.

This for me works, so it can be applied also to other reports.

tanayhan wrote:

I see that the code has the solution in 3.2.0 to this problem. Have you tried to change the template, and regenerate the document ?

How can I do it?

When you prepare a quote, you can select the model of the report on the bottom. Or you can go to configurations as admin and select the template to use.

Thanks, i did it but it does not fix the problem.

I use 3.2 version. I can not find the directory htdocs/includes/modules/propale/pdf_propale_azur.modules.php nor the file pdf_propale_azur.modules.php in my dolibarr directory. There is no such diectory called modules in includes, buy my software works properly. What is my problem.

have you try to search ? Also there are various tools to search files on different OS-es. In version 3.2 it is located in doc/ subdir of propale dir.
Should be includes/modules/propale/doc/ .

The patch I posted here will not apply to the code of 3.2 because it has already a solution in it.

My os is win7. The problem is not fixed ib 3.2 i suppose. I reinstaed it several times, but the problem still exists.

Hi, I dont have much knowledge about php, i would be glad if you me where to add this code in the azur php module.
Thanks

Please see line 1075 of the pdf_azur.modules.php file:

You will see the following code:

$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));

the function dol_nboflines_bis() calculates on how many lines the customer name is splitted and it adds it to the Y position.

This code is from 3.2 branch on github but its the same as you have in the 3.2.0 official release.

Ok, today I did some work wth dolibarr 3.2.0 which I upgraded during the weekend. It seems that still for some reason the code
of dol_nboflines_bis() function does not work or get executed.

The problem of overwriting the address persists in 3.2.0 for me too.

I will try to check this closer during this week, after we do some more work with dolibarr n our company.