]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/mediaedit/mediaedit.cpp
Make bad Storage check in is_on_same_storage non-fatal
[bacula/bacula] / bacula / src / qt-console / mediaedit / mediaedit.cpp
index a31ae978116aebc5e67a414c9f63a4aee03d1bab..3e3b6d03bc0a85cd73051f979e7e2264e5182ae2 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 /*
  * A constructor 
  */
-MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId)
+MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) 
+  : Pages()
 {
    setupUi(this);
    pgInitialize(tr("Media Edit"), parentWidget);
    QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
    thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge-edit.png")));
-   m_closeable = true;
    dockPage();
    setCurrent();
 
@@ -91,10 +91,15 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId)
       query += field + " AS " + AsList[i];
       i += 1;
    }
+
+   QString where = " WHERE Media.VolumeName = '" + mediaId + "' ";
+   if (mediaId.contains(QRegExp("^[0-9]+$"))) {
+      where = " WHERE Media.MediaId=" + mediaId;
+   }
    query += " FROM Media"
             " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
             " LEFT OUTER JOIN Pool AS Pol ON (Media.RecyclePoolId=Pol.PoolId)"
-            " WHERE Media.MediaId='" + mediaId + "'";
+            + where;
 
    if (mainWin->m_sqlDebug) {
       Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data());