From 9dbcc1f4a3362cdceb3235f092702e6149dec10b Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Fri, 27 Dec 2013 22:07:22 +0000 Subject: [PATCH] Search by VLAN name now works --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 674fe404..3620ea35 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -21,6 +21,7 @@ * Fix form reset icon on ports tab when using custom path (Daniel Tuecks) * Don't store failed SNMP community in the database * [#51] Support DBD::Pg default for "host" field as local socket + * [#58] Search by VLAN name now works 2.020002 - 2013-12-11 diff --git a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm index eabaad1c..bcfee23b 100644 --- a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm +++ b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm @@ -352,8 +352,9 @@ sub carrying_vlan { die "vlan number required for carrying_vlan\n" if ref {} ne ref $cond or !exists $cond->{vlan}; - $cond->{'vlans.vlan'} = $cond->{vlan}; - $cond->{'port_vlans.vlan'} = delete $cond->{vlan}; + $cond->{'-and'} ||= []; + push @{$cond->{'-and'}}, 'vlans.vlan' => $cond->{vlan}; + push @{$cond->{'-and'}}, 'port_vlans.vlan' => delete $cond->{vlan}; return $rs ->search_rs($cond, @@ -402,7 +403,7 @@ sub carrying_vlan_name { die "vlan name required for carrying_vlan_name\n" if ref {} ne ref $cond or !exists $cond->{name}; - $cond->{'vlans.description'} = { '-ilike' => $cond->{name} }; + $cond->{'vlans.description'} = { '-ilike' => delete $cond->{name} }; return $rs ->search_rs({}, {