Bugzilla – Attachment 100272 Details for
Bug 17996
longoverdue.pl should not set 'datereturned' when --mark-returned option is used.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17996 - longoverdue.pl should not set 'datereturned' when --mark-returned option is used
Bug-17996---longoverduepl-should-not-set-dateretur.patch (text/plain), 4.23 KB, created by
Nick Clemens (kidclamp)
on 2020-03-06 14:21:22 UTC
(
hide
)
Description:
Bug 17996 - longoverdue.pl should not set 'datereturned' when --mark-returned option is used
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-03-06 14:21:22 UTC
Size:
4.23 KB
patch
obsolete
>From a8123e41baf1a36e609dca48060c154f8cbe53c7 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 25 Jan 2017 16:57:10 +0000 >Subject: [PATCH] Bug 17996 - longoverdue.pl should not set 'datereturned' when > --mark-returned option is used > >When longoverdue.pl returns items, it sets old_issues.returndate to the >current date. This means that when staff look at the borrowers' >circulation history, they see a returndate displayed, which is >confusing. > >We don't lose information by not setting old_issues.returndate, because >items.itemlost_on will contain the date that the item was lost. > >Test Plan: >1) Apply this patch >2) Mark an item lost using longoverdue.pl with --mark-returned >3) Note the item's old_issues line does not have a returndate >--- > C4/Circulation.pm | 18 +++++++++++------- > misc/cronjobs/longoverdue.pl | 4 ++-- > 2 files changed, 13 insertions(+), 9 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 8105b0e9f9..168478f6fb 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2164,15 +2164,17 @@ sub AddReturn { > > =head2 MarkIssueReturned > >- MarkIssueReturned($borrowernumber, $itemnumber, $returndate, $privacy); >+ MarkIssueReturned($borrowernumber, $itemnumber, $returndate, $privacy, $set_returndate); > > Unconditionally marks an issue as being returned by >-moving the C<issues> row to C<old_issues> and >-setting C<returndate> to the current date. >+moving the C<issues> row to C<old_issues> > > if C<$returndate> is specified (in iso format), it is used as the date > of the return. > >+if C<$returndate> is not specified and C<$set_returndate> is not 0 then >+the return date will be set to current_date >+ > C<$privacy> contains the privacy parameter. If the patron has set privacy to 2, > the old_issue is immediately anonymised > >@@ -2183,7 +2185,9 @@ and offline_circ/process_koc.pl. > =cut > > sub MarkIssueReturned { >- my ( $borrowernumber, $itemnumber, $returndate, $privacy ) = @_; >+ my ( $borrowernumber, $itemnumber, $returndate, $privacy, $set_returndate ) = @_; >+ >+ $set_returndate //= 1; > > # Retrieve the issue > my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ) or return; >@@ -2212,7 +2216,7 @@ sub MarkIssueReturned { > if ( $returndate ) { > $issue->returndate( $returndate )->store->discard_changes; # update and refetch > } >- else { >+ elsif( $set_returndate) { > $issue->returndate( \'NOW()' )->store->discard_changes; # update and refetch > } > >@@ -3767,7 +3771,7 @@ sub ReturnLostItem{ > > > sub LostItem{ >- my ($itemnumber, $mark_lost_from, $force_mark_returned) = @_; >+ my ( $itemnumber, $mark_lost_from, $force_mark_returned, $set_returndate ) = @_; > > unless ( $mark_lost_from ) { > # Temporary check to avoid regressions >@@ -3813,7 +3817,7 @@ sub LostItem{ > #warn " $issues->{'borrowernumber'} / $itemnumber "; > } > >- MarkIssueReturned($borrowernumber,$itemnumber,undef,$patron->privacy) if $mark_returned; >+ MarkIssueReturned($borrowernumber,$itemnumber,undef,$patron->privacy,$set_returndate) if $mark_returned; > } > > #When item is marked lost automatically cancel its outstanding transfers and set items holdingbranch to the transfer source branch (frombranch) >diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl >index c75ffd29ca..37b9dd42e1 100755 >--- a/misc/cronjobs/longoverdue.pl >+++ b/misc/cronjobs/longoverdue.pl >@@ -385,10 +385,10 @@ foreach my $startrange (sort keys %$lost) { > if($confirm) { > ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'}); > if ( $charge && $charge eq $lostvalue ) { >- LostItem( $row->{'itemnumber'}, 'cronjob', $mark_returned ); >+ LostItem( $row->{'itemnumber'}, 'cronjob', $mark_returned, 0 ); > } elsif ( $mark_returned ) { > my $patron = Koha::Patrons->find( $row->{borrowernumber} ); >- MarkIssueReturned($row->{borrowernumber},$row->{itemnumber},undef,$patron->privacy) >+ MarkIssueReturned($row->{borrowernumber},$row->{itemnumber},undef,$patron->privacy,0) > } > } > $count++; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17996
:
59560
| 100272