15 $serviceShowInfo =
false;
16 $serviceLoadMenu =
false;
17 $serviceShowMenu =
false;
18 $serviceAllowReadonly =
true;
23 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
28 "action" => array(
"filter" => FILTER_SANITIZE_STRING),
29 "check_number" => array(
"filter" => FILTER_SANITIZE_STRING),
30 "date_cleared" => array(
"filter" => FILTER_SANITIZE_STRING),
31 "amount" => array(
"filter" => FILTER_SANITIZE_STRING),
32 "account" => array(
"filter" => FILTER_SANITIZE_STRING)
34 HCU_ImportVars( $HB_ENV,
"HCUPOST", $varOk );
39 header(
'Content-Type: application/json');
45 $parseRefer = parse_url($_SERVER[
'HTTP_REFERER']);
46 $referScript = basename($parseRefer[
'path']);
47 if (!in_array($referScript, array(
'hcuArchiveCheck.prg'))) {
49 $aryErrors[] = $MC->msg(
'Feature Unavailable', HCU_DISPLAY_AS_RAW);
50 throw new Exception (json_encode($aryErrors));
57 if (!PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_BASIC,
'',
false)) {
58 throw new Exception (HCU_JsonEncode(Array($MC->msg(
'Rights not set', HCU_DISPLAY_AS_HTML))));
75 switch ( $HB_ENV[
"HCUPOST"][
"action"] ) {
78 if (trim($HB_ENV[
"HCUPOST"][
"check_number"]) ==
'' || !is_numeric($HB_ENV[
"HCUPOST"][
"check_number"])) {
79 $aryErrors[] = $MC->msg(
'Check Number Must Be Numeric', HCU_DISPLAY_AS_RAW);
81 $check_number = trim($HB_ENV[
"HCUPOST"][
"check_number"]);
84 if (trim($HB_ENV[
"HCUPOST"][
"amount"]) ==
'' || !is_numeric($HB_ENV[
"HCUPOST"][
"amount"])) {
85 $aryErrors[] = $MC->msg(
'Invalid entry for check amount', HCU_DISPLAY_AS_RAW);
87 $check_amount = number_format($HB_ENV[
"HCUPOST"][
"amount"], 2,
'.',
'');
90 if (trim($HB_ENV[
"HCUPOST"][
"account"]) ==
'' ) {
91 $aryErrors[] = $MC->msg(
'Please select an account', HCU_DISPLAY_AS_RAW);
93 list($ck_micr,$ck_acct,$ck_type) = explode(
"|",$HB_ENV[
"HCUPOST"][
"account"]);
95 list($mm,$dd,$yyyy) = preg_split(
"#[/-]#",$HB_ENV[
"HCUPOST"][
"date_cleared"]);
98 $yyyy = intval($yyyy);
100 $dateTest = strtotime(
"$mm/$dd/$yyyy" );
102 $aryErrors[] = $MC->msg(
'Invalid Date Format', HCU_DISPLAY_AS_RAW);
104 $check_date = date(
'm/d/Y', strtotime($HB_ENV[
"HCUPOST"][
"date_cleared"]));
107 if ( count( $aryErrors ) > 0 ) {
108 throw new Exception (json_encode($aryErrors));
110 $sql =
"SELECT img, rt, flagset 114 $img_rs = db_query($sql, $dbh);
116 list($img_vendor, $cu_rt, $flagset) = db_fetch_row($img_rs, 0);
117 $img_vendor = trim($img_vendor);
118 $cu_rt = trim($cu_rt);
119 db_free_result($img_rs);
122 $check_number = intval($check_number);
124 $use_micr = $ck_micr;
126 $sql_om =
"select trim(rt), trim(micraccount) from cuovermicr 127 where cu='$Cu' and accountnumber='$ck_acct' 128 and accounttype = '$ck_type' 129 and startcheck <= $check_number 130 order by startcheck desc 132 $om_rs = db_query($sql_om, $dbh);
133 if(db_num_rows($om_rs) == 1) {
134 list ($use_rt, $use_micr) = db_fetch_row($om_rs, 0);
147 # pass micr as $sk (sortkey) 148 # for MidAt clients using tracenumber, not micr, for image retrieval 159 if ($img_vendor ==
'FEDIMAGE') {
161 } elseif ($img_vendor ==
'MAC') {
169 $infoParts =
"$Cu|$img_vendor|$check_number|$check_amount|$check_date|$use_rt|$use_micr|$Cn|$sk";
170 $dmskey=sha1(
"{$Cu}{$img_vendor}{$check_number}{$check_amount}{$check_date}{$use_rt}{$use_micr}{$archiveFlag}{$Cn}cierto");
171 $ckitem=hcu_encrypturl( $infoParts, $chk_key );
172 $img_url = $HB_ENV[
'homebankingpath'] .
"/ImageSOLO.prg?" . $HB_ENV[
'cuquery'] .
"&CKITEM=$ckitem&CKARCHIVE=2&CKHASH=$dmskey";
174 $aryResult[
"img_url"] = $img_url;
178 $aryErrors[] = array(
"message" =>
"Unexpected action: {$HB_ENV["HCUPOST
"]["action
"]}" );
179 throw new Exception (json_encode($aryErrors));
186 $aryReply[
"homecuErrors"] = json_decode( $ex->getMessage() );
189 $aryResult = array();
195 if ( count( $aryResult ) ) $aryReply[
"homecuData"] = $aryResult;
197 if ( count( $aryInfo ) ) $aryReply[
"homecuInfo"] = $aryInfo;
199 print json_encode($aryReply);