r3920 copy recent commits from maintenance
authorDenis Ovsienko <infrastation@yandex.ru>
Thu, 19 Aug 2010 11:51:22 +0000 (11:51 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Thu, 19 Aug 2010 11:51:22 +0000 (11:51 +0000)
ChangeLog
inc/database.php
inc/ophandlers.php

index e0ca3ed..a87b68c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+0.18.5
+       bugfix: attribute map editor was broken (#353)
 0.18.4 2010-07-13
        bugfix: a race condition could be triggered in permissions editor
        new feature: "any mode" of user port in VLAN switch template
index 90bf310..f0ea809 100644 (file)
@@ -839,6 +839,7 @@ function getResidentRacksData ($object_id = 0, $fetch_rackdata = TRUE)
 
 function commitAddPort ($object_id = 0, $port_name, $port_type_id, $port_label, $port_l2address)
 {
+       // FIXME: use InvalidRequestArgException and return nothing
        if (NULL === ($db_l2address = l2addressForDatabase ($port_l2address)))
                return "Invalid L2 address ${port_l2address}";
        global $dbxlink;
@@ -2278,6 +2279,7 @@ function getDatabaseVersion ()
        $result = usePreparedSelectBlade ('SELECT varvalue FROM Config WHERE varname = "DB_VERSION" and vartype = "string"');
        if ($result == NULL)
        {
+               // FIXME: this code is never executed, but an exception thrown instead
                global $dbxlink;
                $errorInfo = $dbxlink->errorInfo();
                if ($errorInfo[0] == '42S02') // ER_NO_SUCH_TABLE
index d7ae44e..47333d8 100644 (file)
@@ -655,12 +655,18 @@ function supplementAttrMap ()
        assertUIntArg ('objtype_id');
        $attrMap = getAttrMap();
        if ($attrMap[$_REQUEST['attr_id']]['type'] != 'dict')
-               $chapter_id = 'NULL';
+               $chapter_id = NULL;
        else
        {
-               assertUIntArg ('chapter_no'); // FIXME: this doesn't fail on 0 (ticket:272)
-               if (0 == ($chapter_id = $_REQUEST['chapter_no']))
+               try
+               {
+                       assertUIntArg ('chapter_no');
+               }
+               catch (InvalidRequestArgException $e)
+               {
                        return buildRedirectURL (__FUNCTION__, 'ERR1', array ('chapter not selected'));
+               }
+               $chapter_id = $_REQUEST['chapter_no'];
        }
        if (commitSupplementAttrMap ($_REQUEST['attr_id'], $_REQUEST['objtype_id'], $chapter_id) !== FALSE)
                return buildRedirectURL (__FUNCTION__, 'OK');