Bugzilla – Attachment 122986 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), 24.17 KB, created by
Agustín Moyano
on 2021-07-20 17:00:02 UTC
(
hide
)
Description:
Bug 27944: Add "requested" stage in article request process
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2021-07-20 17:00:02 UTC
Size:
24.17 KB
patch
obsolete
>From ca255899182878fd6dba8f8af9d41b7ef0b85f28 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 | 173 +++++++++++++++++- > .../prog/en/modules/circ/request-article.tt | 2 + > .../bootstrap/en/modules/opac-user.tt | 2 + > svc/article_request | 3 + > 11 files changed, 217 insertions(+), 16 deletions(-) > >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index 05b0e32542..b73f5ff81f 100644 >--- a/Koha/ArticleRequest.pm >+++ b/Koha/ArticleRequest.pm >@@ -39,6 +39,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 >@@ -105,7 +118,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 => { >@@ -198,7 +211,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 2d3dce5627..662677af64 100644 >--- a/Koha/ArticleRequests.pm >+++ b/Koha/ArticleRequests.pm >@@ -60,6 +60,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 26ee7abd96..d1d84a7631 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -370,6 +370,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 941dace0df..b861e53e9e 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -992,6 +992,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 3e918dd4c6..026483bdc7 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 61e94ca026..fabf326dd2 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-set-pending-request" href="#" onclick="HandleMulti( SetPending, [% 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 >@@ -97,7 +102,7 @@ > > <div class="main container-fluid starthidden"> > <div class="row"> >- <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> >+ <div class="col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1"> > > <h1>Article requests</h1> > [% PROCESS urls_modal %] >@@ -120,6 +125,12 @@ > > <div id="article-request-tabs" class="toptabs"> > <ul> >+ <li> >+ <a href="#article-requests-requested"> >+ New (<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>) >@@ -133,6 +144,112 @@ > </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-format">Format</th> >+ <th class="ar-urls">URLs</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-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td> >+ <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</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> >@@ -350,13 +467,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 ); >@@ -380,9 +499,13 @@ > }); > $("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-requested-table:visible,#article-requests-pending-table:visible').length ) >+ $('a.ar-process-request').show(); >+ else $('a.ar-process-request').hide(); >+ >+ if( $('#article-requests-requested-table').is(":visible") ) >+ $('a.ar-set-pending-request').show(); >+ else $('a.ar-set-pending-request').hide(); > }); > > $('#myModal').on("shown.bs.modal", function () { >@@ -398,17 +521,23 @@ > SaveURLs( $('#myModal textarea').val() ); > }); > >+ 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(); > }); >@@ -468,8 +597,33 @@ > }); > } > >+ function SetPending( id, a ) { >+ var table_row = a.closest('tr'); >+ table_row.find('.ar-set-pending-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'); >+ var table = a.closest('table'); >+ var orig_datatable = table.attr('id')==='article-requests-pending-table'?pending_datatable:requested_datatable; > table_row.find('.ar-process-request').remove(); > table_row.find('input[type="checkbox"]').prop('checked', false); > >@@ -483,7 +637,7 @@ > }, > success: function( data ) { > $("img.spinner").remove(); >- pending_datatable.row( table_row ).remove().draw(); >+ orig_datatable.row( table_row ).remove().draw(); > processing_datatable.row.add( table_row ).draw(); > UpdateTabCounts(); > activateBatchActions( active_tab ); >@@ -517,6 +671,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 9206dba4e2..224d2bb846 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 >@@ -282,6 +282,8 @@ > Pending > [% ELSIF ar.status == 'PROCESSING' %] > Processing >+ [% ELSIF ar.status == 'REQUESTED' %] >+ New > [% 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 7c92ba2f9e..578b6ccfbf 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -789,6 +789,8 @@ > Pending > [% ELSIF ar.status == 'PROCESSING' %] > Processing >+ [% ELSIF ar.status == 'REQUESTED' %] >+ New > [% ELSIF ar.status == 'COMPLETED' %] > Completed > [% ELSIF ar.status == 'CANCELED' %] >diff --git a/svc/article_request b/svc/article_request >index 9d55d9a0ab..a372cd6199 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.1
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