Make "Not" work for vlan number search in Device Ports

This commit is contained in:
Oliver Gorwits
2013-12-27 22:37:41 +00:00
parent 9dbcc1f4a3
commit 0122d5728b
2 changed files with 18 additions and 6 deletions

View File

@@ -22,6 +22,7 @@
* 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
* Make "Not" option work for vlan number search in Device Ports
2.020002 - 2013-12-11

View File

@@ -21,12 +21,23 @@ get '/ajax/content/device/ports' => require_login sub {
my $f = param('f');
if ($f) {
if ($f =~ m/^\d+$/) {
if (param('invert')) {
$set = $set->search({
'me.vlan' => { '!=' => $f },
'port_vlans_tagged.vlan' => [
'-or' => { '!=' => $f }, { '=' => undef }
],
}, { join => 'port_vlans_tagged' });
}
else {
$set = $set->search({
-or => {
'me.vlan' => $f,
'port_vlans_tagged.vlan' => $f,
},
}, { join => 'port_vlans_tagged' });
}
return unless $set->count;
}
else {