Get rid of buildDataTableStructure.
This commit is contained in:
parent
a6cf090545
commit
3f5d947282
4 changed files with 28 additions and 26 deletions
|
|
@ -268,7 +268,7 @@ sub buildDataTableStructure {
|
|||
}
|
||||
$hash{records} = \@array;
|
||||
$hash{totalRecords} = $self->quickScalar('select found_rows()') + 0; ##Convert to numeric
|
||||
$hash{recordsReturned} = $sth->rows();
|
||||
$hash{recordsReturned} = $sth->rows()+0;
|
||||
$sth->finish;
|
||||
return %hash;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,10 +366,19 @@ sub www_getTaxesAsJson {
|
|||
}
|
||||
push(@placeholders, $startIndex, $numberOfResults);
|
||||
$sql .= ' order by country desc limit ?,?';
|
||||
my %results = $db->buildDataTableStructure($sql, \@placeholders);
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "desc";
|
||||
my %results = ();
|
||||
my @records = ();
|
||||
my $sth = $db->read($sql, \@placeholders);
|
||||
while (my $record = $sth->hashRef) {
|
||||
push(@records,$record);
|
||||
}
|
||||
$results{'recordsReturned'} = $sth->rows()+0;
|
||||
$sth->finish;
|
||||
$results{'records'} = \@records;
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "desc";
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -432,10 +432,19 @@ sub www_getTransactionsAsJson {
|
|||
}
|
||||
push(@placeholders, $startIndex, $numberOfResults);
|
||||
$sql .= ' order by dateOfPurchase desc limit ?,?';
|
||||
my %results = $db->buildDataTableStructure($sql, \@placeholders);
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "desc";
|
||||
my %results = ();
|
||||
my @records = ();
|
||||
my $sth = $db->read($sql, \@placeholders);
|
||||
while (my $record = $sth->hashRef) {
|
||||
push(@records,$record);
|
||||
}
|
||||
$results{'recordsReturned'} = $sth->rows()+0;
|
||||
$sth->finish;
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
|
||||
$results{'records'} = \@records;
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "desc";
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue