Skip to content

Commit

Permalink
Merge pull request #8595 from ehuelsmann/fix/1.12/admin-template-warn…
Browse files Browse the repository at this point in the history
…ings

Fix warnings in ledgersmb-admin template handling
  • Loading branch information
ehuelsmann authored Jan 17, 2025
2 parents 80eaa88 + fc5757e commit 39b9c63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/LedgerSMB/Admin/Command/template.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use warnings;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use DateTime::Format::Strptime;
use File::Spec;
use IO::Handle;

use LedgerSMB::Admin::Command;
use LedgerSMB::App_State;
Expand Down Expand Up @@ -65,7 +66,7 @@ Template name Format Language Last modified
sub dump {
my ($self, $dbh, $options, @args) = @_;
my ($db, $name, $format, $language) = @args;
$language = undef if $language eq 'all';
$language = undef if $language and $language eq 'all';
my $template = $dbh->selectall_arrayref(
q{SELECT template FROM template
WHERE ($1 is null OR template_name = $1)
Expand All @@ -74,9 +75,11 @@ sub dump {
{ Slice => {} },
$name, $format, $language)
or die $dbh->errstr;
$dbh->disconnect;

STDOUT->flush();
binmode STDOUT, ':encoding(UTF-8)';
print $template->[0]->{template};
$dbh->disconnect;
return 0;
}

Expand Down Expand Up @@ -133,6 +136,7 @@ sub load {
my $content;
{
local $/ = undef;
binmode STDIN, ':encoding(UTF-8)';
$content = <STDIN>;
}
$dbh->do(q{DELETE FROM template
Expand Down

0 comments on commit 39b9c63

Please sign in to comment.