Koha/t/db_dependent
Emily Lamancusa 18884add71 Bug 34972: Remove GetOtherReserves
GetOtherReserves attempts to set the waiting/transit status for the next
hold on the list when applicable, but in practice it either leaves the
hold state unchanged, or sets the itemnumber without setting the found
status (erroneously converting bib-level holds to item-level holds).

The latter situation only occurs when the user has been prompted to
confirm, cancel, or revert the hold, and is able to ignore the prompt.
In those situations, the hold's state should not change.

GetOtherReserves does not need to change the hold state, and it does not
do so correctly. Besides that, it does not do much other than call
CheckReserves, and is only used in 3 places.

This patch removes GetOtherReserves, and refactors returns.pl and
C4::Reserves::ModReserveCancelAll to call CheckReserves directly instead.

To test:
1. Place 2 bib-level holds for 2 different patrons (Patron A and Patron
    B) on the same record, both for pickup at the logged-in library
2. Check in an item from that record to fill Patron A's hold
3. Set the hold's expiration date to yesterday by accessing the database
    in the command line:
    - In a ktd shell prompt, open the db client with koha-mysql kohadev
    - UPDATE reserves
        SET expirationdate = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
        WHERE borrowernumber = <Patron A's borrowernumber>
4. Go to Circulation > Holds Awaiting Pickup, and find the hold in the
    "holds waiting past their expiration date" tab
5. Click the "Cancel hold" button in the Actions column next to the hold
   (do not check in the book)
6. Return to the bib record and look at Patron B's hold
--> Note that Patron B's hold is now an item-level hold and does not
    have a waiting status

7. Cancel Patron B's hold
8. Place 2 new holds on the record: one for Patron A at the logged-in
    library, and one for Patron B at a different library
9. Check in an item to fill Patron A's hold
10. Repeat steps 3-5 to expire and cancel Patron A's hold
11. Return to the Holds tab of the bib record and look at Patron B's hold
--> Note that Patron B's hold is now an item-level hold, and there is no
    "Revert transit status" button

12. Place 2 bib-level holds for 2 different patrons (Patron A and Patron
    B) on the same record, both for pickup at the logged-in library
13. Check in an item from that record to fill Patron A's hold
14. Check in the same item again. A modal will pop up, saying that the
    hold is already waiting
15. In the modal, choose a cancellation reason and click "Cancel hold"
--> A new modal will pop up to fill Patron B's hold
16. Click "Ignore" on the modal for Patron B's hold
17. Return to the bib record and look at Patron B's hold
--> Note that Patron B's hold is now an item-level hold and does not
    have a waiting status

18. Apply patch
19. Repeat steps 1-6
--> Note that Patron B's hold is still a bib-level/"next available" hold
20. Repeat steps 7-11
--> Note that Patron B's hold is still a bib-level/"next available" hold
21. Repeat steps 12-17
--> Note that Patron B's hold is still a bib-level/"next available" hold

Make sure correct behavior is unchanged:

22. Cancel Patron B's hold
23. Place 2 new holds on the record: one for Patron A at the logged-in
    library, and one for Patron B at a different library
24. Check in an item from that record to fill Patron A's hold
25. Check in the same item again. A modal will pop up, saying that the
    hold is already waiting
26. In the modal, choose a cancellation reason and click "Cancel hold"
--> A new modal will pop up to fill Patron B's hold
27. Click "Print slip, transfer, and confirm" on the modal for Patron B's hold
--> Confirm that the information on the slip is correct
--> Confirm that the hold is correctly put in transit

22. Set HoldsAutoFill and HoldsAutoFillPrintSlip to "Do"

23. Place a bib-level hold for the logged-in library
24. Check in an item from that bib
--> Confirm the information on the slip is correct
--> Confirm the hold is correctly assigned and set to waiting
25. Place a bib-level hold for a different library
26. Check in an item from that bib
--> Confirm the information on the slip is correct
--> Confirm the hold is correctly put in transit
27. Change the logged-in branch to match the hold pickup location
28. Check the item in
--> Confirm the information on the slip is correct
--> Confirm the hold is correctly assigned and set to waiting

29. Repeat steps 22-26
--> Confirm a correct hold slip pops up for Patron B's hold
--> Confirm that Patron B's hold is correctly put in transit
30. Cancel Patron B's hold
31. Place 2 bib-level holds for 2 different patrons (Patron A and Patron
    B) on the same record, both for pickup at the logged-in library
33. Repeat steps 24-26
--> Confirm a correct hold slip pops up for Patron B's hold
--> Confirm Patron B's hold is correctly set to Waiting

34. Prove t/db_dependent/Circulation.t
35. Prove t/db_dependent/Koha/Holds.t
--> Tests pass

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit dc00e55a32)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-05-22 14:44:24 +02:00
..
Acquisition Bug 35524: Fix terminology in basket group CSV export 2024-01-03 15:22:05 +01:00
api/v1 Bug 36329: (follow-up) Fix error message comparisson in testes 2024-03-21 11:07:57 +01:00
Auth Bug 36056: Clarify subpermissions AND behavior 2024-03-11 11:23:45 +01:00
AuthoritiesMarc
Authority Bug 29522: Unit test 2024-03-18 10:29:21 +01:00
Biblio Bug 34549: Strip non-XML chars during TransformHtmlToMarc 2023-10-09 11:41:32 -03:00
Budgets
Circulation Bug 35293: Unit test 2024-01-15 14:39:11 +01:00
CourseReserves
Creators
cronjobs
data Bug 35418: Add TR_B2 tests 2023-11-29 17:36:11 -03:00
Exporter
Holds Bug 8367: (QA follow-up) Fix QA script 2023-11-01 18:01:36 -03:00
Illrequest Bug 34842: Fix Illrequest/Config.t if DB upgraded twice 2023-10-03 08:51:12 -04:00
Items Bug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029 2024-03-11 11:16:47 +01:00
Koha Bug 34972: Add tests for ModReservesCancelAll 2024-05-22 14:44:24 +02:00
Labels Bug 10762: Fix tests continued 2023-10-28 10:02:31 -03:00
LDAP
Letters Bug 31383: Adjust and add tests 2023-10-20 14:43:57 -03:00
Members Bug 33947: Remove GetAllIssues 2023-10-20 11:03:03 -03:00
misc/translator
OAI
Patron Bug 16223: Tidy 2023-10-11 12:13:12 -03:00
Record Bug 33045: Fix shebang of marcrecord2csv.t 2023-09-15 11:57:17 -03:00
Reports
Reserves Bug 17798: Confirm hold when printing slip from another patron's account 2023-11-06 08:42:41 -03:00
Search
selenium Bug 34886: Comment failing tests 2024-04-17 17:10:07 +02:00
Serials
SIP Bug 35461: Add unit tests 2024-01-31 14:27:39 +01:00
Template/Plugin Bug 31383: (bug 29691 follow-up) Remove get_opac_news_by_id 2023-10-23 10:45:34 -03:00
Utils Bug 34913: Adjust C4::Utils::DataTables::VirtualShelves 2024-01-29 10:15:53 +01:00
www Bug 35922: Fix www/batch.t 2024-02-01 17:15:42 +01:00
00-strict.t
Accounts.t Bug 34912: Add 14 hours to 1970 date in Account(s).t 2023-10-04 09:15:39 -04:00
Acquisition.t Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template 2023-10-20 16:31:15 -03:00
Amazon.t
ArticleRequests.t
AudioAlerts.t
Auth.t Bug 36092: Add test 2024-02-19 14:41:11 +01:00
Auth_with_cas.t
Auth_with_ldap.t Bug 29930: Regression tests 2024-01-31 13:56:32 +01:00
Auth_with_shibboleth.t
AuthorisedValues.t Bug 35588: Tidy up t/db_dependent/AuthorisedValues.t 2024-01-03 17:05:14 +01:00
AuthoritiesMarc.t Bug 27943: (QA follow-up) Perltidy 2023-10-30 09:02:21 -03:00
AuthoritiesMarc_GetTagsLabels.t
AuthUtils.t
Barcodes.t
Barcodes_ValueBuilder.t
Biblio.t Bug 34014: Unit test 2023-10-20 11:02:59 -03:00
Biblio_holdsqueue.t
Breeding.t Bug 28166: (QA follow-up) Fix and tidy tests and code 2023-10-23 11:33:50 -03:00
Breeding_Auth.t
Budgets.t Bug 31631: (QA follow-up) Tidy code 2023-10-18 15:41:37 -03:00
Cache.t
Calendar.t
Charset.t
check_kohastructure.t
check_sysprefs.t Bug 34979: Add unit test for comparing YAMl files with sysprefs.sql 2024-01-31 14:10:42 +01:00
Circulation.t Bug 34972: Remove GetOtherReserves 2024-05-22 14:44:24 +02:00
Circulation_holdsqueue.t Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
Clubs.t
Context.t
Contract.t
CourseReserves.t
db_structure.t
DecreaseLoanHighHolds.t Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
Filter_MARC_ViewPolicy.t
Fines.t
FrameworkPlugin.t Bug 24879: (follow-up) Fix test suite 2024-03-27 10:23:07 +01:00
Heading.t
Heading_MARC21.t
Hold.t
Holds.t Bug 17617: Unit tests 2023-11-08 11:41:26 -03:00
HoldsQueue.t Bug 35997: (QA follow-up) Number of tests 2024-03-18 10:14:59 +01:00
Holidays.t Bug 27249: Replace DateTime->now by dt_from_string 2023-10-17 14:45:34 -03:00
Illbatches.t Bug 30719: Remove unused Koha::Illbatch->requests_count method 2023-10-17 14:45:24 -03:00
IllbatchStatuses.t Bug 30719: (QA follow-up) Updating remaining naming 2023-10-17 14:45:23 -03:00
Illcomments.t
Illrequestattributes.t Bug 33970: Fix tests 2023-10-25 12:09:46 -03:00
Illrequests.t Bug 34905: Fix icon 2023-10-04 09:15:41 -04:00
ILSDI_Services.t Bug 34893: (QA follow-up) Tidy code for qa script 2024-01-29 10:15:53 +01:00
ImportBatch.t
ImportExportFramework.t
Installer.t
Items.t Bug 32496: Fix tests 2023-09-22 12:35:47 -03:00
Koha.t Bug 34812: Move subtests to db_dependent/Koha.t 2023-09-18 12:06:27 -03:00
Koha_Database.t
Koha_Elasticsearch.t
Koha_ExternalContent_OverDrive.t
Koha_MetadataRecord_Authority.t
Koha_Misc_Files.t
Languages.t
Letters.t Bug 36244: Unit test for tt syntax in parameters 2024-03-27 07:54:16 +01:00
LibraryGroups.t
Linker_Default.t
Linker_FirstMatch.t
Log.t
MarcModificationTemplates.t Bug 24480: (follow-up) Adjust tests 2023-11-03 12:04:35 -03:00
Matcher.t
Members.t Bug 26170: Add protected status for patrons 2023-11-01 17:23:06 -03:00
Message.t
MungeMarcPrice.t
Overdues.t
Passwordrecovery.t
Patroncards.t
PatronLists.t Bug 32730: Add Patron Lists tab to patron details and circulation pages 2023-11-01 17:23:09 -03:00
Patrons.t Bug 36508: Unit tests 2024-05-22 14:37:01 +02:00
Prices.t Bug 34967: Move to db_dependent 2023-10-03 09:24:50 -04:00
Record.t
RecordProcessor_EmbedSeeFromHeadings.t
Reports.t
Reserves.t Bug 35491: Add logging to RevertWaitingStatus 2024-01-03 16:08:46 +01:00
rollingloans.t Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm 2023-09-22 10:52:39 -03:00
RotatingCollections.t
Search.t Bug 34847: Fix t/db_dependent/Search.t 2023-09-22 10:52:43 -03:00
Serials.t Bug 24879: (follow-up) Fix test suite 2024-03-27 10:23:07 +01:00
Serials_2.t
Service.t
ShelfBrowser.t
Sitemapper.t
SocialData.t Bug 33833: Move to db_dependent 2023-09-05 14:35:36 -03:00
StockRotationItems.t
StockRotationRotas.t
StockRotationStages.t
SuggestionEngine_ExplodedTerms.t
Suggestions.t Bug 35215: Add few assumptions in Suggestions.t around emailing 2023-11-06 08:42:48 -03:00
sysprefs.t
TablesSettings.t
Tags.t
Templates.t
TestBuilder.t
Upload.t
UsageStats.t
Virtualshelves.t
XISBN.t
XSLT.t
yaml.t
zebra_config.pl