diff options
author | cos <cos> | 2015-02-05 21:53:15 +0100 |
---|---|---|
committer | cos <cos> | 2015-02-05 21:53:15 +0100 |
commit | 9db2116061714eb2f654f7683ded5390533a03a2 (patch) | |
tree | da05fb32f4800a6b6875d2f776c7fd2f318de057 | |
parent | 8640c0d3a7f3f6c26577cc26138db14f5f68364f (diff) | |
download | mat-9db2116061714eb2f654f7683ded5390533a03a2.zip |
Remove obsolete cmd_setstate
-rwxr-xr-x | mat | 35 |
1 files changed, 0 insertions, 35 deletions
@@ -202,38 +202,6 @@ sub cmd_inventory { printf "----\n%3d\n", $total; } -sub cmd_setstate { - my ( $date, $state ) = @_; - my $mealtype = "lunch"; - - if ($date =~ /^Mon|Tue|Wed|Thu|Fri|Sat|Sun/) { - my $wday; - $wday = 1 if ($date =~ /^Mon/); - $wday = 2 if ($date =~ /^Tue/); - $wday = 3 if ($date =~ /^Wed/); - $wday = 4 if ($date =~ /^Thu/); - $wday = 5 if ($date =~ /^Fri/); - $wday = 6 if ($date =~ /^Sat/); - $wday = 7 if ($date =~ /^Sun/); - - my $dt = DateTime->now(); - while ($dt->wday() != $wday) { - $dt->add(days => 1); - } - - $date = $dt->ymd(); - } - return unless $date =~ "^[0-9]{4}-[0-9]{2}-[0-9]{2}\$"; - - return -1 unless $state =~ "^frozen|ready|sourced|idea\$"; - if (1) { #FIXME Verify that entry exists ? - my $sql = "UPDATE plan SET state=".$db->quote($state)." WHERE date='$date';"; - $db->do($sql); - } - - return 0; -} - sub cmd_randmeal { my ( $date ) = @_; my $recipe_id = get_random_recipe(); @@ -501,7 +469,6 @@ sub cmd_help() { print "showrecipe <recipe_id>\n"; print "movemeal <source_date> <destination_date>\n"; print "setmeal <date> <mealtype> <meal_id>\n"; - print "setstate <date> <idea|sourced|frozen|ready>\n"; print "randmeal <date>\n"; print "showplan [days] [date]\n"; print "postpone <date> <gap>\n"; @@ -840,8 +807,6 @@ if ($ARGV[0]) { print "Command failed!\n" unless (cmd_movemeal($ARGV[1], $ARGV[2]) >= 0); } elsif ( $ARGV[0] eq "setmeal") { print "Command failed!\n" unless (cmd_setmeal($ARGV[1], $ARGV[2], $ARGV[3]) >= 0); - } elsif ( $ARGV[0] eq "setstate") { - print "Command failed!\n" unless (cmd_setstate($ARGV[1], $ARGV[2]) >= 0); } elsif ( $ARGV[0] eq "randmeal") { print "Command failed!\n" unless (cmd_randmeal($ARGV[1]) >= 0); } elsif ( $ARGV[0] eq "showplan") { |