From 16b42dab0e59d79aae6014c0b75ab16eab98f6c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C5=82awomir=20Paszkiewicz?= Date: Sat, 9 Apr 2011 10:04:37 +0000 Subject: [PATCH] - applied upstream Changed files: lms-promotionlist.php.patch -> 1.2 lms-quicksearch.php.patch -> 1.2 --- lms-promotionlist.php.patch | 19 ------- lms-quicksearch.php.patch | 99 ------------------------------------- 2 files changed, 118 deletions(-) delete mode 100644 lms-promotionlist.php.patch delete mode 100644 lms-quicksearch.php.patch diff --git a/lms-promotionlist.php.patch b/lms-promotionlist.php.patch deleted file mode 100644 index 15ef977..0000000 --- a/lms-promotionlist.php.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- modules/promotionlist.php 2011/03/02 10:31:05 1.1 -+++ modules/promotionlist.php 2011/03/21 07:57:57 1.2 -@@ -21,14 +21,14 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - * -- * $Id$ -+ * $Id$ - */ - - $layout['pagetitle'] = trans('Promotions List'); - - $promolist = $DB->GetAll('SELECT p.id, p.name, p.description, disabled, - (SELECT COUNT(*) FROM promotionschemas -- WHERE p.id = promotionid) AS schemas, -+ WHERE p.id = promotionid) AS scs, - (SELECT COUNT(DISTINCT a.tariffid) - FROM promotionassignments a - JOIN promotionschemas s ON (s.id = a.promotionschemaid) diff --git a/lms-quicksearch.php.patch b/lms-quicksearch.php.patch deleted file mode 100644 index c234ef1..0000000 --- a/lms-quicksearch.php.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff -ur lms/modules/quicksearch.php lms.new//modules/quicksearch.php ---- lms/modules/quicksearch.php 2011-03-18 09:59:24.000000000 +0100 -+++ lms.new//modules/quicksearch.php 2011-03-29 20:41:29.772258200 +0200 -@@ -1,7 +1,7 @@ - GetAll('SELECT id, email, address, post_address, deleted, -+ $candidates = $DB->GetAll('SELECT id, email, address, post_name, post_address, deleted, - '.$DB->Concat('UPPER(lastname)',"' '",'name').' AS username - FROM customersview - WHERE '.(preg_match('/^[0-9]+$/', $search) ? 'id = '.intval($search).' OR ' : '').' - LOWER('.$DB->Concat('lastname',"' '",'name').') ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(address) ?LIKE? LOWER(\'%'.$search.'%\') -+ OR LOWER(post_name) ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(post_address) ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(email) ?LIKE? LOWER(\'%'.$search.'%\') - ORDER by deleted, username, email, address -@@ -105,6 +106,10 @@ - $descriptions[$row['id']] = escape_js(trans('Address:').' '.$row['address']); - continue; - } -+ else if (preg_match("~$search~i",$row['post_name'])) { -+ $descriptions[$row['id']] = escape_js(trans('Name:').' '.$row['post_name']); -+ continue; -+ } - else if (preg_match("~$search~i",$row['post_address'])) { - $descriptions[$row['id']] = escape_js(trans('Address:').' '.$row['post_address']); - continue; -@@ -156,20 +161,37 @@ - case 'node': - if(isset($_GET['ajax'])) // support for AutoSuggest - { -- $candidates = $DB->GetAll('SELECT n.id, n.name, INET_NTOA(ipaddr) as ip, -- INET_NTOA(ipaddr_pub) AS ip_pub, mac -- FROM vnodes n -- WHERE ('.(preg_match('/^[0-9]+$/',$search) ? 'n.id = '.intval($search).' OR ' : '').' -- LOWER(n.name) ?LIKE? LOWER(\'%'.$search.'%\') -- OR INET_NTOA(ipaddr) ?LIKE? \'%'.$search.'%\' -- OR INET_NTOA(ipaddr_pub) ?LIKE? \'%'.$search.'%\' -- OR LOWER(mac) ?LIKE? LOWER(\'%'.macformat($search).'%\') -- ) -- AND NOT EXISTS ( -- SELECT 1 FROM customerassignments a -- JOIN excludedgroups e ON (a.customergroupid = e.customergroupid) -- WHERE e.userid = lms_current_user() AND a.customerid = n.ownerid) -- ORDER BY n.name LIMIT 15'); -+ // Build different query for each database engine, -+ // MySQL is slow here when vnodes view is used -+ if ($CONFIG['database']['type'] == 'postgres') -+ $sql_query = 'SELECT n.id, n.name, INET_NTOA(ipaddr) as ip, -+ INET_NTOA(ipaddr_pub) AS ip_pub, mac -+ FROM vnodes n -+ WHERE %where -+ ORDER BY n.name LIMIT 15'; -+ else -+ $sql_query = 'SELECT n.id, n.name, INET_NTOA(ipaddr) as ip, -+ INET_NTOA(ipaddr_pub) AS ip_pub, mac -+ FROM nodes n -+ JOIN ( -+ SELECT nodeid, GROUP_CONCAT(mac SEPARATOR \',\') AS mac -+ FROM macs -+ GROUP BY nodeid -+ ) m ON (n.id = m.nodeid) -+ WHERE %where -+ ORDER BY n.name LIMIT 15'; -+ -+ $sql_where = '('.(preg_match('/^[0-9]+$/',$search) ? 'n.id = '.intval($search).' OR ' : '').' -+ LOWER(n.name) ?LIKE? LOWER(\'%'.$search.'%\') -+ OR INET_NTOA(ipaddr) ?LIKE? \'%'.$search.'%\' -+ OR INET_NTOA(ipaddr_pub) ?LIKE? \'%'.$search.'%\' -+ OR LOWER(mac) ?LIKE? LOWER(\'%'.macformat($search).'%\')) -+ AND NOT EXISTS ( -+ SELECT 1 FROM customerassignments a -+ JOIN excludedgroups e ON (a.customergroupid = e.customergroupid) -+ WHERE e.userid = lms_current_user() AND a.customerid = n.ownerid)'; -+ -+ $candidates = $DB->GetAll(str_replace('%where', $sql_where, $sql_query)); - - $eglible=array(); $actions=array(); $descriptions=array(); - if ($candidates) -- 2.44.0