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 9b30551f97..5b66241152 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 @@ -26,40 +26,40 @@
').find('div.dropdown').hide();
- $.ajax({
- type: "POST",
- url: '/cgi-bin/koha/svc/article_request',
- data: {
- action: 'pending',
- 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 ) {
+
[% END %]
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 f92d2ad035..4295e07a7d 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
@@ -370,32 +370,7 @@
$( ".ar-update-branchcode" ).on('focus', function(){
previous_branchcode = this.value;
- }).on('change', function(){
- var branchcode = this.value;
- var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
-
- if ( c ) {
- var id = this.id.split("branchcode-")[1];
- $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
-
- $.ajax({
- type: "POST",
- url: '/cgi-bin/koha/svc/article_request',
- data: {
- action: 'update_branchcode',
- id: id,
- branchcode: branchcode,
- },
- success: function( data ) {
- $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
- },
- dataType: 'json'
- });
-
- } else {
- this.value = previous_branchcode;
- }
- });
+ })
$('#modal-cancellation-reason').on('change', function(e) {
let reason = $(this).val();
@@ -442,6 +417,33 @@
});
+
+
[% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber %]
[% END %]
diff --git a/svc/article_request b/svc/article_request
index 28db40d42d..3760ae074d 100755
--- a/svc/article_request
+++ b/svc/article_request
@@ -38,34 +38,36 @@ binmode STDOUT, ':encoding(UTF-8)';
print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' );
my $id = $cgi->param('id');
-my $action = $cgi->param('action') || q{};
+my $op = $cgi->param('op') || q{};
my $notes = $cgi->param('notes');
my $ar = Koha::ArticleRequests->find($id);
if ($ar) {
- if ( $action eq 'cancel' ) {
+ if ( $op eq 'cud-cancel' ) {
$ar = $ar->cancel({ notes => $notes });
}
- elsif ( $action eq 'process' ) {
+ elsif ( $op eq 'cud-process' ) {
$ar = $ar->process();
}
- elsif ( $action eq 'pending' ) {
+ elsif ( $op eq 'cud-pending' ) {
$ar = $ar->set_pending();
}
- elsif ( $action eq 'complete' ) {
+ elsif ( $op eq 'cud-complete' ) {
$ar = $ar->complete();
}
- elsif ( $action eq 'update_branchcode' ) {
- my $branchcode = $cgi->param('branchcode');
+ elsif ( $op eq 'cud-update_library_id' ) {
+ my $branchcode = $cgi->param('library_id');
$ar->branchcode( $branchcode ) if $branchcode;
$ar = $ar->store();
}
- elsif( $action eq 'update_urls' ) {
+ elsif( $op eq 'cud-update_urls' ) {
my $urls = $cgi->param('urls') // q{};
$ar->urls( $urls );
$ar = $ar->store();
}
+ else { undef $ar; }
}
+# FIXME do not return 200 if not success
print to_json( { success => $ar ? 1 : 0 } );