|
@@ -91,7 +91,6 @@ class report {
|
|
|
|
|
|
|
|
$sqlWhere_party_id = '';
|
|
$sqlWhere_party_id = '';
|
|
|
$sqlWhere_group_name = '';
|
|
$sqlWhere_group_name = '';
|
|
|
- $systemAccountsqlWhere = " OR system_account IS NULL OR array_length(system_account, 1) = 0 OR '".common::check_input(_getLoginName())."' = any(system_account)";
|
|
|
|
|
if(_isCustomerLogin()){
|
|
if(_isCustomerLogin()){
|
|
|
$ocean_contact_id = _getCompanyContactHandNew($_SESSION["ONLINE_USER"]);
|
|
$ocean_contact_id = _getCompanyContactHandNew($_SESSION["ONLINE_USER"]);
|
|
|
$air_contact_id = _getAirContactID('public');
|
|
$air_contact_id = _getAirContactID('public');
|
|
@@ -125,22 +124,23 @@ class report {
|
|
|
$company = strtolower($company);
|
|
$company = strtolower($company);
|
|
|
$aa = explode(";", $company);
|
|
$aa = explode(";", $company);
|
|
|
|
|
|
|
|
- if(!empty($aa)){
|
|
|
|
|
- $escaped_company = array();
|
|
|
|
|
- foreach ($aa as $value) {
|
|
|
|
|
- $value = trim($value);
|
|
|
|
|
- if (empty($value))
|
|
|
|
|
- continue;
|
|
|
|
|
- $escaped_company[] = "'" . common::check_input($value) . "'";
|
|
|
|
|
- }
|
|
|
|
|
- if(empty($escaped_company)){
|
|
|
|
|
|
|
+ $escaped_company = array();
|
|
|
|
|
+ foreach ($aa as $value) {
|
|
|
|
|
+ $value = trim($value);
|
|
|
|
|
+ if (empty($value))
|
|
|
|
|
+ continue;
|
|
|
|
|
+ $escaped_company[] = "'" . common::check_input($value) . "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if(empty($escaped_company)){
|
|
|
$escaped_company[] = "'" . common::check_input('default_value_that_does_not_exist') . "'";
|
|
$escaped_company[] = "'" . common::check_input('default_value_that_does_not_exist') . "'";
|
|
|
- }
|
|
|
|
|
- $array_str = 'ARRAY[' . implode(',', $escaped_company) . ']';
|
|
|
|
|
- $sqlWhere_group_name = " OR group_names && $array_str";
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $array_str = 'ARRAY[' . implode(',', $escaped_company) . ']';
|
|
|
|
|
+ $sqlWhere_group_name = " OR group_names && $array_str";
|
|
|
|
|
+
|
|
|
|
|
+ $systemAccountsqlWhere = " OR '".common::check_input(_getLoginName())."' = any(system_account)";
|
|
|
$sqlWhere .= " and ( access_type = 'All Users' ".$sqlWhere_party_id . " ".$sqlWhere_group_name ." ".$systemAccountsqlWhere .")";
|
|
$sqlWhere .= " and ( access_type = 'All Users' ".$sqlWhere_party_id . " ".$sqlWhere_group_name ." ".$systemAccountsqlWhere .")";
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ $systemAccountsqlWhere = " OR system_account IS NULL OR array_length(system_account, 1) = 0 OR '".common::check_input(_getLoginName())."' = any(system_account)";
|
|
|
$sqlWhere .= " and ( 1<>1 ".$systemAccountsqlWhere .")";
|
|
$sqlWhere .= " and ( 1<>1 ".$systemAccountsqlWhere .")";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -388,7 +388,6 @@ class report {
|
|
|
|
|
|
|
|
$sqlWhere_party_id = '';
|
|
$sqlWhere_party_id = '';
|
|
|
$sqlWhere_group_name = '';
|
|
$sqlWhere_group_name = '';
|
|
|
- $systemAccountsqlWhere = " OR system_account IS NULL OR array_length(system_account, 1) = 0 OR '".common::check_input(_getLoginName())."' = any(system_account)";
|
|
|
|
|
if(_isCustomerLogin()){
|
|
if(_isCustomerLogin()){
|
|
|
$ocean_contact_id = _getCompanyContactHandNew($_SESSION["ONLINE_USER"]);
|
|
$ocean_contact_id = _getCompanyContactHandNew($_SESSION["ONLINE_USER"]);
|
|
|
$air_contact_id = _getAirContactID('public');
|
|
$air_contact_id = _getAirContactID('public');
|
|
@@ -422,22 +421,23 @@ class report {
|
|
|
$company = strtolower($company);
|
|
$company = strtolower($company);
|
|
|
$aa = explode(";", $company);
|
|
$aa = explode(";", $company);
|
|
|
|
|
|
|
|
- if(!empty($aa)){
|
|
|
|
|
- $escaped_company = array();
|
|
|
|
|
- foreach ($aa as $value) {
|
|
|
|
|
- $value = trim($value);
|
|
|
|
|
- if (empty($value))
|
|
|
|
|
- continue;
|
|
|
|
|
- $escaped_company[] = "'" . common::check_input($value) . "'";
|
|
|
|
|
- }
|
|
|
|
|
- if(empty($escaped_company)){
|
|
|
|
|
|
|
+ $escaped_company = array();
|
|
|
|
|
+ foreach ($aa as $value) {
|
|
|
|
|
+ $value = trim($value);
|
|
|
|
|
+ if (empty($value))
|
|
|
|
|
+ continue;
|
|
|
|
|
+ $escaped_company[] = "'" . common::check_input($value) . "'";
|
|
|
|
|
+ }
|
|
|
|
|
+ if(empty($escaped_company)){
|
|
|
$escaped_company[] = "'" . common::check_input('default_value_that_does_not_exist') . "'";
|
|
$escaped_company[] = "'" . common::check_input('default_value_that_does_not_exist') . "'";
|
|
|
- }
|
|
|
|
|
- $array_str = 'ARRAY[' . implode(',', $escaped_company) . ']';
|
|
|
|
|
- $sqlWhere_group_name = " OR group_names && $array_str";
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ $array_str = 'ARRAY[' . implode(',', $escaped_company) . ']';
|
|
|
|
|
+ $sqlWhere_group_name = " OR group_names && $array_str";
|
|
|
|
|
+
|
|
|
|
|
+ $systemAccountsqlWhere = " OR '".common::check_input(_getLoginName())."' = any(system_account)";
|
|
|
$sqlWhere .= " and ( access_type = 'All Users' ".$sqlWhere_party_id . " ".$sqlWhere_group_name ." ".$systemAccountsqlWhere .")";
|
|
$sqlWhere .= " and ( access_type = 'All Users' ".$sqlWhere_party_id . " ".$sqlWhere_group_name ." ".$systemAccountsqlWhere .")";
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ $systemAccountsqlWhere = " OR system_account IS NULL OR array_length(system_account, 1) = 0 OR '".common::check_input(_getLoginName())."' = any(system_account)";
|
|
|
$sqlWhere .= " and ( 1<>1 ".$systemAccountsqlWhere .")";
|
|
$sqlWhere .= " and ( 1<>1 ".$systemAccountsqlWhere .")";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -446,6 +446,7 @@ class report {
|
|
|
if ($rc == - 1) {
|
|
if ($rc == - 1) {
|
|
|
$sql = "select count(*) from public.kln_report_template where " .$sqlWhere;
|
|
$sql = "select count(*) from public.kln_report_template where " .$sqlWhere;
|
|
|
$rc = common::excuteOneSql($sql);
|
|
$rc = common::excuteOneSql($sql);
|
|
|
|
|
+ error_log($sql);
|
|
|
}
|
|
}
|
|
|
$tp = ceil($rc / $ps);
|
|
$tp = ceil($rc / $ps);
|
|
|
if ($rc > 0) {
|
|
if ($rc > 0) {
|