Bug 25998: Add 'library' relation to Koha::Account::Line
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 16 Jul 2020 08:40:23 +0000 (09:40 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 22 Jul 2020 08:17:53 +0000 (10:17 +0200)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Koha/Account/Line.pm

index 155ae4e..ce00de0 100644 (file)
@@ -85,6 +85,19 @@ sub checkout {
     return $self->{_checkout};
 }
 
+=head3 library
+
+Returns a Koha::Library object representing where the accountline was recorded
+
+=cut
+
+sub library {
+    my ( $self ) = @_;
+    my $rs = $self->_result->branchcode;
+    return unless $rs;
+    return Koha::Library->_new_from_dbic($rs);
+}
+
 =head3 credit_type
 
 Return the credit_type linked to this account line