2 $monLibrary= dirname(__FILE__) .
"/../library";
3 $monIncludes= dirname(__FILE__) .
"/../includes";
4 require_once(
"$monLibrary/cu_top.i");
5 require_once(
"$monLibrary/ck_hticket.i");
6 require_once(
"$monIncludes/cu_remote_top.prg");
8 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
11 header(
"Location: /hcuadm/hcu_noperm.prg");
15 $dms_ok=array(
'trancode'=>
'string',
'trandesc'=>
'string',
'transpec'=>
'string',
16 'Save'=>
'string',
'form_err'=>
'string',
'act'=>
'string',
'tc'=>
'string',
17 'msg'=>
'string',
'Remote_Update'=>
'array');
21 if (!isset($act)) $act =
"2";
25 cu_header(
"Edit CU Transactions");
27 <form action=
"cutrans.prg?act=3" method=
"post">
32 where trancode = '$tc'";
33 $result = db_query($query, $link);
35 $cutrans_row = db_fetch_object($result);
36 $num_rows = db_num_rows($result);
41 if (isset($form_err) && strlen($form_err) > 0)
42 printf(
"\n<font color=\"red\">Errors found before saving the information. Please review errors at bottom of screen.\n<p></font>");
45 <table cellpadding=
"3" cellspacing=
"0" border=
"0" class=
"dmsbg" width=
"500"><tr><td>
46 <table cellpadding=
"2" cellspacing=
"0" border=
"0" bgcolor=white width=
"100%">
48 <td colspan=
"2" class=
"bar" align=
"center">
49 <?php
if($num_rows > 0): ?>
50 EDIT CU TRANSACTION CODE
52 ADD CU TRANSACTION CODE
57 <td nowrap align=
"right" class=
"hdr">
60 <td nowrap
class=
'dtl'>
61 <?php
if ($num_rows == 0): ?>
63 if ( isset($trancode))
64 $cu_info = set_string($trancode);
66 $cu_info = htmlspecialchars(trim($cutrans_row->home_cu_code));
68 <input type=
"text" name=
"trancode" size=
"4" maxlength=
"2" value=
"<?php echo $cu_info ?>">
70 <?php echo $cutrans_row->trancode ?>
71 <input type=
"hidden" name=
"trancode" value=
"<?php echo htmlspecialchars(trim($cutrans_row->trancode)) ?>">
76 <td nowrap align=
"right" class=
"hdr">
79 <td nowrap
class=
'dtl'>
81 if ( isset($trandesc))
82 $cu_info = set_string($trandesc);
84 $cu_info = htmlspecialchars(trim($cutrans_row->trandesc));
86 <input type=
"text" name=
"trandesc" size=
"40" maxlength=
"40" value=
"<?php echo $cu_info ?>"><font color=
"green" size=
"2"><br>New descriptions should also be added to the message dictionary <br>
for internationalized version.</font>
90 <td nowrap align=
"right" class=
"hdr">
93 <td nowrap
class=
'dtl'>
95 if ( isset($transpec))
96 $cu_info = set_string($transpec);
98 $cu_info = htmlspecialchars(trim($cutrans_row->specialproc));
100 <input type=
"text" name=
"transpec" size=
"4" maxlength=
"1" value=
"<?php echo $cu_info ?>"><font color=
"green" size=
"2"><br>Set to 1
for Credit Card and other payments to outside entities.</font>
104 <td
class=
'dtl'> </td>
105 <td nowrap
class=
'dtl'>
106 <?php remote_update_list(); ?>
110 <td
class=
'dtl'> </td>
111 <td nowrap
class=
'dtl'>
112 <input type=
"submit" name=
"Save" Value=
"Save">
113 <input type=
"button" name=
"Cancel" Value=
"Cancel" onClick=
"document.location='cutrans.prg'">
117 if (isset($form_err)) {
118 echo
"<tr><td colspan=2 class='err'>$form_err</td></tr>";
122 </td></tr></table> ";
125 cu_header(
"CU Transaction Codes");
131 $query =
"SELECT * FROM cutrans ORDER BY trancode";
132 $prod_result = db_query($query, $link);
136 <!-- Print out the top of the table -->
138 <table border=
"0" cellpadding=
"3" cellspacing=
"0" align=
"center" width=
"500" class=
"dmsbg"><tr><td>
139 <table border=
"0" cellpadding=
"2" cellspacing=
"0" align=
"center" width=
"100%" bgcolor=white>
141 <td colspan=
"4" class=
"bar" align=
"center">
142 CU TRANSACTION CODES LIST
145 <?php
if (isset($msg)): ?>
147 <td colspan=
"5" class=
"msg" align=
"center">
153 <td colspan=
"5" style=
"background:#f8f8f8;color: #ee5555;font-style:italic" align=
"left">
154 ** NOTE: The description
for any
'Special Processing' transcation code MUST be added to the translation table
158 <td
class=
"hdr" align=
"center">
161 <td
class=
"hdr" align=
"center">
164 <td
class=
"hdr" align=
"center">
167 <td
class=
"hdr" align=
"center">
174 while ($prod_row = db_fetch_object($prod_result, $row)):
177 <tr
class=
"<?php echo $RGB; ?>">
179 <?php echo trim($prod_row->trancode) ?>
182 <?php echo trim($prod_row->trandesc) ?>
184 <td nowrap align=
'center'>
185 <?php echo (trim($prod_row->specialproc) ==
'0' ?
'' : trim($prod_row->specialproc)) ?>
188 <a href=
"cutrans.prg?act=1&tc=<?php echo trim($prod_row->trancode) ?>">Edit</a>
195 $RGB = ($RGB ==
"odd" ?
"even" :
"odd");
200 <a href=
"cutrans.prg?act=1">Add CU Transaction Code</a>
202 <a href=
"<?php echo $infourl ?>/hcuadm/cuilist.prg" target=
"parent">Credit Union List</a>
210 cu_header(
"Save Transaction Code");
212 function save_fail($msg){
214 printf(
"<script language=\"javascript\">\n");
215 printf(
"document.forms[0].elements[\"form_err\"].value = '%s';\n", $msg);
216 printf(
"document.forms[0].action=\"cutrans.prg?act=1&tc=%s\";\n", $trancode);
217 printf(
"document.forms[0].method=\"post\";\n");
218 printf(
"document.forms[0].submit();\n");
220 printf(
"\n</form>\n </body>\n </html>\n");
226 <form action=
"cutrans.prg?act=1" method=
"post">
228 $errors_found =
"No";
244 <!-- LOAD ALL HIDDEN FIELDS -->
247 <input type=
"hidden" name=
"trancode" value=
"<?php echo set_string($trancode) ?>">
248 <input type=
"hidden" name=
"trandesc" value=
"<?php echo set_string($trandesc) ?>">
249 <input type=
"hidden" name=
"transpec" value=
"<?php echo set_string($transpec) ?>">
251 <!-- Create a hidden field
for the form error -->
252 <input type=
"hidden" name=
"form_err" value=
"">
254 <?php
if (strlen($err_msg) > 0): ?>
257 $form_err = sprintf(
"<font size=\"+1\">ERROR! Problems with the credit union information found: <BR></font>");
258 $form_err .= sprintf(
"The following errors will need to be corrected before you will be allowed to save the form.");
259 $form_err .= sprintf(
"<P> <font color=red>%s</font>", $err_msg);
260 save_fail($form_err);
267 $save_sql =
"SELECT trancode FROM cutrans WHERE trancode = '$trancode'";
269 $db_result = db_query($save_sql, $link);
271 $num_rows = db_num_rows($db_result);
275 $qry_stmt = sprintf(
"UPDATE cutrans ");
276 $qry_stmt .= sprintf(
"SET trandesc ='%s', ",prep_save($trandesc));
277 $qry_stmt .= sprintf(
"specialproc ='%s' ",prep_save($transpec));
278 $qry_stmt .= sprintf(
"WHERE trancode = '%s'; ",$trancode);
282 $qry_stmt = sprintf(
"INSERT INTO cutrans ");
283 $qry_stmt .= sprintf(
"(trancode, trandesc, specialproc) ");
284 $qry_stmt .= sprintf(
" VALUES (");
285 $qry_stmt .= sprintf(
"'%s', '%s', %s); ",strtoupper(prep_save($trancode)), prep_save($trandesc), prep_save($transpec));
289 if (!($db_result=db_query($qry_stmt, $link))) {
291 $form_err = sprintf(
"<br>");
292 $form_err .= sprintf(
"<font face=\"Arial\" size=\"2\">Unable to Save Home CU Transaction Code!</font><br>");
293 save_fail($form_err);
295 printError(sprintf(
"Transaction Code Saved Successfully.<br> 296 <a href=\"cutrans.prg?act=2\" target=\"CONTENT\">CU Transaction Code List</a>"));
299 if (Remote_Update_Selected()) {
302 Remote_Field_Add(
"cutrn",
"trancode", $trancode);
303 Remote_Field_Add(
"cutrn",
"trandesc", $trandesc);
304 Remote_Field_Add(
"cutrn",
"transpec", $transpec);
306 $Remote_Results = Remote_Update_Send(
"U",
"cutrn");
307 echo $Remote_Results;
311 header (
"Location: " . $_SERVER[
'PHP_SELF'] .
"?msg=" . urlencode($Remote_Results));
326 cu_header(
"Error Displaying Form");
328 printError(
"Requested form not found!<br>Cancelling action.");