]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl update label barcodes function
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 5 Jul 2007 14:43:33 +0000 (14:43 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 5 Jul 2007 14:43:33 +0000 (14:43 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5123 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/lib/Bweb.pm

index 85d34144311a52daec3b204ed7e7c4d25cb96015..be13e0fa14fd40532b8e48c3f80f5f4ca1a89ecf 100644 (file)
@@ -3337,36 +3337,37 @@ sub label_barcodes
     }
 
     my $slots = '';
+    my $slots_sql = '';
     my $t = 300 ;
     if ($arg->{slots}) {
        $slots = join(",", @{ $arg->{slots} });
+       $slots_sql = " AND Slot IN ($slots) ";
        $t += 60*scalar( @{ $arg->{slots} }) ;
     }
 
-    my $b = new Bconsole(pref => $self->{info}, timeout => $t,log_stdout => 1);
-    print "<h1>This command can take long time, be patient...</h1>";
-    print "<pre>" ;
-    $b->label_barcodes(storage => $storage,
-                      drive => $arg->{drive},
-                      pool  => 'Scratch',
-                      slots => $slots) ;
-    $b->close();
-    print "</pre>";
-
     $self->dbh_do("
   UPDATE Media 
        SET LocationId =   (SELECT LocationId 
                              FROM Location 
                             WHERE Location = '$arg->{ach}'),
 
-           RecyclePoolId = PoolId
-
-     WHERE Media.PoolId = (SELECT PoolId 
+           RecyclePoolId = (SELECT PoolId 
                              FROM Pool
                             WHERE Name = 'Scratch')
-       AND (LocationId = 0 OR LocationId IS NULL)
+
+     WHERE (LocationId = 0 OR LocationId IS NULL)
+       $slots_sql
 ");
 
+    my $b = new Bconsole(pref => $self->{info}, timeout => $t,log_stdout => 1);
+    print "<h1>This command can take long time, be patient...</h1>";
+    print "<pre>" ;
+    $b->label_barcodes(storage => $storage,
+                      drive => $arg->{drive},
+                      pool  => 'Scratch',
+                      slots => $slots) ;
+    $b->close();
+    print "</pre>";
 }
 
 sub purge