View | Details | Raw Unified | Return to bug 7317
Collapse All | Expand All

(-)a/Koha/Illrequest.pm (-11 / +59 lines)
Lines 18-25 package Koha::Illrequest; Link Here
18
# Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin
18
# Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin
19
# Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
# Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
20
21
# use Modern::Perl;
22
23
use Clone 'clone';
21
use Clone 'clone';
24
use File::Basename qw/basename/;
22
use File::Basename qw/basename/;
25
use Koha::Database;
23
use Koha::Database;
Lines 29-34 use Koha::Illrequestattributes; Link Here
29
use Koha::Patron;
27
use Koha::Patron;
30
use Mail::Sendmail;
28
use Mail::Sendmail;
31
use Try::Tiny;
29
use Try::Tiny;
30
use Modern::Perl;
32
31
33
use base qw(Koha::Object);
32
use base qw(Koha::Object);
34
33
Lines 59-64 TODO: Link Here
59
58
60
All methods should return a hashref in the following format:
59
All methods should return a hashref in the following format:
61
60
61
=over
62
62
=item * error
63
=item * error
63
64
64
This should be set to 1 if an error was encountered.
65
This should be set to 1 if an error was encountered.
Lines 75-81 The message is a free text field that can be passed on to the end user. Link Here
75
76
76
The value returned by the method.
77
The value returned by the method.
77
78
78
=over
79
=back
79
80
80
=head2 Interface Status Messages
81
=head2 Interface Status Messages
81
82
Lines 100-107 the API. Link Here
100
The interface's request method returned saying that the desired item is not
101
The interface's request method returned saying that the desired item is not
101
available for request.
102
available for request.
102
103
104
=back
105
103
=head2 Class methods
106
=head2 Class methods
104
107
108
=head3 illrequestattributes
109
105
=cut
110
=cut
106
111
107
sub illrequestattributes {
112
sub illrequestattributes {
Lines 111-116 sub illrequestattributes { Link Here
111
    );
116
    );
112
}
117
}
113
118
119
=head3 patron
120
121
=cut
122
114
sub patron {
123
sub patron {
115
    my ( $self ) = @_;
124
    my ( $self ) = @_;
116
    return Koha::Patron->_new_from_dbic(
125
    return Koha::Patron->_new_from_dbic(
Lines 118-131 sub patron { Link Here
118
    );
127
    );
119
}
128
}
120
129
130
=head3 load_backend
131
132
Require "Base.pm" from the relevant ILL backend.
133
134
=cut
135
121
sub load_backend {
136
sub load_backend {
122
    my ( $self, $backend_id ) = @_;
137
    my ( $self, $backend_id ) = @_;
123
138
124
    my @raw = qw/Koha Illbackends/; # Base Path
139
    my @raw = qw/Koha Illbackends/; # Base Path
125
140
126
    my $backend_name = $backend_id || $self->backend;
141
    my $backend_name = $backend_id || $self->backend;
127
    $location = join "/", @raw, $backend_name, "Base.pm"; # File to load
142
    my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load
128
    $backend_class = join "::", @raw, $backend_name, "Base"; # Package name
143
    my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name
129
    require $location;
144
    require $location;
130
    $self->{_my_backend} = $backend_class->new({ config => $self->_config });
145
    $self->{_my_backend} = $backend_class->new({ config => $self->_config });
131
    return $self;
146
    return $self;
Lines 342-348 sub _status_graph_union { Link Here
342
    my $status_graph = clone($core_status_graph);
357
    my $status_graph = clone($core_status_graph);
343
358
344
    foreach my $backend_status_key ( keys %{$backend_status_graph} ) {
359
    foreach my $backend_status_key ( keys %{$backend_status_graph} ) {
345
        $backend_status = $backend_status_graph->{$backend_status_key};
360
        my $backend_status = $backend_status_graph->{$backend_status_key};
346
        # Add to new status graph
361
        # Add to new status graph
347
        $status_graph->{$backend_status_key} = $backend_status;
362
        $status_graph->{$backend_status_key} = $backend_status;
348
        # Update all core methods' next_actions.
363
        # Update all core methods' next_actions.
Lines 445-459 sub custom_capability { Link Here
445
    return 0;
460
    return 0;
446
}
461
}
447
462
463
=head3 available_backends
464
465
Return a list of available backends.
466
467
=cut
468
448
sub available_backends {
469
sub available_backends {
449
    my ( $self ) = @_;
470
    my ( $self ) = @_;
450
    my $backend_dir = $self->_config->backend_dir;
471
    my $backend_dir = $self->_config->backend_dir;
451
    my @backends = ();
472
    my @backends = ();
452
    @backends = <$backend_dir/*> if ( $backend_dir );
473
    @backends = glob "$backend_dir/*" if ( $backend_dir );
453
    @backends = map { basename($_) } @backends;
474
    @backends = map { basename($_) } @backends;
454
    return \@backends;
475
    return \@backends;
455
}
476
}
456
477
478
=head3 available_actions
479
480
Return a list of available actions.
481
482
=cut
483
457
sub available_actions {
484
sub available_actions {
458
    my ( $self ) = @_;
485
    my ( $self ) = @_;
459
    my $current_action = $self->capabilities($self->status);
486
    my $current_action = $self->capabilities($self->status);
Lines 462-467 sub available_actions { Link Here
462
    return \@available_actions;
489
    return \@available_actions;
463
}
490
}
464
491
492
=head3 mark_completed
493
494
Mark a request as completed (status = COMP).
495
496
=cut
497
465
sub mark_completed {
498
sub mark_completed {
466
    my ( $self ) = @_;
499
    my ( $self ) = @_;
467
    $self->status('COMP')->store;
500
    $self->status('COMP')->store;
Lines 475-486 sub mark_completed { Link Here
475
    };
508
    };
476
}
509
}
477
510
511
=head2 backend_confirm
512
513
Confirm a request. The backend handles setting of mandatory fields in the commit stage:
514
515
=over
516
517
=item * orderid
518
519
=item * accessurl, cost (if available).
520
521
=back
522
523
=cut
524
478
sub backend_confirm {
525
sub backend_confirm {
479
    my ( $self, $params ) = @_;
526
    my ( $self, $params ) = @_;
480
527
481
    # The backend handles setting of mandatory fields in the commit stage:
482
    # - orderid
483
    # - accessurl, cost (if available).
484
    my $response = $self->_backend->confirm({
528
    my $response = $self->_backend->confirm({
485
            request    => $self,
529
            request    => $self,
486
            other      => $params,
530
            other      => $params,
Lines 488-493 sub backend_confirm { Link Here
488
    return $self->expandTemplate($response);
532
    return $self->expandTemplate($response);
489
}
533
}
490
534
535
=head3 backend_update_status
536
537
=cut
538
491
sub backend_update_status {
539
sub backend_update_status {
492
    my ( $self, $params ) = @_;
540
    my ( $self, $params ) = @_;
493
    return $self->expandTemplate($self->_backend->update_status($params));
541
    return $self->expandTemplate($self->_backend->update_status($params));
Lines 739-745 sub _limit_counter { Link Here
739
    } else {                    # assume 'active'
787
    } else {                    # assume 'active'
740
        # XXX: This status list is ugly. There should be a method in config
788
        # XXX: This status list is ugly. There should be a method in config
741
        # to return these.
789
        # to return these.
742
        $where = { status => { -not_in => [ 'QUEUED', 'COMP' ] } };
790
        my $where = { status => { -not_in => [ 'QUEUED', 'COMP' ] } };
743
        $resultset = Koha::Illrequests->search({ %{$target}, %{$where} });
791
        $resultset = Koha::Illrequests->search({ %{$target}, %{$where} });
744
    }
792
    }
745
793
(-)a/Koha/Illrequestattributes.pm (-2 / +4 lines)
Lines 32-39 Koha::Illrequestattributes - Koha Illrequestattributes Object class Link Here
32
32
33
=head2 Class Methods
33
=head2 Class Methods
34
34
35
=cut
36
37
=head3 type
35
=head3 type
38
36
39
=cut
37
=cut
Lines 42-47 sub _type { Link Here
42
    return 'Illrequestattribute';
40
    return 'Illrequestattribute';
43
}
41
}
44
42
43
=head3 object_class
44
45
=cut
46
45
sub object_class {
47
sub object_class {
46
    return 'Koha::Illrequestattribute';
48
    return 'Koha::Illrequestattribute';
47
}
49
}
(-)a/Koha/Illrequests.pm (-3 / +5 lines)
Lines 33-41 Koha::Illrequests - Koha Illrequests Object class Link Here
33
33
34
=head2 Class Methods
34
=head2 Class Methods
35
35
36
=cut
36
=head3 _type
37
38
=head3 type
39
37
40
=cut
38
=cut
41
39
Lines 43-48 sub _type { Link Here
43
    return 'Illrequest';
41
    return 'Illrequest';
44
}
42
}
45
43
44
=head3 object_class
45
46
=cut
47
46
sub object_class {
48
sub object_class {
47
    return 'Koha::Illrequest';
49
    return 'Koha::Illrequest';
48
}
50
}
(-)a/Koha/REST/V1/Illrequests.pm (+12 lines)
Lines 22-27 use Mojo::Base 'Mojolicious::Controller'; Link Here
22
use Koha::Illrequests;
22
use Koha::Illrequests;
23
use Koha::Libraries;
23
use Koha::Libraries;
24
24
25
=head1 NAME
26
27
Koha::REST::V1::Illrequests
28
29
=head2 Operations
30
31
=head3 list
32
33
Return a list of ILL requests, after applying filters.
34
35
=cut
36
25
sub list {
37
sub list {
26
    my $c = shift->openapi->valid_input or return;
38
    my $c = shift->openapi->valid_input or return;
27
39
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-7 / +2 lines)
Lines 348-354 Link Here
348
                    filterNames.forEach(function(thisFilter) {
348
                    filterNames.forEach(function(thisFilter) {
349
                        var filterName = toColumnName(thisFilter) + ':name';
349
                        var filterName = toColumnName(thisFilter) + ':name';
350
                        var regex = '^'+filters[thisFilter]+'$';
350
                        var regex = '^'+filters[thisFilter]+'$';
351
                        console.log(regex);
352
                        myTable.columns(filterName).search(regex, true, false);
351
                        myTable.columns(filterName).search(regex, true, false);
353
                    });
352
                    });
354
                    myTable.draw();
353
                    myTable.draw();
Lines 586-598 Link Here
586
                                </div>
585
                                </div>
587
                                <div class="borrowernumber">
586
                                <div class="borrowernumber">
588
                                    <span class="label borrowernumber">Borrower:</span>
587
                                    <span class="label borrowernumber">Borrower:</span>
589
                                    [% borrowerlink = "/cgi-bin/koha/members/moremember.pl"
588
                                    [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
590
                                    _ "?borrowernumber=" _ request.patron.borrowernumber %]
591
                                    <a href="[% borrowerlink %]" title="View borrower details">
589
                                    <a href="[% borrowerlink %]" title="View borrower details">
592
                                    [% request.patron.firstname _ " "
590
                                    [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" %]
593
                                    _ request.patron.surname _ " ["
594
                                    _ request.patron.cardnumber
595
                                    _ "]" %]
596
                                    </a>
591
                                    </a>
597
                                </div>
592
                                </div>
598
593
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt (-8 / +1 lines)
Lines 253-266 href="/cgi-bin/koha/opac-rss.pl?[% query_cgi %][% limit_cgi |html %]" /> Link Here
253
                            [% INCLUDE 'page-numbers.inc' %]
253
                            [% INCLUDE 'page-numbers.inc' %]
254
                        [% END # / IF total %]
254
                        [% END # / IF total %]
255
255
256
                        [% IF
256
                        [% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername || Koha.Preference( 'ILLModule' ) == 1 ) %]
257
                            Koha.Preference( 'suggestion' ) == 1 &&
258
                            (
259
                                Koha.Preference( 'AnonSuggestions' ) == 1 ||
260
                                loggedinusername ||
261
                                Koha.Preference( 'ILLModule' ) == 1
262
                            )
263
                        %]
264
                            <div class="suggestion">
257
                            <div class="suggestion">
265
                                Not finding what you're looking for?
258
                                Not finding what you're looking for?
266
                                <ul>
259
                                <ul>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-8 / +1 lines)
Lines 562-575 Link Here
562
562
563
                    [% END # / IF total %]
563
                    [% END # / IF total %]
564
564
565
                    [% IF
565
                    [% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername || Koha.Preference( 'ILLModule' ) == 1 )   %]
566
                        Koha.Preference( 'suggestion' ) == 1 &&
567
                        (
568
                            Koha.Preference( 'AnonSuggestions' ) == 1 ||
569
                            loggedinusername ||
570
                            Koha.Preference( 'ILLModule' ) == 1
571
                        )
572
                    %]
573
                        <div class="suggestion">
566
                        <div class="suggestion">
574
                            Not finding what you're looking for?
567
                            Not finding what you're looking for?
575
                            <ul>
568
                            <ul>
(-)a/t/db_dependent/Illrequestattributes.t (-12 / +11 lines)
Lines 1-20 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
#
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
5
# Koha is free software; you can redistribute it and/or modify it
6
# terms of the GNU General Public License as published by the Free Software
6
# under the terms of the GNU General Public License as published by
7
# Foundation; either version 2 of the License, or (at your option) any later
7
# the Free Software Foundation; either version 3 of the License, or
8
# version.
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
9
#
14
# You should have received a copy of the GNU General Public License along
10
# Koha is distributed in the hope that it will be useful, but
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
17
#
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
17
19
use Modern::Perl;
18
use Modern::Perl;
20
19
(-)a/t/db_dependent/Illrequests.t (-13 / +11 lines)
Lines 1-20 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
#
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
5
# Koha is free software; you can redistribute it and/or modify it
6
# terms of the GNU General Public License as published by the Free Software
6
# under the terms of the GNU General Public License as published by
7
# Foundation; either version 2 of the License, or (at your option) any later
7
# the Free Software Foundation; either version 3 of the License, or
8
# version.
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
9
#
14
# You should have received a copy of the GNU General Public License along
10
# Koha is distributed in the hope that it will be useful, but
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
17
#
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
17
19
use Modern::Perl;
18
use Modern::Perl;
20
19
21
- 

Return to bug 7317