From: Moritz Bunkus Date: Mon, 5 Aug 2013 08:22:35 +0000 (+0200) Subject: ParseFilter: neuer Operator 'eq_ignore_empty' X-Git-Tag: release-3.1.0beta1~106 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fe546cb027a1604ce2ba0f93b1bd241794fb66e4;p=kivitendo-erp.git ParseFilter: neuer Operator 'eq_ignore_empty' Ignoriert den Filter, wenn er leer ist. Andernfalls wird mit = verglichen. --- diff --git a/SL/Controller/Helper/ParseFilter.pm b/SL/Controller/Helper/ParseFilter.pm index 1d0515cc8..db5940843 100644 --- a/SL/Controller/Helper/ParseFilter.pm +++ b/SL/Controller/Helper/ParseFilter.pm @@ -22,6 +22,7 @@ my %filters = ( my %methods = ( enable => sub { ;;;; }, + eq_ignore_empty => sub { ($_[0] // '') eq '' ? () : +{ eq => $_[0] } }, map { # since $_ is an alias it can't be used in a closure. even "".$_ or "$_" # does not work, we need a real copy. @@ -383,6 +384,11 @@ Adds "%" at the end of the string. Adds "% .. %" around the search string. +=item eq_ignore_empty + +Ignores this item if it's empty. Otherwise compares it with the +standard SQL C<=> operator. + =back =head2 METHODS (leading with ::)