Bugzilla – Attachment 113381 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: (QA follow-up) Adapt all the things to the new column and accessor names
Bug-23916-QA-follow-up-Adapt-all-the-things-to-the.patch (text/plain), 8.51 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-11-10 12:01:08 UTC
(
hide
)
Description:
Bug 23916: (QA follow-up) Adapt all the things to the new column and accessor names
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-11-10 12:01:08 UTC
Size:
8.51 KB
patch
obsolete
>From 11620571a508606642dc800848469daffe3ef0df Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 10 Nov 2020 08:47:29 -0300 >Subject: [PATCH] Bug 23916: (QA follow-up) Adapt all the things to the new > column and accessor names > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Circulation.pm | 3 ++- > Koha/Checkout.pm | 12 ++++++------ > Koha/Old/Checkout.pm | 15 +++++++++++++++ > .../prog/en/modules/catalogue/issuehistory.tt | 6 +++--- > .../prog/en/modules/members/readingrec.tt | 2 +- > t/db_dependent/Circulation.t | 14 ++++++-------- > t/db_dependent/Koha/Checkouts.t | 12 ++++++------ > 7 files changed, 39 insertions(+), 25 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f0b8dc4d1c0..b33e6d58d10 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1527,7 +1527,7 @@ sub AddIssue { > my $userenv = C4::Context->userenv(); > my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : undef; > if ($usernumber) { >- $issue_attributes->{issuer} = $usernumber; >+ $issue_attributes->{issuer_id} = $usernumber; > } > } > >@@ -1545,6 +1545,7 @@ sub AddIssue { > } > )->store; > } >+ $issue->discard_changes; > if ( $item_object->location && $item_object->location eq 'CART' > && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) { > ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index 7328a9c4b53..944c0b1d731 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -106,18 +106,19 @@ sub patron { > return Koha::Patron->_new_from_dbic( $patron_rs ); > } > >-=head3 issued_by >+=head3 issuer > >-my $issued_by = $checkout->issued_by >+my $issuer = $checkout->issuer > > Return the patron by whom the checkout was done > > =cut > >-sub issued_by { >+sub issuer { > my ( $self ) = @_; >- my $issued_by_rs = $self->_result->issuer; >- return Koha::Patron->_new_from_dbic( $issued_by_rs ); >+ my $issuer_rs = $self->_result->issuer; >+ return unless $issuer_rs; >+ return Koha::Patron->_new_from_dbic( $issuer_rs ); > } > > =head3 to_api_mapping >@@ -131,7 +132,6 @@ 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/Old/Checkout.pm b/Koha/Old/Checkout.pm >index 7b62111f0cd..e0eb1e0382e 100644 >--- a/Koha/Old/Checkout.pm >+++ b/Koha/Old/Checkout.pm >@@ -74,6 +74,21 @@ sub patron { > return Koha::Patron->_new_from_dbic( $patron_rs ); > } > >+=head3 issuer >+ >+my $issuer = $checkout->issuer >+ >+Return the patron by whom the checkout was done >+ >+=cut >+ >+sub issuer { >+ my ( $self ) = @_; >+ my $issuer_rs = $self->_result->issuer; >+ return unless $issuer_rs; >+ return Koha::Patron->_new_from_dbic( $issuer_rs ); >+} >+ > =head3 to_api_mapping > > This method returns the mapping for representing a Koha::Old::Checkout object >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 796c5e62e63..26220fee754 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >@@ -67,9 +67,9 @@ > > [% END %]</td> > [% IF Koha.Preference('RecordStaffUserOnCheckout') %] >- <td>[% IF checkout.issuer %] >- <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% checkout.issuer | uri %]"> >- [% INCLUDE 'patron-title.inc' patron=checkout.issued_by %] >+ <td>[% IF checkout.issuer_id %] >+ <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% checkout.issuer_id | uri %]"> >+ [% INCLUDE 'patron-title.inc' patron=checkout.issuer_id %] > </a> > [% END %]</td> > [% 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 019e3b78cb9..ed734436a7f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >@@ -98,7 +98,7 @@ > </td> > <td>[% Branches.GetName( issue.branchcode ) | html %]</td> > [% IF Koha.Preference('RecordStaffUserOnCheckout') %] >- <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issue.issuer | uri %]">[% issue.firstname | html %] [% issue.surname | html %]</a></td> >+ <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issue.issuer_id | uri %]">[% issue.firstname | html %] [% issue.surname | html %]</a></td> > [% END %] > <td> > [% IF issue.date_due %] >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 819c6c1f446..41b415c27f0 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -4610,20 +4610,19 @@ subtest 'AddIssue records staff who checked out item if appropriate' => sub { > > $module->mock( 'userenv', sub { { branch => $library->{id} } } ); > >- my $library = >- $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); > my $patron = $builder->build_object( > { > class => 'Koha::Patrons', > value => { categorycode => $patron_category->{categorycode} } > } >- )->store; >+ ); > my $issuer = $builder->build_object( > { > class => 'Koha::Patrons', > value => { categorycode => $patron_category->{categorycode} } > } >- )->store; >+ ); > my $item = $builder->build_sample_item( > { > library => $library->{branchcode} >@@ -4632,11 +4631,10 @@ subtest 'AddIssue records staff who checked out item if appropriate' => sub { > > $module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); > >- my $dt_from = dt_from_string(); >- my $dt_to = dt_from_string()->add( days => 7 ); >+ my $dt_from = dt_from_string(); >+ my $dt_to = dt_from_string()->add( days => 7 ); > >- my $issue = >- AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); > > is( $issue->issuer, undef, "Staff who checked out the item not recorded when RecordStaffUserOnCheckout turned off" ); > >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index 246a986eea7..60722ce0bad 100755 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -133,24 +133,24 @@ subtest 'issuer' => sub { > my $item = $builder->build_sample_item; > my $checkout = Koha::Checkout->new({ > borrowernumber => $patron->borrowernumber, >- issuer => $issuer->borrowernumber, >+ issuer_id => $issuer->borrowernumber, > itemnumber => $item->itemnumber, > branchcode => $library->{branchcode}, > })->store; > >- my $i = $checkout->issued_by; >+ my $i = $checkout->issuer; > is( ref($i), 'Koha::Patron', >- 'Koha::Checkout->issued_by should return a Koha::Patron' ); >+ 'Koha::Checkout->issuer should return a Koha::Patron' ); > is( $i->borrowernumber, $issuer->borrowernumber, >- 'Koha::Checkout->issued_by should return the correct patron' ); >+ 'Koha::Checkout->issuer should return the correct patron' ); > > # Testing Koha::Old::Checkout->patron now > my $issue_id = $checkout->issue_id; > C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $checkout->itemnumber ); > $i->delete; > my $old_issue = Koha::Old::Checkouts->find($issue_id); >- is( $old_issue->issuer, undef, >- 'Koha::Checkout->issuer should return undef if the patron record has been deleted' >+ is( $old_issue->issuer_id, undef, >+ 'Koha::Checkout->issuer_id should return undef if the patron record has been deleted' > ); > > }; >-- >2.29.2
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