Changing the quote number manually

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!

what is a quote number?

I mean proposal number

The reference or the proposal id?

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.

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

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

Any idea?

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

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.

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?

Thanks jonbendtsen for your support !

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.

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

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.

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

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

GREAT :smiley:

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

1 Like

I will :slight_smile:

Thanks again for your support :wink:

1 Like