# Changing the quote number manually

**URL:** <https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318>\
**Category:** Using my Dolibarr\
**Tags:** v19\
**Created:** [May 9, 2024, 8:24am UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318 "2024-05-09T08:24:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 9, 2024, 8:24am UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/1 "2024-05-09T08:24:39Z")

</div>

Good morning,

I have been using Dolibarr for 6 months and I have to enter old quotes and invoices with their number.  
S I have to manually enter the quote number.

I see that there is the possibility to manually modify the invoice number (activating INVOICE\_ALLOW\_FREE\_REF) but there is no way to change the quote number.

Is there a way to do this?

Thanks for your support!

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 9, 2024, 11:29am UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/2 "2024-05-09T11:29:21Z")

</div>

> [@hamidine.chakirine](#):
>
> quote number

what is a quote number?

---

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 9, 2024, 11:53am UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/3 "2024-05-09T11:53:20Z")

</div>

I mean proposal number

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 9, 2024, 12:13pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/4 "2024-05-09T12:13:49Z")

</div>

The reference or the proposal id?

---

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 9, 2024, 12:18pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/5 "2024-05-09T12:18:31Z")

</div>

The reference of the proposal “the draft one”.  
i need to put manually the proposal number…

 ![003](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/7/701b4ddfacd9bd09a080d5038902582a9eb648de.png)

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 9, 2024, 5:49pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/6 "2024-05-09T17:49:45Z")

</div>

> [@hamidine.chakirine](#):
>
> The reference of the proposal “the draft one”.  
> i need to put manually the proposal number…

Maybe if you use the mass import tool you can change the proposal REFERENCE. Or perhaps you can use the API.

---

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 10, 2024, 8:32am UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/7 "2024-05-10T08:32:44Z")

</div>

Wich API?

I made some changes to the code.  
In the htdocs\comm\propal\card.php file I added this code:

// Ref proposal  
$morehtmlref .= $form-\>editfieldkey(“Ref”, ‹ref›, $object-\>ref, $object, $usercancreate, ‹string›, ‹›, 0, 1);  
$morehtmlref .= $form-\>editfieldval(“Ref”, ‹ ref ›, $object-\>ref, $object, $usercancreate, ‹ string ›, ‹ ›, null, null, ‹ ›, 1);  
$morehtmlref .= ‹  
›;

So I was able to have the link to modify the quote number

