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

(-)a/Koha/Patron.pm (+51 lines)
Lines 2078-2083 sub account_balance { Link Here
2078
    return $self->account->balance;
2078
    return $self->account->balance;
2079
}
2079
}
2080
2080
2081
=head3 notify_library_of_registration
2082
2083
$patron->notify_library_of_registration( $email_patron_registrations );
2084
2085
Send patron registration email to library if EmailPatronRegistrations system preference is enabled.
2086
2087
=cut
2088
2089
sub notify_library_of_registration {
2090
    my ( $self, $email_patron_registrations ) = @_;
2091
2092
    if (
2093
        my $letter = C4::Letters::GetPreparedLetter(
2094
            module      => 'members',
2095
            letter_code => 'OPAC_REG',
2096
            branchcode  => $self->branchcode,
2097
            lang        => $self->lang || 'default',
2098
            tables      => {
2099
                'borrowers' => $self->borrowernumber
2100
            },
2101
        )
2102
    ) {
2103
        my $to_address;
2104
        if ( $email_patron_registrations eq "BranchEmailAddress" ) {
2105
            my $library = Koha::Libraries->find( $self->branchcode );
2106
            $to_address = $library->inbound_email_address;
2107
        }
2108
        elsif ( $email_patron_registrations eq "KohaAdminEmailAddress" ) {
2109
            $to_address = C4::Context->preference('ReplytoDefault')
2110
            || C4::Context->preference('KohaAdminEmailAddress');
2111
        }
2112
        else {
2113
            $to_address =
2114
                C4::Context->preference('EmailAddressForPatronRegistrations')
2115
                || C4::Context->preference('ReplytoDefault')
2116
                || C4::Context->preference('KohaAdminEmailAddress');
2117
        }
2118
2119
        my $message_id = C4::Letters::EnqueueLetter(
2120
            {
2121
                letter                 => $letter,
2122
                borrowernumber         => $self->borrowernumber,
2123
                to_address             => $to_address,
2124
                message_transport_type => 'email'
2125
            }
2126
        ) or warn "can't enqueue letter $letter";
2127
        if ( $message_id ) {
2128
            return 1;
2129
        }
2130
    }
2131
}
2081
2132
2082
=head2 Internal methods
2133
=head2 Internal methods
2083
2134
(-)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 1648-1662 tables: Link Here
1648
            - "<h3>New OPAC self-registration</h3>"
1648
            - "<h3>New OPAC self-registration</h3>"
1649
            - "<p><h4>Self-registration made by</h4>"
1649
            - "<p><h4>Self-registration made by</h4>"
1650
            - "<ul>"
1650
            - "<ul>"
1651
            - "<li><<borrower_modifications.firstname>> <<borrower_modifications.surname>></li>"
1651
            - "<li><<borrowers.firstname>> <<borrowers.surname>></li>"
1652
            - "<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>"
1652
            - "<li>Email: <<borrowers.email>></li>"
1653
            - "<li>Email: <<borrower_modifications.email>></li>"
1653
            - "<li>Phone: <<borrowers.phone>></li>"
1654
            - "<li>Phone: <<borrower_modifications.phone>></li>"
1654
            - "<li>Mobile: <<borrowers.mobile>></li>"
1655
            - "<li>Mobile: <<borrower_modifications.mobile>></li>"
1655
            - "<li>Fax: <<borrowers.fax>></li>"
1656
            - "<li>Fax: <<borrower_modifications.fax>></li>"
1656
            - "<li>Secondary email: <<borrowers.emailpro>></li>"
1657
            - "<li>Secondary email: <<borrower_modifications.emailpro>></li>"
1657
            - "<li>Secondary phone:<<borrowers.phonepro>></li>"
1658
            - "<li>Secondary phone:<<borrower_modifications.phonepro>></li>"
1658
            - "<li>Home library: <<borrowers.branchcode>></li>"
1659
            - "<li>Home library: <<borrower_modifications.branchcode>></li>"
1659
            - "<li>Temporary patron category: <<borrowers.categorycode>></li>"
1660
            - "<li>Temporary patron category: <<borrower_modifications.categorycode>></li>"
1661
            - "</ul>"
1660
            - "</ul>"
1662
            - "</p>"
1661
            - "</p>"
(-)a/opac/opac-memberentry.pl (+7 lines)
Lines 274-279 if ( $action eq 'create' ) { Link Here
274
                        };
274
                        };
275
                    }
275
                    }
276
                }
276
                }
277
278
                # Notify library of new patron registration
279
                my $notify_library = C4::Context->preference('EmailPatronRegistrations');
280
                if ($notify_library) {
281
                    $patron->notify_library_of_registration($notify_library);
282
                }
283
277
            } else {
284
            } else {
278
                # FIXME Handle possible errors here
285
                # FIXME Handle possible errors here
279
            }
286
            }
(-)a/opac/opac-registration-verify.pl (-1 / +6 lines)
Lines 110-115 if ( Link Here
110
            }
110
            }
111
        }
111
        }
112
112
113
        # Notify library of new patron registration
114
        my $notify_library = C4::Context->preference("EmailPatronRegistrations");
115
        if ($notify_library) {
116
            $patron->notify_library_of_registration($notify_library);
117
        }
118
113
        $template->param(
119
        $template->param(
114
            PatronSelfRegistrationAdditionalInstructions =>
120
            PatronSelfRegistrationAdditionalInstructions =>
115
              C4::Context->preference(
121
              C4::Context->preference(
116
- 

Return to bug 23538