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

(-)a/Koha/ArticleRequest.pm (+23 lines)
Lines 27-32 use Koha::Biblios; Link Here
27
use Koha::Items;
27
use Koha::Items;
28
use Koha::Libraries;
28
use Koha::Libraries;
29
use Koha::DateUtils qw(dt_from_string);
29
use Koha::DateUtils qw(dt_from_string);
30
use C4::Context;
31
use Koha::Account::Lines;
30
32
31
use base qw(Koha::Object);
33
use base qw(Koha::Object);
32
34
Lines 48-53 sub open { Link Here
48
    my ($self) = @_;
50
    my ($self) = @_;
49
51
50
    $self->status(Koha::ArticleRequest::Status::Pending);
52
    $self->status(Koha::ArticleRequest::Status::Pending);
53
    if(C4::Context->preference('ArticleRequests') && $self->borrower->category->article_request_fee) {
54
      my $debit_line = $self->borrower->account->add_debit(
55
        {
56
          amount     => $self->borrower->category->article_request_fee,
57
          user_id    => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
58
          interface  => C4::Context->interface,
59
          library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
60
          type       => 'ARTICLE_REQUEST'
61
        }
62
      );
63
      $self->debit_line_id($debit_line->id);
64
    }
51
    $self->SUPER::store();
65
    $self->SUPER::store();
52
    $self->notify();
66
    $self->notify();
53
    return $self;
67
    return $self;
Lines 88-93 sub cancel { Link Here
88
102
89
    $self->status(Koha::ArticleRequest::Status::Canceled);
103
    $self->status(Koha::ArticleRequest::Status::Canceled);
90
    $self->notes($notes) if $notes;
104
    $self->notes($notes) if $notes;
105
    if($self->debit_line_id) {
106
      my $line = Koha::Account::Lines->find($self->debit_line_id);
107
      $line->cancel(
108
        {
109
          branch => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
110
          staff_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
111
        }
112
      ) unless $line->status eq 'CANCELLED' || $line->amount != $line->amountoutstanding;
113
    }
91
    $self->store();
114
    $self->store();
92
    $self->notify();
115
    $self->notify();
93
    return $self;
116
    return $self;
(-)a/admin/categories.pl (+3 lines)
Lines 79-84 elsif ( $op eq 'add_validate' ) { Link Here
79
    my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
79
    my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
80
    my $min_password_length = $input->param('min_password_length');
80
    my $min_password_length = $input->param('min_password_length');
81
    my $require_strong_password = $input->param('require_strong_password');
81
    my $require_strong_password = $input->param('require_strong_password');
82
    my $article_request_fee = $input->param('article_request_fee');
82
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
83
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
83
84
84
    $reset_password = undef if $reset_password eq -1;
85
    $reset_password = undef if $reset_password eq -1;
Lines 119-124 elsif ( $op eq 'add_validate' ) { Link Here
119
        $category->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
120
        $category->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
120
        $category->min_password_length($min_password_length);
121
        $category->min_password_length($min_password_length);
121
        $category->require_strong_password($require_strong_password);
122
        $category->require_strong_password($require_strong_password);
123
        $category->article_request_fee($article_request_fee);
122
        eval {
124
        eval {
123
            $category->store;
125
            $category->store;
124
            $category->replace_library_limits( \@branches );
126
            $category->replace_library_limits( \@branches );
Lines 150-155 elsif ( $op eq 'add_validate' ) { Link Here
150
            exclude_from_local_holds_priority => $exclude_from_local_holds_priority,
152
            exclude_from_local_holds_priority => $exclude_from_local_holds_priority,
151
            min_password_length => $min_password_length,
153
            min_password_length => $min_password_length,
152
            require_strong_password => $require_strong_password,
154
            require_strong_password => $require_strong_password,
155
            article_request_fee => $article_request_fee,
153
        });
156
        });
154
        eval {
157
        eval {
155
            $category->store;
158
            $category->store;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+16 lines)
Lines 202-207 Link Here
202
                    <label for="reservefee">Hold fee: </label>
202
                    <label for="reservefee">Hold fee: </label>
203
                    <input type="text" name="reservefee" id="reservefee" size="6" value="[% category.reservefee | $Price on_editing => 1 %]" />
203
                    <input type="text" name="reservefee" id="reservefee" size="6" value="[% category.reservefee | $Price on_editing => 1 %]" />
204
                </li>
204
                </li>
205
                [% IF Koha.Preference('ArticleRequests') %]
206
                <li>
207
                    <label for="article_request_fee">Cost for article scan request</label>
208
                    <input type="text" name="article_request_fee" id="article_request_fee" size="6" value="[% category.article_request_fee | $Price on_editing => 1 %]" />
209
                </li>
210
                [% END %]
205
                <li>
211
                <li>
206
                    <label for="category_type" class="required">Category type: </label>
212
                    <label for="category_type" class="required">Category type: </label>
207
                    <select name="category_type" id="category_type">
213
                    <select name="category_type" id="category_type">
Lines 523-528 Link Here
523
                    <th scope="col">Overdue</th>
529
                    <th scope="col">Overdue</th>
524
                    <th scope="col">Lost items</th>
530
                    <th scope="col">Lost items</th>
525
                    <th scope="col">Hold fee</th>
531
                    <th scope="col">Hold fee</th>
532
                    [% IF Koha.Preference('ArticleRequests') %]
533
                    <th scope="col">Article request fee</th>
534
                    [% END %]
526
                    [% IF ( EnhancedMessagingPreferences ) %]
535
                    [% IF ( EnhancedMessagingPreferences ) %]
527
                    <th scope="col">Messaging</th>
536
                    <th scope="col">Messaging</th>
528
                    [% END %]
537
                    [% END %]
Lines 581-586 Link Here
581
                        [% ELSE %]
590
                        [% ELSE %]
582
                            <td>-</td>
591
                            <td>-</td>
583
                        [% END %]
592
                        [% END %]
593
                        [% IF Koha.Preference('ArticleRequests') %]
594
                            [% IF (category.article_request_fee > 0) %]
595
                                <td>[% category.article_request_fee | $Price %]</td>
596
                            [% ELSE %]
597
                                <td>-</td>
598
                            [% END %]
599
                        [% END %]
584
                        [% IF Koha.Preference('EnhancedMessagingPreferences') %]
600
                        [% IF Koha.Preference('EnhancedMessagingPreferences') %]
585
                            <td style="white-space: nowrap; font-size:80%;">
601
                            <td style="white-space: nowrap; font-size:80%;">
586
                                [% SET default_messaging = category.default_messaging %]
602
                                [% SET default_messaging = category.default_messaging %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt (-1 / +6 lines)
Lines 3-8 Link Here
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE ItemTypes %]
5
[% USE ItemTypes %]
6
[% USE Price %]
6
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
7
[% SET article_requests_view = 1 %]
8
[% SET article_requests_view = 1 %]
8
[% SET biblionumber = biblio.biblionumber %]
9
[% SET biblionumber = biblio.biblionumber %]
Lines 94-100 Link Here
94
                        </form>
95
                        </form>
95
                    [% ELSE %]
96
                    [% ELSE %]
96
                        [% IF biblio.can_article_request( patron ) %]
97
                        [% IF biblio.can_article_request( patron ) %]
97
98
                            [% IF patron.category.article_request_fee > 0  %]
99
                                <div class="dialog alert">
100
                                    Patron will be charged with <strong>[% patron.category.article_request_fee | $Price %]</strong> for every request
101
                                </div>
102
                            [% END %]
98
                            <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
103
                            <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
99
                                <input type="hidden" name="action" value="create" />
104
                                <input type="hidden" name="action" value="create" />
100
                                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
105
                                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt (-1 / +7 lines)
Lines 1-6 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE ItemTypes %]
3
[% USE ItemTypes %]
4
[% USE Price %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
6
6
<title>Request article &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
7
<title>Request article &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
Lines 38-43 Link Here
38
39
39
                    <h1>Place article request for [% biblio.title | html %]</h1>
40
                    <h1>Place article request for [% biblio.title | html %]</h1>
40
41
42
                    [% IF patron.category.article_request_fee > 0  %]
43
                        <div class="alert alert-warning">
44
                            You will be charged with <strong>[% patron.category.article_request_fee | $Price %]</strong> for every request
45
                        </div>
46
                    [% END %]
47
41
                    <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
48
                    <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
42
                        <input type="hidden" name="action" value="create" />
49
                        <input type="hidden" name="action" value="create" />
43
                        <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
50
                        <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
44
- 

Return to bug 27946