From: Eric Bollengier Date: Fri, 23 Nov 2007 10:29:08 +0000 (+0000) Subject: ebl fix add_media feature X-Git-Tag: Release-3.0.0~2217 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b3fa58fab97fee1ae3f9afa295b7929900db3252;p=bacula%2Fbacula ebl fix add_media feature detect pool from pool argument or media in run_job_mod git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5968 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 7d221eb11d..742f80fc38 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -3870,6 +3870,7 @@ sub add_media my $cmd; if ($arg->{nb} > 0) { + $arg->{offset} = $arg->{offset}?$arg->{offset}:1; $cmd = "add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n$arg->{nb}\n$arg->{media}\n$arg->{offset}\n"; } else { $cmd = "add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n0\n$arg->{media}\n"; @@ -4113,7 +4114,20 @@ sub run_job_mod my $info = $b->send_cmd("show job=\"$job\""); my $attr = $self->run_parse_job($info); - my $arg = $self->get_form('pool', 'level', 'client', 'fileset', 'storage'); + my $arg = $self->get_form(qw/pool level client fileset storage media/); + + if (!$arg->{pool} and $arg->{media}) { + my $r = $self->dbh_selectrow_hashref(" +SELECT Pool.Name AS name + FROM Media JOIN Pool USING (PoolId) + WHERE Media.VolumeName = '$arg->{media}' + AND Pool.Name != 'Scratch' +"); + if ($r) { + $arg->{pool} = $r->{name}; + } + } + my %job_opt = (%$attr, %$arg); my $jobs = [ map {{ name => $_ }} $b->list_job() ]; diff --git a/gui/bweb/tpl/add_media.tpl b/gui/bweb/tpl/add_media.tpl index 492c5d4887..3c455f2242 100644 --- a/gui/bweb/tpl/add_media.tpl +++ b/gui/bweb/tpl/add_media.tpl @@ -27,13 +27,13 @@ Starting number : - + Name : - + @@ -35,6 +36,7 @@ chkbox.value = ''; chkbox.onclick = function() { document.form1.level.value = ''; document.form1.pool.value = ''; + document.form1.media.value = ''; } ; data.push( new Array(