Bug 14697

Summary: Extend and enhance "Claims returned" lost status
Product: Koha Reporter: Kyle M Hall <kyle.m.hall>
Component: CirculationAssignee: Kyle M Hall <kyle.m.hall>
Status: Pushed to master --- QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: enhancement    
Priority: P5 - low CC: bdaeuber, bklein, cbrannon, clackman, cmartin, cslone, daniel.gaghan, george, gmcharlt, horganl, hughr, joy, jwagner, jzairo, katrin.fischer, kelly, kyle.m.hall, kyle, lisetteslatah, margaret, marjorie.barry-vila, martin.renvoize, niamh.walker-headon, tmisilo, tomascohen
Version: masterKeywords: Manual
Hardware: All   
OS: All   
URL: http://devs.bywatersolutions.com/projects/claimed-returned/
Change sponsored?: Sponsored Patch complexity: ---
Who signed the patch off: Text to go in the release notes:
This enhancement extends the "Claims returned" lost status and allows staff to track items that patrons claim to have returned. Items are marked as "Claims returned" from the checkout page in the staff side. There are 3 new systems preferences to set for this functionality to work: `ClaimReturnedChargeFee`, `ClaimReturnedLostValue` and `ClaimReturnedWarningThreshold`
Version(s) released in:
19.11.00
Bug Depends on:    
Bug Blocks: 24126    
Attachments: Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Show an item has unresolved claims on checkin
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Show an item has unresolved claims on checkin
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Show an item has unresolved claims on checkin
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Extend and enhance "Claims returned" lost status
Bug 14697: Show an item has unresolved claims on checkin
Bug 14697: Move /return_claims/claim to /return_claims
Bug 14697: [DO NOT PUSH] Update Schema Files
Bug 14697: Don't unbless claims before rendering, it's done automatically
Bug 14697: Update database
Bug 14697: Add new schema file
Bug 14697: Introduce Koha::Checkouts::ReturnClaim(s)
Bug 14697: Add return claim handling to AddReturn
Bug 14697: Add Koha::Checkout->claim_returned
Bug 14697: Add Koha::Patron->return_claims
Bug 14697: Add routes to handle return claims
Bug 14697: Enhance the return claims feature [FIXME]
Bug 14697: Schema updates
Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id
Bug 14697: Make controller methods rely on the stashed user
Bug 14697: (QA follow-up) Organize tests in subtests
Bug 14697: (QA follow-up) Add missing AV category
Bug 14697: (QA follow-up) Restore FK on issue_id and adjust tests
Bug 14697: (follow-up) Add auth values to the sample data
Bug 14697: (QA follow-up) Remove tab chars

Description Kyle M Hall 2015-08-19 15:40:45 UTC
A group of librarians have been brainstorming about claimed returns in Koha. They think this would be a good list of features for a claims returned system in Koha:

* Add a system preference to flag which lost status is "Claims returned".
  Not setting this pref would disable the feature.
* Add ability to mark item as "Claims returned"
    * Add the ability to mark an item as claims returned from the checkouts
      table on the checkouts and patron details pages
        * This functionality would operate in the same way checkins and renewals do.
        * It may be better to slim down to one column of checkboxes for all three 
          functions ( that is, one at a time with one set of checkboxes )
    * The ability mark an item as "Claims returned" from the item details would be
      disabled when the feature is enabled. All claims returned marking would happen
      through the checkouts table.
* Charge or don't charge for claims returned
    * Some libraries charge the lost fee on claimed returns, some don't.
    * Add system preference to ask ‘charge’, ‘don’t charge’, or ‘ask for confirmation’ 
      when marking an item claimed returned
