Re: disabling wildcard in AR reports

Dieter Simader <[email protected]> Wed, 24 May 2006 12:50:19 -0600 (MDT)
Newsgroups gmane.comp.web.sql-ledger.user
Message-ID <[email protected]>
On Wed, 24 May 2006, Donald Baud wrote:

> I think Dieter meant that there is no elegance when
> the patch removes the wild cards after they were added

correct.

> by a previous code.  The right way would have been to
> change the behavior at the time the wild cards are
> being added.

And this you can only do by changing the 'like' function. Modifying AA.pm
only changes it for a name search so if you want to say search for an
invoice number or part number the proper way is to modify the 'like'
function in Form.pm


sub like {
  my ($self, $str) = @_;

  if ($str !~ /(%|_)/) {
    if ($str =~ /(^").*("$)/) {
      $str =~ s/(^"|"$)//g;
    } else {
      $str = "%$str%";
    }
  }

  $str =~ s/'/''/g;
  $str;

}


Now this will leave quoted strings alone, remove the quotes and do an
exact lower case search. You can also do searches for such things as for
'3" Bolt' and it works across the board, not just for a name.

-- 
Dieter Simader    http://www.sql-ledger.com   (780) 472-8161
DWS Systems Inc.     Accounting Software       Fax: 478-5281
============ On a clear disk you can seek forever ==========




_______________________________________________
sql-ledger-users mailing list
sql-ledger-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/sql-ledger-users