[Bug 29110] New: Refactor Koha::ArticleRequest->store
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Bug ID: 29110 Summary: Refactor Koha::ArticleRequest->store Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org We should revisit the file altogether, and add more checks to ->store. This way the code will be easier to follow are more similar to what we do everywhere else. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |27949 Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27949 [Bug 27949] Batch printing of article request slips -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 125256 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125256&action=edit Bug 29110: Unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 125257 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125257&action=edit Bug 29110: Refactor Koha::ArticleRequest This patchset is simple to test. It adds lots of tests for the existing routines, and then tweaks them. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/ArticleRequests.t \ t/db_dependent/Koha/ArticleRequest* => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125256|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 125284 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125284&action=edit Bug 29110: Unit tests Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125257|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 125285 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125285&action=edit Bug 29110: Refactor Koha::ArticleRequest This patchset is simple to test. It adds lots of tests for the existing routines, and then tweaks them. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/ArticleRequests.t \ t/db_dependent/Koha/ArticleRequest* => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- I singed this off, but then thought I should check that the article requests system is still working. When adding a request or going to "Your account" (all the other user account ages seem fine) I get: Template process failed: undef error - DBIC result _type isn't of the _type Item at /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt line 751. at /kohadevbox/koha/C4/Templates.pm line 121 in C4::Templates::output at /kohadevbox/koha/C4/Templates.pm line 121 118: 119: my $data; 120: binmode( STDOUT, ":encoding(UTF-8)" ); 121: $template->process( $self->filename, $vars, \$data ) 122: || die "Template process failed: ", $template->error(); 123: return $data; 124: } Show function arguments in (eval) at /kohadevbox/koha/opac/opac-user.pl line 421 418: ); 419: } 420: 421: output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to David Nind from comment #5)
I singed this off, but then thought I should check that the article requests system is still working.
When adding a request or going to "Your account" (all the other user account ages seem fine) I get:
Template process failed: undef error - DBIC result _type isn't of the _type Item at /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt line 751. at /kohadevbox/koha/C4/Templates.pm line 121
in C4::Templates::output at /kohadevbox/koha/C4/Templates.pm line 121
118: 119: my $data; 120: binmode( STDOUT, ":encoding(UTF-8)" ); 121: $template->process( $self->filename, $vars, \$data ) 122: || die "Template process failed: ", $template->error(); 123: return $data; 124: }
Show function arguments in (eval) at /kohadevbox/koha/opac/opac-user.pl line 421
418: ); 419: } 420: 421: output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
Are you sure you restarted all the things? I have just applied the whole tree and reset_all, and things keep working as they used to. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- + $deleted_patron->delete; # Haha -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Koha/ArticleRequest.pm | 187 ++++++++++++++------------- Koha/Schema/Result/ArticleRequest.pm | 38 +++++- Strictly forbidden. Even for Tomas. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- + # this is to avoid calling ->discard_changes to retrieve + # the default value from the DB + $self->status( Koha::ArticleRequest::Status::Requested ) + unless $self->status; Hmm. But if you didnt provide a status, we should be able to rely on the default value from the DB engine, isnt it? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- + $self->SUPER::store; + $self->notify; Not sure if this is an improvement. When you store something, you call notify? This action begs for another code location imo. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Note that I also saw the problem David mentioned: Error trace Template process failed: undef error - DBIC result _type isn't of the _type Item at /usr/share/koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt line 751. at /usr/share/koha/C4/Templates.pm line 121 Yes, I restarted Plack. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Marcel de Rooy from comment #7)
+ $deleted_patron->delete; # Haha
It makes sense :-D I want a patron I'm sure doesn't exist on the DB :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Marcel de Rooy from comment #8)
Koha/Schema/Result/ArticleRequest.pm | 38 +++++-
That's weird. Probably didn't notice on git add.
Strictly forbidden. Even for Tomas.
Specially for any QA team member! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Marcel de Rooy from comment #9)
+ # this is to avoid calling ->discard_changes to retrieve + # the default value from the DB + $self->status( Koha::ArticleRequest::Status::Requested ) + unless $self->status;
Hmm. But if you didnt provide a status, we should be able to rely on the default value from the DB engine, isnt it?
True -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I don't think we need this for now. The only valuable addition is the schema changes, adding relationships with better names, but it falls short as it is not renaming the methods to access those. My original idea was to rename the methods to allow embedding things in an API route for article requests e.g. GET /article_requests x-koha-embed: patron, library so we can use it to render datatables. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |RESOLVED Resolution|--- |INVALID --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #15)
I don't think we need this for now. The only valuable addition is the schema changes, adding relationships with better names, but it falls short as it is not renaming the methods to access those.
My original idea was to rename the methods to allow embedding things in an API route for article requests e.g.
GET /article_requests x-koha-embed: patron, library
so we can use it to render datatables.
That said, I'm closing this bug, and opening a new one, once I can start coding such API route. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29110 Bug 29110 depends on bug 27949, which changed state. Bug 27949 Summary: Batch printing of article request slips https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27949 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org