Bugzilla – Attachment 132424 Details for
Bug 30055
Rewrite some of the patron searches to make them use the REST API routes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30055: Use /acquisitions/baskets/managers for basket's manager
Bug-30055-Use-acquisitionsbasketsmanagers-for-bask.patch (text/plain), 6.75 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-03-29 13:43:26 UTC
(
hide
)
Description:
Bug 30055: Use /acquisitions/baskets/managers for basket's manager
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-03-29 13:43:26 UTC
Size:
6.75 KB
patch
obsolete
>From 3d3163ef305efe83d248ed82586acba11526565b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 9 Feb 2022 12:38:18 +0100 >Subject: [PATCH] Bug 30055: Use /acquisitions/baskets/managers for basket's > manager > >Test plan: >Add a manager to a basket > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1/Acquisitions/Baskets.pm | 62 ++++++++++++++++++ > acqui/add_user_search.pl | 64 ------------------- > api/v1/swagger/paths.yaml | 2 + > .../prog/en/modules/acqui/basket.tt | 2 +- > .../prog/en/modules/members/search.tt | 2 + > 5 files changed, 67 insertions(+), 65 deletions(-) > create mode 100644 Koha/REST/V1/Acquisitions/Baskets.pm > delete mode 100755 acqui/add_user_search.pl > >diff --git a/Koha/REST/V1/Acquisitions/Baskets.pm b/Koha/REST/V1/Acquisitions/Baskets.pm >new file mode 100644 >index 0000000000..a521b631cc >--- /dev/null >+++ b/Koha/REST/V1/Acquisitions/Baskets.pm >@@ -0,0 +1,62 @@ >+package Koha::REST::V1::Acquisitions::Baskets; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Mojo::Base 'Mojolicious::Controller'; >+ >+use Try::Tiny qw( catch try ); >+ >+=head1 NAME >+ >+Koha::REST::V1::Acquisitions::Baskets >+ >+=head1 API >+ >+=head2 Class methods >+ >+=head3 list >+ >+Controller function that handles baskets >+ >+=cut >+ >+=head3 list_managers >+ >+Return the list of possible orders' managers >+ >+=cut >+ >+sub list_managers { >+ my $c = shift->openapi->valid_input or return; >+ >+ return try { >+ >+ my $patrons_rs = Koha::Patrons->search->filter_by_have_subpermission('acquisition.order_manage'); >+ my $patrons = $c->objects->search( $patrons_rs ); >+ >+ return $c->render( >+ status => 200, >+ openapi => $patrons >+ ); >+ } >+ catch { >+ $c->unhandled_exception($_); >+ }; >+} >+ >+1; >diff --git a/acqui/add_user_search.pl b/acqui/add_user_search.pl >deleted file mode 100755 >index 1246b0149d..0000000000 >--- a/acqui/add_user_search.pl >+++ /dev/null >@@ -1,64 +0,0 @@ >-#!/usr/bin/perl >- >-# This file is part of Koha. >-# >-# Copyright 2014 BibLibre >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >- >-use CGI qw ( -utf8 ); >-use C4::Auth qw( get_template_and_user ); >-use C4::Output qw( output_html_with_http_headers ); >-use C4::Members; >- >-use Koha::Patron::Categories ; >- >-my $input = CGI->new; >- >-my $dbh = C4::Context->dbh; >- >-my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user( >- { template_name => "common/patron_search.tt", >- query => $input, >- type => "intranet", >- flagsrequired => { acquisition => 'order_manage' }, >- } >-); >- >-my $q = $input->param('q') || ''; >-my $op = $input->param('op') || ''; >- >-my $referer = $input->referer(); >- >-# If this script is called by acqui/basket.pl >-# the patrons to return should be superlibrarian or have the order_manage >-# acquisition flag. >-my $search_patrons_with_acq_perm_only = >- ( $referer =~ m|acqui/basket.pl| ) >- ? 1 : 0; >- >-my $patron_categories = Koha::Patron::Categories->search_with_library_limits; >-$template->param( >- patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only, >- view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", >- columns => ['cardnumber', 'name', 'branch', 'category', 'action'], >- json_template => 'acqui/tables/members_results.tt', >- selection_type => 'add', >- alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >- categories => $patron_categories, >- aaSorting => 1, >-); >-output_html_with_http_headers( $input, $cookie, $template->output ); >diff --git a/api/v1/swagger/paths.yaml b/api/v1/swagger/paths.yaml >index daa4cb6b09..4636facbb0 100644 >--- a/api/v1/swagger/paths.yaml >+++ b/api/v1/swagger/paths.yaml >@@ -1,6 +1,8 @@ > --- > /oauth/token: > $ref: paths/oauth.yaml#/~1oauth~1token >+/acquisitions/baskets/managers: >+ $ref: paths/acquisitions_baskets.yaml#/~1acquisitions~1baskets~1managers > /acquisitions/orders: > $ref: paths/acquisitions_orders.yaml#/~1acquisitions~1orders > "/acquisitions/orders/{order_id}": >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index 09648ab56a..9ef5b60c62 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -1010,7 +1010,7 @@ > > function UserSearchPopup(f) { > window.open( >- "/cgi-bin/koha/acqui/add_user_search.pl", >+ "/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add&filter=baskets_managers", > 'UserSearchPopup', > 'width=840, height=500, scrollbars=yes, toolbar=no,' > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt >index c1d9e22e6b..51a3f8aa60 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt >@@ -167,6 +167,8 @@ > [% SWITCH filter %] > [% CASE 'suggestions_managers' %] > "url": '/api/v1/suggestions/managers' >+ [% CASE 'baskets_managers' %] >+ "url": '/api/v1/acquisitions/baskets/managers' > [% CASE %] > "url": '/api/v1/patrons' > [% END %] >-- >2.35.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 30055
:
130364
|
130365
|
130366
|
130367
|
130368
|
130369
|
130370
|
130371
|
130372
|
130385
|
130386
|
130387
|
130388
|
130389
|
130390
|
130391
|
130392
|
130393
|
130394
|
130395
|
130457
|
130487
|
130488
|
130491
|
130507
|
130511
|
130629
|
130630
|
130671
|
130672
|
130701
|
130702
|
130704
|
130716
|
130717
|
131829
|
132168
|
132419
|
132420
|
132421
|
132422
|
132423
|
132424
|
132425
|
132426
|
132427
|
132428
|
132429
|
132430
|
132431
|
132432
|
132433
|
132434
|
132435
|
132436
|
132437
|
132438
|
132439
|
132440
|
132441
|
132450
|
132451
|
132452
|
132453
|
132454
|
132455
|
132456
|
132457
|
132458
|
132459
|
132460
|
132461
|
132462
|
132463
|
132464
|
132465
|
132466
|
132467
|
132468
|
132469
|
132470
|
132471
|
132472
|
132473
|
132539
|
132616
|
132617
|
132618
|
132619
|
132620
|
132621
|
132622
|
132623
|
132624
|
132625
|
132627
|
132628
|
132629
|
132630
|
132631
|
132632
|
132633
|
132634
|
132635
|
132636
|
132637
|
132638
|
132639
|
132640
|
132641
|
132664
|
132665
|
132666
|
132667
|
132668
|
132669
|
132670
|
132671
|
132672
|
132673
|
132674
|
132675
|
132676
|
132677
|
132678
|
132679
|
132680
|
132681
|
132682
|
132683
|
132684
|
132685
|
132686
|
132687
|
132688