Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stable langage for the UI #8550

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lib/LedgerSMB/Entity/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ sub reset_password {
return;
}

=item create
=item create( $password, [ \%prefs ] )

Creates the new user.

=cut

sub create {
my ($self, $password) = @_;
my ($self, $password, $prefs) = @_;
my ($ref) = $self->call_dbmethod(
funcname => 'admin__save_user',
args => { password => $password });
Expand All @@ -138,6 +138,18 @@ sub create {
funcname => 'admin__add_user_to_role',
args => [ $self->username, $role ]);
}
$prefs //= {};
my $query = <<~'SQL';
insert into
user_preference (user_id, name, value)
values ($1, $2, $3)
SQL
my $sth = $self->dbh->prepare($query)
or die $self->dbh->errstr;
for my $pref (keys $prefs->%*) {
$sth->execute($self->id, $pref, $prefs->{$pref})
or die $sth->errstr;
}
return;
}

Expand Down
4 changes: 2 additions & 2 deletions xt/lib/Pherkin/Extension/LedgerSMB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ sub create_user {
username => $username,
_dbh => $dbh,
);
$user->create($args{password} // 'password');
$user->create($args{password} // 'password', { language => 'en' });
my $ident_username=$dbh->quote_identifier($username);
$dbh->do(qq(ALTER USER $ident_username VALID UNTIL 'infinity'));

Expand Down Expand Up @@ -311,7 +311,7 @@ INSERT INTO business_unit (class_id, control_code, description)

my $emp = $self->create_employee(dbh => $dbh);
my $user = $self->create_user(dbh => $dbh,
entity_id => $emp->entity_id,
entity_id => $emp->entity_id,
username => $admin);

my $roles;
Expand Down
Loading