include.ini.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <?php
  2. if (extension_loaded('zlib')) {
  3. ini_set('zlib.output_compression', 'On');
  4. ini_set('zlib.output_compression_level', '9');
  5. }
  6. if (!empty($_REQUEST['sessionid'])) {
  7. session_id($_REQUEST['sessionid']);
  8. }
  9. error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
  10. error_reporting(0);
  11. session_start();
  12. ini_set("magic_quotes_runtime", 0);
  13. define('IN_ONLINE', TRUE);
  14. define('DS', DIRECTORY_SEPARATOR);
  15. define('WEB_ROOT', str_replace(DS, '/', str_replace(str_replace("/", DS, $_SERVER['DOCUMENT_ROOT']), '', realpath(dirname(__FILE__)))));
  16. define('ONLINE_ROOT', realpath(dirname(__FILE__)) . DS);
  17. define('ADODB_PATH', ONLINE_ROOT . 'libs' . DS . 'ADOdb-5.20.17' . DS);
  18. define('C_PATH', ONLINE_ROOT . 'service' . DS);
  19. define('FILE_UPLOAD_PAHT', "upload" . DS);
  20. // define('DOCUMENT_AIR_UPLOAD_PATH', "D:" . DS . "DOC_AIR" . DS);
  21. // define('DOCUMENT_OCEAN_UPLOAD_PATH', "D:" . DS . "DOC" . DS);
  22. // define('DOCUMENT_SFSAIR_UPLOAD_PATH', "D:" . DS . "DOC_AIR" . DS);
  23. // define('DOCUMENT_SFSOCEAN_UPLOAD_PATH', "D:" . DS . "DOC" . DS);
  24. define('DOCUMENT_AIR_UPLOAD_PATH', "/DOC_AIR" . DS);
  25. define('DOCUMENT_OCEAN_UPLOAD_PATH', "/DOC" . DS);
  26. define('DOCUMENT_SFSAIR_UPLOAD_PATH', "/DOC_AIR" . DS);
  27. define('DOCUMENT_SFSOCEAN_UPLOAD_PATH', "/DOC" . DS);
  28. if (preg_match("/(bot|crawl|spider|slurp)/i", $_SERVER['HTTP_USER_AGENT'])) {
  29. header('HTTP/1.1 403 Forbidden');
  30. exit;
  31. }
  32. if (function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get"))
  33. @date_default_timezone_set(@date_default_timezone_get());
  34. header('Content-type: text/html; Charset=utf-8');
  35. include_once ADODB_PATH . 'toexport.inc.php';
  36. include_once ADODB_PATH . 'adodb.inc.php';
  37. include_once ONLINE_ROOT . 'libs' . DS . 'config.ini.php';
  38. include_once ONLINE_ROOT . 'utils' . DS . 'utils.class.php';
  39. include_once ONLINE_ROOT . 'utils' . DS . 'common.class.php';
  40. include_once ONLINE_ROOT . 'libs' . DS . 'phpXLSWriter' . DS . "xlsxwriter.class.php";
  41. //测试服务器
  42. if(utils::startWith($_SERVER["HTTP_HOST"],"online-beta.kln.com")){
  43. define('SERVER_PAHT', 'https://online-beta.kln.com/online_backend/');
  44. define('SERVER_Vue_PAHT', 'https://online-beta.kln.com/');
  45. }elseif(utils::startWith($_SERVER["HTTP_HOST"],"online.kln.com")){
  46. define('SERVER_PAHT', 'https://online.kln.com/online_backend/');
  47. define('SERVER_Vue_PAHT', 'https://online.kln.com/');
  48. }else{
  49. //本地测试demo
  50. define('SERVER_PAHT', 'http://192.168.0.161/Customer_Service_Online/');
  51. define('SERVER_Vue_PAHT', 'http://192.168.0.161/k_new_online/');
  52. }
  53. $tar = common::excuteObjectSql("select item_value from config where item='Current_Used_Company'");
  54. if (!empty($tar["item_value"])&&$tar["item_value"]=="TOPOCEAN") {
  55. define("Soure", 'TopOcean');
  56. }else{
  57. define("Soure", 'Apex');
  58. }
  59. function _isApexLogin() {
  60. return strtolower($_SESSION['ONLINE_USER']['user_type']) == "employee";
  61. //return false;
  62. }
  63. function _isAdmin() {
  64. return $_SESSION['ONLINE_USER']['is_super'] == 't';
  65. }
  66. function _isRevenueDisplay() {
  67. return $_SESSION['ONLINE_USER']['revenue_active'] == 't';
  68. }
  69. function _isDesensitizationKln() {
  70. return $_SESSION['ONLINE_USER']['is_desensitization_kln'] == 't';
  71. }
  72. function _isNewUser() {
  73. return _isCustomerLogin() && empty($_SESSION['ONLINE_USER']['permission']);
  74. }
  75. function _isCustomerLogin() {
  76. return strtolower($_SESSION['ONLINE_USER']['user_type']) == 'customer';
  77. }
  78. function _getLoginName() {
  79. return $_SESSION['ONLINE_USER']['user_login'];
  80. }
  81. function _getLoginEamil() {
  82. return $_SESSION['ONLINE_USER']['email'];
  83. }
  84. function _getLoginEmployeeEamil() {
  85. return $_SESSION['ONLINE_USER']['employee_email'];
  86. }
  87. function _isAdminHandNew($user) {
  88. return $user['is_super'] == 't';
  89. }
  90. function _canViewAMSLog($schemas = "public") {
  91. if ($schemas == "public") {
  92. return strtolower($_SESSION['ONLINE_USER']['can_see_amslog']) == 't' || _isAdmin();
  93. } else {
  94. return strtolower($_SESSION[$schemas . '_ONLINE_USER']['can_see_amslog']) == 't' || _isAdmin();
  95. }
  96. }
  97. function _canViewISFLog($schemas = "public") {
  98. if ($schemas == "public") {
  99. return strtolower($_SESSION['ONLINE_USER']['can_see_isflog']) == 't' || _isAdmin();
  100. } else {
  101. return strtolower($_SESSION[$schemas . '_ONLINE_USER']['can_see_isflog']) == 't' || _isAdmin();
  102. }
  103. }
  104. function _isDocAdmin($username) {
  105. return strtolower($username) == "doc.alice" || strtolower($username) == "apexdoc.admin"
  106. || strtolower($username) == "doc.patty1" || strtolower($username) == "maria" || strtolower($username) == "it.andywu"
  107. || strtolower($username) == "doc.riley" || strtolower($username) == "doc.amy" || strtolower($username) == "doc.vicky"
  108. || strtolower($username) == "doc.leah" || strtolower($username) == "doc.yuki" || strtolower($username) == "doc.yoyo";
  109. }
  110. function _isVipReportAdmin($username) {
  111. return strtolower($username) == "doc.alice" || strtolower($username) == "maria" || strtolower($username) == "chud"
  112. || strtolower($username) == "doc.sansa1" || strtolower($username) == "ra.admin"
  113. || strtolower($username) == "doc.tianna" || strtolower($username) == "it.andywu" || strtolower($username) == "ra.admin";
  114. }
  115. function _customerFilerSearchHandNew($user, $schemas = "public", $p = 'place_of_delivery', $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id', $d = 'port_of_discharge_code') {
  116. $tt = $user['customer_search_type'];
  117. $sales = $user['ocean_sales'];
  118. if (empty($tt)) {
  119. return "1<>1";
  120. }
  121. //error_log("_customerFilerSearchHandNew -- " . $schemas);
  122. $_contact_id = _getContactIDHandNew($user, $schemas);
  123. if (empty($_contact_id)) {
  124. return "1<>1";
  125. }
  126. $sqlWhere1 = "";
  127. if (utils::checkExist($tt, 's') && !empty($s)) {
  128. if (empty($sqlWhere1)) {
  129. $sqlWhere1 = " lower($s) " . common::getInNotInSql($_contact_id);
  130. } else {
  131. $sqlWhere1 .= " or lower($s) " . common::getInNotInSql($_contact_id);
  132. }
  133. }
  134. if (utils::checkExist($tt, 'c') && !empty($c)) {
  135. if (empty($sqlWhere1)) {
  136. $sqlWhere1 = " lower($c) " . common::getInNotInSql($_contact_id);
  137. } else {
  138. $sqlWhere1 .= " or lower($c) " . common::getInNotInSql($_contact_id);
  139. }
  140. }
  141. //暂时注释掉,ocean_booking 没有这个字段
  142. // if (utils::checkExist($tt, 'b') && !empty($b)) {
  143. // if (empty($sqlWhere1)) {
  144. // $sqlWhere1 = " lower($b) " . common::getInNotInSql($_contact_id);
  145. // } else {
  146. // $sqlWhere1 .= " or lower($b) " . common::getInNotInSql($_contact_id);
  147. // }
  148. // }
  149. if (utils::checkExist($tt, 'n') && !empty($n)) {
  150. if (empty($sqlWhere1)) {
  151. $sqlWhere1 = " lower($n) " . common::getInNotInSql($_contact_id);
  152. } else {
  153. $sqlWhere1 .= " or lower($n) " . common::getInNotInSql($_contact_id);
  154. }
  155. }
  156. //controlling_customer_code
  157. if (utils::checkExist($tt, 't')) {
  158. if (empty($sqlWhere1)) {
  159. $sqlWhere1 = " exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  160. } else {
  161. $sqlWhere1 .= " or exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  162. }
  163. }
  164. if (empty($sqlWhere1))
  165. return "1<>1";
  166. $sqlWhere1 = "(" . $sqlWhere1 . ")";
  167. if (!empty($user['customer_destination']) && !empty($p)) {
  168. $sqlWhere1 .= " and lower($p) " . common::getInNotInSql($user['customer_destination']);
  169. }
  170. if (!empty($user['customer_discharge']) && !empty($d)) {
  171. $sqlWhere1 .= " and lower($d) " . common::getInNotInSql($user['customer_discharge']);
  172. }
  173. if (strtolower($sales) == 'all' || empty($sales)) {
  174. } else {
  175. if (utils::checkExist($sales, ";")) {
  176. $sql = "1!=1";
  177. $tt = explode(";", $sales);
  178. foreach ($tt as $t) {
  179. $t = trim($t);
  180. if (!empty($t))
  181. $sql .= " or sales_rep ilike '" . $t . "%'";
  182. }
  183. $sqlWhere1 .= " and ($sql)";
  184. } else
  185. $sqlWhere1 .= " and sales_rep ilike '" . $sales . "%'";
  186. }
  187. return $sqlWhere1;
  188. }
  189. function _getContactIDHandNew_Air($user, $schemas = "public") {
  190. $contact_id_user = _getCompanyContactHandNew_Air($user);
  191. $id = "";
  192. if ($schemas == "public") {
  193. $contact_id = common::excuteListSql("select contacts_id from " . $schemas . ".contacts_group_all where lower(company_name) " . utils::getInSql(_getCompanyHandNew($user)));
  194. } else {
  195. $contact_id = common::excuteListSql("select contacts_id from " . $schemas . ".contacts_group_all where lower(company_name) " . utils::getInSql(_getCompanyHandNew($user, $schemas)));
  196. }
  197. foreach ($contact_id as $v) {
  198. if (empty($id))
  199. $id = trim($v['contacts_id']);
  200. else
  201. $id .= ";" . $v['contacts_id'];
  202. }
  203. if (!empty($contact_id_user)) {
  204. $id .= ";" . $contact_id_user;
  205. }
  206. return $id;
  207. }
  208. function _getCompanyContactHandNew_Air($user, $schemas = "public") {
  209. if ($schemas == "public") {
  210. return $user['air_customers'];
  211. } else {
  212. return $user[$schemas . '_ONLINE_USER']['air_customers'];
  213. }
  214. }
  215. function _getCompanyHandNew($user, $schemas = "public") {
  216. if ($schemas == "public") {
  217. return $user['company'];
  218. } else {
  219. if (empty($user['company'])) {
  220. return $user['company_name'];
  221. } else {
  222. return $user['company'];
  223. }
  224. }
  225. }
  226. function _getContactIDHandNew($user, $schemas = "public") {
  227. $contact_id_user = _getCompanyContactHandNew($user);
  228. $id = "";
  229. if ($schemas == "public") {
  230. $contact_id = common::excuteListSql("select contacts_id from " . $schemas . ".contacts_group_all where lower(company_name) " . utils::getInSql(_getCompanyHandNew($user)));
  231. } else {
  232. $contact_id = common::excuteListSql("select contacts_id from " . $schemas . ".contacts_group_all where lower(company_name) " . utils::getInSql(_getCompanyHandNew($user, $schemas)));
  233. }
  234. foreach ($contact_id as $v) {
  235. if (empty($id))
  236. $id = trim($v['contacts_id']);
  237. else
  238. $id .= ";" . $v['contacts_id'];
  239. }
  240. if (!empty($contact_id_user)) {
  241. $id .= ";" . $contact_id_user;
  242. }
  243. return $id;
  244. }
  245. function _getCompanyContactHandNew($user, $schemas = "public") {
  246. if ($schemas == "public") {
  247. return $user['contact_id_user'];
  248. } else {
  249. return $user[$schemas . '_ONLINE_USER']['contact_id_user'];
  250. }
  251. }
  252. function _isDemo() {
  253. return $_SESSION['ONLINE_USER']['is_demo'] == "t";
  254. }
  255. function _is_only_vgm() {
  256. if ($_SESSION['ONLINE_USER']['is_only_vgm'] == "t") {
  257. return TRUE;
  258. }
  259. return FALSE;
  260. }
  261. function _get_schemas() {
  262. return $_SESSION['schemas_list'];
  263. }
  264. function _getViewDocType($schemas = "public") {
  265. if ($schemas == "public") {
  266. return $_SESSION['ONLINE_USER']['view_doc_type'];
  267. } else {
  268. return $_SESSION[$schemas . '_ONLINE_USER']['view_doc_type'];
  269. }
  270. }
  271. function _getAirViewDocType($schemas = "public") {
  272. if ($schemas == "public") {
  273. return $_SESSION['ONLINE_USER']['view_air_doc_type'];
  274. } else {
  275. return $_SESSION[$schemas . '_ONLINE_USER']['view_air_doc_type'];
  276. }
  277. }
  278. function _canEdiVgm($schemas = "public") {
  279. if ($schemas == "public") {
  280. return strtolower($_SESSION['ONLINE_USER']['can_edi_vgm']) == 't' || _isAdmin();
  281. } else {
  282. return strtolower($_SESSION[$schemas . '_ONLINE_USER']['can_edi_vgm']) == 't' || _isAdmin();
  283. }
  284. }
  285. function _getAirStation($schemas = "public") {
  286. if ($schemas == "public") {
  287. return $_SESSION['ONLINE_USER']['air_station'];
  288. } else {
  289. return $_SESSION[$schemas . '_ONLINE_USER']['air_station'];
  290. }
  291. }
  292. function _getAirStationOr($schemas = "public") {
  293. if ($schemas == "public") {
  294. return $_SESSION['ONLINE_USER']['air_station_or'];
  295. } else {
  296. return $_SESSION[$schemas . '_ONLINE_USER']['air_station_or'];
  297. }
  298. }
  299. function _getAirSales($schemas = "public") {
  300. if ($schemas == "public") {
  301. return $_SESSION['ONLINE_USER']['air_sales'];
  302. } else {
  303. return $_SESSION[$schemas . '_ONLINE_USER']['air_sales'];
  304. }
  305. }
  306. function _getAirSalesOr($schemas = "public") {
  307. if ($schemas == "public") {
  308. return $_SESSION['ONLINE_USER']['air_sales_or'];
  309. } else {
  310. return $_SESSION[$schemas . '_ONLINE_USER']['air_sales_or'];
  311. }
  312. }
  313. function _customerAirSearchType($schemas = "public") {
  314. if ($schemas == "public") {
  315. return $_SESSION['ONLINE_USER']['air_customer_search_type'];
  316. } else {
  317. return $_SESSION[$schemas . '_ONLINE_USER']['air_customer_search_type'];
  318. }
  319. }
  320. function _getAirContactID($schemas = "public") {
  321. if ($schemas == "public") {
  322. return $_SESSION['ONLINE_USER']['air_customers'];
  323. } else {
  324. return $_SESSION[$schemas . '_ONLINE_USER']['air_customers'];
  325. }
  326. }
  327. function _customerAirFilerSearch($schemas = "public", $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id') {
  328. $tt = _customerAirSearchType($schemas);
  329. if (empty($tt))
  330. return "1<>1";
  331. $_contact_id = _getAirContactID($schemas);
  332. if (empty($_contact_id)) {
  333. return "1<>1";
  334. }
  335. $sqlWhere1 = "";
  336. if (utils::checkExist($tt, 's') && !empty($s)) {
  337. if (empty($sqlWhere1)) {
  338. $sqlWhere1 = " lower($s) " . common::getInNotInSql($_contact_id);
  339. } else {
  340. $sqlWhere1 .= " or lower($s) " . common::getInNotInSql($_contact_id);
  341. }
  342. }
  343. if (utils::checkExist($tt, 'c') && !empty($c)) {
  344. if (empty($sqlWhere1)) {
  345. $sqlWhere1 = " lower($c) " . common::getInNotInSql($_contact_id);
  346. } else {
  347. $sqlWhere1 .= " or lower($c) " . common::getInNotInSql($_contact_id);
  348. }
  349. }
  350. if (utils::checkExist($tt, 'b') && !empty($b)) {
  351. if (empty($sqlWhere1)) {
  352. $sqlWhere1 = " lower($b) " . common::getInNotInSql($_contact_id);
  353. } else {
  354. $sqlWhere1 .= " or lower($b) " . common::getInNotInSql($_contact_id);
  355. }
  356. }
  357. if (utils::checkExist($tt, 'n') && !empty($n)) {
  358. if (empty($sqlWhere1)) {
  359. $sqlWhere1 = " lower($n) " . common::getInNotInSql($_contact_id);
  360. } else {
  361. $sqlWhere1 .= " or lower($n) " . common::getInNotInSql($_contact_id);
  362. }
  363. }
  364. //controlling_customer_code
  365. if (utils::checkExist($tt, 't')) {
  366. if (empty($sqlWhere1)) {
  367. $sqlWhere1 = " exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  368. } else {
  369. $sqlWhere1 .= " or exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  370. }
  371. }
  372. if (empty($sqlWhere1))
  373. return "1<>1";
  374. $sqlWhere1 = "(" . $sqlWhere1 . ")";
  375. return $sqlWhere1;
  376. }
  377. /**
  378. * 员工的有关的group_name 和contact id 权限配置查询 ocean air 合并写
  379. * @return string sql
  380. */
  381. function _employeeFilerSearch($ocean_air,$contact_field,$group_name_field,$schemas = "public", $p = 'place_of_delivery', $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id', $d = 'port_of_discharge_code'){
  382. if($ocean_air == "ocean"){
  383. $tt = _employeeSearchType($schemas,"employee_search_type");
  384. }else{
  385. $tt = _employeeSearchType($schemas,"employee_air_search_type");
  386. }
  387. if (empty($tt))
  388. return "1<>1";
  389. $_contact_id = _getEmployeeContactID($schemas,$contact_field,$group_name_field);
  390. if (empty($_contact_id)) {
  391. return "1<>1";
  392. }
  393. $sqlWhere1 = "";
  394. if (utils::checkExist($tt, 's') && !empty($s)) {
  395. if (empty($sqlWhere1)) {
  396. $sqlWhere1 = " lower($s) " . common::getInNotInSql($_contact_id);
  397. } else {
  398. $sqlWhere1 .= " or lower($s) " . common::getInNotInSql($_contact_id);
  399. }
  400. }
  401. if (utils::checkExist($tt, 'c') && !empty($c)) {
  402. if (empty($sqlWhere1)) {
  403. $sqlWhere1 = " lower($c) " . common::getInNotInSql($_contact_id);
  404. } else {
  405. $sqlWhere1 .= " or lower($c) " . common::getInNotInSql($_contact_id);
  406. }
  407. }
  408. if (utils::checkExist($tt, 'b') && !empty($b)) {
  409. if (empty($sqlWhere1)) {
  410. $sqlWhere1 = " lower($b) " . common::getInNotInSql($_contact_id);
  411. } else {
  412. $sqlWhere1 .= " or lower($b) " . common::getInNotInSql($_contact_id);
  413. }
  414. }
  415. if (utils::checkExist($tt, 'n') && !empty($n)) {
  416. if (empty($sqlWhere1)) {
  417. $sqlWhere1 = " lower($n) " . common::getInNotInSql($_contact_id);
  418. } else {
  419. $sqlWhere1 .= " or lower($n) " . common::getInNotInSql($_contact_id);
  420. }
  421. }
  422. //controlling_customer_code
  423. if($ocean_air == "ocean"){
  424. if (utils::checkExist($tt, 't')) {
  425. if (empty($sqlWhere1)) {
  426. $sqlWhere1 = " exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  427. } else {
  428. $sqlWhere1 .= " or exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  429. }
  430. }
  431. }else{
  432. if (utils::checkExist($tt, 't')) {
  433. if (empty($sqlWhere1)) {
  434. $sqlWhere1 = " exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  435. } else {
  436. $sqlWhere1 .= " or exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
  437. }
  438. }
  439. }
  440. if (empty($sqlWhere1))
  441. return "1<>1";
  442. return $sqlWhere1 = "(" . $sqlWhere1 . ")";
  443. }
  444. function _isCustomerLoginHandNew($user) {
  445. return strtolower($user["user_type"]) == 'customer';
  446. }
  447. function _employeeSearchType($schemas = "public",$filed) {
  448. if ($schemas == "public") {
  449. return $_SESSION['ONLINE_USER'][$filed];
  450. } else {
  451. return $_SESSION[$schemas . '_ONLINE_USER'][$filed];
  452. }
  453. }
  454. function _getEmployeeContactID($schemas = "public",$contact_field,$group_name_field) {
  455. if(!empty($contact_field)){
  456. $contact_id_user = _getEmployeeCompanyContact($schemas,$contact_field);
  457. }
  458. $id = "";
  459. if(!empty(_getEmployeeCompany($schemas,$group_name_field))){
  460. if ($schemas == "public") {
  461. $contact_id = common::excuteListSql("select contacts_id from " . $schemas . ".contacts_group_all where lower(company_name) " . utils::getInSql(_getEmployeeCompany($schemas,$group_name_field)));
  462. } else {
  463. $contact_id = common::excuteListSql("select contacts_id from " . $schemas . ".contacts_group_all where lower(company_name) " . utils::getInSql(_getEmployeeCompany($schemas,$group_name_field)));
  464. }
  465. }
  466. foreach ($contact_id as $v) {
  467. if (empty($id))
  468. $id = trim($v['contacts_id']);
  469. else
  470. $id .= ";" . $v['contacts_id'];
  471. }
  472. if (!empty($contact_id_user)) {
  473. $id .= ";" . $contact_id_user;
  474. }
  475. return $id;
  476. }
  477. function _getEmployeeCompanyContact($schemas = "public",$contact_field) {
  478. if ($schemas == "public") {
  479. return $_SESSION['ONLINE_USER'][$contact_field];
  480. } else {
  481. return $_SESSION[$schemas . '_ONLINE_USER'][$contact_field];
  482. }
  483. }
  484. function _getEmployeeCompany($schemas = "public",$group_name_field) {
  485. if ($schemas == "public") {
  486. return $_SESSION['ONLINE_USER'][$group_name_field];
  487. } else {
  488. return $_SESSION[$schemas . '_ONLINE_USER'][$group_name_field];
  489. }
  490. }
  491. ?>