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

Send "Alert Reservation" Notification to User. #17

Closed dpareja2 closed 5 years ago

dpareja2 commented 5 years ago

v2.1.1 fixed a problem with sendMailLateReservations. Now I see it only sends a notification that the reservation is ending to: Admin, or different profiles (Admin, Hotline, Technician, etc...) but the "Requester" as in the "New Reservation" Notification. It would be good to have the user notified.

salleman33 commented 5 years ago

Hi, "Alert Reservation" is the GLPI notification. You have to use the Plugin notification "User Reservation Expired (plugin)"

dpareja2 commented 5 years ago

In Setup > Notifications > Notifications I search "Reserv" and find 4 notifications: Name: Alert Reservation, Event: Reservation expired Name: Delete Reservation, Event: Deletion of a reservation Name: New Reservation, Event: New reservation Name: Update Reservation, Event: Update of a reservation

Is that from Reservation 2.1.2 ?

I have GLPI 9.3.3 and Reservation 2.1.1

salleman33 commented 5 years ago

you have to create it : In Setup > Notifications > Notifications. Click the "+" button to add a notification. Select type "reservation" and event "User Reservation Expired (plugin)"

dpareja2 commented 5 years ago

Got it, I just tested it and I can't get it to work. I believe I have it exactly like "Alert Reservation", should I deactivate it or can they both be active at the same time? notif

Also, it's on Entity A, visible from Entities A1 and A2 (Sub entities from Entity A), the reservations are being made from Entity A1.

salleman33 commented 5 years ago

Do you make a notification template for it ? This event works with the automatic action "sendMailLateReservations". Is there some error in log files ?

dpareja2 commented 5 years ago

I forgot about the automatic action, for some reason it was stuck at "Next run: Running" Canceled, forced a run and got an email. It uses the "Alert Reservation" template.

I received this:

Entitat : ##reservation.entity##

--

Automatically generated by GLPI

But it should be like this:

lang.reservation.entity## : ##reservation.entity

FOREACHreservations

lang.reservation.itemtype## : ##reservation.itemtype

lang.reservation.item## : ##reservation.item

reservation.url

ENDFOREACHreservations

So my problem was create the new notification and then fix the automatic action that was stuck.

salleman33 commented 5 years ago

"Alert Reservation" template does not work for this notification event. Glpi alert reservation takes all the reservations, while plugin notification raise up for each reservation. If you create a new one, you can see all available labels. "##FOREACHreservations##" is not available. Use ##FOREACHitems##

dpareja2 commented 5 years ago

Got it working, thank you so much. I used all the tags available and these didn't work (Got sent as the tag itself ##tag##)

reservation.item

reservation.expirationdate

reservation.entity

reservation.item.tech

Everything else was replaced correctly.

dpareja2 commented 5 years ago

Should this work? Even if there's only one item?

FOREACHitems

reservation.item.name## (This one gets replaced OK outside of the foreach)

ENDFOREACHitems

dpareja2 commented 5 years ago

Oh, I just saw that for reservations with multiple items it sends 1 email for each item. Then what is the ##FOREACHitems## for?

salleman33 commented 5 years ago

Yes, FOREACHitems is useless because GLPI creates as much reservation as item reserved. So, there is only one item by reservation

dpareja2 commented 5 years ago

Alright, thank you, this can be closed.