init
This commit is contained in:
36
modules/EcmActions/dbpost.php
Normal file
36
modules/EcmActions/dbpost.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( '-1' );
|
||||
|
||||
if (! $_POST ['job'] || $_POST ['job'] == '')
|
||||
die ( '-1' );
|
||||
|
||||
switch ($_POST ['job']) {
|
||||
case 'getProductList' :
|
||||
getProductList ( $_POST ['id'] );
|
||||
break;
|
||||
}
|
||||
|
||||
function getProductList($id) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$result = array();
|
||||
$q = "SELECT b.id, b.code, b.name FROM ecmproductactions a, ecmproducts b WHERE a.ecmproduct_id = b.id AND a.ecmaction_id = '". $id ."' GROUP BY ecmproduct_id;";
|
||||
$rs = $db->query($q);
|
||||
if ($rs->num_rows > 0) {
|
||||
while ($return = $db->fetchByAssoc($rs)) {
|
||||
$row = array();
|
||||
$row2 = array();
|
||||
$row ['id'] = $return ['id'];
|
||||
$row ['name'] = $return ['name'];
|
||||
$row ['code'] = $return ['code'];
|
||||
$row2['code'] =$row;
|
||||
$row2['name'] = $row;
|
||||
$result [] = $row2;
|
||||
}
|
||||
} else {
|
||||
$result = null;
|
||||
}
|
||||
$json = json_encode($result);
|
||||
print $json;
|
||||
}
|
||||
Reference in New Issue
Block a user