Bug when handling "Add Condition" option

I noticed there is a problem when user tries to edit a lot conditions for an resource. Problem persists both on Chrome and Firefox browser.

When you start creating more than 4 or 5 conditions of the same type and afterwards try to edit their values, a bug occurs. System starts to duplicate records, or deletes previous records. When such a behavior occurs the only solution is to quit this page and come back to it later.

Example:

[stay] 30 If guest stays 30 days or more the price changes by -30 %
[stay] 18 If guest stays 18 days or more the price changes by -25 %
[stay] 12 If guest stays 12 days or more the price changes by -22 %
[stay] 6 If guest stays 6 days or more the price changes by -15 %

At a given point of adding and editing these values the bug occurs.

Can you give me admin access to check it out?

Hello there,

I’ve sent you the credentials for our demo site via the contact form in Contact. There I posted the link to this discussion as well as the exact link, username and pass for our demo.

Thank you in advance.

Looking forward to hearing from you.

Best Regards,
Svetoslav

+1 for this bug.

I can’t even find a pattern to when the bug occurs. I have [stay] filters for 2, 3, 4, 5, 6, 7 nights and when I edit any of them sometimes it works, sometimes it creates a duplicate.

On deletion sometimes it works, sometimes it deletes another.

On addition, sometimes it adds correctly, other times it will overwrite another (or add itself and delete another)

Any progress/report on this?

An update:

When I have 6 ‘stay’ filters added – 7 nights, 6 nights, 5 nights etc. it seems to always be the first filter that encounters the issue – that with the id of 0. I have added a dummy time filter (in the past) which now appears first in the filter list and therefore takes the ID of 0 and the other stay filters now appear to edit etc. without issue.

This is a bit of a fudge work around and would appreciate if there’s anything that can be done.

Thanks in advance.

I’ll check it when I’m back home next week.

think i’ve fixed/found the cause. There is a line of code to check if the ‘price_filter_edit’ POST variable is set.

if(isset($_POST['price_filter_edit']) && !empty($_POST['price_filter_edit']) && isset($filters[$_POST['price_filter_edit']])){

PHP empty() treats 0 and “0” as being empty, so the block concerned with unsetting the filter with an ID of 0 will not be executed.

I changed the statement to:
if(isset($_POST['price_filter_edit']) && isset($filters[$_POST['price_filter_edit']])){

and all seems to be well.

Thank you for sharing it. I think this is the first time a bug got fixed by a user before I could find it.
The problem with not deleting will come from it, but what’s with the overwrite you’ve also talked about?
Do you think it also came from that?
Regards

You must be logged in to reply in this thread.

Not Support
8 posts