Skip to content

Commit

Permalink
Use stable langage for the UI (#8550)
Browse files Browse the repository at this point in the history
* Use stable langage for the UI

Prevents translations from being triggered by browser language.
  • Loading branch information
ehuelsmann authored Dec 26, 2024
1 parent 828e90b commit 91d77df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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

0 comments on commit 91d77df

Please sign in to comment.