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 ?
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.
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.
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.
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.