[Bug 13851] New: Replace waiting holds logic in circulation.pl with Koha Objects
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Bug ID: 13851 Summary: Replace waiting holds logic in circulation.pl with Koha Objects Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Medium patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #1 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 36947 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36947&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |13030 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m --- Comment #2 from Jonathan Druart <jonathan.druart@biblibre.com> --- Kyle, please fix the POD, it's incorrect in some places. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Koha Team Lyon 3 <koha@univ-lyon3.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |koha@univ-lyon3.fr -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Comment on attachment 36947 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36947 Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects Review of attachment 36947: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=13851&attachment=36947) ----------------------------------------------------------------- Please provide tests for new packages. ::: circ/circulation.pl @@ +389,4 @@
# BUILD HTML # show all reserves of this borrower, and the position of the reservation .... if ($borrowernumber) { + my $holds = Koha::Holds->new()->search( { borrowernumber => $borrowernumber } );
Koha::Holds->search should be enough. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #36947|0 |1 is obsolete| | --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 37303 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37303&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Jason Burds <jburds@dubuque.lib.ia.us> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jburds@dubuque.lib.ia.us --- Comment #5 from Jason Burds <jburds@dubuque.lib.ia.us> --- Kyle, I ran through the steps on a sandbox. 1. "Waiting at" is still bold, but not different colored. 2. Selecting Hold in the circulation.pl continues to show the "Processing" box. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #37303|0 |1 is obsolete| | --- Comment #6 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 38175 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=38175&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- (In reply to Jason Burds from comment #5)
Kyle,
I ran through the steps on a sandbox.
1. "Waiting at" is still bold, but not different colored.
That is exactly how it should be! I apologize for not being more specific in my test plan. The only difference is the color change, the text is bold for holds both at your branch and other branches.
2. Selecting Hold in the circulation.pl continues to show the "Processing" box.
That appears to be fixed in master and was unrelated to this patch. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #38175|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 39740 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=39740&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #39740|0 |1 is obsolete| | --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 40028 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40028&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40028|0 |1 is obsolete| | --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 40039 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40039&action=edit [SIGNED-OFF] Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us> Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #11 from Jonathan Druart <jonathan.druart@biblibre.com> --- Comment on attachment 40039 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40039 [SIGNED-OFF] Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects Review of attachment 40039: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=13851&attachment=40039) ----------------------------------------------------------------- There is a lack of tests for new module added by this patch. ::: Koha/Branches.pm @@ +28,5 @@
+use base qw(Koha::Objects); + +=head1 NAME + +Koha::Branches - Koha Reserve object set class
s/Reserve/Branch ::: Koha/Hold.pm @@ +45,5 @@
+ +sub biblio { + my ($self) = @_; + + $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
Why not return $self->{_result}->biblio; ? @@ +59,5 @@
+ +sub item { + my ($self) = @_; + + $self->{_item} ||= Koha::Items->find( $self->itemnumber() );
Same as before. @@ +73,5 @@
+ +sub branch { + my ($self) = @_; + + $self->{_branch} ||= Koha::Branches->find( $self->branchcode() );
Same as before. ::: koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ +763,5 @@
+ [% IF ( WaitingHolds ) %] + <div id="holdswaiting" class="circmessage"> + <h4>Holds waiting:</h4> + [% FOREACH w IN WaitingHolds %]
WaitingHolds is an array?? You have passed WaitingHolds => scalar $holds->waiting() in the pl script. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> ---
There is a lack of tests for new module added by this patch.
I'll add some unit tests!
::: Koha/Hold.pm @@ +45,5 @@
+ +sub biblio { + my ($self) = @_; + + $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
Why not return $self->{_result}->biblio; ?
That would return a DBIC restultset and not a Koha::Biblios object.
::: koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ +763,5 @@
+ [% IF ( WaitingHolds ) %] + <div id="holdswaiting" class="circmessage"> + <h4>Holds waiting:</h4> + [% FOREACH w IN WaitingHolds %]
WaitingHolds is an array?? You have passed WaitingHolds => scalar $holds->waiting() in the pl script.
WaitingHolds is a Koha::Holds object, which Template Toolkit can iterate over. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 40247 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40247&action=edit Bug 13851 [QA Followup] - Unit Tests -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #14 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Kyle M Hall from comment #12)
There is a lack of tests for new module added by this patch.
I'll add some unit tests!
Thanks!
::: Koha/Hold.pm @@ +45,5 @@
+ +sub biblio { + my ($self) = @_; + + $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
Why not return $self->{_result}->biblio; ?
That would return a DBIC restultset and not a Koha::Biblios object.
Yes, you are right, sorry. We will have to create a method for each FK. I don't have a better idea to suggest at the moment.
::: koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ +763,5 @@
+ [% IF ( WaitingHolds ) %] + <div id="holdswaiting" class="circmessage"> + <h4>Holds waiting:</h4> + [% FOREACH w IN WaitingHolds %]
WaitingHolds is an array?? You have passed WaitingHolds => scalar $holds->waiting() in the pl script.
WaitingHolds is a Koha::Holds object, which Template Toolkit can iterate over.
Ok, I thought you passed the number of holds, but actually it's a Koha::Holds ref. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40039|0 |1 is obsolete| | Attachment #40247|0 |1 is obsolete| | --- Comment #15 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 40256 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40256&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us> Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #16 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 40257 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40257&action=edit Bug 13851 [QA Followup] - Unit Tests Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #17 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 40258 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40258&action=edit Bug 13851: Fix typo in POD Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #40256|0 |1 is obsolete| | Attachment #40257|0 |1 is obsolete| | Attachment #40258|0 |1 is obsolete| | --- Comment #18 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 40668 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40668&action=edit Bug 13851 - Replace waiting holds logic in circulation.pl with Koha Objects This is the original patch for bug 12892 and replaces the older style of fetching the holds data with Koha Objects. It will be used as a foundation for future features. Test Plan: 1) Apply this patch 2) Create a hold, set to waiting 3) Browse to circulation.pl for that patron 4) Note you see the list of waiting holds 5) Switch your logged in branch to a different branch 6) Note the "Waiting at" line is no longer emphasized. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us> Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #19 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 40669 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40669&action=edit Bug 13851 [QA Followup] - Unit Tests Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #20 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 40670 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40670&action=edit Bug 13851: Fix typo in POD Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |14557 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14557 [Bug 14557] Add holds count to holds tab -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |14616 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14616 [Bug 14616] Introducing Koha::Object subclasses -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|Passed QA |Pushed to Master --- Comment #21 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patches pushed to master. Thanks Kyle! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |olli-antti.kivilahti@jns.fi --- Comment #22 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Hi there! Tomás asked me to comment on this. I have nothing major to complain, all looks good to me. I spotted one optimization however: +++ b/Koha/Hold.pm +sub biblio { + my ($self) = @_; + + $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() ); + + return $self->{_biblio}; +} When you get the linked object like this 'Koha::Biblios->find()', you need to instantiate a new DBIx::Class::ResultSet to make the search. There is already an instantiated resultset in Koha::Hold (the caller class). Should we instead get the linked data like this? #The relationship is already defined in the DBIx::Schema my $b = $self->_resultset()->biblio() $b = $self->_new_from_dbic($b); using the DBIx::Schema's preconfigured relationships? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 --- Comment #23 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Olli-Antti Kivilahti from comment #22)
Hi there! Tomás asked me to comment on this.
I have nothing major to complain, all looks good to me. I spotted one optimization however:
Olli, would you be kind and fill a bug report with your enhancement proposal? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13851 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |15324 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15324 [Bug 15324] Checkout page: Hide title "Waiting holds:" for patrons without waiting holds -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org