@@ -, +, @@ article request => In opac-user.pl, in "Article requests" tab you should see a row --- Koha/ArticleRequest.pm | 17 +- Koha/ArticleRequest/Status.pm | 21 ++- Koha/ArticleRequests.pm | 11 ++ Koha/Biblio.pm | 1 + Koha/Patron.pm | 1 + Koha/Template/Plugin/Biblio.pm | 1 + circ/article-requests.pl | 1 + .../prog/en/modules/circ/article-requests.tt | 168 +++++++++++++++++- .../prog/en/modules/circ/request-article.tt | 2 + .../bootstrap/en/modules/opac-user.tt | 2 + svc/article_request | 3 + 11 files changed, 212 insertions(+), 16 deletions(-) --- a/Koha/ArticleRequest.pm +++ a/Koha/ArticleRequest.pm @@ -40,6 +40,19 @@ Koha::ArticleRequest - Koha Article Request Object class =cut +=head3 request + +=cut + +sub request { + my ($self) = @_; + + $self->status(Koha::ArticleRequest::Status::Requested); + $self->SUPER::store(); + $self->notify(); + return $self; +} + =head3 open =cut @@ -106,7 +119,7 @@ sub notify { if ( my $letter = C4::Letters::GetPreparedLetter( module => 'circulation', - letter_code => "AR_$status", # AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED + letter_code => "AR_$status", # AR_REQUESTED, AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED message_transport_type => 'email', lang => $self->borrower->lang, tables => { @@ -199,7 +212,7 @@ sub store { return $self->SUPER::store; } else { $self->created_on( dt_from_string() ); - return $self->open; + return $self->request; } } --- a/Koha/ArticleRequest/Status.pm +++ a/Koha/ArticleRequest/Status.pm @@ -19,6 +19,22 @@ package Koha::ArticleRequest::Status; use Modern::Perl; +=head1 AUTHOR + +Kyle M Hall + +=cut + +=head2 Requested + + returns constant string 'REQUESTED' + +=cut + +sub Requested { + return 'REQUESTED'; +} + sub Pending { return 'PENDING'; } @@ -35,10 +51,5 @@ sub Canceled { return 'CANCELED'; } -=head1 AUTHOR - -Kyle M Hall - -=cut 1; --- a/Koha/ArticleRequests.pm +++ a/Koha/ArticleRequests.pm @@ -61,6 +61,17 @@ sub search_limited { return $self->search( $params, $attributes ); } +=head3 requested + +=cut + +sub requested { + my ( $self, $branchcode ) = @_; + my $params = { status => Koha::ArticleRequest::Status::Requested }; + $params->{'me.branchcode'} = $branchcode if $branchcode; + return Koha::ArticleRequests->search_limited($params); +} + =head3 pending =cut --- a/Koha/Biblio.pm +++ a/Koha/Biblio.pm @@ -368,6 +368,7 @@ sub article_requests_current { { biblionumber => $self->biblionumber(), -or => [ + { status => Koha::ArticleRequest::Status::Requested }, { status => Koha::ArticleRequest::Status::Pending }, { status => Koha::ArticleRequest::Status::Processing } ] --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -993,6 +993,7 @@ sub article_requests_current { { borrowernumber => $self->id(), -or => [ + { status => Koha::ArticleRequest::Status::Requested }, { status => Koha::ArticleRequest::Status::Pending }, { status => Koha::ArticleRequest::Status::Processing } ] --- a/Koha/Template/Plugin/Biblio.pm +++ a/Koha/Template/Plugin/Biblio.pm @@ -44,6 +44,7 @@ sub ArticleRequestsActiveCount { biblionumber => $biblionumber, status => [ -or => [ + status => Koha::ArticleRequest::Status::Requested, status => Koha::ArticleRequest::Status::Pending, status => Koha::ArticleRequest::Status::Processing ] --- a/circ/article-requests.pl +++ a/circ/article-requests.pl @@ -39,6 +39,7 @@ my $branchcode = defined( $query->param('branchcode') ) ? $query->param('branchc $template->param( branchcode => $branchcode, + article_requests_requested => scalar Koha::ArticleRequests->requested($branchcode), article_requests_pending => scalar Koha::ArticleRequests->pending($branchcode), article_requests_processing => scalar Koha::ArticleRequests->processing($branchcode), ); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt @@ -19,6 +19,11 @@