53 $serviceViewFromCUAdmin = (isset($serviceViewFromCUAdmin) ? $serviceViewFromCUAdmin :
false);
55 if (!$serviceViewFromCUAdmin) {
58 $serviceShowInfo =
true;
59 $serviceLoadMenu =
true;
60 $serviceShowMenu =
true;
61 $serviceAllowReadonly =
true;
62 $serviceLiveCheck =
true;
66 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
70 $string= array(
"filter" => FILTER_SANITIZE_STRING);
71 $digits= array(
"filter" => FILTER_SANITIZE_NUMBER_INT);
72 $dms_ok = array(
'cu'=>$string,
'a'=>$string,
'r1'=>$string,
'r2'=>$string,
'r3'=>$digits,
"action"=>$string);
73 HCU_ImportVars($HB_ENV,
'HCUPOST', $dms_ok);
79 $parseRefer = parse_url($_SERVER[
'HTTP_REFERER']);
80 $referScript = basename($parseRefer[
'path']);
82 if (!in_array($referScript, array(
'hcuHistory.prg',
'main'))) {
84 throw new Exception ($MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML));
91 if (!PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_BASIC,
'',
false)) {
92 throw new Exception (HCU_JsonEncode(Array($MC->msg(
'Rights not set', HCU_DISPLAY_AS_HTML))));
98 $Get_History_ary = Array();
99 $retJson_ary = Array();
100 if (!is_null($HB_ENV[
'HCUPOST'][
'a'])) {
103 $history_param = hcu_decrypturl($HB_ENV[
'HCUPOST'][
'a'], $HB_ENV[
'historyHash']);
106 $history_acct = explode(
'|', $history_param);
110 if ($HB_ENV[
'HCUPOST'][
'r1'] ==
'' || $HB_ENV[
'HCUPOST'][
'r2'] ==
'') {
112 $HB_ENV[
'HCUPOST'][
'r2'] = date(
'm/d/Y', strtotime(
'+3 days'));
113 $HB_ENV[
'HCUPOST'][
'r1'] = date(
'm/d/Y', strtotime(
'-5 days'));
116 $advSearch = array();
118 $dms_ok = array(
'searchAmt'=>$string,
'searchDesc'=>$string,
'searchCheckNum'=>$string);
119 HCU_ImportVars($HB_ENV,
'HCUPOST', $dms_ok);
121 if (HCU_array_key_exists(
'searchAmt', $HB_ENV[
"HCUPOST"]) && strlen($HB_ENV[
"HCUPOST"][
"searchAmt"]) > 0 ) {
122 $findamt = preg_replace(
"/[^0-9.]/",
"",$HB_ENV[
"HCUPOST"][
"searchAmt"]);
123 $advSearch[
"findamt"] = $findamt;
125 if (HCU_array_key_exists(
'searchDesc', $HB_ENV[
"HCUPOST"]) && strlen($HB_ENV[
"HCUPOST"][
"searchDesc"]) > 0 ) {
126 $fdesc = preg_replace(
"/[^a-zA-Z0-9 ]/",
"",$HB_ENV[
"HCUPOST"][
"searchDesc"]);
127 $advSearch[
"fdesc"] = $fdesc;
129 if (HCU_array_key_exists(
'searchCheckNum', $HB_ENV[
'HCUPOST'])) {
130 if ( strlen($HB_ENV[
"HCUPOST"][
"searchCheckNum"]) > 0 ) {
131 $check = (preg_replace(
"/[^0-9.]/",
"",$HB_ENV[
"HCUPOST"][
"searchCheckNum"]));
132 $advSearch[
"check"] = $check;
137 $Get_History_ary = Get_History($dbh, $HB_ENV, $history_param, $HB_ENV[
'HCUPOST'][
'r1'], $HB_ENV[
'HCUPOST'][
'r2'], $advSearch);
140 if ($HB_ENV[
'live'] && $serviceLiveCheck && HCU_array_key_exists(
'packetStatus', $HB_ENV)) {
141 savePacketStatusCookie($HB_ENV);
145 $ret_defaultdays = intval(5);
147 if ($Get_History_ary[
'status'][
'code'] ==
'000') {
150 if ($Get_History_ary[
'status'][
'startdate'] ==
'') {
151 $Get_History_ary[
'status'][
'startdate'] = date(
'm/d/Y', strtotime(
'now - 90 days'));
152 $Get_History_ary[
'status'][
'stopdate'] = date(
'm/d/Y', strtotime(
'now'));
157 $ret_nextstartdate = date(
'm/d/Y', strtotime(
"- $ret_defaultdays days", strtotime($Get_History_ary[
'status'][
'startdate'])));
159 $ret_nextenddate = date(
'm/d/Y', strtotime(
"- 1 days", strtotime($Get_History_ary[
'status'][
'startdate'])));
162 $retJson_ary = array(
163 'title' =>
'Account History',
165 'datastartdate' => $Get_History_ary[
'status'][
'startdate'],
166 'dataenddate' => $Get_History_ary[
'status'][
'stopdate'],
167 'nextstartdate' => $ret_nextstartdate,
168 'nextenddate' => $ret_nextenddate,
169 'defaultdays' => $ret_defaultdays,
172 if (HCU_array_key_exists($history_param, $Get_History_ary)) {
173 if (count($Get_History_ary[$history_param]) > 0) {
174 foreach ($Get_History_ary[$history_param] as $key => $value) {
175 $Get_History_ary[$history_param][$key][
'date'] = mobile_formatdate($value[
'date']);
178 $Get_History_ary[$history_param][$key][
'datesort'] = returnJsonDateValue($value[
'date']);
182 $retJson_ary[
'itemcount'] = count($Get_History_ary[$history_param]);
183 $retJson_ary[
'items'] = is_array($Get_History_ary[$history_param]) ?
184 array_values($Get_History_ary[$history_param]) :
188 $retJson_value = HCU_JsonEncode($retJson_ary);
192 if (isset($_SERVER[
'HTTP_ACCEPT_ENCODING'])) {
193 if (stristr($_SERVER[
'HTTP_ACCEPT_ENCODING'],
'gzip,deflate')) {
194 $retJson_value = gzencode($retJson_value);
195 header(
'Content-Encoding: gzip');
196 header(
'Content-Length: '.strlen($retJson_value));
213 $retStatus_ary[
'homecuErrors'][] = Array(
'id' =>
'',
'message' => $ex->getMessage());
214 $retJson_value = HCU_JsonEncode(Array(
"Results" => Array($retStatus_ary)));
217 header(
'Content-type: application/json');
218 print $retJson_value;