2 $monLibrary= dirname(__FILE__) .
"/../library";
3 require_once(
"$monLibrary/cu_top.i");
4 require_once(
"$monLibrary/ck_hticket.i");
6 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
9 header(
"Location: /hcuadm/hcu_noperm.prg");
13 $dms_ok=array(
'home_cu_code'=>
'string',
'form_err'=>
'string',
'hcu_form'=>
'string',
'home_cu_desc'=>
'string',
'err_msg'=>
'string');
17 function save_fail($msg){
19 printf(
"<script language=\"javascript\">\n");
20 printf(
"document.forms[0].elements[\"form_err\"].value = '%s';\n", $msg);
21 printf(
"document.forms[0].action=\"hcu_prod_edit.prg?home_cu_code=%s\";\n",urlencode($home_cu_code));
22 printf(
"document.forms[0].method=\"post\";\n");
23 printf(
"document.forms[0].submit();\n");
25 printf(
"\n</form>\n </body>\n </html>\n");
29 cu_header(
"HomeCU Products");
32 <form action=
"hcu_prod_edit.prg" method=
"post">
51 <!-- LOAD ALL HIDDEN FIELDS -->
54 <input type=
"hidden" name=
"home_cu_desc" value=
"<?php echo set_string($home_cu_desc) ?>">
56 <!-- Create a hidden field
for the form error -->
57 <input type=
"hidden" name=
"form_err" value=
"">
59 <?php
if (strlen($err_msg) > 0): ?>
62 $form_err = sprintf(
"<font size=\"+1\">ERROR! Problems with the credit union information found: <BR></font>");
63 $form_err .= sprintf(
"The following errors will need to be corrected before you will be allowed to save the form.");
64 $form_err .= sprintf(
"<P> <font color=red>%s</font>", $err_msg);
72 $cuprod_query =
"SELECT home_cu_code FROM cuprodlist WHERE home_cu_code = '$home_cu_code'";
74 $db_result = db_query($cuprod_query, $link);
76 $num_rows = db_num_rows($db_result);
80 $qry_stmt = sprintf(
"UPDATE cuprodlist\n");
81 $qry_stmt .= sprintf(
"SET home_cu_desc ='%s'\n",prep_save($home_cu_desc));
82 $qry_stmt .= sprintf(
"WHERE home_cu_code = '%s'; \n",$home_cu_code);
86 $qry_stmt = sprintf(
"INSERT INTO cuprodlist \n");
87 $qry_stmt .= sprintf(
"(home_cu_code, home_cu_desc) \n");
88 $qry_stmt .= sprintf(
" VALUES (\n");
89 $qry_stmt .= sprintf(
"'%s', '%s'); \n",prep_save($home_cu_code), prep_save($home_cu_desc));
94 if (!($db_result=db_query($qry_stmt, $link)))
97 printError(sprintf(
"<br>"));
98 printError(sprintf(
"Error in executing {%s} query", $qry_stmt));
99 printError(sprintf(
"<font face=\"Arial\" size=\"2\">Unable to Save Home CU Product Information!</font><br>"));
100 save_fail($form_err);
103 header (
"Location: /hcuadm/hcu_prod_list.prg?msg=" . urlencode(
"HCU Product Saved Successfully"));