Bug 12812

Summary: Longoverdue.pl --mark-returned doesn't return items
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Command-line UtilitiesAssignee: Kyle M Hall <kyle>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, jdemuth, jonathan.druart, josef.moravec, julian.maurice, kyle.m.hall, kyle, marjorie.barry-vila, martin.renvoize, nick
Version: master   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12363
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 13589    
Attachments: Bug 12812 - Longoverdue.pl --mark-returned doesn't return items
Bug 12812: Longoverdue.pl --mark-returned doesn't return items
Bug 12812: (Follow-up) Fix use of C4::Circulation
Bug 12812: Longoverdue.pl --mark-returned doesn't return items
Bug 12812: (Follow-up) Fix use of C4::Circulation

Description Katrin Fischer 2014-08-24 20:19:32 UTC
When testing bug 12467 I foudn that the --mark-returned flag didn't return the items as it was supposed to. The items got marked lost, but remained on the patron's account.
Comment 1 Jonathan Druart 2015-07-15 11:26:19 UTC
How do you launch the cronjob?
It seems that the --charge option is required (or the pref) to mark the item as returned.

I don't understand the following code:
185    ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'});
186    LostItem($row->{'itemnumber'}, $mark_returned) if( $charge && $charge eq $lostvalue);

If the charge and the lostvalue don't match, the item won't be marked as returned, so if it needs to be marked as returned, we should move the MarkIssueReturned from the LostItem subroutine.
Comment 2 Kyle M Hall 2018-02-08 11:41:59 UTC
Created attachment 71336 [details] [review]
Bug 12812 - Longoverdue.pl --mark-returned doesn't return items

The longoverdue.pl option --mark-returned doesn't work unless the
--charge option is used as well.

Test Plan:
1) Run long overdue with --mark-returned and not --charge,
   note your items are marked lost but not returned
2) Apply this patch
3) Repeat step 1, the items should now get returned!
Comment 3 Josef Moravec 2018-03-09 06:52:31 UTC
Created attachment 72544 [details] [review]
Bug 12812: Longoverdue.pl --mark-returned doesn't return items

The longoverdue.pl option --mark-returned doesn't work unless the
--charge option is used as well.

Test Plan:
1) Run long overdue with --mark-returned and not --charge,
   note your items are marked lost but not returned
2) Apply this patch
3) Repeat step 1, the items should now get returned!

Tested with (for example):
misc/cronjobs/longoverdue.pl --lost 10=1 --mark-returned --verbose
--confirm

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 4 Josef Moravec 2018-03-09 06:52:34 UTC
Created attachment 72545 [details] [review]
Bug 12812: (Follow-up) Fix use of C4::Circulation

Fixes this error:
Undefined subroutine &main::MarkIssueReturned called at
misc/cronjobs/longoverdue.pl line 316.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 5 Julian Maurice 2018-03-09 12:14:36 UTC
Created attachment 72564 [details] [review]
Bug 12812: Longoverdue.pl --mark-returned doesn't return items

The longoverdue.pl option --mark-returned doesn't work unless the
--charge option is used as well.

Test Plan:
1) Run long overdue with --mark-returned and not --charge,
   note your items are marked lost but not returned
2) Apply this patch
3) Repeat step 1, the items should now get returned!

Tested with (for example):
misc/cronjobs/longoverdue.pl --lost 10=1 --mark-returned --verbose
--confirm

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 6 Julian Maurice 2018-03-09 12:14:40 UTC
Created attachment 72565 [details] [review]
Bug 12812: (Follow-up) Fix use of C4::Circulation

Fixes this error:
Undefined subroutine &main::MarkIssueReturned called at
misc/cronjobs/longoverdue.pl line 316.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 7 Nick Clemens 2018-03-15 09:20:51 UTC
Pushed to master for 18.05, thanks to all for your hard work.
Comment 8 Nick Clemens 2018-04-06 17:52:56 UTC
Awesome work all, backported to stable for 17.11.05
Comment 9 Fridolin Somers 2018-04-10 07:36:24 UTC
Pushed to 17.05.x for v17.05.11