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(
'act'=>
'string',
'addr1'=>
'string',
'addr2'=>
'string',
16 'city'=>
'string',
'comments'=>
'string',
'contact'=>
'string',
'email'=>
'string',
17 'fax'=>
'string',
'form_err'=>
'string',
'phone'=>
'string',
'Save'=>
'string',
18 'st'=>
'string',
'vc'=>
'string',
'vendcode'=>
'string',
'venddesc'=>
'string',
19 'vendvar'=>
'string',
'zip'=>
'string',
'msg'=>
'string',
'Remote_Update'=>
'array');
23 $vendcode = isset($vendcode) ? $vendcode :
"";
24 $venddesc = isset($venddesc) ? $venddesc :
"";
25 $vendvar = isset($vendvar) ? $vendvar :
"";
26 $addr1 = isset($addr1) ? $addr1 :
"";
27 $addr2 = isset($addr2) ? $addr2 :
"";
28 $city = isset($city) ? $city :
"";
29 $st = isset($st) ? $st :
"";
30 $zip = isset($zip) ? $zip :
"";
31 $phone = isset($phone) ? $phone :
"";
32 $fax = isset($fax) ? $fax :
"";
33 $email = isset($email) ? $email :
"";
34 $contact = isset($contact) ? $contact :
"";
35 $comments = isset($comments) ? $comments :
"";
37 if (!isset($act)) $act =
"2";
41 cu_header(
"Edit CU Vendors");
43 <form action=
"cuvndr.prg?act=3" method=
"post">
50 where vendor = '$vc'";
51 $result = db_query($query, $link);
53 $cuvndr_row = db_fetch_object($result);
54 $num_rows = db_num_rows($result);
60 if (isset($form_err) && strlen($form_err) > 0)
61 printf(
"\n<font color=\"red\">Errors found before saving the information. Please review errors at bottom of screen.\n<p></font>");
64 <table cellpadding=
"3" cellspacing=
"0" border=
"0" width=
"500" class=
'dmsbg'><tr><td>
65 <table cellpadding=
"1" cellspacing=
"0" border=
"0" width=
"100%" bgcolor=white>
67 <td colspan=
"2" class=
"bar" align=
"center">
68 <?php
if($num_rows > 0): ?>
76 <td nowrap align=
"right" class=
"hdr">
79 <td nowrap
class=
'dtl'>
80 <?php
if ($num_rows == 0): ?>
84 $cu_info = htmlspecialchars(trim($cuvndr_row->vendor));
86 $cu_info = set_string($vendcode);
89 <input type=
"text" name=
"vendcode" size=
"15" maxlength=
"15" value=
"<?php echo $cu_info ?>">
91 <?php echo $cuvndr_row->vendor ?>
92 <input type=
"hidden" name=
"vendcode" maxlength=
"30" value=
"<?php echo htmlspecialchars(trim($cuvndr_row->vendor)) ?>">
97 <td nowrap align=
"right" class=
"hdr">
100 <td nowrap
class=
'dtl'>
104 $cu_info = htmlspecialchars(trim($cuvndr_row->venddesc));
106 $cu_info = set_string($venddesc);
109 <input type=
"text" name=
"venddesc" size=
"30" maxlength=
"30" value=
"<?php echo $cu_info ?>">
113 <td nowrap align=
"right" class=
"hdr">
116 <td nowrap
class=
'dtl'>
120 $cu_info = htmlspecialchars(trim($cuvndr_row->vendvar));
122 $cu_info = set_string($vendvar);
125 <input type=
"text" name=
"vendvar" size=
"30" maxlength=
"30" value=
"<?php echo $cu_info ?>">
129 <td nowrap align=
"right" class=
"hdr">
132 <td nowrap
class=
'dtl'>
136 $cu_info = htmlspecialchars(trim($cuvndr_row->addr1));
138 $cu_info = set_string($addr1);
141 <input type=
"text" name=
"addr1" size=
"40" maxlength=
"40" value=
"<?php echo $cu_info ?>">
145 <td nowrap align=
"right" class=
"hdr">
148 <td nowrap
class=
'dtl'>
152 $cu_info = htmlspecialchars(trim($cuvndr_row->addr2));
154 $cu_info = set_string($addr2);
157 <input type=
"text" name=
"addr2" size=
"40" maxlength=
"40" value=
"<?php echo $cu_info ?>">
161 <td nowrap align=
"right" class=
"hdr">
164 <td nowrap
class=
'dtl'>
168 $cu_info = htmlspecialchars(trim($cuvndr_row->city));
170 $cu_info = set_string($city);
173 <input type=
"text" name=
"city" size=
"25" maxlength=
"25" value=
"<?php echo $cu_info ?>">
177 <td align=
"right" nowrap
class=
"hdr">
184 $cu_info = htmlspecialchars(trim($cuvndr_row->st));
186 $cu_info = set_string($st);
190 <select name=
"st" size=1>
191 <OPTION VALUE=
""><Select>
192 <OPTION VALUE=
"AL" <?php
if ($cu_info ==
"AL")echo
"SELECTED" ?>> Alabama
193 <OPTION VALUE=
"AK" <?php
if ($cu_info ==
"AK")echo
"SELECTED" ?>> Alaska
194 <OPTION VALUE=
"AZ" <?php
if ($cu_info ==
"AZ")echo
"SELECTED" ?>> Arizona
195 <OPTION VALUE=
"AR" <?php
if ($cu_info ==
"AR")echo
"SELECTED" ?>> Arkansas
196 <OPTION VALUE=
"CA" <?php
if ($cu_info ==
"CA")echo
"SELECTED" ?>> California
197 <OPTION VALUE=
"CO" <?php
if ($cu_info ==
"CO")echo
"SELECTED" ?>> Colorado
198 <OPTION VALUE=
"CT" <?php
if ($cu_info ==
"CT")echo
"SELECTED" ?>> Connecticut
199 <OPTION VALUE=
"DE" <?php
if ($cu_info ==
"DE")echo
"SELECTED" ?>> Delaware
200 <OPTION VALUE=
"DC" <?php
if ($cu_info ==
"DC")echo
"SELECTED" ?>> District of Columbia
201 <OPTION VALUE=
"FL" <?php
if ($cu_info ==
"FL")echo
"SELECTED" ?>> Florida
202 <OPTION VALUE=
"GA" <?php
if ($cu_info ==
"GA")echo
"SELECTED" ?>> Georgia
203 <OPTION VALUE=
"HI" <?php
if ($cu_info ==
"HI")echo
"SELECTED" ?>> Hawaii
204 <OPTION VALUE=
"ID" <?php
if ($cu_info ==
"ID")echo
"SELECTED" ?>> Idaho
205 <OPTION VALUE=
"IL" <?php
if ($cu_info ==
"IL")echo
"SELECTED" ?>> Illinois
206 <OPTION VALUE=
"IN" <?php
if ($cu_info ==
"IN")echo
"SELECTED" ?>> Indiana
207 <OPTION VALUE=
"IA" <?php
if ($cu_info ==
"IA")echo
"SELECTED" ?>> Iowa
208 <OPTION VALUE=
"KS" <?php
if ($cu_info ==
"KS")echo
"SELECTED" ?>> Kansas
209 <OPTION VALUE=
"KY" <?php
if ($cu_info ==
"KY")echo
"SELECTED" ?>> Kentucky
210 <OPTION VALUE=
"LA" <?php
if ($cu_info ==
"LA")echo
"SELECTED" ?>> Louisiana
211 <OPTION VALUE=
"ME" <?php
if ($cu_info ==
"ME")echo
"SELECTED" ?>> Maine
212 <OPTION VALUE=
"MD" <?php
if ($cu_info ==
"MD")echo
"SELECTED" ?>> Maryland
213 <OPTION VALUE=
"MA" <?php
if ($cu_info ==
"MA")echo
"SELECTED" ?>> Massachusetts
214 <OPTION VALUE=
"MI" <?php
if ($cu_info ==
"MI")echo
"SELECTED" ?>> Michigan
215 <OPTION VALUE=
"MN" <?php
if ($cu_info ==
"MN")echo
"SELECTED" ?>> Minnesota
216 <OPTION VALUE=
"MS" <?php
if ($cu_info ==
"MS")echo
"SELECTED" ?>> Mississippi
217 <OPTION VALUE=
"MO" <?php
if ($cu_info ==
"MO")echo
"SELECTED" ?>> Missouri
218 <OPTION VALUE=
"MT" <?php
if ($cu_info ==
"MT")echo
"SELECTED" ?>> Montana
219 <OPTION VALUE=
"NE" <?php
if ($cu_info ==
"NE")echo
"SELECTED" ?>> Nebraska
220 <OPTION VALUE=
"NV" <?php
if ($cu_info ==
"NV")echo
"SELECTED" ?>> Nevada
221 <OPTION VALUE=
"NH" <?php
if ($cu_info ==
"NH")echo
"SELECTED" ?>> New Hampshire
222 <OPTION VALUE=
"NJ" <?php
if ($cu_info ==
"NJ")echo
"SELECTED" ?>> New Jersey
223 <OPTION VALUE=
"NM" <?php
if ($cu_info ==
"NM")echo
"SELECTED" ?>> New Mexico
224 <OPTION VALUE=
"NY" <?php
if ($cu_info ==
"NY")echo
"SELECTED" ?>> New York
225 <OPTION VALUE=
"NC" <?php
if ($cu_info ==
"NC")echo
"SELECTED" ?>> North Carolina
226 <OPTION VALUE=
"ND" <?php
if ($cu_info ==
"ND")echo
"SELECTED" ?>> North Dakota
227 <OPTION VALUE=
"OH" <?php
if ($cu_info ==
"OH")echo
"SELECTED" ?>> Ohio
228 <OPTION VALUE=
"OK" <?php
if ($cu_info ==
"OK")echo
"SELECTED" ?>> Oklahoma
229 <OPTION VALUE=
"OR" <?php
if ($cu_info ==
"OR")echo
"SELECTED" ?>> Oregon
230 <OPTION VALUE=
"PA" <?php
if ($cu_info ==
"PA")echo
"SELECTED" ?>> Pennsylvania
231 <OPTION VALUE=
"RI" <?php
if ($cu_info ==
"RI")echo
"SELECTED" ?>> Rhode Island
232 <OPTION VALUE=
"SC" <?php
if ($cu_info ==
"SC")echo
"SELECTED" ?>> South Carolina
233 <OPTION VALUE=
"SD" <?php
if ($cu_info ==
"SD")echo
"SELECTED" ?>> South Dakota
234 <OPTION VALUE=
"TN" <?php
if ($cu_info ==
"TN")echo
"SELECTED" ?>> Tennessee
235 <OPTION VALUE=
"TX" <?php
if ($cu_info ==
"TX")echo
"SELECTED" ?>> Texas
236 <OPTION VALUE=
"UT" <?php
if ($cu_info ==
"UT")echo
"SELECTED" ?>> Utah
237 <OPTION VALUE=
"VT" <?php
if ($cu_info ==
"VT")echo
"SELECTED" ?>> Vermont
238 <OPTION VALUE=
"VA" <?php
if ($cu_info ==
"VA")echo
"SELECTED" ?>> Virginia
239 <OPTION VALUE=
"WA" <?php
if ($cu_info ==
"WA")echo
"SELECTED" ?>> Washington
240 <OPTION VALUE=
"WV" <?php
if ($cu_info ==
"WV")echo
"SELECTED" ?>> West Virginia
241 <OPTION VALUE=
"WI" <?php
if ($cu_info ==
"WI")echo
"SELECTED" ?>> Wisconsin
242 <OPTION VALUE=
"WY" <?php
if ($cu_info ==
"WY")echo
"SELECTED" ?>> Wyoming
243 <OPTION VALUE=
"VI" <?php
if ($cu_info ==
"VI")echo
"SELECTED" ?>> U.S. Virgin Islands
248 <td nowrap align=
"right" class=
"hdr">
251 <td nowrap
class=
'dtl'>
255 $cu_info = htmlspecialchars(trim($cuvndr_row->zip));
257 $cu_info = set_string($zip);
260 <input type=
"text" name=
"zip" size=
"15" maxlength=
"15" value=
"<?php echo $cu_info ?>">
264 <td nowrap align=
"right" class=
"hdr">
267 <td nowrap
class=
'dtl'>
271 $cu_info = htmlspecialchars(trim($cuvndr_row->phone));
273 $cu_info = set_string($phone);
276 <input type=
"text" name=
"phone" size=
"20" maxlength=
"20" value=
"<?php echo $cu_info ?>">
280 <td nowrap align=
"right" class=
"hdr">
283 <td nowrap
class=
'dtl'>
287 $cu_info = htmlspecialchars(trim($cuvndr_row->fax));
289 $cu_info = set_string($fax);
292 <input type=
"text" name=
"fax" size=
"20" maxlength=
"20" value=
"<?php echo $cu_info ?>">
296 <td nowrap align=
"right" class=
"hdr">
299 <td nowrap
class=
'dtl'>
303 $cu_info = htmlspecialchars(trim($cuvndr_row->email));
305 $cu_info = set_string($email);
308 <input type=
"text" name=
"email" size=
"40" maxlength=
"40" value=
"<?php echo $cu_info ?>">
312 <td nowrap align=
"right" class=
"hdr">
315 <td nowrap
class=
'dtl'>
319 $cu_info = htmlspecialchars(trim($cuvndr_row->contact));
321 $cu_info = set_string($contact);
324 <input type=
"text" name=
"contact" size=
"40" maxlength=
"40" value=
"<?php echo $cu_info ?>">
328 <td nowrap align=
"right" class=
"hdr" valign=
"top">
331 <td nowrap
class=
'dtl'>
335 $cu_info = htmlspecialchars(trim($cuvndr_row->comments));
337 $cu_info = set_string($comments);
340 <textarea name=
"comments" rows=5 cols=40 wrap=
"physical"><?php echo $cu_info; ?></textarea>
344 <td
class=
'dtl'> </td>
345 <td nowrap
class=
'dtl'>
346 <?php remote_update_list(); ?>
350 <td
class=
'dtl'> </td>
351 <td nowrap
class=
'dtl'>
352 <input type=
"submit" name=
"Save" Value=
"Save">
353 <input type=
"button" name=
"Cancel" Value=
"Cancel" onClick=
"document.location='cuvndr.prg'">
360 if (isset($form_err))
367 cu_header(
"CU Vendor Codes");
373 $query =
"SELECT * FROM cuvendors ORDER BY vendor";
374 $prod_result = db_query($query, $link);
378 <!-- Print out the top of the table -->
380 <table border=
"0" cellpadding=
"3" cellspacing=
"0" align=
"center" class=
'dmsbg' width=
"500"><tr><td>
381 <table border=
"0" cellpadding=
"1" cellspacing=
"0" align=
"center" width=
"100%" bgcolor=white>
383 <td colspan=
"5" class=
"bar" align=
"center">
387 <?php
if (isset($msg)): ?>
389 <td colspan=
"5" class=
"msg" align=
"center">
395 <td
class=
"hdr" align=
"left">
398 <td
class=
"hdr" align=
"left">
401 <td
class=
"hdr" align=
"left">
404 <td
class=
"hdr" align=
"left">
407 <td
class=
"hdr" align=
"center">
414 while ($prod_row = db_fetch_object($prod_result, $row)):
417 <tr
class=
"<?php echo $RGB; ?>">
419 <?php echo trim($prod_row->vendor) ?>
422 <?php echo trim($prod_row->vendvar) ?>
425 <?php echo trim($prod_row->contact) ?>
428 <?php echo trim($prod_row->phone) ?>
431 <a href=
"cuvndr.prg?act=1&vc=<?php echo trim($prod_row->vendor) ?>">Edit</a>
438 $RGB = ($RGB ==
"odd" ?
"even" :
"odd");
443 <a href=
"cuvndr.prg?act=1">Add CU Vendor Code</a>
445 <a href=
"<?php echo $infourl ?>/hcuadm/cuilist.prg" target=
"parent">Credit Union List</a>
453 cu_header(
"Save Vendor Code");
455 function save_fail($msg){
457 printf(
"<script language=\"javascript\">\n");
458 printf(
"document.forms[0].elements[\"form_err\"].value = '%s';\n", $msg);
459 printf(
"document.forms[0].action=\"cuvndr?act=1&vc=%s\";\n", $vendcode);
460 printf(
"document.forms[0].method=\"post\";\n");
461 printf(
"document.forms[0].submit();\n");
463 printf(
"\n</form>\n </body>\n </html>\n");
469 <form action=
"cuvndr?act=1" method=
"post">
471 $errors_found =
"No";
487 <!-- LOAD ALL HIDDEN FIELDS -->
490 <input type=
"hidden" name=
"vendcode" value=
"<?php echo set_string($vendcode) ?>">
491 <input type=
"hidden" name=
"venddesc" value=
"<?php echo set_string($venddesc) ?>">
492 <input type=
"hidden" name=
"vendvar" value=
"<?php echo set_string($vendvar) ?>">
493 <input type=
"hidden" name=
"addr1" value=
"<?php echo set_string($addr1) ?>">
494 <input type=
"hidden" name=
"addr2" value=
"<?php echo set_string($addr2) ?>">
495 <input type=
"hidden" name=
"city" value=
"<?php echo set_string($city) ?>">
496 <input type=
"hidden" name=
"st" value=
"<?php echo set_string($st) ?>">
497 <input type=
"hidden" name=
"zip" value=
"<?php echo set_string($zip) ?>">
498 <input type=
"hidden" name=
"phone" value=
"<?php echo set_string($phone) ?>">
499 <input type=
"hidden" name=
"fax" value=
"<?php echo set_string($fax) ?>">
500 <input type=
"hidden" name=
"email" value=
"<?php echo set_string($email) ?>">
501 <input type=
"hidden" name=
"contact" value=
"<?php echo set_string($contact) ?>">
502 <input type=
"hidden" name=
"comments" value=
"<?php echo set_string($comments) ?>">
504 <!-- Create a hidden field
for the form error -->
505 <input type=
"hidden" name=
"form_err" value=
"">
507 <?php
if (strlen($err_msg) > 0): ?>
510 $form_err = sprintf(
"<font size=\"+1\">ERROR! Problems with the credit union information found: <BR></font>");
511 $form_err .= sprintf(
"The following errors will need to be corrected before you will be allowed to save the form.");
512 $form_err .= sprintf(
"<P> <font color=red>%s</font>", $err_msg);
513 save_fail($form_err);
520 $save_sql =
"SELECT vendor FROM cuvendors WHERE vendor = '$vendcode'";
522 $db_result = db_query($save_sql, $link);
524 $num_rows = db_num_rows($db_result);
525 if ($num_rows > 0 ) {
527 $qry_stmt = sprintf(
"UPDATE cuvendors ");
528 $qry_stmt .= sprintf(
"SET venddesc ='%s', ",prep_save($venddesc));
529 $qry_stmt .= sprintf(
"vendvar ='%s', ",prep_save($vendvar));
530 $qry_stmt .= sprintf(
"addr1 ='%s', ",prep_save($addr1));
531 $qry_stmt .= sprintf(
"addr2 ='%s', ",prep_save($addr2));
532 $qry_stmt .= sprintf(
"city ='%s', ",prep_save($city));
533 $qry_stmt .= sprintf(
"st ='%s', ",prep_save($st));
534 $qry_stmt .= sprintf(
"zip ='%s', ",prep_save($zip));
535 $qry_stmt .= sprintf(
"phone ='%s', ",prep_save($phone));
536 $qry_stmt .= sprintf(
"fax ='%s', ",prep_save($fax));
537 $qry_stmt .= sprintf(
"email ='%s', ",prep_save($email));
538 $qry_stmt .= sprintf(
"contact ='%s', ",prep_save($contact));
539 $qry_stmt .= sprintf(
"comments = '%s' ", prep_save($comments));
540 $qry_stmt .= sprintf(
"WHERE vendor = '%s'; ",$vendcode);
542 $qry_stmt = sprintf(
"INSERT INTO cuvendors ");
543 $qry_stmt .= sprintf(
"(vendor, venddesc, vendvar, addr1, addr2, city, ");
544 $qry_stmt .= sprintf(
"st, zip, phone, fax, email, contact, comments) ");
545 $qry_stmt .= sprintf(
" VALUES (");
546 $qry_stmt .= sprintf(
"'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'); ",
547 strtoupper(prep_save($vendcode)),
548 prep_save($venddesc),
559 prep_save($comments));
563 if (!($db_result=db_query($qry_stmt, $link))) {
565 $form_err = sprintf(
"<br>");
566 $form_err .= sprintf(
"<font face=\"Arial\" size=\"2\">Unable to Save Home CU Vendor Code!</font><br>");
567 save_fail($form_err);
569 printError(sprintf(
"Vendor Code Saved Successfully.<br> 570 <a href=\"cuvndr.prg?act=2\" target=\"CONTENT\">CU Vendor Code List</a>"));
573 if (Remote_Update_Selected()) {
576 Remote_Field_Add(
"cuvndr",
"vendcode", $vendcode);
577 Remote_Field_Add(
"cuvndr",
"venddesc", $venddesc);
578 Remote_Field_Add(
"cuvndr",
"vendvar", $vendvar);
579 Remote_Field_Add(
"cuvndr",
"addr1", $addr1);
580 Remote_Field_Add(
"cuvndr",
"addr2", $addr2);
581 Remote_Field_Add(
"cuvndr",
"city", $city);
582 Remote_Field_Add(
"cuvndr",
"st", $st);
583 Remote_Field_Add(
"cuvndr",
"zip", $zip);
584 Remote_Field_Add(
"cuvndr",
"phone", $phone);
585 Remote_Field_Add(
"cuvndr",
"fax", $fax);
586 Remote_Field_Add(
"cuvndr",
"email", $email);
587 Remote_Field_Add(
"cuvndr",
"contact", $contact);
588 Remote_Field_Add(
"cuvndr",
"comments", $comments);
591 $Remote_Results = Remote_Update_Send(
"U",
"cuvndr");
592 echo $Remote_Results;
596 header (
"Location: " . $_SERVER[
'PHP_SELF'] .
"?msg=" . urlencode($Remote_Results));
610 cu_header(
"Error Displaying Form");
612 printError(
"Requested form not found!<br>Cancelling action.");