Bugzilla – Attachment 107510 Details for
Bug 20472
Add digital scan as optional format to Article Requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20472: Edit URL field on staff form
Bug-20472-Edit-URL-field-on-staff-form.patch (text/plain), 10.36 KB, created by
Marcel de Rooy
on 2020-07-29 14:48:42 UTC
(
hide
)
Description:
Bug 20472: Edit URL field on staff form
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-07-29 14:48:42 UTC
Size:
10.36 KB
patch
obsolete
>From 7702f92abd034e152eb7a8575d55eb0411fa4a67 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 5 Apr 2018 14:22:42 +0200 >Subject: [PATCH] Bug 20472: Edit URL field on staff form >Content-Type: text/plain; charset=utf-8 > >This patch makes the following changes: > >Add menu option Edit URLs. >Edit modal form to edit URLs. >Save URLs via ajax call to svc/article_request (Add action update_urls). >Add URL column to pending and processing table. >Allow Edit URLs for pending table too (just as Complete). >Do not allow 'Complete request' if a scan request has no URL(s). > >Test plan: >[1] Add a few scan and photocopy requests. >[2] Fill url-A and url-B in two separate scan requests. >[3] Verify that these two urls are really saved (refresh form). >[4] Check that you cannot complete a scan request without URL and that you > cannot add a URL to a photocopy request. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/circ/article-requests.tt | 76 +++++++++++++++++++++- > svc/article_request | 7 +- > 2 files changed, 80 insertions(+), 3 deletions(-) > >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 9d56c848f1..785255082a 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 >@@ -22,6 +22,13 @@ > Process request > </a> > >+ [% IF id_arg && format=='SCAN' %] >+ <a class="ar-edit-urls" href="#" onclick="HandleMulti( EditURLs, [% id_arg %], $(this) ); return false;"> >+ <i class="fa fa-edit"></i> >+ Edit URLs >+ </a> >+ [% END %] >+ > <a class="ar-complete-request" href="#" onclick="HandleMulti( Complete, [% id_arg | html %], $(this) ); return false;"> > <i class="fa fa-check-circle"></i> > Complete request >@@ -49,6 +56,23 @@ > [% ELSIF myitem.notforloan < 0 %]<span>On order</span> > [% END %] > [% END %] >+[% BLOCK urls_modal %] >+ <div id="myModal" class="modal fade modal-lg" role="dialog"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h4 class="modal-title">Edit URL(s)</h4> >+ </div> >+ <div class="modal-body"> >+ <textarea id="urls" style="width:100%;"></textarea> >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-default" data-dismiss="modal">Save</button> >+ </div> >+ </div> >+ </div> >+ </div> >+[% END %] > > <body id="circ_article-requests" class="circ"> > [% INCLUDE 'header.inc' %] >@@ -67,6 +91,7 @@ > <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> > > <h1>Article requests</h1> >+ [% PROCESS urls_modal %] > > <form id="ar-branchcode-form" method="post"> > <select name="branchcode" id="branchcode"> >@@ -119,6 +144,7 @@ > <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">Actions</th> >@@ -190,6 +216,7 @@ > <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 %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id%]" style="display:none;">[% ar.urls %]</span>[% END %]</td> > <td class="ar-patron"> > <p> > <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]"> >@@ -201,7 +228,7 @@ > </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' %] >+ [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %] > </td> > </tr> > [% END %] >@@ -228,6 +255,7 @@ > <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">Actions</th> >@@ -299,6 +327,7 @@ > <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 %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id%]" style="display:none;">[% ar.urls %]</span>[% END %]</td> > <td class="ar-patron"> > <p> > <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]"> >@@ -310,7 +339,7 @@ > </td> > <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td> > <td class="ar-actions"> >- [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %] >+ [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %] > </td> > </tr> > [% END %] >@@ -368,6 +397,18 @@ > $('a.ar-process-request').hide(); > else $('a.ar-process-request').show(); > }); >+ $('#myModal').on("shown.bs.modal", function () { >+ $('#myModal textarea').focus(); >+ }); >+ $('#myModal').on("hidden.bs.modal", function () { >+ // Set focus back to dropdown >+ var id = $('#myModal textarea').attr('ar_id'); >+ var link = $('span#url_'+ id).parent().parent().find('td.ar-actions').find('div.dropdown a'); >+ if( link.length > 0 ) link[0].focus(); >+ }); >+ $( '#myModal button' ).on("click", function () { >+ SaveURLs( $('#myModal textarea').val() ); >+ }); > }); > > function activateBatchActions( active_table ){ >@@ -450,6 +491,12 @@ > } > > function Complete( id, a ) { >+ // if it is a scan, check if urls field is filled >+ var urlspan = $('span#url_'+id); >+ if( urlspan.length>0 && urlspan.text() === '' ) { >+ alert( _("Please fill URL before completing request.") ); >+ return; >+ } > a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide(); > $.ajax({ > type: "POST", >@@ -476,6 +523,31 @@ > $("#ar_processing_count").html( processing_count ); > if ( processing_count == 0 ) $(".ar-processing-none").show(); > } >+ >+ function EditURLs(id) { >+ var urls = $('span#url_'+ id).text(); >+ $('#myModal textarea').val(urls); >+ $('#myModal textarea').attr('ar_id', id); >+ $('#myModal').modal('show'); >+ } >+ >+ function SaveURLs(newurl) { >+ var id = $('#myModal textarea').attr('ar_id'); >+ $('span#url_'+ id).text(newurl); >+ if(newurl) >+ $('span#url_yesno_'+id).text(_("Yes")); >+ else >+ $('span#url_yesno_'+id).text(_("No")); >+ >+ $.ajax({ >+ type: "POST", >+ url: '/cgi-bin/koha/svc/article_request', >+ data: { action: 'update_urls', id: id, urls: newurl }, >+ dataType: 'json', >+ error: function() { alert('Error: Saving URL failed!'); }, >+ success: function(data) { if(!data.success) alert('Saving URL failed!'); }, >+ }); >+ } > </script> > [% END %] > >diff --git a/svc/article_request b/svc/article_request >index 4a0a3f5189..b4593276af 100755 >--- a/svc/article_request >+++ b/svc/article_request >@@ -20,7 +20,7 @@ > > use Modern::Perl; > >-use CGI; >+use CGI qw ( -utf8 ); > use JSON qw(to_json); > > use C4::Auth qw(check_cookie_auth); >@@ -58,6 +58,11 @@ if ($ar) { > $ar->branchcode( $branchcode ) if $branchcode; > $ar = $ar->store(); > } >+ elsif( $action eq 'update_urls' ) { >+ my $urls = $cgi->param('urls') // q{}; >+ $ar->urls( $urls ); >+ $ar = $ar->store(); >+ } > } > > print to_json( { success => $ar ? 1 : 0 } ); >-- >2.11.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 20472
:
107506
|
107507
|
107508
|
107509
|
107510
|
107511
|
107512
|
111473
|
111474
|
111475
|
111476
|
111477
|
111478
|
111479
|
122366
|
122367
|
122368
|
122369
|
122370
|
122371
|
122372
|
122373
|
122374
|
122375
|
122376
|
122377
|
122378
|
122379
|
122382
|
122383
|
122699
|
122700
|
122701
|
122702
|
122703
|
122704
|
122705
|
122706
|
122775
|
122781