* Some libraries want to alerted of repeat offenders.
    * Add a sys pref to offer an option to block a patron, or alert staff somehow,
      after a set number of claimed returns.
    * This will be a running total over the lifetime of the patron,
      not the current number of outstanding claimed returns.
    * There will need to be a table that stores basic information about the item on  
      patron’s record so you can track how many times they’ve said ‘i returned that’
        * This allows us to track claimed returns even for returned and deleted items
        * This data will display on a new tab on the patron record ( moremember.pl ) 
          for "claims returned" items
        * Will store the status so we know if the claim is open or resolved
        * ex. [title 1] / checked out {date} / claimed {date} / not returned / notes
* Remove item from patron's current checkouts on marking "claims returned" ( e.g. current lost behavior )
    * Will stop fines from continuing to accrue for said item
* show as missing in the opac and claimed returned in the staff client 
  ( e.g. current lost behavior, no change needed )
* Be able to mark item as ‘found’ from claimed tab if item happens to be found
  ( using standard 'found' behavior Koha already has )
    * Offer options of “returned by patron” or “found in library” in a pull down to
      the side of every item that has been claimed.
    * next to each claimed item have a ‘notes’ field. 
      Should be in line editable for ease of use
* Claimed items should be easily distinguishable on staff side
  (compared to other types of lost items) on patron check out under ‘Attention’
  so alert ‘Patron has claimed returns’ that links to the ‘Claimed’ tab below 
  ( in a similar fashion to the current restrictions system )
