salleman33 / reservation

Plugin GLPI to manage reservation
http://plugins.glpi-project.org/#/plugin/reservation
GNU General Public License v3.0
7 stars 13 forks source link

Issue or Confusion with the Checkin / Checkout Process #89

Open StunPals opened 1 month ago

StunPals commented 1 month ago

Steps to Reproduce

  1. Want to clarify the definitions as the wording is a bit confusing, especially from the Admin side where selecting Checkout/Checkin on a specific order produces an error in the UI. First I want to confirm the actual meaning of these terms as in my tests below trying it both ways concluded with unexpected results.

    • "Checkin" is when the item is handed out to the staff? Tooltip says "Set As Gone" which seems contradictory to a typical Check-in normally meaning returned.
    • "Chechout" is when the item is returned by staff? Tooltip says "Set As Returned" which seems contradictory to a typical Check-out, normally meaning handed out.
  2. My initial instinct to use "Checkout" when handing out the item to staff (PM013), and then waiting a few mins before using "Checkin" (as a quick/short test), there is an "error.." on the Checkin column. image image

  3. On the next attempt to hand out the item (InSeeGo-01) the Admin first selects the "Checkin" icon, the I noticed the End Date changes to the current date/time even though this was a multi-day reservation. Then on a page refresh (search button) the item now shows as overdue (filled red)? Shouldn't it only show overdue (red) if the item is not returned before the End Date/time of the booking? image The Reservation is still showing a 3 day booking. image

Expected Behaviour

I can adjust my actions as an Admin to the naming of Checkin/Checkout if in fact their definitions are reverse to what I am expecting, I just need to confirm what should be happening in the console with regards to is the item out with staff or in stock and available.

Observed Behaviour

Context

Technical Info

Analysis

StunPals commented 1 month ago

Perhaps issues my be related to time zones? I have, prior to testing, in GLPI user preferences, sent the Admin to PST and the User to MST time zones.

Oddly when creating a booking as the User July 23 15:00 for 1hr which shows properly to the User, but for the Admin the Start and End times are both 14:00-14:00 when I am expecting 14:00-15:00.

image

StunPals commented 1 month ago

I can confirm the reservation is considered expired as the auto "[GLPI] User Reservation Expired (plugin)" emails are being sent shortly after Checkin the item.

salleman33 commented 1 month ago

1 & 3) When I wrote this I was thinking about check in/out at a hostel. So yes, it's ambiguous ! 4) It's strange ! checkin a reservation should modify the begin date. I will test it and come back to you.

salleman33 commented 1 month ago

Perhaps issues my be related to time zones? I have, prior to testing, in GLPI user preferences, sent the Admin to PST and the User to MST time zones.

Oddly when creating a booking as the User July 23 15:00 for 1hr which shows properly to the User, but for the Admin the Start and End times are both 14:00-14:00 when I am expecting 14:00-15:00.

image

yes, there is a problem with dates and multiples timezones. I will work on that

salleman33 commented 1 month ago

I don't find how to change the timezone for user or admin. My GLPI instance only accepts timezone defined on the server (apache/php). Could you check if the GLPI view of reservations shows the same date error please ?

StunPals commented 1 month ago

When I say change the Time Zone for Admin and the User, I am referring to the GLPI "My Preferences" for the user, not a global setting. There is in Setup--General--Default Values--Time Zone but my understanding is this only affects new users to set their timezone in there preferences.

I am not sure what you are asking "check if the GLPI view of reservations shows the same date error"?There are two issues I pointed out, are you referring to the Begin/End times syncing issue or the "Error in entering Dates" popup issue?

Issue: Error in Entering Dates Popup This only occurs when, I click the "checkout" first then the errors occur when clicking the "Checkin". I believe that may be because I am doing it in the wrong order. Can you confirm the terminology, to hand out the device, I should be using the Checkin or Checkout? I assume based on my tests Checkin is the hand out.

Suggestion, if Checkin is actually the handout step perhaps there is a way to not allow the Checkout to be selected if the Checkin has not been selected first.

Issue: Begin/End As the Reservation Admin (PST), and the reservation made by the User in MST, both the Begin & End dates get changed to time the Checkin is selected.

I then made a reservation in PST and then the Reservation Admin (MST) checkin the item, only the Begin time is updated to the time it was selected, the End. I'll do a few more tests to confirm it is consistent where only Admins in the time zone other than the GLPI server theory is correct.

StunPals commented 1 month ago

My suspicion was wrong, doesn't appear to be related to if the Admin time zone is in the same as the server.

So there is some inconsistencies, I did one test this morning where reservation worked as expected and the only Begin time updated when selecting Checkin and the End time updated only when the Checkout was selected. image image

But several tests after that using the same User (PST) and Admin (MST) I am seeing the same result of both Begin & End times are updating to the date/time the Checkin is selected. image

I then thought maybe it related to the time of the reservation and the timing of selecting the Checkin, eg if clicked before/after the Begin time. But that had no change, same result, so I am not sure why one worked this morning but all the others are not updating both Begin/End times at the same time. The screenshot above, Checkin was selected before the Begin time, the screenshot below Checkin was selected after the Begin time. image

One more thing I noticed, the one that worked fine, had "specified" Begin & End times, not the 1hr or 2hr options. I'll test that next.

StunPals commented 1 month ago

Ok the "Specified" times testing didn't make a difference either, I am sort of stumped now. The reservation image

The hand out process from Admin side image

StunPals commented 1 month ago

I think we may have figured out the what is happening. I am still not clear why some reservations don't exhibit the same issue of time matching of Begin/End to the time an item is "Checked in" but in our testing it is the majority of the reservations that are having this issue.

It appears that Plugin--Reservation Admin page Begin & End time fields may be separate or at least the End time is since the actual reservation form uses a Duration vs date/time. I am not sure if the Begin time field is the same field as the "Start date" or if they are 2 different fields and there is an automation that is copying "Start date" date/time to Begin field. If they are separate fields perhaps there is a two way update/sync between the Begin time and the "Start date" fields. This doesn't seem to be functioning the same for the End time and Duration fields, which I assume it should be. Checking out does update the Duration on the reservation but some action on the Checkin is where the issues may be and is updating the End date/time when it shouldn't be.

What we found is once the reservation Checkin is selected, the Begin & End time are both updated to the time of the Checkin selection. If you then open/edit the actual reservation and make a change (eg to Comments (time changes not needed)) and save it, the Plugin--Reservation page is reflects those changes and properly displays the actual End time and the item is no longer listed as Expired (Red).

This workaround does fix the End time issue but hopefully there is a fix from your end that can be considered.

--Steps-- Starting mid process with an item "InSeeGp-02", has been "checked in" and the End time is now matching the Begin time, image

Edit the Reservation add/remove/change the comment (added "Update Test"), (even adding a space will work but has to be some change) and saved. image

Refresh the Plugin--Reservation Admin page, and the item is displayed correctly. image

Not sure this may be related but we also noticed that the Checkout time is in a different format than the Checkin time. image

salleman33 commented 1 month ago

Hi, In your last test, I think it's the schedule task who has changed the end date to maintain the reservation until checkout. Could you test a checkin and send me the log file after updating the code with the branch "salleman33-issue-89" : https://github.com/salleman33/reservation/tree/salleman33-issue-89 or apply the changes : https://github.com/salleman33/reservation/commit/0312cefd7e2cf150b034e6d886cd60ca1ec8da14