# Company name overwrites address text

**URL:** <https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227>\
**Category:** Using my Dolibarr\
**Created:** [June 27, 2012, 2:51am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227 "2012-06-27T02:51:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [June 27, 2012, 2:51am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/1 "2012-06-27T02:51:16Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![katas](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@katas](https://www.dolibarr.org/forum/u/katas)\
**Post date:** [June 27, 2012, 3:50pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/2 "2012-06-27T15:50:37Z")

</div>

That has been fixed. Update your dolibarr.

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [June 27, 2012, 4:22pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/3 "2012-06-27T16:22:51Z")

</div>

I’m running latest stable 3.1.1 version.

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 20, 2012, 10:58am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/4 "2012-07-20T10:58:16Z")

</div>

Is there a solution for that problem in release 3.1.1 ?

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 20, 2012, 11:47am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/5 "2012-07-20T11:47:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![katas](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@katas](https://www.dolibarr.org/forum/u/katas)\
**Post date:** [July 20, 2012, 11:55am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/6 "2012-07-20T11:55:35Z")

</div>

3.3.0 alpha works just fine

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 20, 2012, 12:03pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/7 "2012-07-20T12:03:34Z")

</div>

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

![SnapShot.jpg](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/1X/ab0b8d2da062d8e72c1d0dd8299dec232a564754.jpeg)

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 20, 2012, 12:06pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/8 "2012-07-20T12:06:47Z")

</div>

No help for the below bug?

![SnapShot-20120720.jpg](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/1X/b6e13f95e17098047a5e1977240fd8a188558e28.jpeg)

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 21, 2012, 10:09am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/9 "2012-07-21T10:09:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 21, 2012, 12:47pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/10 "2012-07-21T12:47:55Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 21, 2012, 1:50pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/11 "2012-07-21T13:50:04Z")

</div>

tanayhan wrote:

> [@](#):
>
> Hi, I have upgraded to 3.2 but the same overwriting problem still exists.

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 ?

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 21, 2012, 3:16pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/12 "2012-07-21T15:16:52Z")

</div>

How can I do it?

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 21, 2012, 4:46pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/13 "2012-07-21T16:46:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 22, 2012, 7:15am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/14 "2012-07-22T07:15:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 22, 2012, 7:21am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/15 "2012-07-22T07:21:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 22, 2012, 11:02am UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/16 "2012-07-22T11:02:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 22, 2012, 12:29pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/17 "2012-07-22T12:29:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanayhan](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/tanayhan/32/3142_2.png) [@tanayhan](https://www.dolibarr.org/forum/u/tanayhan)\
**Post date:** [July 22, 2012, 1:33pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/18 "2012-07-22T13:33:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 22, 2012, 7:31pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/19 "2012-07-22T19:31:35Z")

</div>

Please see line 1075 of the pdf\_azur.modules.php file:

> <https://github.com/Dolibarr/dolibarr/blob/3.2/htdocs/core/modules/propale/doc/pdf_azur.modules.php#L1075>

You will see the following code:

```auto
$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.

---

<div class="post-metadata">

**Author:** ![saxa](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/saxa/32/2795_2.png) [@saxa](https://www.dolibarr.org/forum/u/saxa)\
**Post date:** [July 23, 2012, 3:50pm UTC](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227/20 "2012-07-23T15:50:50Z")

</div>

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.

[Next page](https://www.dolibarr.org/forum/t/company-name-overwrites-address-text/8227.md?page=2)
