Bug 7317: QA followup
This fixes some of the issues reported by the QA script, but not all. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
9fafb8bd94
commit
66727e6c68
|
|
@ -18,8 +18,6 @@ package Koha::Illrequest;
|
|||
# Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
||||
# Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
# use Modern::Perl;
|
||||
|
||||
use Clone 'clone';
|
||||
use File::Basename qw/basename/;
|
||||
use Koha::Database;
|
||||
|
|
@ -29,6 +27,7 @@ use Koha::Illrequestattributes;
|
|||
use Koha::Patron;
|
||||
use Mail::Sendmail;
|
||||
use Try::Tiny;
|
||||
use Modern::Perl;
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
|
|
@ -59,6 +58,8 @@ TODO:
|
|||
|
||||
All methods should return a hashref in the following format:
|
||||
|
||||
=over
|
||||
|
||||
=item * error
|
||||
|
||||
This should be set to 1 if an error was encountered.
|
||||
|
|
@ -75,7 +76,7 @@ The message is a free text field that can be passed on to the end user.
|
|||
|
||||
The value returned by the method.
|
||||
|
||||
=over
|
||||
=back
|
||||
|
||||
=head2 Interface Status Messages
|
||||
|
||||
|
|
@ -100,8 +101,12 @@ the API.
|
|||
The interface's request method returned saying that the desired item is not
|
||||
available for request.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Class methods
|
||||
|
||||
=head3 illrequestattributes
|
||||
|
||||
=cut
|
||||
|
||||
sub illrequestattributes {
|
||||
|
|
@ -111,6 +116,10 @@ sub illrequestattributes {
|
|||
);
|
||||
}
|
||||
|
||||
=head3 patron
|
||||
|
||||
=cut
|
||||
|
||||
sub patron {
|
||||
my ( $self ) = @_;
|
||||
return Koha::Patron->_new_from_dbic(
|
||||
|
|
@ -118,14 +127,20 @@ sub patron {
|
|||
);
|
||||
}
|
||||
|
||||
=head3 load_backend
|
||||
|
||||
Require "Base.pm" from the relevant ILL backend.
|
||||
|
||||
=cut
|
||||
|
||||
sub load_backend {
|
||||
my ( $self, $backend_id ) = @_;
|
||||
|
||||
my @raw = qw/Koha Illbackends/; # Base Path
|
||||
|
||||
my $backend_name = $backend_id || $self->backend;
|
||||
$location = join "/", @raw, $backend_name, "Base.pm"; # File to load
|
||||
$backend_class = join "::", @raw, $backend_name, "Base"; # Package name
|
||||
my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load
|
||||
my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name
|
||||
require $location;
|
||||
$self->{_my_backend} = $backend_class->new({ config => $self->_config });
|
||||
return $self;
|
||||
|
|
@ -342,7 +357,7 @@ sub _status_graph_union {
|
|||
my $status_graph = clone($core_status_graph);
|
||||
|
||||
foreach my $backend_status_key ( keys %{$backend_status_graph} ) {
|
||||
$backend_status = $backend_status_graph->{$backend_status_key};
|
||||
my $backend_status = $backend_status_graph->{$backend_status_key};
|
||||
# Add to new status graph
|
||||
$status_graph->{$backend_status_key} = $backend_status;
|
||||
# Update all core methods' next_actions.
|
||||
|
|
@ -445,15 +460,27 @@ sub custom_capability {
|
|||
return 0;
|
||||
}
|
||||
|
||||
=head3 available_backends
|
||||
|
||||
Return a list of available backends.
|
||||
|
||||
=cut
|
||||
|
||||
sub available_backends {
|
||||
my ( $self ) = @_;
|
||||
my $backend_dir = $self->_config->backend_dir;
|
||||
my @backends = ();
|
||||
@backends = <$backend_dir/*> if ( $backend_dir );
|
||||
@backends = glob "$backend_dir/*" if ( $backend_dir );
|
||||
@backends = map { basename($_) } @backends;
|
||||
return \@backends;
|
||||
}
|
||||
|
||||
=head3 available_actions
|
||||
|
||||
Return a list of available actions.
|
||||
|
||||
=cut
|
||||
|
||||
sub available_actions {
|
||||
my ( $self ) = @_;
|
||||
my $current_action = $self->capabilities($self->status);
|
||||
|
|
@ -462,6 +489,12 @@ sub available_actions {
|
|||
return \@available_actions;
|
||||
}
|
||||
|
||||
=head3 mark_completed
|
||||
|
||||
Mark a request as completed (status = COMP).
|
||||
|
||||
=cut
|
||||
|
||||
sub mark_completed {
|
||||
my ( $self ) = @_;
|
||||
$self->status('COMP')->store;
|
||||
|
|
@ -475,12 +508,23 @@ sub mark_completed {
|
|||
};
|
||||
}
|
||||
|
||||
=head2 backend_confirm
|
||||
|
||||
Confirm a request. The backend handles setting of mandatory fields in the commit stage:
|
||||
|
||||
=over
|
||||
|
||||
=item * orderid
|
||||
|
||||
=item * accessurl, cost (if available).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub backend_confirm {
|
||||
my ( $self, $params ) = @_;
|
||||
|
||||
# The backend handles setting of mandatory fields in the commit stage:
|
||||
# - orderid
|
||||
# - accessurl, cost (if available).
|
||||
my $response = $self->_backend->confirm({
|
||||
request => $self,
|
||||
other => $params,
|
||||
|
|
@ -488,6 +532,10 @@ sub backend_confirm {
|
|||
return $self->expandTemplate($response);
|
||||
}
|
||||
|
||||
=head3 backend_update_status
|
||||
|
||||
=cut
|
||||
|
||||
sub backend_update_status {
|
||||
my ( $self, $params ) = @_;
|
||||
return $self->expandTemplate($self->_backend->update_status($params));
|
||||
|
|
@ -739,7 +787,7 @@ sub _limit_counter {
|
|||
} else { # assume 'active'
|
||||
# XXX: This status list is ugly. There should be a method in config
|
||||
# to return these.
|
||||
$where = { status => { -not_in => [ 'QUEUED', 'COMP' ] } };
|
||||
my $where = { status => { -not_in => [ 'QUEUED', 'COMP' ] } };
|
||||
$resultset = Koha::Illrequests->search({ %{$target}, %{$where} });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ Koha::Illrequestattributes - Koha Illrequestattributes Object class
|
|||
|
||||
=head2 Class Methods
|
||||
|
||||
=cut
|
||||
|
||||
=head3 type
|
||||
|
||||
=cut
|
||||
|
|
@ -42,6 +40,10 @@ sub _type {
|
|||
return 'Illrequestattribute';
|
||||
}
|
||||
|
||||
=head3 object_class
|
||||
|
||||
=cut
|
||||
|
||||
sub object_class {
|
||||
return 'Koha::Illrequestattribute';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ Koha::Illrequests - Koha Illrequests Object class
|
|||
|
||||
=head2 Class Methods
|
||||
|
||||
=cut
|
||||
|
||||
=head3 type
|
||||
=head3 _type
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -43,6 +41,10 @@ sub _type {
|
|||
return 'Illrequest';
|
||||
}
|
||||
|
||||
=head3 object_class
|
||||
|
||||
=cut
|
||||
|
||||
sub object_class {
|
||||
return 'Koha::Illrequest';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,18 @@ use Mojo::Base 'Mojolicious::Controller';
|
|||
use Koha::Illrequests;
|
||||
use Koha::Libraries;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::REST::V1::Illrequests
|
||||
|
||||
=head2 Operations
|
||||
|
||||
=head3 list
|
||||
|
||||
Return a list of ILL requests, after applying filters.
|
||||
|
||||
=cut
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,6 @@
|
|||
filterNames.forEach(function(thisFilter) {
|
||||
var filterName = toColumnName(thisFilter) + ':name';
|
||||
var regex = '^'+filters[thisFilter]+'$';
|
||||
console.log(regex);
|
||||
myTable.columns(filterName).search(regex, true, false);
|
||||
});
|
||||
myTable.draw();
|
||||
|
|
@ -586,13 +585,9 @@
|
|||
</div>
|
||||
<div class="borrowernumber">
|
||||
<span class="label borrowernumber">Borrower:</span>
|
||||
[% borrowerlink = "/cgi-bin/koha/members/moremember.pl"
|
||||
_ "?borrowernumber=" _ request.patron.borrowernumber %]
|
||||
[% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
|
||||
<a href="[% borrowerlink %]" title="View borrower details">
|
||||
[% request.patron.firstname _ " "
|
||||
_ request.patron.surname _ " ["
|
||||
_ request.patron.cardnumber
|
||||
_ "]" %]
|
||||
[% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" %]
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -253,14 +253,7 @@ href="/cgi-bin/koha/opac-rss.pl?[% query_cgi %][% limit_cgi |html %]" />
|
|||
[% INCLUDE 'page-numbers.inc' %]
|
||||
[% END # / IF total %]
|
||||
|
||||
[% IF
|
||||
Koha.Preference( 'suggestion' ) == 1 &&
|
||||
(
|
||||
Koha.Preference( 'AnonSuggestions' ) == 1 ||
|
||||
loggedinusername ||
|
||||
Koha.Preference( 'ILLModule' ) == 1
|
||||
)
|
||||
%]
|
||||
[% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername || Koha.Preference( 'ILLModule' ) == 1 ) %]
|
||||
<div class="suggestion">
|
||||
Not finding what you're looking for?
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -562,14 +562,7 @@
|
|||
|
||||
[% END # / IF total %]
|
||||
|
||||
[% IF
|
||||
Koha.Preference( 'suggestion' ) == 1 &&
|
||||
(
|
||||
Koha.Preference( 'AnonSuggestions' ) == 1 ||
|
||||
loggedinusername ||
|
||||
Koha.Preference( 'ILLModule' ) == 1
|
||||
)
|
||||
%]
|
||||
[% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername || Koha.Preference( 'ILLModule' ) == 1 ) %]
|
||||
<div class="suggestion">
|
||||
Not finding what you're looking for?
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,19 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
|
||||
# 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 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
# 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,19 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
|
||||
# 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 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
# 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# 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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue