Ask YUI to parse strings as numbers in the Tax module.
This commit is contained in:
parent
0b516612b9
commit
b9af7f97ac
1 changed files with 15 additions and 5 deletions
|
|
@ -434,13 +434,12 @@ sub www_getTaxesAsJson {
|
|||
my @records = ();
|
||||
my $sth = $db->read($sql, \@placeholders);
|
||||
while (my $record = $sth->hashRef) {
|
||||
$record->{taxRate} += 0; ##Convert to numeric
|
||||
push(@records,$record);
|
||||
}
|
||||
$results{'recordsReturned'} = $sth->rows()+0;
|
||||
$results{'recordsReturned'} = $sth->rows();
|
||||
$sth->finish;
|
||||
$results{'records'} = \@records;
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()'); ##Convert to numeric
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "desc";
|
||||
|
|
@ -552,8 +551,19 @@ EODIV
|
|||
mySource.responseType = DataSource.TYPE_JSON;
|
||||
mySource.responseSchema = {
|
||||
resultsList : 'records',
|
||||
totalRecords: 'totalRecords',
|
||||
fields : [ 'taxId', 'country', 'state', 'city', 'code', 'taxRate']
|
||||
fields : [
|
||||
{key:"country", parser:YAHOO.util.DataSource.parseString},
|
||||
{key:"state", parser:YAHOO.util.DataSource.parseString},
|
||||
{key:"city", parser:YAHOO.util.DataSource.parseString},
|
||||
{key:"code", parser:YAHOO.util.DataSource.parseString},
|
||||
{key:"taxRate", parser:YAHOO.util.DataSource.parseNumber},
|
||||
{key:"taxId", parser:YAHOO.util.DataSource.parseString}
|
||||
],
|
||||
metaFields : [
|
||||
'startIndex', 'sort', 'dir',
|
||||
{key:"recordsReturned", parser:YAHOO.util.DataSource.parseNumber},
|
||||
{key:"totalRecords", parser:YAHOO.util.DataSource.parseNumber}
|
||||
]
|
||||
};
|
||||
EODSURL
|
||||
$output .= <<STOP;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue