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

(-)a/Koha/Patron.pm (+51 lines)
Lines 2093-2098 sub account_balance { Link Here
2093
    return $self->account->balance;
2093
    return $self->account->balance;
2094
}
2094
}
2095
2095
2096
=head3 notify_library_of_registration
2097
2098
$patron->notify_library_of_registration( $email_patron_registrations );
2099
2100
Send patron registration email to library if EmailPatronRegistrations system preference is enabled.
2101
2102
=cut
2103
2104
sub notify_library_of_registration {
2105
    my ( $self, $email_patron_registrations ) = @_;
2106
2107
    if (
2108
        my $letter = C4::Letters::GetPreparedLetter(
2109
            module      => 'members',
2110
            letter_code => 'OPAC_REG',
2111
            branchcode  => $self->branchcode,
2112
            lang        => $self->lang || 'default',
2113
            tables      => {
2114
                'borrowers' => $self->borrowernumber
2115
            },
2116
        )
2117
    ) {
2118
        my $to_address;
2119
        if ( $email_patron_registrations eq "BranchEmailAddress" ) {
2120
            my $library = Koha::Libraries->find( $self->branchcode );
2121
            $to_address = $library->inbound_email_address;
2122
        }
2123
        elsif ( $email_patron_registrations eq "KohaAdminEmailAddress" ) {
2124
            $to_address = C4::Context->preference('ReplytoDefault')
2125
            || C4::Context->preference('KohaAdminEmailAddress');
2126
        }
2127
        else {
2128
            $to_address =
2129
                C4::Context->preference('EmailAddressForPatronRegistrations')
2130
                || C4::Context->preference('ReplytoDefault')
2131
                || C4::Context->preference('KohaAdminEmailAddress');
2132
        }
2133
2134
        my $message_id = C4::Letters::EnqueueLetter(
2135
            {
2136
                letter                 => $letter,
2137
                borrowernumber         => $self->borrowernumber,
2138
                to_address             => $to_address,
2139
                message_transport_type => 'email'
2140
            }
2141
        ) or warn "can't enqueue letter $letter";
2142
        if ( $message_id ) {
2143
            return 1;
2144
        }
2145
    }
2146
}
2096
2147
2097
=head3 has_messaging_preference
2148
=head3 has_messaging_preference
2098
2149
(-)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 1711-1725 tables: Link Here
1711
            - "<h3>New OPAC self-registration</h3>"
1711
            - "<h3>New OPAC self-registration</h3>"
1712
            - "<p><h4>Self-registration made by</h4>"
1712
            - "<p><h4>Self-registration made by</h4>"
1713
            - "<ul>"
1713
            - "<ul>"
1714
            - "<li><<borrower_modifications.firstname>> <<borrower_modifications.surname>></li>"
1714
            - "<li><<borrowers.firstname>> <<borrowers.surname>></li>"
1715
            - "<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>"
1715
            - "<li>Email: <<borrowers.email>></li>"
1716
            - "<li>Email: <<borrower_modifications.email>></li>"
1716
            - "<li>Phone: <<borrowers.phone>></li>"
1717
            - "<li>Phone: <<borrower_modifications.phone>></li>"
1717
            - "<li>Mobile: <<borrowers.mobile>></li>"
1718
            - "<li>Mobile: <<borrower_modifications.mobile>></li>"
1718
            - "<li>Fax: <<borrowers.fax>></li>"
1719
            - "<li>Fax: <<borrower_modifications.fax>></li>"
1719
            - "<li>Secondary email: <<borrowers.emailpro>></li>"
1720
            - "<li>Secondary email: <<borrower_modifications.emailpro>></li>"
1720
            - "<li>Secondary phone:<<borrowers.phonepro>></li>"
1721
            - "<li>Secondary phone:<<borrower_modifications.phonepro>></li>"
1721
            - "<li>Home library: <<borrowers.branchcode>></li>"
1722
            - "<li>Home library: <<borrower_modifications.branchcode>></li>"
1722
            - "<li>Temporary patron category: <<borrowers.categorycode>></li>"
1723
            - "<li>Temporary patron category: <<borrower_modifications.categorycode>></li>"
1724
            - "</ul>"
1723
            - "</ul>"
1725
            - "</p>"
1724
            - "</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