Skip to content

Commit

Permalink
Use stable langage for the UI
Browse files Browse the repository at this point in the history
Prevents translations from being triggered by browser language.
  • Loading branch information
ehuelsmann committed Dec 25, 2024
1 parent 828e90b commit 53064f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 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,16 @@ sub create {
funcname => 'admin__add_user_to_role',
args => [ $self->username, $role ]);
}
$prefs //= {};
my $query = q|insert into user_preference (user_id, name, value)
values ($1, $2, $3)
on conflict (user_id, name) do update set value = $3|;
my $sth = $self->dbh->prepare($query)
or die $self->dbh->errstr;
for my $pref (keys $prefs->%*) {
$sth->execute($self->id, $pref, $prefs->{$pref})

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.38, 14, chrome, 1, 3)

( STDERR ) job 18 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname='std-template-4940-18';host='localhost';options='-c search_path=xyz'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.38, 14, chrome, 1, 3)

( DIAG ) job 18 # DBD::Pg::st execute failed: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.38, 14, chrome, 1, 3)

( STDERR ) job 19 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle host='localhost';options='-c search_path=xyz';dbname='std-template-4943-19'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.38, 14, chrome, 1, 3)

( DIAG ) job 19 # DBD::Pg::st execute failed: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.38, 14, chrome, 1, 3)

( STDERR ) job 18 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname='std-template-4940-18';host='localhost';options='-c search_path=xyz'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.36, 15, firefox, 1, 7)

( STDERR ) job 19 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle host='localhost';dbname='std-template-5159-19';options='-c search_path=xyz'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.36, 15, firefox, 1, 7)

( DIAG ) job 19 # DBD::Pg::st execute failed: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.36, 15, firefox, 1, 7)

( STDERR ) job 18 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname='std-template-5095-18';options='-c search_path=xyz';host='localhost'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.36, 15, firefox, 1, 7)

( DIAG ) job 18 # DBD::Pg::st execute failed: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.36, 15, firefox, 1, 7)

( STDERR ) job 21 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname='std-template-5403-21';options='-c search_path=xyz';host='localhost'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.40, 13, operablink, 1, 7)

( STDERR ) job 21 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle host='localhost';options='-c search_path=xyz';dbname='std-template-5218-21'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.40, 13, operablink, 1, 7)

( DIAG ) job 21 # DBD::Pg::st execute failed: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.40, 13, operablink, 1, 7)

( STDERR ) job 18 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle options='-c search_path=xyz';dbname='std-template-5177-18';host='localhost'

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.40, 13, operablink, 1, 7)

( DIAG ) job 18 # DBD::Pg::st execute failed: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

Check failure on line 148 in lib/LedgerSMB/Entity/User.pm

View workflow job for this annotation

GitHub Actions / test-remainder (5.40, 13, operablink, 1, 7)

( STDERR ) job 19 Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname='std-template-5178-19';options='-c search_path=xyz';host='localhost'
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 53064f2

Please sign in to comment.