Commit 8734d309 authored by Nigel Kukard's avatar Nigel Kukard

Add ability to change tax type ID

parent de895105
......@@ -242,6 +242,7 @@ sub update
$detail->{'GLAssetAccountNumber'} = $parms->{'assetaccount'};
$detail->{'GLExpenseAccountNumber'} = $parms->{'expenseaccount'};
$detail->{'SellPrice'} = $parms->{'sellprice'};
$detail->{'TaxTypeID'} = $parms->{'taxtype'};
$detail->{'Unit'} = $parms->{'unit'};
$detail->{'Discountable'} = $parms->{'discoutable'};
my $res = soapCall($OUT,"wiaflos/server/api/Inventory","updateInventoryItem",$detail);
......
......@@ -1209,6 +1209,7 @@ sub removeInventoryItem
# GLAssetAccountNumber - GL asset account
# GLExpenseAccountNumber - GL expense account
# SellPrice - Selling price
# TaxTypeID - Tax type ID
# Unit - Unit
# Discountable - Either service is discountable or not
sub updateInventoryItem
......@@ -1295,6 +1296,23 @@ sub updateInventoryItem
if (defined($data->{'SellPrice'})) {
push(@updates,sprintf('SellPrice = %s',DBQuote($data->{'SellPrice'})));
}
# Check if TaxTypeID was specified
if (defined($data->{'TaxTypeID'})) {
# Check if tax type exists
if ((my $res = wiaflos::server::core::Tax::taxTypeIDExists($data->{'TaxTypeID'})) != 1) {
# If not exist, err
if ($res == 0) {
setError("Tax type '".$data->{'TaxTypeId'}."' does not exist");
return ERR_NOTFOUND;
}
# else err with result & set error
setError(wiaflos::server::core::Tax::Error());
return $res;
}
push(@updates,sprintf('TaxTypeID = %s',DBQuote($data->{'TaxTypeID'})));
}
if (defined($data->{'Unit'})) {
push(@updates,sprintf('Unit = %s',DBQuote($data->{'Unit'})));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment