fix PDOExceptions on mysql 5.7 with SQL_MODE contains ONLY_FULL_GROUP_BY
authorgithub138 <m.ehinger@ltur.de>
Tue, 12 Jul 2016 11:39:05 +0000 (13:39 +0200)
committergithub138 <m.ehinger@ltur.de>
Tue, 12 Jul 2016 11:47:28 +0000 (13:47 +0200)
LinkManagement/plugins/linkmgmt.php

index 0693c95..7bf9910 100644 (file)
@@ -4014,7 +4014,7 @@ function linkmgmt_findSparePorts($port_info, $filter, $linktype, $multilink = fa
 
        if($objectsonly)
        {
-               $query .= " remotePort.object_id, CONCAT(IFNULL(remoteObject.name, CONCAT('[',remoteObjectDictionary.dict_value,']')), ' (', count(remotePort.id), ')') as name";
+               $query .= " remoteObject.id, CONCAT(IFNULL(remoteObject.name, CONCAT('[',remoteObjectDictionary.dict_value,']')), ' (', count(remoteObject.id), ')') as name";
                $group .= " GROUP by remoteObject.id";
        }
        else
@@ -4070,7 +4070,9 @@ function linkmgmt_findSparePorts($port_info, $filter, $linktype, $multilink = fa
                /* exclude current port */
                $where .= " remotePort.id <> ?";
                $whereparams[] = $port_info['id'];
-               $order .= " ,remotePort.name";
+
+               if(! $objectsonly)
+                       $order .= " ,remotePort.name";
 
                /* add info to remoteport */
                $join .= " LEFT JOIN $linkinfotable as infolnk_a on remotePort.id = infolnk_a.porta";