Bug 21149: Fix superlibrarian creation in onboarding

See bug 21087 for more details.

Test plan:
Drop your DB
Start the installation process
Use the onboarding process to install missing data
The superlibrarian created during this process should be created
sucessfully and allowed to login

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2018-08-02 11:47:24 -03:00 committed by Nick Clemens
parent c6b50f0bac
commit d463a1b347

View file

@ -173,12 +173,10 @@ if ( $step == 3 ) {
branchcode => scalar $input->param('libraries'), branchcode => scalar $input->param('libraries'),
categorycode => scalar $input->param('categorycode_entry'), categorycode => scalar $input->param('categorycode_entry'),
userid => scalar $input->param('userid'), userid => scalar $input->param('userid'),
password => scalar $input->param('password'),
password2 => scalar $input->param('password2'),
privacy => "default", privacy => "default",
address => "", address => "",
city => "", city => "",
flags => 1, # Will be superlibrarian flags => 1, # Will be superlibrarian
}; };
my $patron_category = my $patron_category =
@ -187,7 +185,8 @@ if ( $step == 3 ) {
$patron_category->get_expiry_date( $patron_data->{dateenrolled} ); $patron_category->get_expiry_date( $patron_data->{dateenrolled} );
eval { eval {
Koha::Patron->new($patron_data)->store; my $patron = Koha::Patron->new($patron_data)->store;
$patron->update_password($patron->userid, $firstpassword);
}; };
#Error handling checking if the patron was created successfully #Error handling checking if the patron was created successfully
@ -195,6 +194,7 @@ if ( $step == 3 ) {
push @messages, { code => 'success_on_insert_patron' }; push @messages, { code => 'success_on_insert_patron' };
} }
else { else {
warn $@;
push @messages, { code => 'error_on_insert_patron' }; push @messages, { code => 'error_on_insert_patron' };
} }
} }