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

(-)a/Koha/ArticleRequest.pm (-1 / +1 lines)
Lines 48-54 Koha::ArticleRequest - Koha Article Request Object class Link Here
48
sub open {
48
sub open {
49
    my ($self) = @_;
49
    my ($self) = @_;
50
50
51
    $self->status(Koha::ArticleRequest::Status::Open);
51
    $self->status(Koha::ArticleRequest::Status::Pending);
52
    $self->notify();
52
    $self->notify();
53
    return $self;
53
    return $self;
54
}
54
}
(-)a/Koha/ArticleRequest/Status.pm (-2 / +2 lines)
Lines 19-26 package Koha::ArticleRequest::Status; Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
sub Open {
22
sub Pending {
23
    return 'OPEN';
23
    return 'PENDING';
24
}
24
}
25
25
26
sub Processing {
26
sub Processing {
(-)a/Koha/ArticleRequests.pm (-3 / +3 lines)
Lines 38-50 Koha::ArticleRequests - Koha ArticleRequests Object class Link Here
38
38
39
=cut
39
=cut
40
40
41
=head3 open
41
=head3 pending
42
42
43
=cut
43
=cut
44
44
45
sub open {
45
sub pending {
46
    my ( $self, $branchcode ) = @_;
46
    my ( $self, $branchcode ) = @_;
47
    my $params = { status => Koha::ArticleRequest::Status::Open };
47
    my $params = { status => Koha::ArticleRequest::Status::Pending };
48
    $params->{branchcode} = $branchcode if $branchcode;
48
    $params->{branchcode} = $branchcode if $branchcode;
49
    return Koha::ArticleRequests->search( $params );
49
    return Koha::ArticleRequests->search( $params );
50
}
50
}
(-)a/Koha/Biblio.pm (-1 / +1 lines)
Lines 159-165 sub article_requests_current { Link Here
159
        {
159
        {
160
            biblionumber => $self->biblionumber(),
160
            biblionumber => $self->biblionumber(),
161
            -or          => [
161
            -or          => [
162
                { status => Koha::ArticleRequest::Status::Open },
162
                { status => Koha::ArticleRequest::Status::Pending },
163
                { status => Koha::ArticleRequest::Status::Processing }
163
                { status => Koha::ArticleRequest::Status::Processing }
164
            ]
164
            ]
165
        }
165
        }
(-)a/Koha/Borrower.pm (-1 / +1 lines)
Lines 72-78 sub article_requests_current { Link Here
72
        {
72
        {
73
            borrowernumber => $self->id(),
73
            borrowernumber => $self->id(),
74
            -or          => [
74
            -or          => [
75
                { status => Koha::ArticleRequest::Status::Open },
75
                { status => Koha::ArticleRequest::Status::Pending },
76
                { status => Koha::ArticleRequest::Status::Processing }
76
                { status => Koha::ArticleRequest::Status::Processing }
77
            ]
77
            ]
78
        }
78
        }
(-)a/circ/article-requests.pl (-1 / +1 lines)
Lines 40-46 my $branchcode = $query->param('branchcode') || C4::Context->userenv->{'branch'} Link Here
40
40
41
$template->param(
41
$template->param(
42
    branchcode                  => $branchcode,
42
    branchcode                  => $branchcode,
43
    article_requests_open       => scalar Koha::ArticleRequests->open($branchcode),
43
    article_requests_pending    => scalar Koha::ArticleRequests->pending($branchcode),
44
    article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode),
44
    article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode),
45
);
45
);
46
46
(-)a/installer/data/mysql/atomicupdate/bug_14610.sql (-1 / +1 lines)
Lines 19-25 CREATE TABLE IF NOT EXISTS `article_requests` ( Link Here
19
  `date` text,
19
  `date` text,
20
  `pages` text,
20
  `pages` text,
21
  `chapters` text,
21
  `chapters` text,
22
  `status` enum('OPEN','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'OPEN',
22
  `status` enum('PENDING','PROCESSING','COMPLETED','CANCELED') NOT NULL DEFAULT 'PENDING',
23
  `notes` text,
23
  `notes` text,
24
  `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
24
  `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
25
  `updated_on` timestamp NULL DEFAULT NULL,
25
  `updated_on` timestamp NULL DEFAULT NULL,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt (-6 / +6 lines)
Lines 110-122 Link Here
110
110
111
                <div id="article-request-tabs" class="toptabs">
111
                <div id="article-request-tabs" class="toptabs">
112
                    <ul>
112
                    <ul>
113
                        <li><a href="#article-requests-open">Open ([% article_requests_open.count %])</a></li>
113
                        <li><a href="#article-requests-pending">Pending ([% article_requests_pending.count %])</a></li>
114
                        <li><a href="#article-requests-processing">Processing ([% article_requests_processing.count %])</a></li>
114
                        <li><a href="#article-requests-processing">Processing ([% article_requests_processing.count %])</a></li>
115
                    </ul>
115
                    </ul>
116
116
117
                    <div id="article-requests-open">
117
                    <div id="article-requests-pending">
118
                        [% IF article_requests_open.count %]
118
                        [% IF article_requests_pending.count %]
119
                            <table id="article-requests-processing-open-table">
119
                            <table id="article-requests-processing-pending-table">
120
                                <thead>
120
                                <thead>
121
                                    <tr>
121
                                    <tr>
122
                                        <th class="ar-title">Title</th>
122
                                        <th class="ar-title">Title</th>
Lines 134-140 Link Here
134
                                </thead>
134
                                </thead>
135
135
136
                                 <tbody>
136
                                 <tbody>
137
                                    [% FOREACH ar IN article_requests_open %]
137
                                    [% FOREACH ar IN article_requests_pending %]
138
                                        <tr>
138
                                        <tr>
139
                                            <td class="ar-title">
139
                                            <td class="ar-title">
140
                                                <p>
140
                                                <p>
Lines 235-241 Link Here
235
                                </tbody>
235
                                </tbody>
236
                            </table>
236
                            </table>
237
                        [% ELSE %]
237
                        [% ELSE %]
238
                            There are currently no open article requests.
238
                            There are currently no pending article requests.
239
                        [% END %]
239
                        [% END %]
240
                    </div>
240
                    </div>
241
241
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt (-2 / +2 lines)
Lines 292-299 $(document).ready(function() { Link Here
292
                                            [% END %]
292
                                            [% END %]
293
                                        </td>
293
                                        </td>
294
                                        <td>
294
                                        <td>
295
                                            [% IF ar.status == 'OPEN' %]
295
                                            [% IF ar.status == 'PENDING' %]
296
                                                Open
296
                                                Pending
297
                                            [% ELSIF ar.status == 'PROCESSING' %]
297
                                            [% ELSIF ar.status == 'PROCESSING' %]
298
                                                Processing
298
                                                Processing
299
                                            [% ELSIF ar.status == 'COMPLETED' %]
299
                                            [% ELSIF ar.status == 'COMPLETED' %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-2 / +2 lines)
Lines 748-755 Link Here
748
                                            </td>
748
                                            </td>
749
749
750
                                            <td class="article-request-status">
750
                                            <td class="article-request-status">
751
                                                [% IF ar.status == 'OPEN' %]
751
                                                [% IF ar.status == 'PENDING' %]
752
                                                    Open
752
                                                    Pending
753
                                                [% ELSIF ar.status == 'PROCESSING' %]
753
                                                [% ELSIF ar.status == 'PROCESSING' %]
754
                                                    Processing
754
                                                    Processing
755
                                                [% ELSIF ar.status == 'COMPLETED' %]
755
                                                [% ELSIF ar.status == 'COMPLETED' %]
(-)a/t/db_dependent/ArticleRequests.t (-6 / +5 lines)
Lines 79-92 my $article_request = Koha::ArticleRequest->new( Link Here
79
$article_request = Koha::ArticleRequests->find( $article_request->id );
79
$article_request = Koha::ArticleRequests->find( $article_request->id );
80
ok( $article_request->id, 'Koha::ArticleRequest created' );
80
ok( $article_request->id, 'Koha::ArticleRequest created' );
81
81
82
is( $article_request->status, Koha::ArticleRequest::Status::Open, 'New article request has status of Open' );
82
is( $article_request->status, Koha::ArticleRequest::Status::Pending, 'New article request has status of Open' );
83
$article_request->process();
83
$article_request->process();
84
is( $article_request->status, Koha::ArticleRequest::Status::Processing, '$ar->process() changes status to Processing' );
84
is( $article_request->status, Koha::ArticleRequest::Status::Processing, '$ar->process() changes status to Processing' );
85
$article_request->complete();
85
$article_request->complete();
86
is( $article_request->status, Koha::ArticleRequest::Status::Completed, '$ar->complete() changes status to Completed' );
86
is( $article_request->status, Koha::ArticleRequest::Status::Completed, '$ar->complete() changes status to Completed' );
87
$article_request->cancel();
87
$article_request->cancel();
88
is( $article_request->status, Koha::ArticleRequest::Status::Canceled, '$ar->complete() changes status to Canceled' );
88
is( $article_request->status, Koha::ArticleRequest::Status::Canceled, '$ar->complete() changes status to Canceled' );
89
$article_request->status(Koha::ArticleRequest::Status::Open);
89
$article_request->status(Koha::ArticleRequest::Status::Pending);
90
$article_request->store();
90
$article_request->store();
91
91
92
is( $article_request->biblio->id,   $biblio->id, '$ar->biblio() gets corrosponding Koha::Biblio object' );
92
is( $article_request->biblio->id,   $biblio->id, '$ar->biblio() gets corrosponding Koha::Biblio object' );
Lines 105-111 is( $patron->article_requests_current()->count(), 0, 'Completed request not retu Link Here
105
$article_request->cancel();
105
$article_request->cancel();
106
is( $patron->article_requests_current()->count(), 0, 'Canceled request not returned for article_requests_current' );
106
is( $patron->article_requests_current()->count(), 0, 'Canceled request not returned for article_requests_current' );
107
107
108
$article_request->status(Koha::ArticleRequest::Status::Open);
108
$article_request->status(Koha::ArticleRequest::Status::Pending);
109
$article_request->store();
109
$article_request->store();
110
110
111
is( $patron->article_requests_finished()->count(), 0, 'Open request returned for article_requests_finished' );
111
is( $patron->article_requests_finished()->count(), 0, 'Open request returned for article_requests_finished' );
Lines 115-121 $article_request->complete(); Link Here
115
$article_request->cancel();
115
$article_request->cancel();
116
is( $patron->article_requests_finished()->count(), 1, 'Canceled request not returned for article_requests_finished' );
116
is( $patron->article_requests_finished()->count(), 1, 'Canceled request not returned for article_requests_finished' );
117
117
118
$article_request->status(Koha::ArticleRequest::Status::Open);
118
$article_request->status(Koha::ArticleRequest::Status::Pending);
119
$article_request->store();
119
$article_request->store();
120
120
121
$ar = $biblio->article_requests();
121
$ar = $biblio->article_requests();
Lines 130-136 is( $biblio->article_requests_current()->count(), 0, 'Completed request not retu Link Here
130
$article_request->cancel();
130
$article_request->cancel();
131
is( $biblio->article_requests_current()->count(), 0, 'Canceled request not returned for article_requests_current' );
131
is( $biblio->article_requests_current()->count(), 0, 'Canceled request not returned for article_requests_current' );
132
132
133
$article_request->status(Koha::ArticleRequest::Status::Open);
133
$article_request->status(Koha::ArticleRequest::Status::Pending);
134
$article_request->store();
134
$article_request->store();
135
135
136
is( $biblio->article_requests_finished()->count(), 0, 'Open request returned for article_requests_finished' );
136
is( $biblio->article_requests_finished()->count(), 0, 'Open request returned for article_requests_finished' );
137
- 

Return to bug 14610