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

(-)a/Koha/Patron/Password/Recovery.pm (-2 / +4 lines)
Lines 104-109 sub SendPasswordRecoveryEmail { Link Here
104
    my $borrower  = shift;    # Koha::Patron
104
    my $borrower  = shift;    # Koha::Patron
105
    my $userEmail = shift;    #to_address (the one specified in the request)
105
    my $userEmail = shift;    #to_address (the one specified in the request)
106
    my $update    = shift;
106
    my $update    = shift;
107
    my $staff     = shift // 0;
107
108
108
    my $schema = Koha::Database->new->schema;
109
    my $schema = Koha::Database->new->schema;
109
110
Lines 114-121 sub SendPasswordRecoveryEmail { Link Here
114
    } while ( substr ( $uuid_str, -1, 1 ) eq '.' );
115
    } while ( substr ( $uuid_str, -1, 1 ) eq '.' );
115
116
116
    # insert into database
117
    # insert into database
118
    my $days = $staff ? 5 : 2;
117
    my $expirydate =
119
    my $expirydate =
118
      dt_from_string()->add( days => 2 );
120
      dt_from_string()->add( days => $days );
119
    if ($update) {
121
    if ($update) {
120
        my $rs =
122
        my $rs =
121
          $schema->resultset('BorrowerPasswordRecovery')
123
          $schema->resultset('BorrowerPasswordRecovery')
Lines 141-147 sub SendPasswordRecoveryEmail { Link Here
141
    # prepare the email
143
    # prepare the email
142
    my $letter = C4::Letters::GetPreparedLetter(
144
    my $letter = C4::Letters::GetPreparedLetter(
143
        module      => 'members',
145
        module      => 'members',
144
        letter_code => 'PASSWORD_RESET',
146
        letter_code => $staff ? 'STAFF_PASSWORD_RESET' : 'PASSWORD_RESET',
145
        branchcode  => $borrower->branchcode,
147
        branchcode  => $borrower->branchcode,
146
        lang        => $borrower->lang,
148
        lang        => $borrower->lang,
147
        substitute =>
149
        substitute =>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc (+4 lines)
Lines 72-77 Link Here
72
                    <li><a id="sendwelcome" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber | uri %]&op=send_welcome">Send welcome email</a></li>
72
                    <li><a id="sendwelcome" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber | uri %]&op=send_welcome">Send welcome email</a></li>
73
                [% END %]
73
                [% END %]
74
74
75
                [% IF CAN_user_borrowers_edit_borrowers %]
76
                    <li><a id="resetpassword" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% patron.borrowernumber | uri %]&op=send_password_reset">Send password reset</a></li>
77
                [% END %]
78
75
                [% IF CAN_user_borrowers_delete_borrowers %]
79
                [% IF CAN_user_borrowers_delete_borrowers %]
76
                    <li><a id="deletepatron" href="#">Delete</a></li>
80
                    <li><a id="deletepatron" href="#">Delete</a></li>
77
                [% ELSE %]
81
                [% ELSE %]
(-)a/members/notices.pl (-1 / +19 lines)
Lines 27-32 use C4::Members; Link Here
27
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
27
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
28
use Koha::Patrons;
28
use Koha::Patrons;
29
use Koha::Patron::Categories;
29
use Koha::Patron::Categories;
30
use Koha::Patron::Password::Recovery qw( SendPasswordRecoveryEmail ValidateBorrowernumber );
30
31
31
my $input=CGI->new;
32
my $input=CGI->new;
32
33
Lines 93-98 if ( $op eq 'send_welcome' ) { Link Here
93
    print $input->redirect("/cgi-bin/koha/members/notices.pl?borrowernumber=$borrowernumber");
94
    print $input->redirect("/cgi-bin/koha/members/notices.pl?borrowernumber=$borrowernumber");
94
}
95
}
95
96
97
if ( $op eq 'send_password_reset' ) {
98
99
    my $emailaddr = $patron->notice_email_address;
100
101
    if ($emailaddr) {
102
103
        # check if there's already a recovery in process
104
        my $update = ValidateBorrowernumber( $patron->borrowernumber );
105
106
        # send staff initiated password recovery
107
        SendPasswordRecoveryEmail( $patron, $emailaddr, $update, 1 );
108
    }
109
110
    # redirect to self to avoid form submission on refresh
111
    print $input->redirect(
112
        "/cgi-bin/koha/members/notices.pl?borrowernumber=$borrowernumber");
113
}
114
96
# Getting the messages
115
# Getting the messages
97
my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
116
my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber});
98
117
99
- 

Return to bug 30611