From fbc9cbf00ffd7d6a1096342174aae4594c31ea98 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 10 Nov 2007 19:57:44 +0000 Subject: [PATCH] ebl Make Location.Enabled like Media.Enabled git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@5894 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/lib/Bweb.pm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 3e29c34438..aae48d00a3 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -1208,15 +1208,29 @@ sub human_enabled { my $val = shift || 0; - if ($val == 1 or $val eq "yes") { + if ($val eq '1' or $val eq "yes") { return "yes"; - } elsif ($val == 2 or $val eq "archived") { + } elsif ($val eq '2' or $val eq "archived") { return "archived"; } else { return "no"; } } +# display Enabled +sub from_human_enabled +{ + my $val = shift || 0; + + if ($val == 1 or $val eq "yes") { + return 1; + } elsif ($val == 2 or $val eq "archived") { + return 2; + } else { + return 0; + } +} + # get Day, Hour, Year sub from_human_sec { @@ -1255,6 +1269,8 @@ sub connect_db if ($self->{info}->{dbi} =~ /^dbi:Pg/i) { $self->{dbh}->do("SET datestyle TO 'ISO, YMD'"); + } else { + $self->{dbh}->do("SET group_concat_max_len=1000000"); } } } @@ -2372,7 +2388,7 @@ WHERE Location.Location = $loc->{qlocation} "; my $row = $self->dbh_selectrow_hashref($query); - + $row->{enabled} = human_enabled($row->{enabled}); $self->display({ ID => $cur_id++, %$row }, "location_edit.tpl") ; } @@ -2382,7 +2398,7 @@ sub location_save my ($self) = @_ ; $self->can_do('r_location_mgnt'); - my $arg = $self->get_form(qw/qlocation qnewlocation cost/) ; + my $arg = $self->get_form(qw/qlocation qnewlocation cost enabled/) ; unless ($arg->{qlocation}) { return $self->error("Can't get location"); } @@ -2393,8 +2409,7 @@ sub location_save return $self->error("Can't get new cost"); } - my $enabled = CGI::param('enabled') || ''; - $enabled = $enabled?1:0; + my $enabled = from_human_enabled($arg->{enabled}); my $query = " UPDATE Location SET Cost = $arg->{cost}, -- 2.39.5