Fee Field: Type: Text, default: Blank, Formula * /

  • Calum
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
7 years 10 months ago #99559 by Calum
There is a bug/issue in 2.9 (certainly on PHP 7.0, with Joomla 3.7.2) with a Fee Field with a type=text and the default set to blank, and a formula containing either a multiplication or a division, which results in an error when calculateFIeld is called and the @eval step tried to do a sum like "Blank" * 10. (the field is set to validate as a integer)

I've recently upgraded to PHP 7, Memb Pro 2.9, on Joomla 3.7.2 so I can't quite pin down where the issue has appeared.

Replacing the default with 0 prevents the issue. Either the default should become mandated if the formula is set, or the code needs to detect if it is blank and then skip the @eval step if the maths has a * or / in it (or perhaps replace blank with 0?)

Not exactly a major bug but it does appear to be a new issue in some respect.

I had left the default blank to encourage people to think about what to complete, now it will default to zero which may mean they don't update the field.

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #99565 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Fee Field: Type: Text, default: Blank, Formula * /
Hello Calum

Exactly what we need to do to re-procedure the issue? Please let us know step by step so that we can try to re-procedure the issue, check to see why it happens to get it sorted

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Calum
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
7 years 10 months ago - 7 years 10 months ago #99595 by Calum
Create a custom field.
Set it to apply to a plan
Set it to be a fee field
Set it to be a text field
Don't provide any default value
Set it to validate the field type as an integer
Set the formula to [FIELD_VALUE] * 10
(i.e. it should multiply the field value by 10, so if someone answers 4 it will charge an extra £40)
-
Go to the front end - attempt to register for the selected plan. You should get an error message reporting unexpected '*' when trying to display the form.
Go to the back end - add a new subscription. On submitting the new subscription same error message will appear.
Last edit: 7 years 10 months ago by Calum.

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #99616 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Fee Field: Type: Text, default: Blank, Formula * /
I haven't tested myself but I think the modified file here should help fixing it

Could you please get this file, unzip it, upload to administrator/components/com_osmembership/libraries\mpf\form folder, then try again?

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Calum
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
7 years 10 months ago #99636 by Calum
Did you forget to attach it?

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #99649 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Fee Field: Type: Text, default: Blank, Formula * /
Hello

Yes. I forgot to upload it. Here it is

Regards,

Tuan
Attachments:

Please Log in or Create an account to join the conversation.