Treat product database as user input.
This commit is contained in:
parent
ac1c7235f7
commit
c1db0fc1e9
2 changed files with 10 additions and 5 deletions
|
@ -22,8 +22,10 @@ sub command :Tab(market) {
|
|||
my ($username, $id, $seller, $space, $description) = @$fields;
|
||||
|
||||
next if $command ne $id;
|
||||
next if $space < 0;
|
||||
next if $seller < 0;
|
||||
|
||||
$username = parse_user($username) or next;
|
||||
$seller = parse_amount($seller) or next;
|
||||
$space = parse_amount($space) or next;
|
||||
|
||||
$cart->add(undef, -($seller + $space), $description);
|
||||
$cart->add($username, 0+$seller, "\$you bought $description")
|
||||
|
|
|
@ -20,10 +20,13 @@ sub command :Tab(edit) {
|
|||
chomp @$_ for @products;
|
||||
|
||||
for my $fields (@products) {
|
||||
next if $command ne $fields->[0];
|
||||
next if $fields->[1] < 0;
|
||||
my ($id, $price, $description) = @$fields;
|
||||
|
||||
$cart->add(undef, 0 - $fields->[1], $fields->[2]);
|
||||
next if $command ne $id;
|
||||
|
||||
$price = parse_amount($price) or next;
|
||||
|
||||
$cart->add(undef, -$price, $description);
|
||||
return ACCEPT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue