forked from science-ation/science-ation
Dont use JSON anymore, we really dont need the entire report object, we just need the 3 fields type, stock and desc, so return them on their own line, so we can just split on \n
This commit is contained in:
parent
f17f07ff94
commit
515a92dda7
@ -32,8 +32,14 @@
|
|||||||
|
|
||||||
if($reports_id > 0) {
|
if($reports_id > 0) {
|
||||||
$report = report_load($reports_id);
|
$report = report_load($reports_id);
|
||||||
echo json_encode($report);
|
echo $report['type']."\n";
|
||||||
|
echo $report['stock']."\n";
|
||||||
|
echo $report['desc']."\n";
|
||||||
|
// echo json_encode($report);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo json_encode(array());
|
{
|
||||||
|
echo "\n\n\n";
|
||||||
|
// echo json_encode(array());
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -239,6 +239,7 @@
|
|||||||
document.getElementById('reporttypecustom').style.display='none';
|
document.getElementById('reporttypecustom').style.display='none';
|
||||||
document.getElementById('reportstockcustom').style.display='none';
|
document.getElementById('reportstockcustom').style.display='none';
|
||||||
|
|
||||||
|
/* dont use JSON anymore since it adds an extra PHP-side requirement, we'll just get a 3 line response with one thing per line that we need
|
||||||
var obj=eval('('+http.responseText+')');
|
var obj=eval('('+http.responseText+')');
|
||||||
if(obj['option']['type']) {
|
if(obj['option']['type']) {
|
||||||
for(i=0;i<document.addreport.type.options.length;i++) {
|
for(i=0;i<document.addreport.type.options.length;i++) {
|
||||||
@ -260,6 +261,32 @@
|
|||||||
|
|
||||||
if(obj['desc'])
|
if(obj['desc'])
|
||||||
document.addreport.comment.value=obj['desc'];
|
document.addreport.comment.value=obj['desc'];
|
||||||
|
*/
|
||||||
|
var lines=http.responseText.split('\n');
|
||||||
|
var reportType=lines[0];
|
||||||
|
var reportStock=lines[1];
|
||||||
|
var reportDesc=lines[2];
|
||||||
|
|
||||||
|
if(reportType) {
|
||||||
|
for(i=0;i<document.addreport.type.options.length;i++) {
|
||||||
|
if(document.addreport.type.options[i].value==reportType)
|
||||||
|
document.addreport.type.selectedIndex=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
document.addreport.type.selectedIndex=0;
|
||||||
|
|
||||||
|
if(reportStock) {
|
||||||
|
for(i=0;i<document.addreport.stock.options.length;i++) {
|
||||||
|
if(document.addreport.stock.options[i].value==reportStock)
|
||||||
|
document.addreport.stock.selectedIndex=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
document.addreport.stock.selectedIndex=0;
|
||||||
|
|
||||||
|
if(reportDesc);
|
||||||
|
document.addreport.comment.value=reportDesc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user