Bugzilla – Attachment 119022 Details for
Bug 27944
Add new stages to the article request process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27944: Add "requested" stage in article request process
Bug-27944-Add-requested-stage-in-article-request-p.patch (text/plain), 22.39 KB, created by
Agustín Moyano
on 2021-03-30 16:20:22 UTC
(
hide
)
Description:
Bug 27944: Add "requested" stage in article request process
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2021-03-30 16:20:22 UTC
Size:
22.39 KB
patch
obsolete
>From 5ff0647adadeea93c1d8332f5aa2943c1912aec9 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Tue, 30 Mar 2021 10:52:31 -0300 >Subject: [PATCH] Bug 27944: Add "requested" stage in article request process > >This patch adds the stage "requested" in article request process, which >is previous to pending stage. > >To test: >1. apply this patch >2. updatedatabase >3. enable ArticleRequests syspref >4. from staff inteface and from opac search for a record and place an > article request >5. koha-mysql kohadev >6. query: select subject, content, letter_code from message_queue; >CHECK => There is a message for each article request with code >AR_REQUESTED > => In opac-user.pl, in "Article requests" tab you should see a row >in the table with "Requested" status >5. in staff go to Circulation -> Article Requests >SUCCESS => You should see 3 tabs, one for Requested stage (with two >requests), one for Pending stage and one for Processing stage. >6. play with actions buttons >CHECK => you should see a new action called "Set request as pending" >SUCCESS => All action buttons behave as expected, and tab counts updates >correctly. >--- > Koha/ArticleRequest.pm | 17 +- > Koha/ArticleRequest/Status.pm | 21 ++- > Koha/ArticleRequests.pm | 11 ++ > Koha/Biblio.pm | 1 + > Koha/Patron.pm | 1 + > Koha/Template/Plugin/Biblio.pm | 1 + > circ/article-requests.pl | 1 + > .../prog/en/modules/circ/article-requests.tt | 162 +++++++++++++++++- > .../prog/en/modules/circ/request-article.tt | 2 + > .../bootstrap/en/modules/opac-user.tt | 2 + > svc/article_request | 3 + > 11 files changed, 208 insertions(+), 14 deletions(-) > >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index 2c47dd03fe..6a8716204d 100644 >--- a/Koha/ArticleRequest.pm >+++ b/Koha/ArticleRequest.pm >@@ -40,6 +40,19 @@ Koha::ArticleRequest - Koha Article Request Object class > > =cut > >+=head3 request >+ >+=cut >+ >+sub request { >+ my ($self) = @_; >+ >+ $self->status(Koha::ArticleRequest::Status::Requested); >+ $self->SUPER::store(); >+ $self->notify(); >+ return $self; >+} >+ > =head3 open > > =cut >@@ -106,7 +119,7 @@ sub notify { > if ( > my $letter = C4::Letters::GetPreparedLetter( > module => 'circulation', >- letter_code => "AR_$status", # AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED >+ letter_code => "AR_$status", # AR_REQUESTED, AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED > message_transport_type => 'email', > lang => $self->borrower->lang, > tables => { >@@ -199,7 +212,7 @@ sub store { > return $self->SUPER::store; > } else { > $self->created_on( dt_from_string() ); >- return $self->open; >+ return $self->request; > } > } > >diff --git a/Koha/ArticleRequest/Status.pm b/Koha/ArticleRequest/Status.pm >index 42de00d551..859e9f4a56 100644 >--- a/Koha/ArticleRequest/Status.pm >+++ b/Koha/ArticleRequest/Status.pm >@@ -19,6 +19,22 @@ package Koha::ArticleRequest::Status; > > use Modern::Perl; > >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=cut >+ >+=head2 Requested >+ >+ returns constant string 'REQUESTED' >+ >+=cut >+ >+sub Requested { >+ return 'REQUESTED'; >+} >+ > sub Pending { > return 'PENDING'; > } >@@ -35,10 +51,5 @@ sub Canceled { > return 'CANCELED'; > } > >-=head1 AUTHOR >- >-Kyle M Hall <kyle@bywatersolutions.com> >- >-=cut > > 1; >diff --git a/Koha/ArticleRequests.pm b/Koha/ArticleRequests.pm >index 9b27615573..ac7c82a163 100644 >--- a/Koha/ArticleRequests.pm >+++ b/Koha/ArticleRequests.pm >@@ -61,6 +61,17 @@ sub search_limited { > return $self->search( $params, $attributes ); > } > >+=head3 requested >+ >+=cut >+ >+sub requested { >+ my ( $self, $branchcode ) = @_; >+ my $params = { status => Koha::ArticleRequest::Status::Requested }; >+ $params->{'me.branchcode'} = $branchcode if $branchcode; >+ return Koha::ArticleRequests->search_limited($params); >+} >+ > =head3 pending > > =cut >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index fc1affe233..1356683bb9 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -368,6 +368,7 @@ sub article_requests_current { > { > biblionumber => $self->biblionumber(), > -or => [ >+ { status => Koha::ArticleRequest::Status::Requested }, > { status => Koha::ArticleRequest::Status::Pending }, > { status => Koha::ArticleRequest::Status::Processing } > ] >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 8c1592c3f2..0980b36400 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -983,6 +983,7 @@ sub article_requests_current { > { > borrowernumber => $self->id(), > -or => [ >+ { status => Koha::ArticleRequest::Status::Requested }, > { status => Koha::ArticleRequest::Status::Pending }, > { status => Koha::ArticleRequest::Status::Processing } > ] >diff --git a/Koha/Template/Plugin/Biblio.pm b/Koha/Template/Plugin/Biblio.pm >index e9d7a73009..5ec3542294 100644 >--- a/Koha/Template/Plugin/Biblio.pm >+++ b/Koha/Template/Plugin/Biblio.pm >@@ -44,6 +44,7 @@ sub ArticleRequestsActiveCount { > biblionumber => $biblionumber, > status => [ > -or => [ >+ status => Koha::ArticleRequest::Status::Requested, > status => Koha::ArticleRequest::Status::Pending, > status => Koha::ArticleRequest::Status::Processing > ] >diff --git a/circ/article-requests.pl b/circ/article-requests.pl >index 3e856bcafa..10bdab4497 100755 >--- a/circ/article-requests.pl >+++ b/circ/article-requests.pl >@@ -39,6 +39,7 @@ my $branchcode = defined( $query->param('branchcode') ) ? $query->param('branchc > > $template->param( > branchcode => $branchcode, >+ article_requests_requested => scalar Koha::ArticleRequests->requested($branchcode), > article_requests_pending => scalar Koha::ArticleRequests->pending($branchcode), > article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode), > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >index eec1c7432e..7fb8c59e90 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >@@ -19,6 +19,11 @@ > > <ul class="dropdown-menu [% pull_right | html %]" role="menu" aria-labelledby="[% aria_menu | html %]"> > <li> >+ <a class="ar-open-request" href="#" onclick="HandleMulti( Open, [% id_arg | html %], $(this) ); return false;"> >+ <i class="fa fa-bars"></i> >+ Set request as pending >+ </a> >+ > <a class="ar-process-request" href="#" onclick="HandleMulti( Process, [% id_arg | html %], $(this) ); return false;"> > <i class="fa fa-cog"></i> > Process request >@@ -88,6 +93,12 @@ > > <div id="article-request-tabs" class="toptabs"> > <ul> >+ <li> >+ <a href="#article-requests-requested"> >+ Requested (<span id="ar_requested_count">[% article_requests_requested.count | html %]</span>) >+ </a> >+ </li> >+ > <li> > <a href="#article-requests-pending"> > Pending (<span id="ar_pending_count">[% article_requests_pending.count | html %]</span>) >@@ -101,6 +112,108 @@ > </li> > </ul> > >+ <div id="article-requests-requested"> >+ <div class="article-requests-requested_table_controls"> >+ <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> >+ [% PROCESS actions menuid='article-menu-requested' id_arg=0 pull_right='' aria_menu='table_controls' %] >+ </div> >+ >+ <table id="article-requests-requested-table"> >+ <thead> >+ <tr> >+ <th/> >+ <th class="ar-title">Title</th> >+ <th class="ar-request">Requested article</th> >+ <th class="ar-collection">Collection</th> >+ <th class="ar-itemtype">Item type</th> >+ <th class="ar-callnumber">Call number</th> >+ <th class="ar-status">Status</th> >+ <th class="ar-copynumber">Copy number</th> >+ <th class="ar-enumchron">Enumeration</th> >+ <th class="ar-barcode">Barcode</th> >+ <th class="ar-patron">Patron</th> >+ <th class="ar-date">Date</th> >+ <th class="ar-actions noExport">Actions</th> >+ </tr> >+ </thead> >+ >+ <tbody> >+ [% FOREACH ar IN article_requests_requested %] >+ <tr class="ar-row ar-requested"> >+ <td><input type="checkbox" reqid="[% ar.id | html %]"/></td> >+ <td class="ar-title"> >+ <p> >+ <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]"> >+ [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %] >+ </a> >+ </p> >+ >+ <p> >+ <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div> >+ <div class="ar-author">[% ar.biblio.author | html %]</div> >+ <div class="ar-pubdata"> >+ [% ar.biblio.biblioitem.publishercode | html %] >+ >+ [% IF ar.biblio.biblioitem.publicationyear %] >+ [% ar.biblio.biblioitem.publicationyear | html %] >+ [% ELSIF ar.biblio.copyrightdate %] >+ [% ar.biblio.copyrightdate | html %] >+ [% END %] >+ >+ [% IF ar.biblio.biblioitem.pages %] >+ : [% ar.biblio.biblioitem.pages | html %] >+ [% END %] >+ >+ [% r.biblio.biblioitem.size | html %] >+ >+ [% IF ar.biblio.biblioitem.isbn %] >+ ISBN: [% ar.biblio.biblioitem.isbn | html %] >+ [% END %] >+ </div> >+ </p> >+ </td> >+ <td class="ar-request"> >+ [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %] >+ [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %] >+ [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %] >+ [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %] >+ [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %] >+ [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %] >+ [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %] >+ [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %] >+ </td> >+ <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td> >+ <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td> >+ <td class="ar-callnumber"> >+ [% IF ar.item.location %] >+ <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em> >+ [% END %] >+ >+ [% ar.item.itemcallnumber | html %] >+ </td> >+ <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td> >+ <td class="ar-copynumber">[% ar.item.copynumber | html %]</td> >+ <td class="ar-enumchron">[% ar.item.enumchron | html %]</td> >+ <td class="ar-barcode">[% ar.item.barcode | html %]</td> >+ <td class="ar-patron"> >+ <p> >+ <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]"> >+ [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %]) >+ </a> >+ </p> >+ >+ <p>[% ar.borrower.phone | html %]</p> >+ </td> >+ <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td> >+ <td class="ar-actions"> >+ [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </div> >+ > <div id="article-requests-pending"> > <div class="article-requests-pending_table_controls"> > <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> >@@ -310,13 +423,15 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > <script> >- var active_tab = "#article-requests-pending"; >- var last_cancel_reason, pending_datatable, processing_datatable, active_datatable; >+ var active_tab = "#article-requests-requested"; >+ var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable; > $(document).ready(function() { > $('#article-request-tabs').tabs({ > activate: function( activate_event, activate_ui ) { > active_tab = activate_ui.newPanel.selector; >- if( active_tab == '#article-requests-pending' ) >+ if( active_tab == '#article-requests-requested' ) >+ active_datatable = requested_datatable; >+ else if( active_tab == '#article-requests-pending' ) > active_datatable = pending_datatable; > else active_datatable = processing_datatable; > activateBatchActions( active_tab ); >@@ -340,22 +455,31 @@ > }); > $("a.ar-actions").on('click', function(e) { > // Hide menu option ? >- if( $('#article-requests-processing-table').is(":visible") ) >- $('a.ar-process-request').hide(); >- else $('a.ar-process-request').show(); >+ if( $('#article-requests-pending-table').is(":visible") ) >+ $('a.ar-process-request').show(); >+ else $('a.ar-process-request').hide(); >+ >+ if( $('#article-requests-requested-table').is(":visible") ) >+ $('a.ar-open-request').show(); >+ else $('a.ar-open-request').hide(); > }); > >+ requested_datatable = $("#article-requests-requested-table").DataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [0, -1], "bSortable": false, "bSearchable": false }, >+ ], >+ })); > pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, { > "aoColumnDefs": [ > { "aTargets": [0, -1], "bSortable": false, "bSearchable": false }, > ], > })); >- active_datatable = pending_datatable; > processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, { > "aoColumnDefs": [ > { "aTargets": [0, -1], "bSortable": false, "bSearchable": false }, > ], > })); >+ active_datatable = requested_datatable; > activateBatchActions( active_tab ); > $(".starthidden").show(); > }); >@@ -415,6 +539,29 @@ > }); > } > >+ function Open( id, a ) { >+ var table_row = a.closest('tr'); >+ table_row.find('.ar-open-request').remove(); >+ table_row.find('input[type="checkbox"]').prop('checked', false); >+ a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide(); >+ $.ajax({ >+ type: "POST", >+ url: '/cgi-bin/koha/svc/article_request', >+ data: { >+ action: 'open', >+ id: id, >+ }, >+ success: function( data ) { >+ $("img.spinner").remove(); >+ requested_datatable.row( table_row ).remove().draw(); >+ pending_datatable.row.add( table_row ).draw(); >+ UpdateTabCounts(); >+ activateBatchActions( active_tab ); >+ }, >+ dataType: 'json' >+ }); >+ } >+ > function Process( id, a ) { > var table_row = a.closest('tr'); > table_row.find('.ar-process-request').remove(); >@@ -458,6 +605,7 @@ > } > > function UpdateTabCounts() { >+ $("#ar_requested_count").html( requested_datatable.rows().count() ); > $("#ar_pending_count").html( pending_datatable.rows().count() ); > $("#ar_processing_count").html( processing_datatable.rows().count() ); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >index 3a228ba1cd..2e7ee9a8f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >@@ -260,6 +260,8 @@ > Pending > [% ELSIF ar.status == 'PROCESSING' %] > Processing >+ [% ELSIF ar.status == 'REQUESTED' %] >+ Requested > [% ELSIF ar.status == 'COMPLETED' %] > Completed > [% ELSIF ar.status == 'CANCELED' %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 5d4206a0c6..e71edaf2ea 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -782,6 +782,8 @@ > Pending > [% ELSIF ar.status == 'PROCESSING' %] > Processing >+ [% ELSIF ar.status == 'REQUESTED' %] >+ Requested > [% ELSIF ar.status == 'COMPLETED' %] > Completed > [% ELSIF ar.status == 'CANCELED' %] >diff --git a/svc/article_request b/svc/article_request >index e5c1759b2b..20767ad134 100755 >--- a/svc/article_request >+++ b/svc/article_request >@@ -50,6 +50,9 @@ if ($ar) { > elsif ( $action eq 'process' ) { > $ar = $ar->process(); > } >+ elsif ( $action eq 'open' ) { >+ $ar = $ar->open(); >+ } > elsif ( $action eq 'complete' ) { > $ar = $ar->complete(); > } >-- >2.25.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 27944
:
119020
|
119021
|
119022
|
120454
|
122673
|
122836
|
122837
|
122838
|
122839
|
122842
|
122843
|
122857
|
122984
|
122985
|
122986
|
122987
|
122988
|
122989
|
122990
|
123710
|
123711
|
123712
|
123943
|
123944
|
123945
|
123946
|
123947
|
123948
|
123949
|
123950
|
123951
|
123952
|
124966
|
124967
|
124968
|
124969
|
124970
|
124971
|
124972
|
124973
|
124974
|
124975
|
124976
|
125158
|
125544
|
125565
|
125567
|
125762
|
125813