alextselegidis/easyappointments

Errors with Blocked Periods in Calendar Default View

Closed this issue · 3 comments

In v1.5.0-dev.4 there are several issues with blocked periods in calendar default view

  1. Set a blocked period that is not whole day: This can be set and edited, but when deleted, there is error message "json_decode(): Argument #1 ($json) must be of type string, array given"

  2. Set a blocked period that is whole day: This can't be set, there is error message

"A PHP ERROR WAS ENCOUNTERED
SEVERITY
Warning

MESSAGE
Trying to access array offset on value of type null

FILENAME
models/Providers_model.php

LINE NUMBER
500

A PHP ERROR WAS ENCOUNTERED
SEVERITY
8192

MESSAGE
strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated

FILENAME
models/Providers_model.php

LINE NUMBER
500

A PHP ERROR WAS ENCOUNTERED
SEVERITY
Warning

MESSAGE
Trying to access array offset on value of type null

FILENAME
models/Providers_model.php

LINE NUMBER
502

A PHP ERROR WAS ENCOUNTERED
SEVERITY
8192

MESSAGE
strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated

FILENAME
models/Providers_model.php

LINE NUMBER
502"

  1. Problem in line 2 can be circumvented with editing Providers_model.php like this:
500 - $start = date('H:i', strtotime($working_plan_exception['start']));
500 + $start = (!empty($working_plan_exception['start']) ? date('H:i', strtotime($working_plan_exception['start'])) : null);

502 - $end = date('H:i', strtotime($working_plan_exception['end'])));
502 + $end = (!empty($working_plan_exception['end']) ? date('H:i', strtotime($working_plan_exception['end'])) : null);
  1. After this edit, full day exception can be set, but there remains a problem when deleting it. On delete, there is error message "No appointment id provided."

Hello!

Thanks for reporting this!

From the description I can tell that this is not about blocked periods but working plan exceptions.

Based on that I was able to fix the first and last issue (working plan exception removal in calendar page), but was not able to replicate the other two.

Can you elaborate on those?

Kapture.2024-04-15.at.14.27.12.mp4
Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

Assuming that line 322 in application/models/Providers_model.php has been merged and lines 214-215 in assets/js/utils/calendar_default_view.js, both from dec0cf9 , have been merged, there remains the following problem:

Nimeton.video.mp4

Or is the cause of this that I'm using PHP 8.1?

It seems that this error is gone with merge on 11.5.2024. I'll close this issue.