Comment 1 Nicole C. Engard 2016-01-06 16:20:20 UTC
Seeking Co-sponsors: http://devs.bywatersolutions.com/projects/claimed-returned/
Comment 2 Christopher Brannon 2016-03-18 22:45:25 UTC
How are fines/fees taken into account with this action?  Will associated fines be removed if claimed returned?  Or will they be removed if marked as found?  Will there be a preference for this?
Comment 3 Katrin Fischer 2016-06-19 22:12:54 UTC
*** Bug 4236 has been marked as a duplicate of this bug. ***
Comment 4 Katrin Fischer 2016-06-19 22:13:32 UTC
*** Bug 4241 has been marked as a duplicate of this bug. ***
Comment 5 Benjamin Daeuber 2017-05-01 21:54:15 UTC
(In reply to Christopher Brannon from comment #2)
> How are fines/fees taken into account with this action?  Will associated
> fines be removed if claimed returned?  Or will they be removed if marked as
> found?  Will there be a preference for this?

I think this covers your first questions:

>Add system preference to ask ‘charge’, ‘don’t charge’, or ‘ask for confirmation’ when marking an item claimed returned

As to your second, I think we ought to treat it like we do lost items via the system preference RefundLostItemFeeOnReturn 

Perhaps a system pref: RefundClaimReturnonLocate?
Comment 6 Christopher Brannon 2017-05-01 22:20:56 UTC
(In reply to Benjamin Daeuber from comment #5)
> (In reply to Christopher Brannon from comment #2)
> > How are fines/fees taken into account with this action?  Will associated
> > fines be removed if claimed returned?  Or will they be removed if marked as
> > found?  Will there be a preference for this?
> 
> I think this covers your first questions:
> 
> >Add system preference to ask ‘charge’, ‘don’t charge’, or ‘ask for confirmation’ when marking an item claimed returned

This is good.  Since we have started making the refund library specific, would you consider preferences under each library?

> As to your second, I think we ought to treat it like we do lost items via
> the system preference RefundLostItemFeeOnReturn 
> 
> Perhaps a system pref: RefundClaimReturnonLocate?

As mentioned in my response above, this functionality was moved to the library configuration as individual preferences for each library.  I would say it needs to be there.
Comment 7 Hugh Rundle 2018-06-01 02:22:31 UTC
I see from http://devs.bywatersolutions.com/2016/11/30/Claimed-Returned/ this is fully funded but nothing seems to have happened. Is there an update on this? It would be a great feature.
Comment 8 Brian 2018-11-01 19:17:49 UTC
Could we please get an update on this bug?
Comment 9 Laura Horgan 2019-01-29 18:33:26 UTC
We are also interested in an update of this enhancement. Once a request is funded what is the procedure for moving an option into development.  I don't believe all the libraries in our group are interested in this feature so it would be good if each library could decide for itself.
Comment 10 Kyle M Hall 2019-02-22 13:39:16 UTC
For everyone asking about that status of this work, I just want to let you know I'm working on it!
Comment 11 Joy Nelson 2019-03-05 21:16:54 UTC
*** Bug 20210 has been marked as a duplicate of this bug. ***
Comment 12 Joy Nelson 2019-03-05 22:02:19 UTC
(In reply to Laura Horgan from comment #9)
> We are also interested in an update of this enhancement. Once a request is
> funded what is the procedure for moving an option into development.  I don't
> believe all the libraries in our group are interested in this feature so it
> would be good if each library could decide for itself.

Hi Laura,
The ability to use claims returned at a branch specific level is not part of this development and is outside the scope of this development.  This feature is intended to be global and turned on or off for the system through system preferences.

joy
Comment 13 Laura Horgan 2019-08-20 14:26:51 UTC
Kyle you mentioned you were working on it in Feb. Is it slated to be part of a specific future release?
Comment 14 Daniel Gaghan 2019-08-20 16:32:32 UTC
This would also be appreciated at PCCLD. We all the options mentioned in  http://devs.bywatersolutions.com/2016/11/30/Claimed-Returned/.
Comment 15 Kyle M Hall 2019-08-21 18:45:45 UTC
Created attachment 92407 [details] [review]
Bug 14697: Update database
Comment 16 Kyle M Hall 2019-08-21 18:45:55 UTC
Created attachment 92408 [details] [review]
Bug 14697: Add new schema file
Comment 17 Kyle M Hall 2019-08-21 18:46:00 UTC
Created attachment 92409 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim
Comment 18 Kyle M Hall 2019-08-21 18:46:04 UTC
Created attachment 92410 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files
Comment 19 Owen Leonard 2019-08-26 12:48:53 UTC
There is what looks like a minor conflict in the third patch. I get an error with updatedatabase:

DEV atomic update: bug_14697.perl
DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')
        VALUES
          (
            'RETURN_CLAIM_RESOLUTION', 'RET_BY_PATR' at line 1 [for Statement "
        INSERT INTO `authorised_values` ( category, authorised_value, lib, )
        VALUES
          (
            'RETURN_CLAIM_RESOLUTION', 'RET_BY_PATRON', 'Returned by patron'
          ),
          (
            'RETURN_CLAIM_RESOLUTION', 'FOUND_IN_LIB', 'Found in library',
          );

And the "Update Schema Files" patch didn't apply.
Comment 20 Kyle M Hall 2019-09-19 11:21:33 UTC
Created attachment 92962 [details] [review]
Bug 14697: Update database
Comment 21 Kyle M Hall 2019-09-19 11:21:47 UTC
Created attachment 92963 [details] [review]
Bug 14697: Add new schema file
Comment 22 Kyle M Hall 2019-09-19 11:21:51 UTC
Created attachment 92964 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim
Comment 23 Kyle M Hall 2019-09-19 11:21:55 UTC
Created attachment 92965 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files
Comment 24 Owen Leonard 2019-09-19 13:40:48 UTC
I still get this error:

(In reply to Owen Leonard from comment #19)
> I get an error
> with updatedatabase:
> 
> DEV atomic update: bug_14697.perl
> DBD::mysql::db do failed: You have an error in your SQL syntax; check the
> manual that corresponds to your MariaDB server version for the right syntax
> to use near ')
>         VALUES
>           (
>             'RETURN_CLAIM_RESOLUTION', 'RET_BY_PATR' at line 1 [for
> Statement "
>         INSERT INTO `authorised_values` ( category, authorised_value, lib, )
>         VALUES
>           (
>             'RETURN_CLAIM_RESOLUTION', 'RET_BY_PATRON', 'Returned by patron'
>           ),
>           (
>             'RETURN_CLAIM_RESOLUTION', 'FOUND_IN_LIB', 'Found in library',
>           );
>
Comment 25 Kyle M Hall 2019-09-20 15:49:04 UTC
Created attachment 93005 [details] [review]
Bug 14697: Update database
Comment 26 Kyle M Hall 2019-09-20 15:49:22 UTC
Created attachment 93006 [details] [review]
Bug 14697: Add new schema file
Comment 27 Kyle M Hall 2019-09-20 15:49:30 UTC
Created attachment 93007 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim
Comment 28 Kyle M Hall 2019-09-20 15:49:38 UTC
Created attachment 93008 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files
Comment 29 Lisette Scheer 2019-09-20 16:10:16 UTC
Got these error messages when we tried opening a patron to do some checkouts. 

Template process failed: undef error - Can't locate object method "return_claims_borrowernumbers" via package "Koha::Schema::Result::Borrower" at /kohadevbox/koha/Koha/Patron.pm line 1083.
 at /kohadevbox/koha/C4/Templates.pm line 122
in C4::Templates::output at /kohadevbox/koha/C4/Templates.pm line 122
  119: 
  120:     my $data;
  121:     binmode( STDOUT, ":utf8" );
  122:     $template->process( $self->filename, $vars, \$data )
  123:       || die "Template process failed: ", $template->error();
  124:     return $data;
  125: }

in (eval) at /kohadevbox/koha/members/moremember.pl line 214
  211:     relatives_borrowernumbers => \@relatives,
  212: );
  213: 
  214: output_html_with_http_headers $input, $cookie, $template->output;

in CGI::Compile::ROOT::kohadevbox_koha_members_moremember_2epl::__ANON__ at /kohadevbox/koha/members/moremember.pl line 2
    1: #!/usr/bin/perl
    2: 
    3: # Copyright 2000-2002 Katipo Communications
    4: # Copyright 2010 BibLibre
    5: # Copyright 2014 ByWater Solutions
Comment 30 Kyle M Hall 2019-09-20 17:13:55 UTC
Created attachment 93012 [details] [review]
Bug 14697: Update database
Comment 31 Kyle M Hall 2019-09-20 17:14:22 UTC
Created attachment 93013 [details] [review]
Bug 14697: Add new schema file
Comment 32 Kyle M Hall 2019-09-20 17:14:31 UTC
Created attachment 93014 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim
Comment 33 Kyle M Hall 2019-09-20 17:14:37 UTC
Created attachment 93015 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files
Comment 34 ByWater Sandboxes 2019-09-20 18:18:36 UTC
Created attachment 93017 [details] [review]
Bug 14697: Show an item has unresolved claims on checkin
Comment 35 ByWater Sandboxes 2019-09-20 19:26:05 UTC
Created attachment 93038 [details] [review]
Bug 14697: Update database

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 36 ByWater Sandboxes 2019-09-20 19:26:24 UTC
Created attachment 93039 [details] [review]
Bug 14697: Add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 37 ByWater Sandboxes 2019-09-20 19:26:32 UTC
Created attachment 93040 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 38 ByWater Sandboxes 2019-09-20 19:26:40 UTC
Created attachment 93041 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 39 ByWater Sandboxes 2019-09-20 19:26:46 UTC
Created attachment 93042 [details] [review]
Bug 14697: Show an item has unresolved claims on checkin

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 40 Lisette Scheer 2019-09-20 19:27:43 UTC
Jessie Zario and I tested this at koha-US 2019. 
Lisette
Comment 41 Kyle M Hall 2019-09-20 21:12:21 UTC
Created attachment 93061 [details] [review]
Bug 14697: Update database

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 42 Kyle M Hall 2019-09-20 21:13:05 UTC
Created attachment 93062 [details] [review]
Bug 14697: Add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 43 Kyle M Hall 2019-09-20 21:13:16 UTC
Created attachment 93063 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 44 Kyle M Hall 2019-09-20 21:13:23 UTC
Created attachment 93064 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 45 Kyle M Hall 2019-09-20 21:13:30 UTC
Created attachment 93065 [details] [review]
Bug 14697: Show an item has unresolved claims on checkin

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 46 Jessie Zairo 2019-09-23 00:12:10 UTC
Created attachment 93040 [details] [review] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Comment 47 Tomás Cohen Arazi 2019-09-27 18:00:59 UTC
This route:

POST /return_claims/claim/{item_id}
{
  notes: ...,
  created_by: ...,
  charge_lost_fee: ...
}

should really be

POST /return_claims

{
  item_id: ...,
  notes: ...,
  created_by: ...,
  charge_lost_fee: ...
}
Comment 48 Kyle M Hall 2019-10-10 14:34:18 UTC
Created attachment 93952 [details] [review]
Bug 14697: Update database

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 49 Kyle M Hall 2019-10-10 14:34:41 UTC
Created attachment 93953 [details] [review]
Bug 14697: Add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 50 Kyle M Hall 2019-10-10 14:34:46 UTC
Created attachment 93954 [details] [review]
Bug 14697: Extend and enhance "Claims returned" lost status

This adds a "Claims returned" feature that extends and enhances the claims returned lost status

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 51 Kyle M Hall 2019-10-10 14:34:51 UTC
Created attachment 93955 [details] [review]
Bug 14697: Show an item has unresolved claims on checkin

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 52 Kyle M Hall 2019-10-10 14:34:56 UTC
Created attachment 93956 [details] [review]
Bug 14697: Move /return_claims/claim to /return_claims
Comment 53 Kyle M Hall 2019-10-10 14:35:02 UTC
Created attachment 93957 [details] [review]
Bug 14697: [DO NOT PUSH] Update Schema Files
Comment 54 Kyle M Hall 2019-10-10 14:44:55 UTC
Created attachment 93959 [details] [review]
Bug 14697: Don't unbless claims before rendering, it's done automatically
Comment 55 Martin Renvoize 2019-10-23 18:13:32 UTC
Sponsored-by: lines needed pretty please ;)
Comment 56 Kyle M Hall 2019-10-24 14:55:34 UTC
(In reply to Martin Renvoize from comment #55)
> Sponsored-by: lines needed pretty please ;)

Will do, sponsor is North Central Regional Library System
Comment 57 Kyle M Hall 2019-10-29 19:20:17 UTC
Created attachment 94842 [details] [review]
Bug 14697: Update database

This patch introduces the new table and related sysprefs.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 58 Kyle M Hall 2019-10-29 19:20:29 UTC
Created attachment 94843 [details] [review]
Bug 14697: Add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 59 Kyle M Hall 2019-10-29 19:20:34 UTC
Created attachment 94844 [details] [review]
Bug 14697: Introduce Koha::Checkouts::ReturnClaim(s)

This patch introduces the Koha::Object(s)-derived classes for handling
return claims. Tests are added to cover the overloaded ->store method,
and domain-specific exceptions are added as well.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 60 Kyle M Hall 2019-10-29 19:20:38 UTC
Created attachment 94845 [details] [review]
Bug 14697: Add return claim handling to AddReturn

This adds the ability to alert a librarian of an item claimed as returned is actually returned.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 61 Kyle M Hall 2019-10-29 19:20:42 UTC
Created attachment 94846 [details] [review]
Bug 14697: Add Koha::Checkout->claim_returned

Adds the ability to generate a return claim from a Checkout object.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 62 Kyle M Hall 2019-10-29 19:20:46 UTC
Created attachment 94847 [details] [review]
Bug 14697: Add Koha::Patron->return_claims

Adds the ability to get a list of a patron's return claims directly
from the Patron object.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 63 Kyle M Hall 2019-10-29 19:20:51 UTC
Created attachment 94848 [details] [review]
Bug 14697: Add routes to handle return claims

This patch adds the /return_claims route to add new return claims, and
then routes to updates notes and the resolution code.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 64 Kyle M Hall 2019-10-29 19:20:55 UTC
Created attachment 94849 [details] [review]
Bug 14697: Enhance the return claims feature [FIXME]

This adds a "Claims returned" feature that extends and enhances the claims returned lost status.
To use this feature, a new LOST status to represent an item claimed as returned needs to be created.
The value of this LOST authorised value should be set in the new syspref ClaimReturnedLostValue.
Setting this system preference turns on the feature.

Once the feature is enabled, you should be able to mark checked out items as return claims from the
checkout and patron details pages, and also modify them from the new claims tab on those pages.

Returning a claimed item will notify the librarian that the item in question has a claim on it.

Setting the ClaimReturnedWarningThreshold will add an alert to make librarians aware that this
patron has many return claims on the patron's record.

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Sponsored-by: North Central Regional Library System

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 65 Kyle M Hall 2019-10-29 19:21:00 UTC
Created attachment 94850 [details] [review]
Bug 14697: Schema updates

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 66 Kyle M Hall 2019-10-29 19:21:04 UTC
Created attachment 94851 [details] [review]
Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id

This patch avoids querying the DB for an already existing
Koha::Checkouts::ReturnClaim with the same issue_id, now that there's a
UNIQUE constraint on it.

Also, 409 should be returned instead. Tests added for this changes.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 67 Kyle M Hall 2019-10-29 19:21:09 UTC
Created attachment 94852 [details] [review]
Bug 14697: Make controller methods rely on the stashed user

This patch adjusts the return values and HTTP status codes, as well as
removing the use of C4::Context->userenv. It also makes the date
calculation happen on the DB engine in the case of resolving the claim.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 68 Kyle M Hall 2019-10-29 19:21:14 UTC
Created attachment 94853 [details] [review]
Bug 14697: (QA follow-up) Organize tests in subtests

This patch organizes the tests better, and adds some more.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 69 Kyle M Hall 2019-10-29 19:21:19 UTC
Created attachment 94854 [details] [review]
Bug 14697: (QA follow-up) Add missing AV category

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 70 Tomás Cohen Arazi 2019-10-29 20:44:33 UTC
Created attachment 94857 [details] [review]
Bug 14697: (QA follow-up) Restore FK on issue_id and adjust tests

This patch reintroduces the FK constraint on issue_id. The tests are
adjusted to reflect the UNIQUE constraint we also added.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 71 Tomás Cohen Arazi 2019-10-30 15:17:48 UTC
Created attachment 94877 [details] [review]
Bug 14697: (follow-up) Add auth values to the sample data

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 72 Tomás Cohen Arazi 2019-10-30 17:38:49 UTC
Good job Kyle. I would love to see the resolution types be outside of AVs, but that's really out of the scope of this bug now, as this is the way things are actually done in Koha so far.
Comment 73 Josef Moravec 2019-10-30 18:14:42 UTC
Created attachment 94878 [details] [review]
Bug 14697: (QA follow-up) Remove tab chars

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 74 Martin Renvoize 2019-10-31 12:08:02 UTC
(In reply to Tomás Cohen Arazi from comment #72)
> Good job Kyle. I would love to see the resolution types be outside of AVs,
> but that's really out of the scope of this bug now, as this is the way
> things are actually done in Koha so far.

Agreed.. would be lovely to see the AV's system tidied up a little.. I think things like this are somewhat misleading to have as AV's (This feature does not allow one to specify per branch values, but the AV system still exposes that.. for example).

But, that's certainly not inside the scope of this bug.

Great to see such a team effort !
Comment 75 Martin Renvoize 2019-10-31 12:08:46 UTC
Nice work!

Pushed to master for 19.11.00
Comment 76 Martin Renvoize 2019-10-31 12:21:44 UTC
Nice work!

Pushed to master for 19.11.00
Comment 77 Martin Renvoize 2019-11-26 11:33:01 UTC
Added sponsor details to follow-up commit