Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Yes, I agree.

I will first have a discussion withnJanusz about this.

Joe

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

I would disagree for removing the reference field. Without removing the Reference Field the Functionality shall be added to jump to Next Available Reference without notifying user.

Keeping Reference field open sometimes allow users to maintain a different sequence manually maintained specially in case of Invoices.

Like in our area we have a practice that Sales Taxed Invoices must have a separate sequence then Normal Invoices. In such situation we suggest users to manually maintain a sequence for Sales Taxed Invoices and Put that sequence in the Reference Field before Processing the Invoice.

www.boxygen.pk

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

This problem just have been fixed in our repo, the fix will be included in next release.
Thanks.

Janusz

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

apmuthu wrote:

@joe: It is better to remove the Reference field from all such forms and save as next available Reference automatically and informing the user of the actual reference it was saved as by reporting it in the "success" message.

Yes, I think that'll be great.

In the interim though, any way I can get the value in the ref field on the form increasing to the next available ref? Or automatically saving with the next available ref if the one displayed is used?

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

itronics wrote:

This problem just have been fixed in our repo, the fix will be included in next release.
Thanks.

Janusz

Still not working. Unset() definitely destroys $_POST['ref'] but does not refresh/change/increase the ref field on the form and clicking Place Order  again doesn't save the order, just displays same error message again.

 $ref = $Refs->get_next($_SESSION['Items']->trans_type, null, array('date' => Today()));

The get_next() function rightly gets the next available ref. So the only thing left to do is to set the value of the ref field on the form to $ref.

How do we set/change/increase/refresh the value of the ref field on the form to $ref?

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

I have just tested the fix by Janusz, and it works perfectly.

@davidkumi
Maybe you need to refresh your browser caches. It should work now.

You will get an error saying the reference is already in use. Another line tells that the reference is updated, so you should save again. The reference is updated and when you save it should be ok. Well it could happen that other users are playing with the same numbers, so it could be repeated a few times.

/Joe

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Should it not just save with the next available reference by itself and then inform the user of the new reference number it saved it as?

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

itronics wrote:

This problem just have been fixed in our repo, the fix will be included in next release.
Thanks.

Janusz

Oh yes, you're right. It works like magic. Just had to comment out those two other lines as below:

unset($_POST['ref']); // force refresh reference
display_error(_("The reference number field has been increased. Please save the document again."));
//$_POST['ref'] = $_SESSION['Items']->reference = $ref;
//$Ajax->activate('ref');

Thank you, thank you, thank you all

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

@ApMuthu,
I don't think so. Now user can easily accept proposed next reference, or change it if he wish, at the low cost of one additional Ctrl-Enter keypress. In alternative scenario, changing once stored invoice is much more unhandy.
Janusz

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

@itronics, thanks for the reason behind the slight inconvenience of re-submission. When would one want to change the reference the form automatically provides?

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

I don't know, the people's needs are so various... The reference field is editable, so you can change it according to your imagination, you can
for example want to use some reference from previously voided transaction, and mistake a mistake in number (the entered reference is already used). You should have last chance to edit it after clash again. You would not like to be forced to next reference unconditionally instead, and having to reedit it again.

Janusz

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

@itronics you solution works only for SalesOrder/Invoices. What for JE, Bank Payments, Bank Deposits and other such transaction forms?

www.boxygen.pk

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

@itronics: looks like every entry screen that has a reference needs to be fixed in a similar way and the empty.po generated again.

39 (edited by boxygen 10/30/2017 11:00:30 am)

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Yes please have a look into this. Also sometimes it happens that auto increment of the reference gets stopped without any reason. Unless you manually go to the Forms Setup and increase it.

The next reference number routine shall check the reference table as well as the transaction table and If any reference in transactions table is higher than the reference in reference table than it shall automatically takes the next reference from the Transaction table and update the next reference in reference table.

www.boxygen.pk

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

When using FA, make sure there are no other instances of the browser / browser tab open.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

I've just installed 2.4.2 and the Reference number fields setup screen cannot be found.
It used to be in "Forms Setup". Can anyone tell me where to find this option?
Thank you.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

It is now called Transaction References and the menu item is at the same place in Setup.

/Joe

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Thanks Joe. It is better than the 2.3.21.
Well done team!

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

apmuthu wrote:

When would one want to change the reference the form automatically provides?

In our case, there are different users entering data at the same time. If two or more open the same form, they'll be assigned the same ref. After one saves successfully, the others will encounter The entered reference is already in use..

That is when references need to be changed.

Changing it manually was also not the best for us since instead of manually changing from say 134/2017 to 135/2017, sometimes they'd type funny things like 1352017 or 1355/2017 or 135/2o17.

If it's automatic, none of these problems.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

davidkumi wrote:
unset($_POST['ref']); // force refresh reference
display_error(_("The reference number field has been increased. Please save the document again."));
//$_POST['ref'] = $_SESSION['Items']->reference = $ref;
//$Ajax->activate('ref');

Hi all, I used this solution also for delivery and invoices and it worked. However, I'm struggling with the other forms - customer payments, bank payments, bank transfers, inventory adjustments, location transfers, etc.

Is there one thing we can do to fix them all?

If not, kindly guide me through how to fix the The entered reference is already in use. problem in each. We can start with bank payments.

Thanks.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Some if not all of these issues have been addressed in FA 2.4.3 or a means to edit it in the next screen is provided.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Just installed it - FA 2.4.3 - but  the same problem. Sales order is OK but not customer payments, bank payments, bank transfers, location transfers, inventory adjustments.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Starting with customer payment, any help?

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

None of the others have any externally sourced references like a sales order did.

@joe: should the concurrent edit issue have a more generic solution to cover all auto generated references?

Post's attachments

Internal_Ref.png 28.5 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Not working: Automatic Increase of reference number fields in FA 2.4.2

Just got a solution for customer payment.

In the can_process() function in sales/customer_payments.php, I update $_POST['ref'] with the next available ref before check_reference() runs. That means, if the ref on the form is used, the next available will be chosen and the problem of used ref will never occur again.

I'm particularly happy that no warning message is displayed on the form to the user. That's exactly how I wanted it.

The code is as below:

    ////////// setting  $_POST['ref'] to the next available ref
    $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT, null, array('customer' => get_post('customer_id'), 'date' => get_post('DateBanked')));
    if (!check_reference($_POST['ref'], ST_CUSTPAYMENT, @$_POST['trans_no'])) {
        set_focus('ref');
        return false;
    }