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

(-)a/C4/Letters.pm (-12 / +13 lines)
Lines 746-763 sub _parseletter_sth { Link Here
746
    #       broke things for the rest of us. prepare_cached is a better
746
    #       broke things for the rest of us. prepare_cached is a better
747
    #       way to cache statement handles anyway.
747
    #       way to cache statement handles anyway.
748
    my $query = 
748
    my $query = 
749
    ($table eq 'biblio'       ) ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
749
    ($table eq 'biblio'       )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
750
    ($table eq 'biblioitems'  ) ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
750
    ($table eq 'biblioitems'  )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
751
    ($table eq 'items'        ) ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
751
    ($table eq 'items'        )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
752
    ($table eq 'issues'       ) ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
752
    ($table eq 'issues'       )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
753
    ($table eq 'old_issues'   ) ? "SELECT * FROM $table WHERE     itemnumber = ? ORDER BY timestamp DESC LIMIT 1"  :
753
    ($table eq 'old_issues'   )    ? "SELECT * FROM $table WHERE     itemnumber = ? ORDER BY timestamp DESC LIMIT 1"  :
754
    ($table eq 'reserves'     ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?"             :
754
    ($table eq 'reserves'     )    ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?"             :
755
    ($table eq 'borrowers'    ) ? "SELECT * FROM $table WHERE borrowernumber = ?"                                  :
755
    ($table eq 'borrowers'    )    ? "SELECT * FROM $table WHERE borrowernumber = ?"                                  :
756
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                                  :
756
    ($table eq 'branches'     )    ? "SELECT * FROM $table WHERE     branchcode = ?"                                  :
757
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                                  :
757
    ($table eq 'suggestions'  )    ? "SELECT * FROM $table WHERE   suggestionid = ?"                                  :
758
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                                  :
758
    ($table eq 'aqbooksellers')    ? "SELECT * FROM $table WHERE             id = ?"                                  :
759
    ($table eq 'aqorders'     ) ? "SELECT * FROM $table WHERE    ordernumber = ?"                                  :
759
    ($table eq 'aqorders'     )    ? "SELECT * FROM $table WHERE    ordernumber = ?"                                  :
760
    ($table eq 'opac_news'    ) ? "SELECT * FROM $table WHERE          idnew = ?"                                  :
760
    ($table eq 'opac_news'    )    ? "SELECT * FROM $table WHERE          idnew = ?"                                  :
761
    ($table eq 'article_requests') ? "SELECT * FROM $table WHERE             id = ?"                                  :
761
    ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" :
762
    ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" :
762
    undef ;
763
    undef ;
763
    unless ($query) {
764
    unless ($query) {
(-)a/Koha/ArticleRequest.pm (+81 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Carp;
22
use Carp;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Borrowers;
26
use Koha::Biblios;
27
use Koha::Items;
28
use Koha::ArticleRequest::Status;
25
29
26
use base qw(Koha::Object);
30
use base qw(Koha::Object);
27
31
Lines 35-40 Koha::ArticleRequest - Koha Article Request Object class Link Here
35
39
36
=cut
40
=cut
37
41
42
=head3 process
43
44
=cut
45
46
sub process {
47
    my ( $self ) = @_;
48
49
    $self->status( Koha::ArticleRequest::Status::Processing );
50
    return $self->store();
51
}
52
53
=head3 complete
54
55
=cut
56
57
sub complete {
58
    my ( $self ) = @_;
59
60
    $self->status( Koha::ArticleRequest::Status::Completed );
61
    return $self->store();
62
}
63
64
=head3 cancel
65
66
=cut
67
68
sub cancel {
69
    my ( $self, $notes ) = @_;
70
71
    $self->status( Koha::ArticleRequest::Status::Canceled );
72
    $self->notes( $notes ) if $notes;
73
    return $self->store();
74
}
75
76
77
=head3 biblio
78
79
Returns the Koha::Biblio object for this article request
80
81
=cut
82
83
sub biblio {
84
    my ( $self ) = @_;
85
86
    $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
87
88
    return $self->{_biblio};
89
}
90
91
=head3 item
92
93
Returns the Koha::Item object for this article request
94
95
=cut
96
97
sub item {
98
    my ( $self ) = @_;
99
100
    $self->{_item} ||= Koha::Items->find( $self->itemnumber() );
101
102
    return $self->{_item};
103
}
104
105
=head3 borrower
106
107
Returns the Koha::Borrower object for this article request
108
109
=cut
110
111
sub borrower {
112
    my ( $self ) = @_;
113
114
    $self->{_borrower} ||= Koha::Borrowers->find( $self->borrowernumber() );
115
116
    return $self->{_borrower};
117
}
118
38
=head3 type
119
=head3 type
39
120
40
=cut
121
=cut
(-)a/Koha/ArticleRequest/Status.pm (+44 lines)
Line 0 Link Here
1
package Koha::ArticleRequest::Status;
2
3
# Copyright ByWater Solutions 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
sub Open {
23
    return 'OPEN';
24
}
25
26
sub Processing {
27
    return 'PROCESSING';
28
}
29
30
sub Completed {
31
    return 'COMPLETED';
32
}
33
34
sub Canceled {
35
    return 'CANCELED';
36
}
37
38
=head1 AUTHOR
39
40
Kyle M Hall <kyle@bywatersolutions.com>
41
42
=cut
43
44
1;
(-)a/Koha/ArticleRequests.pm (-2 / +35 lines)
Lines 23-29 use Carp; Link Here
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
26
use Koha::Borrower;
26
use Koha::ArticleRequest;
27
use Koha::ArticleRequest::Status;
27
28
28
use base qw(Koha::Objects);
29
use base qw(Koha::Objects);
29
30
Lines 37-48 Koha::ArticleRequests - Koha ArticleRequests Object class Link Here
37
38
38
=cut
39
=cut
39
40
41
=head3 open
42
43
=cut
44
45
sub open {
46
    return Koha::ArticleRequests->search( { status => Koha::ArticleRequest::Status::Open } );
47
}
48
49
=head3 processing
50
51
=cut
52
53
sub processing {
54
    return Koha::ArticleRequests->search( { status => Koha::ArticleRequest::Status::Processing } );
55
}
56
57
=head3 completed
58
59
=cut
60
61
sub completed {
62
    return Koha::ArticleRequests->search( { status => Koha::ArticleRequest::Status::Completed } );
63
}
64
65
=head3 canceled
66
67
=cut
68
69
sub canceled {
70
    return Koha::ArticleRequests->search( { status => Koha::ArticleRequest::Status::Completed } );
71
}
72
40
=head3 type
73
=head3 type
41
74
42
=cut
75
=cut
43
76
44
sub type {
77
sub type {
45
    return 'ArticleRequests';
78
    return 'ArticleRequest';
46
}
79
}
47
80
48
sub object_class {
81
sub object_class {
(-)a/Koha/Biblio.pm (+175 lines)
Lines 25-30 use Koha::Database; Link Here
25
25
26
use base qw(Koha::Object);
26
use base qw(Koha::Object);
27
27
28
use C4::Circulation qw(GetIssuingRule);
29
use Koha::Items;
30
use Koha::ArticleRequests;
31
use Koha::ArticleRequest::Status;
32
28
=head1 NAME
33
=head1 NAME
29
34
30
Koha::Biblio - Koha Biblio Object class
35
Koha::Biblio - Koha Biblio Object class
Lines 35-40 Koha::Biblio - Koha Biblio Object class Link Here
35
40
36
=cut
41
=cut
37
42
43
=head3 can_article_request
44
45
my $bool = $biblio->can_article_request( $borrower );
46
47
Returns true if article requests can be made for this record
48
49
$borrower must be a Koha::Borrower object
50
51
=cut
52
53
sub can_article_request {
54
    my ( $self, $borrower ) = @_;
55
56
    my $rule = $self->article_request_type($borrower);
57
    return q{} if $rule eq 'item_only' && !$self->items()->count();
58
    return 1 if $rule && $rule ne 'no';
59
60
    return q{};
61
}
62
63
=head3 article_request_type
64
65
my $type = $biblio->article_request_type( $borrower );
66
67
Returns the article request type based on items, or on the record
68
itself if there are no items.
69
70
$borrower must be a Koha::Borrower object
71
72
=cut
73
74
sub article_request_type {
75
    my ( $self, $borrower ) = @_;
76
77
    my $rule = $self->article_request_type_for_items( $borrower );
78
    return $rule if $rule;
79
80
    # If the record has no items that are requestable, go by the record itemtype
81
    $rule = $self->article_request_type_for_bib($borrower);
82
    return $rule if $rule;
83
84
    return q{};
85
}
86
87
=head3 article_request_type_for_bib
88
89
my $type = $biblio->article_request_type_for_bib
90
91
Returns the article request type 'yes', 'no', 'item_only', 'bib_only', for the given record
92
93
=cut
94
95
sub article_request_type_for_bib {
96
    my ( $self, $borrower ) = @_;
97
98
    my $borrowertype = $borrower->categorycode;
99
    my $itemtype     = $self->itemtype();
100
    my $rules        = GetIssuingRule( $borrowertype, $itemtype );
101
102
    return $rules->{article_requests} || q{};
103
}
104
105
=head3 article_request_type_for_items
106
107
my $type = $biblio->article_request_type_for_items
108
109
Returns the article request type 'yes', 'no', 'item_only', 'bib_only', for the given record's items
110
111
If there is a conflict where some items are 'bib_only' and some are 'item_only', 'bib_only' will be returned.
112
113
=cut
114
115
sub article_request_type_for_items {
116
    my ( $self, $borrower ) = @_;
117
118
    my $counts;
119
    foreach my $item ( $self->items()->as_list() ) {
120
        my $rule = $item->article_request_type($borrower);
121
        return $rule if $rule eq 'bib_only';    # we don't need to go any further
122
        $counts->{$rule}++;
123
    }
124
125
    return 'item_only' if $counts->{item_only};
126
    return 'yes'       if $counts->{yes};
127
    return 'no'        if $counts->{no};
128
    return q{};
129
}
130
131
=head3 article_requests
132
133
my @requests = $biblio->article_requests
134
135
Returns the article requests associated with this Biblio
136
137
=cut
138
139
sub article_requests {
140
    my ( $self, $borrower ) = @_;
141
142
    $self->{_article_requests} ||= Koha::ArticleRequests->search( { biblionumber => $self->biblionumber() } );
143
144
    return wantarray ? $self->{_article_requests}->as_list : $self->{_article_requests};
145
}
146
147
=head3 article_requests_current
148
149
my @requests = $biblio->article_requests_current
150
151
Returns the article requests associated with this Biblio that are incomplete
152
153
=cut
154
155
sub article_requests_current {
156
    my ( $self, $borrower ) = @_;
157
158
    $self->{_article_requests_current} ||= Koha::ArticleRequests->search(
159
        {
160
            biblionumber => $self->biblionumber(),
161
            -or          => [
162
                { status => Koha::ArticleRequest::Status::Open },
163
                { status => Koha::ArticleRequest::Status::Processing }
164
            ]
165
        }
166
    );
167
168
    return wantarray ? $self->{_article_requests_current}->as_list : $self->{_article_requests_current};
169
}
170
171
=head3 article_requests_finished
172
173
my @requests = $biblio->article_requests_finished
174
175
Returns the article requests associated with this Biblio that are completed
176
177
=cut
178
179
sub article_requests_finished {
180
    my ( $self, $borrower ) = @_;
181
182
    $self->{_article_requests_finished} ||= Koha::ArticleRequests->search(
183
        {
184
            biblionumber => $self->biblionumber(),
185
            -or          => [
186
                { status => Koha::ArticleRequest::Status::Completed },
187
                { status => Koha::ArticleRequest::Status::Canceled }
188
            ]
189
        }
190
    );
191
192
    return wantarray ? $self->{_article_requests_finished}->as_list : $self->{_article_requests_finished};
193
}
194
195
=head3 items
196
197
my @items = $biblio->items();
198
my $items = $biblio->items();
199
200
Returns a list of Koha::Item objects or a Koha::Items object of
201
items associated with this bib
202
203
=cut
204
205
sub items {
206
    my ( $self ) = @_;
207
208
    $self->{_items} ||= Koha::Items->search({ biblionumber => $self->biblionumber() });
209
210
    return $self->{_items};
211
}
212
38
=head3 type
213
=head3 type
39
214
40
=cut
215
=cut
(-)a/Koha/Biblios.pm (-1 / +1 lines)
Lines 1-6 Link Here
1
package Koha::Biblios;
1
package Koha::Biblios;
2
2
3
# Copyright ByWater Solutions 2014
3
# Copyright ByWater Solutions 2015
4
#
4
#
5
# This file is part of Koha.
5
# This file is part of Koha.
6
#
6
#
(-)a/Koha/Borrower.pm (+70 lines)
Lines 23-28 use Carp; Link Here
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
26
use Koha::ArticleRequests;
27
use Koha::ArticleRequest::Status;
28
26
use base qw(Koha::Object);
29
use base qw(Koha::Object);
27
30
28
=head1 NAME
31
=head1 NAME
Lines 35-40 Koha::Borrower - Koha Borrower Object class Link Here
35
38
36
=cut
39
=cut
37
40
41
=head3 article_requests
42
43
my @requests = $borrower->article_requests();
44
my $requests = $borrower->article_requests();
45
46
Returns either a list of ArticleRequests objects,
47
or an ArtitleRequests object, depending on the
48
calling context.
49
50
=cut
51
52
sub article_requests {
53
    my ( $self ) = @_;
54
55
    $self->{_article_requests} ||= Koha::ArticleRequests->search({ borrowernumber => $self->borrowernumber() });
56
57
    return $self->{_article_requests};
58
}
59
60
=head3 article_requests_current
61
62
my @requests = $patron->article_requests_current
63
64
Returns the article requests associated with this patron that are incomplete
65
66
=cut
67
68
sub article_requests_current {
69
    my ( $self ) = @_;
70
71
    $self->{_article_requests_current} ||= Koha::ArticleRequests->search(
72
        {
73
            borrowernumber => $self->id(),
74
            -or          => [
75
                { status => Koha::ArticleRequest::Status::Open },
76
                { status => Koha::ArticleRequest::Status::Processing }
77
            ]
78
        }
79
    );
80
81
    return $self->{_article_requests_current};
82
}
83
84
=head3 article_requests_finished
85
86
my @requests = $biblio->article_requests_finished
87
88
Returns the article requests associated with this patron that are completed
89
90
=cut
91
92
sub article_requests_finished {
93
    my ( $self, $borrower ) = @_;
94
95
    $self->{_article_requests_finished} ||= Koha::ArticleRequests->search(
96
        {
97
            borrowernumber => $self->id(),
98
            -or          => [
99
                { status => Koha::ArticleRequest::Status::Completed },
100
                { status => Koha::ArticleRequest::Status::Canceled }
101
            ]
102
        }
103
    );
104
105
    return $self->{_article_requests_finished};
106
}
107
38
=head3 type
108
=head3 type
39
109
40
=cut
110
=cut
(-)a/Koha/Item.pm (-2 / +45 lines)
Lines 21-28 use Modern::Perl; Link Here
21
21
22
use Carp;
22
use Carp;
23
23
24
use Koha::Database;
24
use C4::Context;
25
25
use C4::Circulation qw(GetIssuingRule);
26
use Koha::Branches;
26
use Koha::Branches;
27
27
28
use base qw(Koha::Object);
28
use base qw(Koha::Object);
Lines 73-78 sub holding_branch { Link Here
73
    return $self->{_holding_branch};
73
    return $self->{_holding_branch};
74
}
74
}
75
75
76
=head3 can_article_request
77
78
my $bool = $item->can_article_request( $borrower )
79
80
Returns true if item can be specifically requested
81
82
$borrower must be a Koha::Borrower object
83
84
=cut
85
86
sub can_article_request {
87
    my ( $self, $borrower ) = @_;
88
89
    my $rule = $self->article_request_type($borrower);
90
91
    return 1 if $rule && $rule ne 'no' && $rule ne 'bib_only';
92
    return q{};
93
}
94
95
=head3 article_request_type
96
97
my $type = $item->article_request_type( $borrower )
98
99
returns 'yes', 'no', 'bib_only', or 'item_only'
100
101
$borrower must be a Koha::Borrower object
102
103
=cut
104
105
sub article_request_type {
106
    my ( $self, $borrower ) = @_;
107
108
    my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
109
    my $branchcode =
110
        $branch_control eq 'homebranch'    ? $self->homebranch
111
      : $branch_control eq 'holdingbranch' ? $self->holdingbranch
112
      :                                      undef;
113
    my $borrowertype = $borrower->categorycode;
114
    my $itemtype = $self->effective_itemtype();
115
    my $rules = GetIssuingRule( $borrowertype, $itemtype, $branchcode );
116
117
    return $rules->{article_requests} || q{};
118
}
76
119
77
=head3 type
120
=head3 type
78
121
(-)a/Koha/Schema/Result/ArticleRequest.pm (-2 / +23 lines)
Lines 82-87 __PACKAGE__->table("article_requests"); Link Here
82
  data_type: 'text'
82
  data_type: 'text'
83
  is_nullable: 1
83
  is_nullable: 1
84
84
85
=head2 status
86
87
  data_type: 'enum'
88
  default_value: 'OPEN'
89
  extra: {list => ["OPEN","PROCESSING","COMPLETED","CANCELED"]}
90
  is_nullable: 0
91
92
=head2 notes
93
94
  data_type: 'text'
95
  is_nullable: 1
96
85
=head2 created_on
97
=head2 created_on
86
98
87
  data_type: 'timestamp'
99
  data_type: 'timestamp'
Lines 120-125 __PACKAGE__->add_columns( Link Here
120
  { data_type => "text", is_nullable => 1 },
132
  { data_type => "text", is_nullable => 1 },
121
  "chapters",
133
  "chapters",
122
  { data_type => "text", is_nullable => 1 },
134
  { data_type => "text", is_nullable => 1 },
135
  "status",
136
  {
137
    data_type => "enum",
138
    default_value => "OPEN",
139
    extra => { list => ["OPEN", "PROCESSING", "COMPLETED", "CANCELED"] },
140
    is_nullable => 0,
141
  },
142
  "notes",
143
  { data_type => "text", is_nullable => 1 },
123
  "created_on",
144
  "created_on",
124
  {
145
  {
125
    data_type => "timestamp",
146
    data_type => "timestamp",
Lines 200-207 __PACKAGE__->belongs_to( Link Here
200
);
221
);
201
222
202
223
203
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-07-28 10:40:02
224
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-09-02 13:10:22
204
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Gcq0lkNV972sKkcueQq19w
225
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KfP2PsyQthZxHfzWAOxGIg
205
226
206
227
207
# You can replace this text with custom code or comments, and it will be preserved on regeneration
228
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/Koha/Template/Plugin/Biblio.pm (+11 lines)
Lines 23-28 use Template::Plugin; Link Here
23
use base qw( Template::Plugin );
23
use base qw( Template::Plugin );
24
24
25
use Koha::Holds;
25
use Koha::Holds;
26
use Koha::Biblios;
27
use Koha::Borrowers;
26
28
27
sub HoldsCount {
29
sub HoldsCount {
28
    my ( $self, $biblionumber ) = @_;
30
    my ( $self, $biblionumber ) = @_;
Lines 32-35 sub HoldsCount { Link Here
32
    return $holds->count();
34
    return $holds->count();
33
}
35
}
34
36
37
sub CanArticleRequest {
38
    my ( $self, $biblionumber, $borrowernumber ) = @_;
39
40
    my $biblio = Koha::Biblios->find( $biblionumber );
41
    my $borrower = Koha::Borrowers->find( $borrowernumber );
42
43
    return $biblio ? $biblio->can_article_request( $borrower ) : 0;
44
}
45
35
1;
46
1;
(-)a/circ/article-request-slip.pl (+66 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2015 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw( -utf8 );
23
24
use C4::Context;
25
use C4::Output;
26
use C4::Auth;
27
use Koha::ArticleRequests;
28
29
my $cgi = new CGI;
30
31
my $id = $cgi->param('id');
32
33
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
34
    {
35
        template_name   => "circ/printslip.tt",
36
        query           => $cgi,
37
        type            => "intranet",
38
        authnotrequired => 0,
39
        flagsrequired   => { circulate => "circulate_remaining_permissions" },
40
    }
41
);
42
43
my $ar = Koha::ArticleRequests->find($id);
44
45
$template->param( article_request => $ar );
46
47
my $slip = C4::Letters::GetPreparedLetter(
48
    module                   => 'circulation',
49
    letter_code              => 'AR_PRINT',
50
    'message_transport_type' => 'print',
51
    tables                   => {
52
        'article_requests' => $ar->id,
53
        'borrowers'        => $ar->borrowernumber,
54
        'biblio'           => $ar->biblionumber,
55
        'items'            => $ar->itemnumber,
56
    },
57
);
58
59
$template->param(
60
    slip   => $slip->{content},
61
    caller => 'article-request',
62
    plain  => !$slip->{is_html},
63
);
64
65
output_html_with_http_headers $cgi, $cookie, $template->output;
66
(-)a/circ/article-requests.pl (+44 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2015 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Auth;
25
use C4::Output;
26
use Koha::ArticleRequests;
27
28
my $query = new CGI;
29
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
30
    {
31
        template_name   => "circ/article-requests.tt",
32
        query           => $query,
33
        type            => "intranet",
34
        authnotrequired => 0,
35
        flagsrequired   => { circulate => "circulate_remaining_permissions" },
36
    }
37
);
38
39
$template->param(
40
    article_requests_open       => scalar Koha::ArticleRequests->open(),
41
    article_requests_processing => scalar Koha::ArticleRequests->processing(),
42
);
43
44
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/circ/request-article-cancel.pl (+45 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Output;
25
use C4::Auth;
26
use Koha::ArticleRequests;
27
28
my $cgi = new CGI;
29
30
my ( $template, $librarian, $cookie, $flags ) = get_template_and_user(
31
    {
32
        template_name   => "circ/request-article.tt",
33
        query           => $cgi,
34
        type            => "intranet",
35
        authnotrequired => 0,
36
        flagsrequired   => { circulate => 'circulate_remaining_permissions' },
37
    }
38
);
39
40
my $id = $cgi->param('id');
41
my $ar = Koha::ArticleRequests->find($id);
42
$ar->cancel();
43
my $biblionumber = $ar->biblionumber;
44
45
print $cgi->redirect("/cgi-bin/koha/circ/request-article.pl?biblionumber=$biblionumber");
(-)a/circ/request-article-do.pl (+68 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright ByWater Solutions 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Auth;
25
use C4::Output;
26
27
use Koha::ArticleRequest;
28
29
my $cgi = new CGI;
30
31
my ( $template, $librarian, $cookie, $flags ) = get_template_and_user(
32
    {
33
        template_name   => "circ/request-article.tt",
34
        query           => $cgi,
35
        type            => "intranet",
36
        authnotrequired => 0,
37
        flagsrequired   => { circulate => 'circulate_remaining_permissions' },
38
    }
39
);
40
41
my $biblionumber   = $cgi->param('biblionumber');
42
my $borrowernumber = $cgi->param('borrowernumber');
43
44
my $itemnumber = $cgi->param('itemnumber') || undef;
45
my $title      = $cgi->param('title')      || undef;
46
my $author     = $cgi->param('author')     || undef;
47
my $volume     = $cgi->param('volume')     || undef;
48
my $issue      = $cgi->param('issue')      || undef;
49
my $date       = $cgi->param('date')       || undef;
50
my $pages      = $cgi->param('pages')      || undef;
51
my $chapters   = $cgi->param('chapters')   || undef;
52
53
my $ar = Koha::ArticleRequest->new(
54
    {
55
        borrowernumber => $borrowernumber,
56
        biblionumber   => $biblionumber,
57
        itemnumber     => $itemnumber,
58
        title          => $title,
59
        author         => $author,
60
        volume         => $volume,
61
        issue          => $issue,
62
        date           => $date,
63
        pages          => $pages,
64
        chapters       => $chapters,
65
    }
66
)->store();
67
68
print $cgi->redirect("/cgi-bin/koha/circ/request-article.pl?biblionumber=$biblionumber");
(-)a/circ/request-article.pl (+53 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2015 ByWater Solutions
4
# Copyright 2000-2002 Katipo Communications
5
# Copyright 2011 Catalyst IT
6
#
7
# This file is part of Koha.
8
#
9
# Koha is free software; you can redistribute it and/or modify it
10
# under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 3 of the License, or
12
# (at your option) any later version.
13
#
14
# Koha is distributed in the hope that it will be useful, but
15
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
22
use Modern::Perl;
23
24
use C4::Output;
25
use C4::Auth;
26
use Koha::Biblios;
27
use Koha::Borrowers;
28
use Koha::ArticleRequests;
29
30
my $input = new CGI;
31
32
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
33
    {
34
        template_name   => "circ/request-article.tt",
35
        query           => $input,
36
        type            => "intranet",
37
        authnotrequired => 0,
38
        flagsrequired   => { circulate => 'circulate_remaining_permissions' },
39
    }
40
);
41
42
my $biblionumber      = $input->param('biblionumber');
43
my $patron_cardnumber = $input->param('patron_cardnumber');
44
45
my $biblio = Koha::Biblios->find($biblionumber);
46
my $patron = Koha::Borrowers->find( { cardnumber => $patron_cardnumber } );
47
48
$template->param(
49
    biblio => $biblio,
50
    patron => $patron,
51
);
52
53
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/installer/data/mysql/atomicupdate/bug_14610.sql (+2 lines)
Lines 10-15 CREATE TABLE `koha_kohaqa`.`article_requests` ( Link Here
10
        `date` TEXT NULL DEFAULT NULL ,
10
        `date` TEXT NULL DEFAULT NULL ,
11
        `pages` TEXT NULL DEFAULT NULL ,
11
        `pages` TEXT NULL DEFAULT NULL ,
12
        `chapters` TEXT NULL DEFAULT NULL ,
12
        `chapters` TEXT NULL DEFAULT NULL ,
13
        `status` enum('OPEN','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'OPEN',
14
        `notes` text,
13
        `created_on` TIMESTAMP NOT NULL ,
15
        `created_on` TIMESTAMP NOT NULL ,
14
        `updated_on` TIMESTAMP NULL DEFAULT NULL ,
16
        `updated_on` TIMESTAMP NULL DEFAULT NULL ,
15
        INDEX (  `borrowernumber` ),
17
        INDEX (  `borrowernumber` ),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc (+1 lines)
Lines 26-31 Link Here
26
    [% IF ( holdsview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio_object_id %]">Holds ([% Biblio.HoldsCount( biblio_object_id ) %])</a></li>
26
    [% IF ( holdsview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio_object_id %]">Holds ([% Biblio.HoldsCount( biblio_object_id ) %])</a></li>
27
    [% END %]
27
    [% END %]
28
    [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio_object_id %]&amp;analyze=1">Analytics</a></li>[% END %]
28
    [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio_object_id %]&amp;analyze=1">Analytics</a></li>[% END %]
29
    [% IF ( article_requests_view ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% IF ( object ) %][% object %][% ELSE %][% biblionumber %][% END %]">Article requests</a></li>
29
30
30
    [% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&amp;biblionumber=[% biblio_object_id %]">Subscription(s)</a></li>[% END %]
31
    [% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&amp;biblionumber=[% biblio_object_id %]">Subscription(s)</a></li>[% END %]
31
</ul>
32
</ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (+1 lines)
Lines 536-541 var holdForPatron = function () { Link Here
536
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
536
                                  <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
537
                                  [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
537
                                  [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
538
                              [% END %]
538
                              [% END %]
539
                              | <a id="requst_article_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Request article</a>
539
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
540
                          [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
540
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
541
                          | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Edit record</a>
541
                          [% END %]
542
                          [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt (+352 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% USE ItemTypes %]
3
[% USE Branches %]
4
[% USE AuthorisedValues %]
5
6
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; Circulation &rsaquo; Article requests</title>
8
[% INCLUDE 'doc-head-close.inc' %]
9
<style type="text/css"> p { margin-top: 0; }</style>
10
</head>
11
12
<body id="circ_view_holdsqueue" class="circ">
13
    [% INCLUDE 'header.inc' %]
14
    [% INCLUDE 'cat-search.inc' %]
15
16
    <script type="text/javascript">//<![CDATA[
17
        $(document).ready(function() {
18
            $('#article-request-tabs').tabs();
19
        });
20
21
        function PrintSlip(link) {
22
            window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
23
        }
24
25
        function Cancel( id, a ) {
26
            notes = prompt("Reason for cancelation:");
27
            if ( notes == null ) {
28
                return;
29
            }
30
31
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>');
32
            a.closest('div').hide();
33
            $.ajax({
34
                type: "POST",
35
                url: '/cgi-bin/koha/svc/article_request',
36
                data: {
37
                    action: 'cancel',
38
                    id: id,
39
                    notes: notes
40
                },
41
                success: function( data ) {
42
                    a.closest('tr').remove();
43
                },
44
                dataType: 'json'
45
            });
46
        }
47
48
        function Process( id, a ) {
49
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>');
50
            a.closest('div').hide();
51
            $.ajax({
52
                type: "POST",
53
                url: '/cgi-bin/koha/svc/article_request',
54
                data: {
55
                    action: 'process',
56
                    id: id,
57
                },
58
                success: function( data ) {
59
                    a.closest('tr').remove();
60
                },
61
                dataType: 'json'
62
            });
63
        }
64
65
        function Complete( id, a ) {
66
            a.closest('td').prepend('<img src="[% interface %]/[% theme %]/img/loading-small.gif"/>');
67
            a.closest('div').hide();
68
            $.ajax({
69
                type: "POST",
70
                url: '/cgi-bin/koha/svc/article_request',
71
                data: {
72
                    action: 'complete',
73
                    id: id,
74
                },
75
                success: function( data ) {
76
                    a.closest('tr').remove();
77
                },
78
                dataType: 'json'
79
            });
80
        }
81
    //]]></script>
82
83
    <div id="breadcrumbs">
84
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
85
        &rsaquo;
86
        <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
87
        &rsaquo;
88
        <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a>
89
    </div>
90
91
<div id="doc" class="yui-t7">
92
    <div id="bd">
93
        <div id="yui-main">
94
            <div class="yui-g">
95
96
                <h1>Article requests</h1>
97
98
                <div id="article-request-tabs" class="toptabs">
99
                    <ul>
100
                        <li><a href="#article-requests-open">Open ([% article_requests_open.count %])</a></li>
101
                        <li><a href="#article-requests-processing">Processing ([% article_requests_processing.count %])</a></li>
102
                    </ul>
103
104
                    <div id="article-requests-open">
105
                        [% IF article_requests_open.count %]
106
                            <table id="article-requests-processing-open-table">
107
                                <thead>
108
                                    <tr>
109
                                        <th class="ar-title">Title</th>
110
                                        <th class="ar-request">Requested article</th>
111
                                        <th class="ar-collection">Collection</th>
112
                                        <th class="ar-itemtype">Item type</th>
113
                                        <th class="ar-callnumber">Call number</th>
114
                                        <th class="ar-copynumber">Copy number</th>
115
                                        <th class="ar-enumchron">Enumeration</th>
116
                                        <th class="ar-barcode">Barcode</th>
117
                                        <th class="ar-patron">Patron</th>
118
                                        <th class="ar-date">Date</th>
119
                                        <th class="ar-actions">Actions</th>
120
                                    </tr>
121
                                </thead>
122
123
                                 <tbody>
124
                                    [% FOREACH ar IN article_requests_open %]
125
                                        <tr>
126
                                            <td class="ar-title">
127
                                                <p>
128
                                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ar.biblionumber %]">
129
                                                        <strong>[% ar.biblio.title | html %]</strong>
130
                                                        [% FOREACH s IN itemsloo.subtitle %] [% s %][% END %]
131
                                                    </a>
132
                                                </p>
133
134
                                                <p>
135
                                                    <div class="ar-biblionumber content_hidden">[% ar.biblionumber %]</div>
136
                                                    <div class="ar-author">[% ar.biblio.author %]</div>
137
                                                    <div class="ar-pubdata">
138
                                                        [% ar.biblio.biblioitem.publishercode %]
139
140
                                                        [% IF ar.biblio.biblioitem.publicationyear %]
141
                                                            , [% ar.biblio.biblioitem.publicationyear %]
142
                                                        [% ELSIF ar.biblio.copyrightdate %]
143
                                                            , [% ar.biblio.copyrightdate %]
144
                                                        [% END %]
145
146
                                                        [% IF ar.biblio.biblioitem.pages %]
147
                                                            : [% ar.biblio.biblioitem.pages %]
148
                                                        [% END %]
149
150
                                                        [%  r.biblio.biblioitem.size %]
151
152
                                                        [% IF ar.biblio.biblioitem.isbn %]
153
                                                            ISBN: [% ar.biblio.biblioitem.isbn %]
154
                                                        [% END %]
155
                                                    </div>
156
                                                </p>
157
                                            </td>
158
                                            <td class="ar-request">
159
                                                [% IF ar.title %]    <p><strong>Title:</strong>    [% ar.title %]    </p> [% END %]
160
                                                [% IF ar.author %]   <p><strong>Author:</strong>   [% ar.author %]   </p> [% END %]
161
                                                [% IF ar.volume %]   <p><strong>Volume:</strong>   [% ar.volume %]   </p> [% END %]
162
                                                [% IF ar.issue %]    <p><strong>Issue:</strong>    [% ar.issue %]    </p> [% END %]
163
                                                [% IF ar.date %]     <p><strong>Date:</strong>     [% ar.date %]     </p> [% END %]
164
                                                [% IF ar.pages %]    <p><strong>Pages:</strong>    [% ar.pages %]    </p> [% END %]
165
                                                [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters %] </p> [% END %]
166
                                            </td>
167
                                            <td class="ar-collection">[% AuthorisedValues.GetByCode( 'CCODE', ar.item.ccode ) %]</td>
168
                                            <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) %]</td>
169
                                            <td class="ar-callnumber">
170
                                                [% IF ar.item.location %]
171
                                                    <em>[% AuthorisedValues.GetByCode( 'LOC', ar.item.location ) %]</em>
172
                                                [% END %]
173
174
                                                [% ar.item.itemcallnumber %]
175
                                            </td>
176
                                            <td class="ar-copynumber">[% ar.item.copynumber %]</td>
177
                                            <td class="ar-enumchron">[% ar.item.enumchron %]</td>
178
                                            <td class="ar-barcode">[% ar.item.barcode %]</td>
179
                                            <td class="ar-patron">
180
                                                <p>
181
                                                    <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber %]">
182
                                                        [% ar.borrower.surname %], [% ar.borrower.firstname %] ([% ar.borrower.cardnumber %])
183
                                                    </a>
184
                                                </p>
185
186
                                                <p>[% ar.borrower.phone %]</p>
187
                                            </td>
188
                                            <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
189
                                            <td class="ar-actions">
190
                                                <div class="dropdown">
191
                                                    <a class="btn btn-mini dropdown-toggle" id="ar-actions" role="button" data-toggle="dropdown" href="#">
192
                                                        Actions <b class="caret"></b>
193
                                                    </a>
194
195
                                                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="ar-actions">
196
                                                        <li>
197
                                                            <a href="#" onclick="Process( [% ar.id %], $(this) ); return false;">
198
                                                                <i class="icon-ok-circle"></i>
199
                                                                Process request
200
                                                            </a>
201
202
                                                            <a href="#" onclick="Complete( [% ar.id %], $(this) ); return false;">
203
                                                                <i class="icon-ok-circle"></i>
204
                                                                Complete request
205
                                                            </a>
206
207
                                                            <a href="#" onclick="Cancel( [% ar.id %], $(this) ); return false;">
208
                                                                <i class="icon-remove-circle"></i>
209
                                                                Cancel request
210
                                                            </a>
211
212
                                                            <a href="#" onclick="PrintSlip('article-request-slip.pl?id=[% ar.id %]'); return false;">
213
                                                                <i class="icon-print"></i>
214
                                                                Print slip
215
                                                            </a>
216
                                                        </li>
217
                                                    </ul>
218
                                                </div>
219
                                            </td>
220
                                        </tr>
221
                                    [% END %]
222
                                </tbody>
223
                            </table>
224
                        [% ELSE %]
225
                            There are currently no open article requests.
226
                        [% END %]
227
                    </div>
228
229
                    <div id="article-requests-processing">
230
                        [% IF article_requests_processing.count %]
231
                            <table id="article-requests-processing-table">
232
                                <thead>
233
                                    <tr>
234
                                        <th class="ar-title">Title</th>
235
                                        <th class="ar-request">Requested article</th>
236
                                        <th class="ar-collection">Collection</th>
237
                                        <th class="ar-itemtype">Item type</th>
238
                                        <th class="ar-callnumber">Call number</th>
239
                                        <th class="ar-copynumber">Copy number</th>
240
                                        <th class="ar-enumchron">Enumeration</th>
241
                                        <th class="ar-barcode">Barcode</th>
242
                                        <th class="ar-patron">Patron</th>
243
                                        <th class="ar-date">Date</th>
244
                                        <th class="ar-actions">Actions</th>
245
                                    </tr>
246
                                </thead>
247
248
                                 <tbody>
249
                                    [% FOREACH ar IN article_requests_processing %]
250
                                        <tr>
251
                                            <td class="ar-title">
252
                                                <p>
253
                                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ar.biblionumber %]">
254
                                                        <strong>[% ar.biblio.title | html %]</strong>
255
                                                        [% FOREACH s IN itemsloo.subtitle %] [% s %][% END %]
256
                                                    </a>
257
                                                </p>
258
259
                                                <p>
260
                                                    <div class="ar-biblionumber content_hidden">[% ar.biblionumber %]</div>
261
                                                    <div class="ar-author">[% ar.biblio.author %]</div>
262
                                                    <div class="ar-pubdata">
263
                                                        [% ar.biblio.biblioitem.publishercode %]
264
265
                                                        [% IF ar.biblio.biblioitem.publicationyear %]
266
                                                            , [% ar.biblio.biblioitem.publicationyear %]
267
                                                        [% ELSIF ar.biblio.copyrightdate %]
268
                                                            , [% ar.biblio.copyrightdate %]
269
                                                        [% END %]
270
271
                                                        [% IF ar.biblio.biblioitem.pages %]
272
                                                            : [% ar.biblio.biblioitem.pages %]
273
                                                        [% END %]
274
275
                                                        [%  r.biblio.biblioitem.size %]
276
277
                                                        [% IF ar.biblio.biblioitem.isbn %]
278
                                                            ISBN: [% ar.biblio.biblioitem.isbn %]
279
                                                        [% END %]
280
                                                    </div>
281
                                                </p>
282
                                            </td>
283
                                            <td class="ar-request">
284
                                                [% IF ar.title %]    <p><strong>Title:</strong>    [% ar.title %]    </p> [% END %]
285
                                                [% IF ar.author %]   <p><strong>Author:</strong>   [% ar.author %]   </p> [% END %]
286
                                                [% IF ar.volume %]   <p><strong>Volume:</strong>   [% ar.volume %]   </p> [% END %]
287
                                                [% IF ar.issue %]    <p><strong>Issue:</strong>    [% ar.issue %]    </p> [% END %]
288
                                                [% IF ar.date %]     <p><strong>Date:</strong>     [% ar.date %]     </p> [% END %]
289
                                                [% IF ar.pages %]    <p><strong>Pages:</strong>    [% ar.pages %]    </p> [% END %]
290
                                                [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters %] </p> [% END %]
291
                                            </td>
292
                                            <td class="ar-collection">[% AuthorisedValues.GetByCode( 'CCODE', ar.item.ccode ) %]</td>
293
                                            <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) %]</td>
294
                                            <td class="ar-callnumber">
295
                                                [% IF ar.item.location %]
296
                                                    <em>[% AuthorisedValues.GetByCode( 'LOC', ar.item.location ) %]</em>
297
                                                [% END %]
298
299
                                                [% ar.item.itemcallnumber %]
300
                                            </td>
301
                                            <td class="ar-copynumber">[% ar.item.copynumber %]</td>
302
                                            <td class="ar-enumchron">[% ar.item.enumchron %]</td>
303
                                            <td class="ar-barcode">[% ar.item.barcode %]</td>
304
                                            <td class="ar-patron">
305
                                                <p>
306
                                                    <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber %]">
307
                                                        [% ar.borrower.surname %], [% ar.borrower.firstname %] ([% ar.borrower.cardnumber %])
308
                                                    </a>
309
                                                </p>
310
311
                                                <p>[% ar.borrower.phone %]</p>
312
                                            </td>
313
                                            <td class="ar-date"><span title="[% ar.created_on %]">[% ar.created_on | $KohaDates %]</span></td>
314
                                            <td class="ar-actions">
315
                                                <div class="dropdown">
316
                                                    <a class="btn btn-mini dropdown-toggle" id="ar-actions" role="button" data-toggle="dropdown" href="#">
317
                                                        Actions <b class="caret"></b>
318
                                                    </a>
319
320
                                                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="ar-actions">
321
                                                        <li>
322
                                                            <a href="#" onclick="Complete( [% ar.id %], $(this) ); return false;">
323
                                                                <i class="icon-ok-circle"></i>
324
                                                                Complete request
325
                                                            </a>
326
327
                                                            <a href="#" onclick="Cancel( [% ar.id %], $(this) ); return false;">
328
                                                                <i class="icon-remove-circle"></i>
329
                                                                Cancel request
330
                                                            </a>
331
332
                                                            <a href="#" onclick="PrintSlip('article-request-slip.pl?id=[% ar.id %]'); return false;">
333
                                                                <i class="icon-print"></i>
334
                                                                Print slip
335
                                                            </a>
336
                                                        </li>
337
                                                    </ul>
338
                                                </div>
339
                                            </td>
340
                                        </tr>
341
                                    [% END %]
342
                                </tbody>
343
                            </table>
344
                        [% ELSE %]
345
                            There are currently no article requests being processed.
346
                        [% END %]
347
                    </div>
348
                </div>
349
            </div>
350
        </div>
351
    </div>
352
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt (+3 lines)
Lines 41-46 Link Here
41
	<li>    <a href="/cgi-bin/koha/circ/pendingreserves.pl" title="holds to retrieve off the shelf">Holds to pull</a></li>
41
	<li>    <a href="/cgi-bin/koha/circ/pendingreserves.pl" title="holds to retrieve off the shelf">Holds to pull</a></li>
42
	<li>    <a href="/cgi-bin/koha/circ/waitingreserves.pl" title="holds waiting for patron pickup">Holds awaiting pickup</a></li>
42
	<li>    <a href="/cgi-bin/koha/circ/waitingreserves.pl" title="holds waiting for patron pickup">Holds awaiting pickup</a></li>
43
	<li>    <a href="/cgi-bin/koha/circ/reserveratios.pl">Hold ratios</a></li>
43
	<li>    <a href="/cgi-bin/koha/circ/reserveratios.pl">Hold ratios</a></li>
44
    <li>
45
        <a href="/cgi-bin/koha/circ/article-requests.pl" title="Article requests">Article requests</a>
46
    </li>
44
	<li>    <a href="/cgi-bin/koha/circ/transferstoreceive.pl" title="transfers to receive at your library">Transfers to receive</a></li>
47
	<li>    <a href="/cgi-bin/koha/circ/transferstoreceive.pl" title="transfers to receive at your library">Transfers to receive</a></li>
45
     [% IF ( CAN_user_circulate_overdues_report ) %]<li>    <a href="/cgi-bin/koha/circ/overdue.pl">Overdues</a>
48
     [% IF ( CAN_user_circulate_overdues_report ) %]<li>    <a href="/cgi-bin/koha/circ/overdue.pl">Overdues</a>
46
	- <b>Warning:</b> This report is very resource intensive on
49
	- <b>Warning:</b> This report is very resource intensive on
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt (+245 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% SET article_requests_view = 1 %]
3
[% SET biblionumber = biblio.biblionumber %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Circulation &rsaquo; Request article</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8
[% INCLUDE 'datatables.inc' %]
9
10
<script type="text/javascript">
11
// <![CDATA[
12
$(document).ready(function() {
13
    $( "#patron" ).autocomplete({
14
        source: "/cgi-bin/koha/circ/ysearch.pl",
15
        minLength: 3,
16
        select: function( event, ui ) {
17
            $( "#patron" ).val( ui.item.cardnumber );
18
            $( "#holds_patronsearch" ).submit();
19
            return false;
20
        }
21
    })
22
    .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
23
        return $( "<li></li>" )
24
        .data( "ui-autocomplete-item", item )
25
        .append( "<a>" + item.surname + ", " + item.firstname +
26
                 " (" + item.cardnumber + ") <small>" + item.address +
27
                 " " + item.city + " " + item.zipcode + " " +
28
                 item.country + "</small></a>" )
29
        .appendTo( ul );
30
    };
31
});
32
// ]]>
33
</script>
34
</head>
35
36
<body id="circ_article_request" class="catalog">
37
    [% INCLUDE 'header.inc' %]
38
    [% INCLUDE 'circ-search.inc' %]
39
40
    <div id="breadcrumbs">
41
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
42
        &rsaquo;
43
        <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
44
        &rsaquo;
45
        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]">[% biblio.title | html %]</a>
46
        &rsaquo;
47
        Request article
48
    </div>
49
50
    <div id="doc3" class="yui-t2">
51
        <div id="bd">
52
            <div id="yui-main">
53
                <div class="yui-b">
54
55
                    <h1>Request article from <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.id %]">[% biblio.title | html %]</a></h1>
56
57
                    [% UNLESS patron %]
58
                        <form id="article_requests_patronsearch" action="request-article.pl" method="post">
59
                            <fieldset class="brief">
60
                                <label for="patron">Patron: </label>
61
                                <div class="hint">Enter patron card number or partial name:</div>
62
                                <input type="text" size="40" id="patron" class="focus" name="patron_cardnumber" />
63
                                <input type="submit" value="Search" />
64
                                <input type="hidden" name="biblionumber" value="[% biblio.id %]" />
65
                            </fieldset>
66
                        </form>
67
                    [% ELSE %]
68
                        [% IF biblio.can_article_request( patron ) %]
69
70
                            <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article-do.pl">
71
                                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
72
                                <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id %]" />
73
74
                                <fieldset class="rows">
75
                                    <legend>Place article request from [% biblio.title %] for [% patron.firstname %] [% patron.surname %] ( [% patron.cardnumber %] )</legend>
76
                                    <p/>
77
                                    <ul>
78
                                        <li>
79
                                            <label for="title">Title:</label>
80
                                            <input type="text" name="title" id="title" size="50"/>
81
                                        </li>
82
83
                                        <li>
84
                                            <label for="author">Author:</label>
85
                                            <input type="text" name="author" id="author" size="50"/>
86
                                        </li>
87
88
                                        <li>
89
                                            <label for="volume">Volume:</label>
90
                                            <input type="text" name="volume" id="volume" size="50"/>
91
                                        </li>
92
93
                                        <li>
94
                                            <label for="issue">Issue:</label>
95
                                            <input type="text" name="issue" id="issue" size="50"/>
96
                                        </li>
97
98
                                        <li>
99
                                            <label for="date">Date:</label>
100
                                            <input type="text" name="date" id="date" size="50"/>
101
                                        </li>
102
103
                                        <li>
104
                                            <label for="pages">Pages:</label>
105
                                            <input type="text" name="pages" id="pages" size="50"/>
106
                                        </li>
107
108
                                        <li>
109
                                            <label for="chapters">Chapters:</label>
110
                                            <input type="text" name="chapters" id="pages" size="50"/>
111
                                        </li>
112
                                    </ul>
113
                                </fieldset>
114
115
                                [% SET article_request_type = biblio.article_request_type( patron ) %]
116
                                [% IF article_request_type != 'bib_only' %]
117
                                    <table class="copiesrow table table-bordered table-striped">
118
                                        <caption>Select item:</caption>
119
                                        <thead>
120
                                            <tr>
121
                                                <th>&nbsp;</th>
122
                                                <th>Item type</th>
123
                                                <th>Barcode</th>
124
                                                <th>Home library</th>
125
                                                <th>Call number</th>
126
                                            </tr>
127
                                        </thead>
128
129
                                        <tbody>
130
                                            [% FOREACH item IN biblio.items %]
131
                                                [% IF item.can_article_request( patron ) %]
132
                                                    <tr>
133
                                                        <td>
134
                                                            [% IF article_request_type == 'item_only' && !checked %]
135
                                                                [% SET checked = 1 %]
136
                                                                <input type="radio" name="itemnumber" value="[% item.itemnumber %]" checked="checked" />
137
                                                            [% ELSE %]
138
                                                                <input type="radio" name="itemnumber" value="[% item.itemnumber %]" />
139
                                                            [% END %]
140
                                                        </td>
141
                                                        <td>
142
                                                            [% item.itype %]
143
                                                        </td>
144
                                                        <td>
145
                                                            [% item.barcode %]
146
                                                        </td>
147
                                                        <td>
148
                                                            [% item.homebranch %]
149
                                                        </td>
150
                                                        <td>
151
                                                            [% item.itemcallnumber %]
152
                                                        </td>
153
                                                    </tr>
154
                                                [% END %]
155
                                            [% END %]
156
157
                                            [% IF article_request_type != 'item_only' %]
158
                                                <tr>
159
                                                    <td>
160
                                                        <input type="radio" name="itemnumber" value="" checked="checked"/>
161
                                                    </td>
162
                                                    <td colspan="4">
163
                                                        Any item
164
                                                    </td>
165
                                                </tr>
166
                                            [% END %]
167
                                        </tbody>
168
                                    </table>
169
                                [% END %]
170
171
                                <p>
172
                                    <input type="submit" class="btn" value="Place request" />
173
                                </p>
174
                            </form>
175
                        [% ELSE %]
176
                            No article requests can be made for this record.
177
                        [% END %]
178
179
                    [% END %]
180
181
                    [% IF biblio.article_requests_current && !patron %]
182
                        <fieldset class="rows left">
183
                            <legend>Current article requests</legend>
184
185
                            <table>
186
                                <tr>
187
                                    <th>Placed on</th>
188
                                    <th>Patron</th>
189
                                    <th>Title</th>
190
                                    <th>Author</th>
191
                                    <th>Volume</th>
192
                                    <th>Issue</th>
193
                                    <th>Date</th>
194
                                    <th>Pages</th>
195
                                    <th>Chapters</th>
196
                                    <th>Item</th>
197
                                    <th>Status</th>
198
                                    <th>&nbsp;</th>
199
                                </tr>
200
201
                                [% FOREACH ar IN biblio.article_requests_current %]
202
                                    <tr>
203
                                        <td>[% ar.created_on | $KohaDates %]</td>
204
                                        <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber %]">[% ar.borrower.firstname %] [% ar.borrower.surname %]</a></td>
205
                                        <td>[% ar.title %]</td>
206
                                        <td>[% ar.author %]</td>
207
                                        <td>[% ar.volume %]</td>
208
                                        <td>[% ar.issue %]</td>
209
                                        <td>[% ar.date %]</td>
210
                                        <td>[% ar.pages %]</td>
211
                                        <td>[% ar.chapters %]</td>
212
                                        <td>
213
                                            [% IF ar.item %]
214
                                                <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber %]&biblionumber=[% ar.biblionumber %]">[% ar.item.barcode %]</a>
215
                                            [% END %]
216
                                        </td>
217
                                        <td>
218
                                            [% IF ar.status == 'OPEN' %]
219
                                                Open
220
                                            [% ELSIF ar.status == 'PROCESSING' %]
221
                                                Processing
222
                                            [% ELSIF ar.status == 'COMPLETED' %]
223
                                                Completed
224
                                            [% ELSIF ar.status == 'CANCELED' %]
225
                                                Canceled
226
                                            [% END %]
227
                                        <td>
228
                                            <a title="Cancel article request" href="/cgi-bin/koha/circ/request-article-cancel.pl?action=cancel&amp;id=[% ar.id %]">
229
                                                <img src="/intranet-tmpl/prog/img/x.png" border="0" alt="Cancel">
230
                                            </a>
231
                                        </td>
232
                                    </tr>
233
                                [% END %]
234
                            </table>
235
                        </fieldset>
236
                    [% END %]
237
                </div>
238
            </div>
239
240
            <div class="yui-b">
241
                [% INCLUDE 'biblio-view-menu.inc' %]
242
            </div>
243
        </div>
244
    </div>
245
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (+9 lines)
Lines 113-120 Link Here
113
                    || ( CAN_user_borrowers && pending_borrower_modifications )
113
                    || ( CAN_user_borrowers && pending_borrower_modifications )
114
                    || ( CAN_user_acquisition && pendingsuggestions )
114
                    || ( CAN_user_acquisition && pendingsuggestions )
115
                    || ( CAN_user_borrowers && pending_discharge_requests )
115
                    || ( CAN_user_borrowers && pending_discharge_requests )
116
                    || pending_article_requests
116
            ) %]
117
            ) %]
117
                <div id="area-pending">
118
                <div id="area-pending">
119
                    [% IF pending_article_requests %]
120
                    <div class="pending-info" id="article_requests_pending">
121
122
                        <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a>:
123
                        <span class="pending-number-link">[% pending_article_requests %]</span>
124
                    </div>
125
                    [% END %]
126
118
                    [% IF ( CAN_user_acquisition && pendingsuggestions ) %]
127
                    [% IF ( CAN_user_acquisition && pendingsuggestions ) %]
119
                    <div class="pending-info" id="suggestions_pending">
128
                    <div class="pending-info" id="suggestions_pending">
120
129
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (+8 lines)
Lines 1-3 Link Here
1
[% USE Biblio %]
1
<ul id="action">
2
<ul id="action">
2
    [% UNLESS ( norequests ) %]
3
    [% UNLESS ( norequests ) %]
3
        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
4
        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
Lines 8-13 Link Here
8
            [% END %]
9
            [% END %]
9
        [% END %]
10
        [% END %]
10
    [% END %]
11
    [% END %]
12
13
    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
14
        [% IF Biblio.CanArticleRequest( biblionumber, borrowernumber ) %]
15
            <li><a class="article_request" href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% biblionumber %]">Request article</a></li>
16
        [% END %]
17
    [% END %]
18
11
    <li><a class="print-large" href="#" onclick="window.print();">Print</a></li>
19
    <li><a class="print-large" href="#" onclick="window.print();">Print</a></li>
12
    [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
20
    [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
13
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %]
21
        [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt (+157 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Request article</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% BLOCK cssinclude %][% END %]
5
</head>
6
7
[% INCLUDE 'bodytag.inc' bodyid='opac-holds' %]
8
[% INCLUDE 'masthead.inc' %]
9
10
<div class="main">
11
    <ul class="breadcrumb">
12
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
13
        <li><a href="#">Request article</a></li>
14
    </ul>
15
16
    <div class="container">
17
        [% IF biblio.can_article_request( patron ) %]
18
            <h3>Place article request for [% biblio.title %]</h3>
19
20
            <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article-do.pl">
21
                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber %]" />
22
23
                <fieldset class="rows">
24
                    <ul>
25
                        <li>
26
                            <label for="title">Title:</label>
27
                            <input type="text" name="title" id="title" size="50"/>
28
                        </li>
29
30
                        <li>
31
                            <label for="author">Author:</label>
32
                            <input type="text" name="author" id="author" size="50"/>
33
                        </li>
34
35
                        <li>
36
                            <label for="volume">Volume:</label>
37
                            <input type="text" name="volume" id="volume" size="50"/>
38
                        </li>
39
40
                        <li>
41
                            <label for="issue">Issue:</label>
42
                            <input type="text" name="issue" id="issue" size="50"/>
43
                        </li>
44
45
                        <li>
46
                            <label for="date">Date:</label>
47
                            <input type="text" name="date" id="date" size="50"/>
48
                        </li>
49
50
                        <li>
51
                            <label for="pages">Pages:</label>
52
                            <input type="text" name="pages" id="pages" size="50"/>
53
                        </li>
54
55
                        <li>
56
                            <label for="chapters">Chapters:</label>
57
                            <input type="text" name="chapters" id="chapters" size="50"/>
58
                        </li>
59
                    </ul>
60
                </fieldset>
61
62
                [% SET article_request_type = biblio.article_request_type( patron ) %]
63
                [% IF article_request_type != 'bib_only' %]
64
                    <table class="copiesrow table table-bordered table-striped">
65
                        <caption>Select a specific item:</caption>
66
                        <thead>
67
                            <tr>
68
                                <th>&nbsp;</th>
69
                                <th>Item type</th>
70
                                <th>Barcode</th>
71
                                <th>Home library</th>
72
                                <th>Call number</th>
73
                            </tr>
74
                        </thead>
75
76
                        <tbody>
77
                            [% FOREACH item IN biblio.items %]
78
                                [% IF item.can_article_request( patron ) %]
79
                                    <tr>
80
                                        <td>
81
                                            [% IF article_request_type == 'item_only' && !checked %]
82
                                                [% SET checked = 1 %]
83
                                                <input type="radio" name="itemnumber" value="[% item.itemnumber %]" checked="checked" />
84
                                            [% ELSE %]
85
                                                <input type="radio" name="itemnumber" value="[% item.itemnumber %]" />
86
                                            [% END %]
87
                                        </td>
88
                                        <td>
89
                                            [% item.itype %]
90
                                        </td>
91
                                        <td>
92
                                            [% item.barcode %]
93
                                        </td>
94
                                        <td>
95
                                            [% item.homebranch %]
96
                                        </td>
97
                                        <td>
98
                                            [% item.itemcallnumber %]
99
                                        </td>
100
                                    </tr>
101
                                [% END %]
102
                            [% END %]
103
104
                            [% IF article_request_type != 'item_only' %]
105
                                <tr>
106
                                    <td>
107
                                        <input type="radio" name="itemnumber" value="" checked="checked"/>
108
                                    </td>
109
                                    <td colspan="4">
110
                                        Any item
111
                                    </td>
112
                                </tr>
113
                            [% END %]
114
                        </tbody>
115
                    </table>
116
                [% END %]
117
118
                <input type="submit" class="btn" value="Place request" />
119
            </form>
120
        [% ELSE %]
121
            No article requests can be made for this record.
122
        [% END %]
123
124
    </div> <!-- / .container -->
125
</div> <!-- / .main -->
126
127
[% INCLUDE 'opac-bottom.inc' %]
128
129
[% BLOCK jsinclude %]
130
<script type="text/javascript">
131
// <![CDATA[
132
    $('#place-article-request').on('submit', function( event ){
133
        if ( ! $("input:radio[name='itemnumber']").is(":checked") ) {
134
            event.preventDefault();
135
            alert( _("Please select a specific item for this article request.") );
136
            return 0;
137
        }
138
139
        if (
140
               $('#title').val()
141
            || $('#author').val()
142
            || $('#volume').val()
143
            || $('#issue').val()
144
            || $('#date').val()
145
            || $('#pages').val()
146
            || $('#chapters').val()
147
        ) {
148
            return 1;
149
        } else {
150
            event.preventDefault();
151
            alert( _("Please fill out at least one field to place article request.") );
152
            return 0;
153
        }
154
    });
155
// ]]>
156
</script>
157
[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+4 lines)
Lines 509-514 Link Here
509
                                                            [% END # UNLESS SEARCH_RESULT.norequests %]
509
                                                            [% END # UNLESS SEARCH_RESULT.norequests %]
510
                                                        [% END # IF RequestOnOpac %]
510
                                                        [% END # IF RequestOnOpac %]
511
511
512
                                                        [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
513
                                                            <span class="actions"><a class="article_request" href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Request article</a></span>
514
                                                        [% END %]
515
512
                                                        [% IF ( TagsInputEnabled ) %]
516
                                                        [% IF ( TagsInputEnabled ) %]
513
                                                            [% IF ( loggedinusername ) %]
517
                                                            [% IF ( loggedinusername ) %]
514
                                                                <span class="actions"><a class="tag_add" id="tag_add[% SEARCH_RESULT.biblionumber %]" href="#">Add tag</a></span>
518
                                                                <span class="actions"><a class="tag_add" id="tag_add[% SEARCH_RESULT.biblionumber %]" href="#">Add tag</a></span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (+90 lines)
Lines 112-117 Link Here
112
                            [% END %]
112
                            [% END %]
113
                            [% IF ( waiting_count ) %][% IF ( BORROWER_INF.atdestination ) %]<li><a href="#opac-user-waiting">Waiting ([% waiting_count %])</a></li>[% END %][% END %]
113
                            [% IF ( waiting_count ) %][% IF ( BORROWER_INF.atdestination ) %]<li><a href="#opac-user-waiting">Waiting ([% waiting_count %])</a></li>[% END %][% END %]
114
                            [% IF ( reserves_count ) %]<li><a href="#opac-user-holds">Holds ([% reserves_count %])</a></li>[% END %]
114
                            [% IF ( reserves_count ) %]<li><a href="#opac-user-holds">Holds ([% reserves_count %])</a></li>[% END %]
115
                            [% IF ( borrower.article_requests_current ) %]<li><a href="#opac-user-article-requests">Article requests ([% borrower.article_requests_current.count %])</a></li>[% END %]
115
                        </ul>
116
                        </ul>
116
117
117
                        <div id="opac-user-checkouts">
118
                        <div id="opac-user-checkouts">
Lines 667-672 Link Here
667
                            [% END %]
668
                            [% END %]
668
                        </div> <!-- / #opac-user-holds -->
669
                        </div> <!-- / #opac-user-holds -->
669
                        [% END # / #reserves_count %]
670
                        [% END # / #reserves_count %]
671
672
                        [% IF ( borrower.article_requests_current.count ) %]
673
                            <div id="opac-user-article-requests">
674
                                <table id="article-requests-table" class="table table-bordered table-striped">
675
                                    <caption>Article requests <span class="count">([% borrower.article_requests_current.count %] total)</span></caption>
676
                                    <!-- RESERVES TABLE ROWS -->
677
                                    <thead>
678
                                        <tr>
679
                                            <th class="anti-the">Record title</th>
680
                                            <th class="psort">Placed on</th>
681
                                            <th class="anti-the">Title</th>
682
                                            <th>Author</th>
683
                                            <th>Volume</th>
684
                                            <th>Issue</th>
685
                                            <th>Date</th>
686
                                            <th>Pages</th>
687
                                            <th>Chapters</th>
688
                                            <th>Status</th>
689
                                            <th class="nosort">&nbsp;</th>
690
                                        </tr>
691
                                    </thead>
692
693
                                    <tbody>
694
                                    [% FOREACH ar IN borrower.article_requests_current %]
695
                                            <td class="article-request-title">
696
                                                <a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber %]">
697
                                                    [% ar.biblio.title %]
698
                                                    [% ar.item.enumchron %]
699
                                                </a>
700
                                                [% ar.biblio.author %]
701
                                                [% IF ar.itemnumber %] <i>(only [% ar.item.barcode %])</i>[% END %]
702
                                            </td>
703
704
                                            <td class="article-request-created_on">
705
                                                [% ar.created_on | $KohaDates %]
706
                                            </td>
707
708
                                            <td class="article-request-title">
709
                                                [% ar.title %]
710
                                            </td>
711
712
                                            <td class="article-request-author">
713
                                                [% ar.author %]
714
                                            </td>
715
716
                                            <td class="article-request-volume">
717
                                                [% ar.volume %]
718
                                            </td>
719
720
                                            <td class="article-request-issue">
721
                                                [% ar.issue %]
722
                                            </td>
723
724
                                            <td class="article-request-date">
725
                                                [% ar.date %]
726
                                            </td>
727
728
                                            <td class="article-request-pages">
729
                                                [% ar.pages %]
730
                                            </td>
731
732
                                            <td class="article-request-chapters">
733
                                                [% ar.chapters %]
734
                                            </td>
735
736
                                            <td class="article-request-status">
737
                                                [% IF ar.status == 'OPEN' %]
738
                                                    Open
739
                                                [% ELSIF ar.status == 'PROCESSING' %]
740
                                                    Processing
741
                                                [% ELSIF ar.status == 'COMPLETED' %]
742
                                                    Completed
743
                                                [% ELSIF ar.status == 'CANCELED' %]
744
                                                    Canceled
745
                                                [% END %]
746
                                            </td>
747
748
                                            <td class="article-request-cancel">
749
                                                <span class="tdlabel">Cancel:</span>
750
                                                <a class="btn btn-mini btn-danger" href="opac-article-request-cancel.pl?id=[% ar.id %]" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"><i class="icon-remove icon-white"></i> Cancel</a>
751
                                                <!-- TODO: replace MSG_CONFIRM_DELETE_HOLD with correct message -->
752
                                            </td>
753
                                        </tr>
754
                                    [% END %]
755
                                </tbody>
756
                            </table>
757
                        </div> <!-- / #opac-user-article-requests -->
758
                    [% END %]
759
670
                    </div> <!-- /#opac-user-views -->
760
                    </div> <!-- /#opac-user-views -->
671
                </div> <!-- /#userdetails -->
761
                </div> <!-- /#userdetails -->
672
            </div> <!-- /.span10 -->
762
            </div> <!-- /.span10 -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less (+18 lines)
Lines 266-271 td { Link Here
266
            padding-left : 21px;
266
            padding-left : 21px;
267
            text-decoration : none;
267
            text-decoration : none;
268
        }
268
        }
269
        &.article_request {
270
            background-image : url("../images/sprite.png"); /* Place hold small */
271
            background-position : -2px -26px;
272
            background-repeat: no-repeat;
273
            margin-right : 1em;
274
            padding-left : 21px;
275
            text-decoration : none;
276
        }
269
        &.addtocart {
277
        &.addtocart {
270
            background-image : url("../images/sprite.png"); /* Cart small */
278
            background-image : url("../images/sprite.png"); /* Cart small */
271
            background-position : -5px -572px;
279
            background-position : -5px -572px;
Lines 1345-1350 a.print-large, Link Here
1345
a.removeitems,
1353
a.removeitems,
1346
a.removeitems.disabled,
1354
a.removeitems.disabled,
1347
a.reserve,
1355
a.reserve,
1356
a.article_request,
1348
a.send,
1357
a.send,
1349
a.tag_add,
1358
a.tag_add,
1350
a.removefromlist,
1359
a.removefromlist,
Lines 1473-1478 a.reserve { Link Here
1473
    padding-left : 35px;
1482
    padding-left : 35px;
1474
}
1483
}
1475
1484
1485
a.article_request {
1486
    background-position: 0px -24px; /* Place article request */
1487
    padding-left : 35px;
1488
}
1489
1476
a.send {
1490
a.send {
1477
    background-position : 2px -386px; /* Email */
1491
    background-position : 2px -386px; /* Email */
1478
    text-decoration : none;
1492
    text-decoration : none;
Lines 2490-2493 a.reviewlink:visited { Link Here
2490
    font-size: 90%;
2504
    font-size: 90%;
2491
}
2505
}
2492
2506
2507
.btn-danger {
2508
    color: white !important;
2509
}
2510
2493
@import "responsive.less";
2511
@import "responsive.less";
(-)a/mainpage.pl (+3 lines)
Lines 30-35 use C4::Suggestions qw/CountSuggestion/; Link Here
30
use C4::Tags qw/get_count_by_tag_status/;
30
use C4::Tags qw/get_count_by_tag_status/;
31
use Koha::Borrower::Modifications;
31
use Koha::Borrower::Modifications;
32
use Koha::Borrower::Discharge;
32
use Koha::Borrower::Discharge;
33
use Koha::ArticleRequests;
33
34
34
my $query = new CGI;
35
my $query = new CGI;
35
36
Lines 67-72 my $pendingsuggestions = CountSuggestion("ASKED"); Link Here
67
my $pending_borrower_modifications =
68
my $pending_borrower_modifications =
68
  Koha::Borrower::Modifications->GetPendingModificationsCount( $branch );
69
  Koha::Borrower::Modifications->GetPendingModificationsCount( $branch );
69
my $pending_discharge_requests = Koha::Borrower::Discharge::count({ pending => 1 });
70
my $pending_discharge_requests = Koha::Borrower::Discharge::count({ pending => 1 });
71
my $pending_article_requests = Koha::ArticleRequests->count();
70
72
71
$template->param(
73
$template->param(
72
    pendingcomments                => $pendingcomments,
74
    pendingcomments                => $pendingcomments,
Lines 74-79 $template->param( Link Here
74
    pendingsuggestions             => $pendingsuggestions,
76
    pendingsuggestions             => $pendingsuggestions,
75
    pending_borrower_modifications => $pending_borrower_modifications,
77
    pending_borrower_modifications => $pending_borrower_modifications,
76
    pending_discharge_requests     => $pending_discharge_requests,
78
    pending_discharge_requests     => $pending_discharge_requests,
79
    pending_article_requests       => $pending_article_requests,
77
);
80
);
78
81
79
#
82
#
(-)a/opac/opac-article-request-cancel.pl (+47 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Output;
25
use C4::Auth;
26
use Koha::ArticleRequests;
27
28
my $query = new CGI;
29
30
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
31
    {
32
        template_name   => "opac-account.tt",
33
        query           => $query,
34
        type            => "opac",
35
        authnotrequired => 0,
36
        debug           => 1,
37
    }
38
);
39
40
my $id = $query->param('id');
41
42
if ( $id && $borrowernumber ) {
43
    my $ar = Koha::ArticleRequests->find( $id );
44
    $ar->cancel() if $ar;
45
}
46
47
print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
(-)a/opac/opac-request-article-do.pl (+67 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright ByWater Solutions 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Auth;
25
use C4::Output;
26
27
use Koha::ArticleRequest;
28
29
my $cgi = new CGI;
30
31
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
32
    {
33
        template_name   => "opac-request-article.tt",
34
        query           => $cgi,
35
        type            => "opac",
36
        authnotrequired => 0,
37
        debug           => 1,
38
    }
39
);
40
41
my $biblionumber = $cgi->param('biblionumber');
42
43
my $itemnumber = $cgi->param('itemnumber') || undef;
44
my $title      = $cgi->param('title')      || undef;
45
my $author     = $cgi->param('author')     || undef;
46
my $volume     = $cgi->param('volume')     || undef;
47
my $issue      = $cgi->param('issue')      || undef;
48
my $date       = $cgi->param('date')       || undef;
49
my $pages      = $cgi->param('pages')      || undef;
50
my $chapters   = $cgi->param('chapters')   || undef;
51
52
my $ar = Koha::ArticleRequest->new(
53
    {
54
        borrowernumber => $borrowernumber,
55
        biblionumber   => $biblionumber,
56
        itemnumber     => $itemnumber,
57
        title          => $title,
58
        author         => $author,
59
        volume         => $volume,
60
        issue          => $issue,
61
        date           => $date,
62
        pages          => $pages,
63
        chapters       => $chapters,
64
    }
65
)->store();
66
67
print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
(-)a/opac/opac-request-article.pl (+53 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright ByWater Solutions 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Auth;
25
use C4::Output;
26
27
use Koha::Biblios;
28
use Koha::Borrowers;
29
30
my $cgi = new CGI;
31
32
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
33
    {
34
        template_name   => "opac-request-article.tt",
35
        query           => $cgi,
36
        type            => "opac",
37
        authnotrequired => 0,
38
        debug           => 1,
39
    }
40
);
41
42
my $biblionumber = $cgi->param('biblionumber');
43
44
my $biblio = Koha::Biblios->find($biblionumber);
45
my $patron = Koha::Borrowers->find($borrowernumber);
46
47
$template->param(
48
    biblio => $biblio,
49
    patron => $patron,
50
);
51
52
output_html_with_http_headers $cgi, $cookie, $template->output;
53
(-)a/opac/opac-user.pl (+2 lines)
Lines 36-41 use C4::Letters; Link Here
36
use C4::Branch; # GetBranches
36
use C4::Branch; # GetBranches
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Koha::Borrower::Debarments qw(IsDebarred);
38
use Koha::Borrower::Debarments qw(IsDebarred);
39
use Koha::Borrowers;
39
40
40
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
41
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
41
42
Lines 394-399 $template->param( Link Here
394
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
395
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
395
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
396
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
396
    OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
397
    OpacHoldNotes => C4::Context->preference('OpacHoldNotes'),
398
    borrower => Koha::Borrowers->find($borrowernumber),
397
);
399
);
398
400
399
output_html_with_http_headers $query, $cookie, $template->output;
401
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/svc/article_request (-1 / +58 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2015 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
23
use CGI;
24
use JSON qw(to_json);
25
26
use C4::Auth qw(check_cookie_auth);
27
use Koha::ArticleRequests;
28
29
my $cgi = new CGI;
30
31
my ( $auth_status, $sessionID ) =
32
  check_cookie_auth( $cgi->cookie('CGISESSID'), { circulate => 'circulate_remaining_permissions' } );
33
if ( $auth_status ne "ok" ) {
34
    exit 0;
35
}
36
37
binmode STDOUT, ':encoding(UTF-8)';
38
print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' );
39
40
my $id = $cgi->param('id');
41
my $action = $cgi->param('action') || q{};
42
my $notes = $cgi->param('notes');
43
44
my $ar = Koha::ArticleRequests->find($id);
45
46
if ($ar) {
47
    if ( $action eq 'cancel' ) {
48
        $ar = $ar->cancel( $notes );
49
    }
50
    elsif ( $action eq 'process' ) {
51
        $ar = $ar->process();
52
    }
53
    elsif ( $action eq 'complete' ) {
54
        $ar = $ar->complete();
55
    }
56
}
57
58
print to_json( { success => $ar ? 1 : 0 } );

Return to bug 14610