From af44926c90fe3013192bc2edbdad7bd5c9dcd8d7 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Mon, 24 Dec 2018 17:00:45 +0100 Subject: [PATCH] Support substring searches --- src/InfoCon/buch/infocon | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/InfoCon/buch/infocon b/src/InfoCon/buch/infocon index 08f69e6..931fdc7 100755 --- a/src/InfoCon/buch/infocon +++ b/src/InfoCon/buch/infocon @@ -1,7 +1,7 @@ #! /usr/bin/perl # infocon - Administration tool for InfoCon -# Copyright (c) 1998-2003,2005-8,10,11,12,14,15,16 Martin Schulze +# Copyright (c) 1998-2003,2005-8,10,11,12,14,15,16,18 Martin Schulze # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,6 +41,7 @@ my $opt_csv = 0; my $opt_verbose = 0; my $opt_year = 0; my $opt_date = undef; +my $opt_grep = undef; my $opt_direction = undef; sub sdate @@ -194,6 +195,11 @@ sub sales_list } } + if ($opt_grep) { + $where .= " AND " if $where; + $where .= sprintf("description ILIKE '%%%s%%'", $opt_grep); + } + if ($where !~ /visible/) { $where .= " AND " if $where; $where .= "visible = 1"; @@ -568,7 +574,7 @@ sub usage print "infocon [options] [-h|--help] commands\n"; print " --buchung-category|-bc [category]\n"; print " --buchung-input|-bi\n"; - print " --buchung-unpaid\n"; + print " --buchung-unpaid|-bu\n"; print " --buchung-hidden\n"; print " --date [yyyy-mm-dd|dd.mm.] (for --pay)\n"; print " --pay | --unpay \n"; @@ -578,6 +584,7 @@ sub usage print " --all|-a\n"; print " --csv\n"; print " --verbose|-v\n"; + print " --grep|-g keyword\n"; print " --year|-y year\n"; print " --direction|--dir|-d in|out\n"; print " --dm\n"; @@ -606,6 +613,7 @@ my %options = ( 'year=i' => \$opt_year, 'date=s' => \$opt_date, 'direction|d=s' => \$opt_direction, + 'grep|g=s' => \$opt_grep, 'mailto:s' => \$data{mailto}, 'all' => \$opt_all, 'csv' => \$opt_csv, -- 2.20.1