Bugzilla – Attachment 112365 Details for
Bug 23916
Issuer should be recorded and visible in patron circulation history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23916: Record and display item issuer
Bug-23916-Record-and-display-item-issuer.patch (text/plain), 6.74 KB, created by
Nick Clemens (kidclamp)
on 2020-10-24 03:04:06 UTC
(
hide
)
Description:
Bug 23916: Record and display item issuer
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-10-24 03:04:06 UTC
Size:
6.74 KB
patch
obsolete
>From a5c4afb1d904addea707e0ba58efa0b2460d6927 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Mon, 2 Mar 2020 11:04:59 +0000 >Subject: [PATCH] Bug 23916: Record and display item issuer > >This patch adds the recording and display of the item issuer. This >behaviour is governed by the RecordIssuer syspref, if disabled (the >default), no recording or display of issuer will take place. > >Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk> >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> >--- > C4/Circulation.pm | 11 +++++++++++ > C4/Members.pm | 6 ++++-- > Koha/Checkout.pm | 15 +++++++++++++++ > .../prog/en/modules/catalogue/issuehistory.tt | 10 ++++++++++ > .../intranet-tmpl/prog/en/modules/members/readingrec.tt | 6 ++++++ > 5 files changed, 46 insertions(+), 2 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 18c4dacda5..0d47e3a6a5 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1513,6 +1513,17 @@ sub AddIssue { > auto_renew => $auto_renew ? 1 : 0, > }; > >+ # Get ID of logged in user. if called from a batch job, >+ # no user session exists and C4::Context->userenv() returns >+ # the scalar '0'. Only do this is the syspref says so >+ if ( C4::Context->preference('RecordIssuer') ) { >+ my $userenv = C4::Context->userenv(); >+ my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : undef; >+ if ($usernumber) { >+ $issue_attributes->{issuer} = $usernumber; >+ } >+ } >+ > $issue = Koha::Checkouts->find( { itemnumber => $item_object->itemnumber } ); > if ($issue) { > $issue->set($issue_attributes)->store; >diff --git a/C4/Members.pm b/C4/Members.pm >index 6c10eeeb2c..1d47f5dc07 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -276,16 +276,18 @@ sub GetAllIssues { > 'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp > FROM issues > LEFT JOIN items on items.itemnumber=issues.itemnumber >+ LEFT JOIN borrowers on borrowers.borrowernumber=issues.issuer > LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber > LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber >- WHERE borrowernumber=? >+ WHERE issues.borrowernumber=? > UNION ALL > SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp > FROM old_issues > LEFT JOIN items on items.itemnumber=old_issues.itemnumber >+ LEFT JOIN borrowers on borrowers.borrowernumber=old_issues.issuer > LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber > LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber >- WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL >+ WHERE old_issues.borrowernumber=? AND old_issues.itemnumber IS NOT NULL > order by ' . $order; > if ($limit) { > $query .= " limit $limit"; >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index 8fd7b6ad03..7328a9c4b5 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -106,6 +106,20 @@ sub patron { > return Koha::Patron->_new_from_dbic( $patron_rs ); > } > >+=head3 issued_by >+ >+my $issued_by = $checkout->issued_by >+ >+Return the patron by whom the checkout was done >+ >+=cut >+ >+sub issued_by { >+ my ( $self ) = @_; >+ my $issued_by_rs = $self->_result->issuer; >+ return Koha::Patron->_new_from_dbic( $issued_by_rs ); >+} >+ > =head3 to_api_mapping > > This method returns the mapping for representing a Koha::Checkout object >@@ -117,6 +131,7 @@ sub to_api_mapping { > return { > issue_id => 'checkout_id', > borrowernumber => 'patron_id', >+ issuer => 'issuer_id', > itemnumber => 'item_id', > date_due => 'due_date', > branchcode => 'library_id', >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >index f22f6d2edd..a79feb04de 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >@@ -37,6 +37,9 @@ > [% END %] > <th>Barcode</th> > <th>Checked out from</th> >+ [% IF Koha.Preference('RecordIssuer') %] >+ <th>Checked out by</th> >+ [% END %] > <th>Renewed</th> > <th class='title-string'>Checkout on</th> > <th class='title-string'>Due date</th> >@@ -63,6 +66,13 @@ > [% ELSE %] > > [% END %]</td> >+ [% IF Koha.Preference('RecordIssuer') %] >+ <td>[% IF checkout.issuer %] >+ <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% checkout.issuer | uri %]"> >+ [% checkout.issued_by.firstname | html %] [% checkout.issued_by.surname | html %] >+ </a> >+ [% END %]</td> >+ [% END %] > <td>[% IF checkout.renewals %] > Yes[% IF checkout.lastreneweddate %], <small>last on: [% checkout.lastreneweddate |$KohaDates with_hours => 1 %]</small> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >index e2699e3bdf..59e84be4d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >@@ -58,6 +58,9 @@ > <th>Number of renewals</th> > <th class="title-string">Checked out on</th> > <th>Checked out from</th> >+ [% IF Koha.Preference('RecordIssuer') %] >+ <th>Checked out by</th> >+ [% END %] > <th class="title-string">Date due</th> > <th class="title-string">Return date</th> > </tr> >@@ -94,6 +97,9 @@ > <span title="[% issue.issuedate | html %]">[% issue.issuedate |$KohaDates with_hours => 1 %]</span> > </td> > <td>[% Branches.GetName( issue.branchcode ) | html %]</td> >+ [% IF Koha.Preference('RecordIssuer') %] >+ <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issue.issuer | uri %]">[% issue.firstname | html %] [% issue.surname | html %]</a></td> >+ [% END %] > <td> > [% IF issue.date_due %] > <span title="[% issue.date_due | html %]">[% issue.date_due |$KohaDates with_hours => 1 %]</span> >-- >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 23916
:
94914
|
94915
|
94916
|
94917
|
94918
|
95503
|
95504
|
95505
|
95506
|
95507
|
95508
|
95509
|
97719
|
97720
|
97721
|
97722
|
97723
|
97724
|
98586
|
98587
|
98588
|
98589
|
98590
|
98591
|
98594
|
99886
|
99887
|
99888
|
99889
|
99890
|
99891
|
110649
|
110650
|
110651
|
110652
|
110653
|
110654
|
110655
|
111485
|
111486
|
111487
|
111488
|
111489
|
111490
|
111491
|
111492
|
111966
|
111967
|
111968
|
111969
|
111970
|
111971
|
111972
|
111973
|
111974
|
112248
|
112249
|
112250
|
112251
|
112252
|
112253
|
112254
|
112255
|
112256
|
112257
|
112363
|
112364
|
112365
|
112366
|
112367
|
112368
|
112369
|
112370
|
112371
|
112372
|
112373
|
113035
|
113036
|
113037
|
113038
|
113039
|
113040
|
113041
|
113042
|
113043
|
113044
|
113045
|
113316
|
113317
|
113318
|
113319
|
113320
|
113321
|
113322
|
113323
|
113324
|
113325
|
113326
|
113327
|
113367
|
113368
|
113369
|
113370
|
113371
|
113372
|
113373
|
113374
|
113375
|
113376
|
113377
|
113378
|
113379
|
113380
|
113381
|
113382
|
113396