[**![002](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/8/8cddea395a2194d3eaf4364fe571d3ecc2de2585.png)**](https://www.dolibarr.fr/forum/uploads/default/optimized/3X/8/c/8cddea395a2194d3eaf4364fe571d3ecc2de2585_2_690x259.png)

However I received an error when I tried to modify the number.

[![](https://www.dolibarr.fr/forum/uploads/default/optimized/3X/2/f/2fdae918fc5bd03a9f7df01a93eee2239c4ce535_2_690x194.png) ](https://www.dolibarr.fr/forum/uploads/default/optimized/3X/2/f/2fdae918fc5bd03a9f7df01a93eee2239c4ce535_2_690x194.png)

Any idea?

What is the name of the function that allows to modify the invoice number ?

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 10, 2024, 2:14pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/8 "2024-05-10T14:14:15Z")

</div>

> [@hamidine.chakirine](#):
>
> Wich API?

If you have enabled the API module then you go into the Tools menu in the top towards the right of the middle and then you find the “API explorer” menu entry in the left menu.

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 10, 2024, 2:18pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/9 "2024-05-10T14:18:26Z")

</div>

> [@hamidine.chakirine](#):
>
> In the htdocs\comm\propal\card.php file I added this code:
> 
> // Ref proposal  
> $morehtmlref .= $form-\>editfieldkey(“Ref”, ‹ref›, $object-\>ref, $object, $usercancreate, ‹string›, ‹›, 0, 1);  
> $morehtmlref .= $form-\>editfieldval(“Ref”, ‹ ref ›, $object-\>ref, $object, $usercancreate, ‹ string ›, ‹ ›, null, null, ‹ ›, 1);  
> $morehtmlref .= ‹  
> ›;

That will be overwritten when you upgrade Dolibarr. Perhaps you should edit this file and submit a pull request so it can be available to everyone?

> <https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/card.php>

---

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 13, 2024, 2:14pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/10 "2024-05-13T14:14:50Z")

</div>

Thanks jonbendtsen for your support !

> [@jonbendtsen](#):
>
> That will be overwritten when you upgrade Dolibarr. Perhaps you should edit this file and submit a pull request so it can be available to everyone?

This is what I plan to do.  
However, I am on the halfway there.

It’s true that I was able to display the link which allows me to modify the proposal number, however if i change the number and validate I receive an error “Record not found”

I’m still looking for the solution.

I’m still looking for the piece of code that allows the update on the database.

If some can help.

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 13, 2024, 5:02pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/11 "2024-05-13T17:02:46Z")

</div>

@hamidine.chakirine okay, you probably need to call a function to **update** the reference. Maybe this one will work

> <https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/class/propal.class.php#L4427>

another option could be to duplicate this function and change it to modify the ref and not the ref\_client, but try the update one first.

> <https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/class/propal.class.php#L2411>

---

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 17, 2024, 11:53am UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/12 "2024-05-17T11:53:42Z")

</div>

> [@jonbendtsen](#):
>
> another option could be to duplicate this function and change it to modify the ref and not the ref\_client, but try the update one first.
> 
> [dolibarr/htdocs/comm/propal/class/propal.class.php at develop · Dolibarr/dolibarr · GitHub](https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/class/propal.class.php#L2411)

Thank you very much.  
Great idea!!!  
I’ve created a new function called: set\_ref\_proposal() which does the same job as set\_ref\_client().

[https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/class/propal.class.php#L2411](https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/class/propal.class.php#L2411)

And in the card.php file, I added the line that calls the new function to update the quote number.

```
// Action clone object

```

…

} elseif ($action == ‘setref\_client’ && $usercancreate) {  
// Positionne ref client  
$result = $object-\>set\_ref\_client($user, GETPOST(‘ref\_client’));  
if ($result \< 0) {  
setEventMessages($object-\>error, $object-\>errors, ‘errors’);  
}

```
	**//// HERE //////////**
} elseif ($action == 'setref' && $usercancreate) {
	// Positionne ref devis
	$result = $object->set_ref_proposal($user, GETPOST('ref'));
	if ($result < 0) {
		setEventMessages($object->error, $object->errors, 'errors');
	}

```

And as a result, I was able to have control to modify the proposal number.

THANK YOU VERY MUCH

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [May 17, 2024, 2:45pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/13 "2024-05-17T14:45:56Z")

</div>

> [@hamidine.chakirine](#):
>
> Thank you very much.  
> Great idea!!!  
> I’ve created a new function called: set\_ref\_proposal() which does the same job as set\_ref\_client().

GREAT 😃

I wish you would file a merge request with your new function such that others might benefit too. Also, if you get it into the main Dolibarr code then you do not have to keep inserting it whenever you upgrade your Dolibarr installation.

How?

you edit this file and insert your function at a free spot - which could be this line [dolibarr/htdocs/comm/propal/class/propal.class.php at develop · Dolibarr/dolibarr · GitHub](https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/comm/propal/class/propal.class.php#L2458) just below the existing function. Then you commit, write a meaningful commit message and then you get to the merge request where you also file a meaningful merge request message.

It might be an idea to link to this thread so people can see why

---

<div class="post-metadata">

**Author:** ![hamidine.chakirine](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/a4c791/32.png) [@hamidine.chakirine](https://www.dolibarr.org/forum/u/hamidine.chakirine)\
**Post date:** [May 17, 2024, 3:43pm UTC](https://www.dolibarr.org/forum/t/changing-the-quote-number-manually/25318/14 "2024-05-17T15:43:26Z")

</div>

I will 🙂

Thanks again for your support :wink:
