Bug 30403

Summary: Update notforloan status also on check out
Product: Koha Reporter: Emmi Takkinen <emmi.takkinen>
Component: CirculationAssignee: Emmi Takkinen <emmi.takkinen>
Status: RESOLVED FIXED QA Contact: Kyle M Hall <kyle>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, catherine.dupuy-lenen, catrina, eric.begin, gmcharlt, jacob.omara, kyle.m.hall, kyle, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/687
Text to go in the release notes:
Version(s) released in:
23.05.00
Bug Depends on:    
Bug Blocks: 33431, 34720    
Attachments: Bug 30403: Add syspref UpdateNotForLoanOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Bug 30403: (QA follow-up) Fix warning in unit test
Bug 30403: (QA follow-up) Fix up atomic update
Bug 30403: (QA follow-up) Add new YAML syspref to about.pl

Description Emmi Takkinen 2022-03-30 07:03:09 UTC
We currently have syspref UpdateNotForLoanOnCheckin which updates notforloan status when item is checked in. We should also have same kind of syspref for check outs. This would be useful if for example library has item in exhibition with status "In exhibition, available for loan". When patron check outs the item notforloan status can be changed to 0, informing staff that the item is back on circulation and not longer present in the exhibition.
Comment 1 Emmi Takkinen 2022-03-30 07:13:44 UTC
Created attachment 132534 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanOnCheckout

We currently have syspref UpdateNotForLoanOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy
Comment 2 Emmi Takkinen 2022-03-30 07:36:48 UTC
Created attachment 132535 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy

----

Previous patch had typos in description (missing Status from both sysprefs). This is just a readd to fix them.
Comment 3 Emmi Takkinen 2022-03-30 07:56:37 UTC
Created attachment 132536 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy
Comment 4 Rachael 2022-06-30 19:23:15 UTC
patch does not apply
Comment 5 Emmi Takkinen 2022-08-23 12:12:26 UTC
Created attachment 139675 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy
Comment 6 Katrin Fischer 2022-10-03 20:13:33 UTC
Missing the sign-off (line?) here, but also don't see a comment from testing. Please verify!
Comment 7 Victor Grousset/tuxayo 2022-10-13 12:27:53 UTC
Hi, they tested it and only changed the status. I sent a message with how to signoff the patches via the sandboxes. So it should be in order shortly and switched to signed-off.
Comment 8 catherine.dupuy-lenen 2022-10-14 12:01:06 UTC
I tested this patch once (Koha 21.05 or 21.11, I don't remember) and it worked, but when I retest (koha 22.06) I get an error when I apply the patch : 
"Applying: Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout
Using index info to reconstruct a base tree...
M	C4/Circulation.pm
M	installer/data/mysql/mandatory/sysprefs.sql
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
M	t/db_dependent/Circulation/issue.t
Falling back to patching base and 3-way merge...
Auto-merging t/db_dependent/Circulation/issue.t
CONFLICT (content): Merge conflict in t/db_dependent/Circulation/issue.t
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
Auto-merging installer/data/mysql/mandatory/sysprefs.sql
Auto-merging C4/Circulation.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout"
Comment 9 Victor Grousset/tuxayo 2022-10-17 03:04:14 UTC
> I tested this patch once (Koha 21.05 or 21.11, I don't remember)

How did you test it on 21.05 or 21.11? The sandboxes can't work if trying to get an older version of Koha.

Anyway, setting this to "patch does not apply" since that's the current blocker. Don't hesitate to do this if when applying a patch in a sandbox you get "CONFLICT (content): Merge conflict"
Comment 10 Emmi Takkinen 2022-11-02 08:29:39 UTC
Created attachment 142915 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy
Comment 11 ByWater Sandboxes 2022-11-14 22:38:31 UTC
Created attachment 143883 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Catrina <catrina@bywatersolutions.com>
Comment 12 Kyle M Hall 2022-12-16 14:23:07 UTC
Created attachment 144681 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Catrina <catrina@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 13 Kyle M Hall 2022-12-16 14:34:48 UTC
Created attachment 144682 [details] [review]
Bug 30403: Add syspref UpdateNotForLoanStatusOnCheckout

We currently have syspref UpdateNotForLoanStatusOnCheckin which updates
notforloan status when item is checked in. We should also have
same kind of syspref for check outs. This would be usefull if for
example library has item in exhibition with status
"In exhibition, available for loan". When patron check outs the
item notforloan status can be reseted back to 0, informing staff
that the item is back on circulation.

This patch adds new syspref Add syspref UpdateNotForLoanStatusOnCheckout.

To test:
1. Set items notforloan status as e.g -1.
2. Check out item for a patron.
=> Note that items status doesn't change.
3. Apply patch and update database if needed.
4. Add "-1: 0" to syspref UpdateNotForLoanStatusOnCheckout.
5. Check item in and out again for a patron.
=> Note that items status is changed as 0.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Catrina <catrina@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Kyle M Hall 2022-12-16 14:35:03 UTC
Created attachment 144683 [details] [review]
Bug 30403: (QA follow-up) Fix warning in unit test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Kyle M Hall 2022-12-16 14:35:07 UTC
Created attachment 144684 [details] [review]
Bug 30403: (QA follow-up) Fix up atomic update

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 16 Tomás Cohen Arazi 2023-04-06 13:40:19 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 17 Tomás Cohen Arazi 2023-04-06 14:29:12 UTC
Created attachment 149234 [details] [review]
Bug 30403: (QA follow-up) Add new YAML syspref to about.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 18 Jacob O'Mara 2023-04-17 07:22:28 UTC
Enhancement - not backporting to 22.11.x

Nice work everyone!