Support substring searches
[infodrom.org/service.infodrom.org] / src / InfoCon / buch / infocon
index 08f69e6..931fdc7 100755 (executable)
@@ -1,7 +1,7 @@
 #! /usr/bin/perl
 
 #  infocon - Administration tool for InfoCon
 #! /usr/bin/perl
 
 #  infocon - Administration tool for InfoCon
-#  Copyright (c) 1998-2003,2005-8,10,11,12,14,15,16  Martin Schulze <joey@infodrom.org>
+#  Copyright (c) 1998-2003,2005-8,10,11,12,14,15,16,18  Martin Schulze <joey@infodrom.org>
 #
 #  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
 #
 #  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_verbose = 0;
 my $opt_year = 0;
 my $opt_date = undef;
+my $opt_grep = undef;
 my $opt_direction = undef;
 
 sub sdate
 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";
     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 "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 <nr> | --unpay <nr>\n";
     print "  --buchung-hidden\n";
     print "  --date [yyyy-mm-dd|dd.mm.] (for --pay)\n";
     print "  --pay <nr> | --unpay <nr>\n";
@@ -578,6 +584,7 @@ sub usage
     print "    --all|-a\n";
     print "    --csv\n";
     print "    --verbose|-v\n";
     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";
     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,
     '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,
     'mailto:s' => \$data{mailto},
     'all' => \$opt_all,
     'csv' => \$opt_csv,