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

(-)a/Koha/Patron.pm (+51 lines)
Lines 2108-2113 sub account_balance { Link Here
2108
    return $self->account->balance;
2108
    return $self->account->balance;
2109
}
2109
}
2110
2110
2111
=head3 notify_library_of_registration
2112
2113
$patron->notify_library_of_registration( $email_patron_registrations );
2114
2115
Send patron registration email to library if EmailPatronRegistrations system preference is enabled.
2116
2117
=cut
2118
2119
sub notify_library_of_registration {
2120
    my ( $self, $email_patron_registrations ) = @_;
2121
2122
    if (
2123
        my $letter = C4::Letters::GetPreparedLetter(
2124
            module      => 'members',
2125
            letter_code => 'OPAC_REG',
2126
            branchcode  => $self->branchcode,
2127
            lang        => $self->lang || 'default',
2128
            tables      => {
2129
                'borrowers' => $self->borrowernumber
2130
            },
2131
        )
2132
    ) {
2133
        my $to_address;
2134
        if ( $email_patron_registrations eq "BranchEmailAddress" ) {
2135
            my $library = Koha::Libraries->find( $self->branchcode );
2136
            $to_address = $library->inbound_email_address;
2137
        }
2138
        elsif ( $email_patron_registrations eq "KohaAdminEmailAddress" ) {
2139
            $to_address = C4::Context->preference('ReplytoDefault')
2140
            || C4::Context->preference('KohaAdminEmailAddress');
2141
        }
2142
        else {
2143
            $to_address =
2144
                C4::Context->preference('EmailAddressForPatronRegistrations')
2145
                || C4::Context->preference('ReplytoDefault')
2146
                || C4::Context->preference('KohaAdminEmailAddress');
2147
        }
2148
2149
        my $message_id = C4::Letters::EnqueueLetter(
2150
            {
2151
                letter                 => $letter,
2152
                borrowernumber         => $self->borrowernumber,
2153
                to_address             => $to_address,
2154
                message_transport_type => 'email'
2155
            }
2156
        ) or warn "can't enqueue letter $letter";
2157
        if ( $message_id ) {
2158
            return 1;
2159
        }
2160
    }
2161
}
2111
2162
2112
=head3 has_messaging_preference
2163
=head3 has_messaging_preference
2113
2164
(-)a/installer/data/mysql/atomicupdate/bug23538-add_EmailPatronRegistrations_and_EmailAddressForPatronRegistrations_sysprefs.pl (-10 / +9 lines)
Lines 13-28 return { Link Here
13
            '<h3>New OPAC self-registration</h3>
13
            '<h3>New OPAC self-registration</h3>
14
            <p><h4>Self-registration made by</h4>
14
            <p><h4>Self-registration made by</h4>
15
            <ul>
15
            <ul>
16
            <li><<borrower_modifications.firstname>> <<borrower_modifications.surname>></li>
16
            <li><<borrowers.firstname>> <<borrowers.surname>></li>
17
            <li>Physical address: <<borrower_modifications.streetnumber>> <<borrower_modifications.streettype>> <<borrower_modifications.address>> <<borrower_modifications.address2>>, <<borrower_modifications.city>>, <<borrower_modifications.state>> <<borrower_modifications.zipcode>>, <<borrower_modifications.country>></li>
17
            <li>Email: <<borrowers.email>></li>
18
            <li>Email: <<borrower_modifications.email>></li>
18
            <li>Phone: <<borrowers.phone>></li>
19
            <li>Phone: <<borrower_modifications.phone>></li>
19
            <li>Mobile: <<borrowers.mobile>></li>
20
            <li>Mobile: <<borrower_modifications.mobile>></li>
20
            <li>Fax: <<borrowers.fax>></li>
21
            <li>Fax: <<borrower_modifications.fax>></li>
21
            <li>Secondary email: <<borrowers.emailpro>></li>
22
            <li>Secondary email: <<borrower_modifications.emailpro>></li>
22
            <li>Secondary phone:<<borrowers.phonepro>></li>
23
            <li>Secondary phone:<<borrower_modifications.phonepro>></li>
23
            <li>Home library: <<borrowers.branchcode>></li>
24
            <li>Home library: <<borrower_modifications.branchcode>></li>
24
            <li>Patron category: <<borrowers.categorycode>></li>
25
            <li>Temporary patron category: <<borrower_modifications.categorycode>></li>
26
            </ul>
25
            </ul>
27
            </p>', 'email', 'default') });
26
            </p>', 'email', 'default') });
28
    },
27
    },
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (-10 / +9 lines)
Lines 1744-1758 tables: Link Here
1744
            - "<h3>New OPAC self-registration</h3>"
1744
            - "<h3>New OPAC self-registration</h3>"
1745
            - "<p><h4>Self-registration made by</h4>"
1745
            - "<p><h4>Self-registration made by</h4>"
1746
            - "<ul>"
1746
            - "<ul>"
1747
            - "<li><<borrower_modifications.firstname>> <<borrower_modifications.surname>></li>"
1747
            - "<li><<borrowers.firstname>> <<borrowers.surname>></li>"
1748
            - "<li>Physical address: <<borrower_modifications.streetnumber>> <<borrower_modifications.streettype>> <<borrower_modifications.address>> <<borrower_modifications.address2>>, <<borrower_modifications.city>>, <<borrower_modifications.state>> <<borrower_modifications.zipcode>>, <<borrower_modifications.country>></li>"
1748
            - "<li>Email: <<borrowers.email>></li>"
1749
            - "<li>Email: <<borrower_modifications.email>></li>"
1749
            - "<li>Phone: <<borrowers.phone>></li>"
1750
            - "<li>Phone: <<borrower_modifications.phone>></li>"
1750
            - "<li>Mobile: <<borrowers.mobile>></li>"
1751
            - "<li>Mobile: <<borrower_modifications.mobile>></li>"
1751
            - "<li>Fax: <<borrowers.fax>></li>"
1752
            - "<li>Fax: <<borrower_modifications.fax>></li>"
1752
            - "<li>Secondary email: <<borrowers.emailpro>></li>"
1753
            - "<li>Secondary email: <<borrower_modifications.emailpro>></li>"
1753
            - "<li>Secondary phone:<<borrowers.phonepro>></li>"
1754
            - "<li>Secondary phone:<<borrower_modifications.phonepro>></li>"
1754
            - "<li>Home library: <<borrowers.branchcode>></li>"
1755
            - "<li>Home library: <<borrower_modifications.branchcode>></li>"
1755
            - "<li>Temporary patron category: <<borrowers.categorycode>></li>"
1756
            - "<li>Temporary patron category: <<borrower_modifications.categorycode>></li>"
1757
            - "</ul>"
1756
            - "</ul>"
1758
            - "</p>"
1757
            - "</p>"
(-)a/opac/opac-memberentry.pl (+7 lines)
Lines 275-280 if ( $action eq 'create' ) { Link Here
275
                        };
275
                        };
276
                    }
276
                    }
277
                }
277
                }
278
279
                # Notify library of new patron registration
280
                my $notify_library = C4::Context->preference('EmailPatronRegistrations');
281
                if ($notify_library) {
282
                    $patron->notify_library_of_registration($notify_library);
283
                }
284
278
            } else {
285
            } else {
279
                # FIXME Handle possible errors here
286
                # FIXME Handle possible errors here
280
            }
287
            }
(-)a/opac/opac-registration-verify.pl (-1 / +6 lines)
Lines 117-122 if ( Link Here
117
            }
117
            }
118
        }
118
        }
119
119
120
        # Notify library of new patron registration
121
        my $notify_library = C4::Context->preference("EmailPatronRegistrations");
122
        if ($notify_library) {
123
            $patron->notify_library_of_registration($notify_library);
124
        }
125
120
        $template->param(
126
        $template->param(
121
            PatronSelfRegistrationAdditionalInstructions =>
127
            PatronSelfRegistrationAdditionalInstructions =>
122
              C4::Context->preference(
128
              C4::Context->preference(
123
- 

Return to bug 23538