After resolving Bug 31963 everything works as expected when there is hold fee defined (!= 0). But in case when the fee for given patron category is set to 0.00, the user will always see the message "You will be charged a hold fee of 0,00 ...", which is obviously not intended. This is because categories.reservefee is returned from database as '0.000000' and as such, without type casting, is interpreted as string in Perl. Prior to Bug 31963 the result was compared to 0 before sending anything to the template, so the casting was done, now it is not.
Created attachment 148120 [details] [review] Bug 33210: (Bug 31963 follow-up) No hold fee message on OPAC should be displayed when there is no fee After resolving Bug 31963 everything works as expected when there is hold fee defined (!= 0). But in case when the fee for given patron category is set to 0.00, the user will always see the message "You will be charged a hold fee of 0,00 ...", which is obviously not intended. This is because categories.reservefee is returned from database as '0.000000' and as such, without type casting, is interpreted as string in Perl. Prior to Bug 31963 the result was compared to 0 before sending anything to the template, so the casting was done, now it is not. To test: ======== 1. Go to Administration -> Patron categories 2. Edit your patron category and give a hold fee of 0. 3. HoldFeeMode does not matter - you can set it to any value. 4. In another tab, open the OPAC. 5. Search the OPAC for any record with an item. 6. Go to place a hold on this record. You will see "You will be charged a hold fee of 0,00" --> This is a bug. 7. Apply patch and restart services. 6. Repeat step 6. 8. You should NOT see the hold fee message.
Created attachment 148149 [details] [review] Bug 33210: (Bug 31963 follow-up) No hold fee message on OPAC should be displayed when there is no fee After resolving Bug 31963 everything works as expected when there is hold fee defined (!= 0). But in case when the fee for given patron category is set to 0.00, the user will always see the message "You will be charged a hold fee of 0,00 ...", which is obviously not intended. This is because categories.reservefee is returned from database as '0.000000' and as such, without type casting, is interpreted as string in Perl. Prior to Bug 31963 the result was compared to 0 before sending anything to the template, so the casting was done, now it is not. To test: ======== 1. Go to Administration -> Patron categories 2. Edit your patron category and give a hold fee of 0. 3. HoldFeeMode does not matter - you can set it to any value. 4. In another tab, open the OPAC. 5. Search the OPAC for any record with an item. 6. Go to place a hold on this record. You will see "You will be charged a hold fee of 0,00" --> This is a bug. 7. Apply patch and restart services. 6. Repeat step 6. 8. You should NOT see the hold fee message. Signed-off-by: David Nind <david@davidnind.com>
Please add a small unit test.
Created attachment 148676 [details] [review] Bug 33210: Add unit test I'm not an expert in writing unit tests--so please correct it if it didn't conform to the guidelines.
Created attachment 149144 [details] [review] Bug 33210: (Bug 31963 follow-up) No hold fee message on OPAC should be displayed when there is no fee After resolving Bug 31963 everything works as expected when there is hold fee defined (!= 0). But in case when the fee for given patron category is set to 0.00, the user will always see the message "You will be charged a hold fee of 0,00 ...", which is obviously not intended. This is because categories.reservefee is returned from database as '0.000000' and as such, without type casting, is interpreted as string in Perl. Prior to Bug 31963 the result was compared to 0 before sending anything to the template, so the casting was done, now it is not. To test: ======== 1. Go to Administration -> Patron categories 2. Edit your patron category and give a hold fee of 0. 3. HoldFeeMode does not matter - you can set it to any value. 4. In another tab, open the OPAC. 5. Search the OPAC for any record with an item. 6. Go to place a hold on this record. You will see "You will be charged a hold fee of 0,00" --> This is a bug. 7. Apply patch and restart services. 6. Repeat step 6. 8. You should NOT see the hold fee message. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 149145 [details] [review] Bug 33210: Add unit test Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. Tests pass before and after the patches are applied: prove t/db_dependent/Reserves/GetReserveFee.t
Created attachment 149769 [details] [review] Bug 33210: Add unit test Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick <nick@bywatersolutions.com>
Created attachment 149770 [details] [review] Bug 33210: (Bug 31963 follow-up) No hold fee message on OPAC should be displayed when there is no fee After resolving Bug 31963 everything works as expected when there is hold fee defined (!= 0). But in case when the fee for given patron category is set to 0.00, the user will always see the message "You will be charged a hold fee of 0,00 ...", which is obviously not intended. This is because categories.reservefee is returned from database as '0.000000' and as such, without type casting, is interpreted as string in Perl. Prior to Bug 31963 the result was compared to 0 before sending anything to the template, so the casting was done, now it is not. To test: ======== 1. Go to Administration -> Patron categories 2. Edit your patron category and give a hold fee of 0. 3. HoldFeeMode does not matter - you can set it to any value. 4. In another tab, open the OPAC. 5. Search the OPAC for any record with an item. 6. Go to place a hold on this record. You will see "You will be charged a hold fee of 0,00" --> This is a bug. 7. Apply patch and restart services. 6. Repeat step 6. 8. You should NOT see the hold fee message. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick <nick@bywatersolutions.com>
Pushed to master for 23.05. Nice work everyone, thanks!
Many hands makes light work, thankyou everyone! Pushed to 22.11.x for the next release
I accidentally pushed this for 22.05 and then realized it is dependent on 31963 so I reverted. Missing dependencies for 22.05.x, no backport.