From 1f668504db20c4f9342e8c347e4d7ec0811e0868 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 30 Sep 2021 11:55:11 -0300 Subject: [PATCH] Bug 27944: (follow-up) Add POD The library didn't contain real POD. This patch adds it. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- Koha/ArticleRequest.pm | 99 ++++++++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 37 deletions(-) diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm index 71a106d3f7..82437089c9 100644 --- a/Koha/ArticleRequest.pm +++ b/Koha/ArticleRequest.pm @@ -42,6 +42,10 @@ Koha::ArticleRequest - Koha Article Request Object class =head3 request + $article_request->request; + +Marks the article as requested. Send a notification if appropriate. + =cut sub request { @@ -55,6 +59,10 @@ sub request { =head3 set_pending + $article_request->set_pending; + +Marks the article as pending. Send a notification if appropriate. + =cut sub set_pending { @@ -68,6 +76,10 @@ sub set_pending { =head3 process + $article_request->process; + +Marks the article as in process. Send a notification if appropriate. + =cut sub process { @@ -81,6 +93,10 @@ sub process { =head3 complete + $article_request->complete; + +Marks the article as completed. Send a notification if appropriate. + =cut sub complete { @@ -94,6 +110,10 @@ sub complete { =head3 cancel + $article_request->cancel; + +Marks the article as cancelled. Send a notification if appropriate. + =cut sub cancel { @@ -106,43 +126,6 @@ sub cancel { return $self; } -=head3 notify - -=cut - -sub notify { - my ($self) = @_; - - my $status = $self->status; - - require C4::Letters; - if ( - my $letter = C4::Letters::GetPreparedLetter( - module => 'circulation', - letter_code => "AR_$status", # AR_REQUESTED, AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED - message_transport_type => 'email', - lang => $self->borrower->lang, - tables => { - article_requests => $self->id, - borrowers => $self->borrowernumber, - biblio => $self->biblionumber, - biblioitems => $self->biblionumber, - items => $self->itemnumber, - branches => $self->branchcode, - }, - ) - ) - { - C4::Letters::EnqueueLetter( - { - letter => $letter, - borrowernumber => $self->borrowernumber, - message_transport_type => 'email', - } - ) or warn "can't enqueue letter ". $letter->{code}; - } -} - =head3 biblio Returns the Koha::Biblio object for this article request @@ -218,6 +201,48 @@ sub store { =head2 Internal methods +=head3 notify + + $self->notify(); + +internal method to be called when changing an article request status. +If a letter exists for the new status, it enqueues it. + +=cut + +sub notify { + my ($self) = @_; + + my $status = $self->status; + + require C4::Letters; + if ( + my $letter = C4::Letters::GetPreparedLetter( + module => 'circulation', + letter_code => "AR_$status", # AR_REQUESTED, AR_PENDING, AR_PROCESSING, AR_COMPLETED, AR_CANCELED + message_transport_type => 'email', + lang => $self->borrower->lang, + tables => { + article_requests => $self->id, + borrowers => $self->borrowernumber, + biblio => $self->biblionumber, + biblioitems => $self->biblionumber, + items => $self->itemnumber, + branches => $self->branchcode, + }, + ) + ) + { + C4::Letters::EnqueueLetter( + { + letter => $letter, + borrowernumber => $self->borrowernumber, + message_transport_type => 'email', + } + ) or warn "can't enqueue letter ". $letter->{code}; + } +} + =head3 _type =cut -- 2.39.5