|
Lines 2063-2068
sub recalls {
Link Here
|
| 2063 |
return Koha::Recalls->search({ borrowernumber => $self->borrowernumber }); |
2063 |
return Koha::Recalls->search({ borrowernumber => $self->borrowernumber }); |
| 2064 |
} |
2064 |
} |
| 2065 |
|
2065 |
|
|
|
2066 |
=head3 account_balance |
| 2067 |
|
| 2068 |
my $balance = $patron->account_balance |
| 2069 |
|
| 2070 |
Return the patron's account balance |
| 2071 |
|
| 2072 |
=cut |
| 2073 |
|
| 2074 |
sub account_balance { |
| 2075 |
my ($self) = @_; |
| 2076 |
return $self->account->balance; |
| 2077 |
} |
| 2078 |
|
| 2079 |
=head3 notify_library_of_registration |
| 2080 |
|
| 2081 |
$patron->notify_library_of_registration( $email_patron_registrations ); |
| 2082 |
|
| 2083 |
Send patron registration email to library if EmailPatronRegistrations system preference is enabled. |
| 2084 |
|
| 2085 |
=cut |
| 2086 |
|
| 2087 |
sub notify_library_of_registration { |
| 2088 |
my ( $self, $email_patron_registrations ) = @_; |
| 2089 |
|
| 2090 |
if ( |
| 2091 |
my $letter = C4::Letters::GetPreparedLetter( |
| 2092 |
module => 'members', |
| 2093 |
letter_code => 'OPAC_REG', |
| 2094 |
branchcode => $self->branchcode, |
| 2095 |
lang => $self->lang || 'default', |
| 2096 |
tables => { |
| 2097 |
'borrowers' => $self->borrowernumber |
| 2098 |
}, |
| 2099 |
) |
| 2100 |
) { |
| 2101 |
my $to_address; |
| 2102 |
if ( $email_patron_registrations eq "BranchEmailAddress" ) { |
| 2103 |
my $library = Koha::Libraries->find( $self->branchcode ); |
| 2104 |
$to_address = $library->inbound_email_address; |
| 2105 |
} |
| 2106 |
elsif ( $email_patron_registrations eq "KohaAdminEmailAddress" ) { |
| 2107 |
$to_address = C4::Context->preference('ReplytoDefault') |
| 2108 |
|| C4::Context->preference('KohaAdminEmailAddress'); |
| 2109 |
} |
| 2110 |
else { |
| 2111 |
$to_address = |
| 2112 |
C4::Context->preference('EmailAddressForPatronRegistrations') |
| 2113 |
|| C4::Context->preference('ReplytoDefault') |
| 2114 |
|| C4::Context->preference('KohaAdminEmailAddress'); |
| 2115 |
} |
| 2116 |
|
| 2117 |
my $message_id = C4::Letters::EnqueueLetter( |
| 2118 |
{ |
| 2119 |
letter => $letter, |
| 2120 |
borrowernumber => $self->borrowernumber, |
| 2121 |
to_address => $to_address, |
| 2122 |
message_transport_type => 'email' |
| 2123 |
} |
| 2124 |
) or warn "can't enqueue letter $letter"; |
| 2125 |
if ( $message_id ) { |
| 2126 |
return 1; |
| 2127 |
} |
| 2128 |
} |
| 2129 |
} |
| 2130 |
|
| 2066 |
=head2 Internal methods |
2131 |
=head2 Internal methods |
| 2067 |
|
2132 |
|
| 2068 |
=head3 _type |
2133 |
=head3 _type |