r3812 commitUpdatePort(): handle empty column value
authorDenis Ovsienko <infrastation@yandex.ru>
Fri, 11 Jun 2010 13:50:29 +0000 (13:50 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Fri, 11 Jun 2010 13:50:29 +0000 (13:50 +0000)
editPortForObject(): dismiss value quoting

inc/database.php
inc/ophandlers.php

index 5a6c555afd677b31e52bb7e589b83797896fde1a..5a07da6328b3739af80d458433db1ee80b877118 100644 (file)
@@ -906,7 +906,7 @@ function commitUpdatePort ($object_id, $port_id, $port_name, $port_type_id, $por
                        $port_name,
                        $port_type_id,
                        $port_label,
-                       $port_reservation_comment,
+                       mb_strlen ($port_reservation_comment) ? $port_reservation_comment : NULL,
                        ($db_l2address === '') ? NULL : $db_l2address,
                        $port_id,
                        $object_id
index 592a1ed5af64f4cb70c0ce856583a4cd218ebc52..3aefda2bb62339235ffc35b59281adf7a21d667c 100644 (file)
@@ -158,16 +158,13 @@ function editPortForObject ()
        assertUIntArg ('object_id');
        assertUIntArg ('port_id');
        assertUIntArg ('port_type_id');
+       assertStringArg ('reservation_comment', TRUE);
        // tolerate empty value now to produce custom informative message later
        assertStringArg ('name', TRUE);
        if (!strlen ($_REQUEST['name']))
                return buildRedirectURL (__FUNCTION__, 'ERR1');
 
-       if (isset ($_REQUEST['reservation_comment']) and strlen ($_REQUEST['reservation_comment']))
-               $port_rc = '"' . $_REQUEST['reservation_comment'] . '"';
-       else
-               $port_rc = 'NULL';
-       $error = commitUpdatePort ($_REQUEST['object_id'], $_REQUEST['port_id'], $_REQUEST['name'], $_REQUEST['port_type_id'], $_REQUEST['label'], $_REQUEST['l2address'], $port_rc);
+       $error = commitUpdatePort ($_REQUEST['object_id'], $_REQUEST['port_id'], $_REQUEST['name'], $_REQUEST['port_type_id'], $_REQUEST['label'], $_REQUEST['l2address'], $_REQUEST['reservation_comment']);
        if ($error != '')
                return buildRedirectURL (__FUNCTION__, 'ERR2', array ($error));
        else