Add php files
This commit is contained in:
29
modules/EcmSyntheticAccounts/helper.php
Executable file
29
modules/EcmSyntheticAccounts/helper.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
if (!defined('sugarEntry') || !sugarEntry) {
|
||||
die('-1');
|
||||
}
|
||||
if (!$_POST ['job'] || $_POST ['job'] == '') {
|
||||
die('-1');
|
||||
}
|
||||
switch ($_POST ['job']) {
|
||||
case 'checkCode' :
|
||||
checkCode ($_POST ['kod']);
|
||||
break;
|
||||
}
|
||||
|
||||
function checkCode($code) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$query = "SELECT count(id) as c FROM ecmsyntheticaccounts WHERE account_code='" . $code."'";
|
||||
$r = $db->fetchByAssoc ( $db->query ( $query ) );
|
||||
if (! $r || ! $r ['c'] || $r ['c'] == '')
|
||||
$count = 0;
|
||||
else
|
||||
$count = intval ( $r ['c'] );
|
||||
|
||||
if($count > 0 ){
|
||||
$json = json_encode (true);
|
||||
}else{
|
||||
$json = json_encode (false);
|
||||
}
|
||||
print $json;
|
||||
}
|
||||
Reference in New Issue
Block a user