Odyssey
ivr_cuStatus.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 $sharedLibrary= dirname(__FILE__) . "/../../shared/library";
4 require_once("$monLibrary/cu_top.i");
5 require_once("$monLibrary/ck_hticket.i");
6 require_once("$monLibrary/cu_pass.i");
7 require_once("$sharedLibrary/errormail.i");
8 
9  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
10  // ** Permissions failed
11  // ** redirect to new page
12  header("Location: /hcuadm/hcu_noperm.prg");
13  exit;
14  }
15 
16 $dms_ok=array('action'=>'string','msg'=>'string','offlinestat'=>'string','offlineblurb'=>'string','rowid'=>'string','livebatch'=>'string');
17 
18 dms_import($dms_ok);
19 
20 $self = $_SERVER['PHP_SELF'];
21 
22 if (isset($action)) {
23  $msg="";
24 # validate entries if needed; set $msg for error conditions
25 
26  if (empty($msg)){
27  $sql= "update cuadmin set offlinestat='$offlinestat',
28  offlineblurb='" . prep_save($offlineblurb) . "'
29  where cu='$rowid'";
30  $sth = db_query($sql,$dbh);
31  if (!$sth) {
32  $msg= "Unable to update status";
33  $notify = new ErrorMail;
34  $notify->mailto='miki@homecu.net';
35  $notify->replyto='miki@homecu.net';
36  $notify->subject='Error updating status';
37  $notify->msgbody = "\tUnable to update status\n\n";
38  $notify->msgbody .= "Cu: $rowid\n";
39  $notify->msgbody .= $sql;
40  $notify->callingfunction = __FUNCTION__;
41  $notify->file = __FILE__;
42  $notify->cu = $rowid;
43  $notify->SendMail();
44 
45  } else {
46  db_free_result($sth);
47 
48  cu_header("Status Updated");
49  cu_message("Succeeded<br>Status successfully updated");
50  cu_footer();
51  exit;
52 
53  }
54  }
55 }
56  $sql = "select offlinestat, offlineblurb, livebatch
57  from cuadmin where cu ='$rowid';";
58  $sth = db_query($sql, $dbh);
59  if ($sth) {
60  $row=db_fetch_array($sth);
61 cu_header4("$rowid Status Change");
62 
63 print <<<EOF
64  <script language="javascript">
65  function val_save() {
66  var err_msg = "";
67 
68  if (document.forms['status'].elements['offlinestat'].selectedIndex == 0)
69  err_msg += "Offline Status must be selected.\\n";
70 
71  if (document.forms['status'].elements['offlinestat'].value == 'R' && document.forms['status'].elements['livebatch'].value == 'L')
72  err_msg += "Read-Only Status is for Batch Systems only.\\n";
73 
74  if (err_msg != "") {
75  err_msg += "\\nPlease correct errors to continue.\\n";
76  window.alert(err_msg);
77  return false;
78  }
79  else {
80  return true;
81  }
82  }
83  function showblurb() {
84 
85  var idx= document.forms['status'].elements['reason'].selectedIndex;
86  var msg= document.forms['status'].elements['reason'][idx].text;
87  document.forms['status'].elements['offlineblurb'].value =
88  '<h2>' + msg + '</h2>';
89 
90  return true;
91  }
92 </script>
93 <CENTER>
94  <FORM NAME=status ACTION="${self}" METHOD=post>
95  <TABLE BORDER=0 width="90%" cellpadding=3 cellspacing=0 class='dmsbg'><tr><td>
96  <TABLE BORDER=0 width="100%" cellpadding=2 cellspacing=0 bgcolor=white>
97  <TR><TD CLASS="bar" align="center" colspan=3>$rowid Status Change</TD></TR>
98 
99 EOF;
100  if (db_num_rows($sth) == 0) {
101  print <<<EOF
102  <tr>
103  <td class='dtl' align=center>Missing cuadmin record for $rowid</td>
104  </tr>
105  </table>
106  </td></tr></table>
107  </FORM>
108  </BODY></HTML>
109 EOF;
110  } else {
111  print <<<EOF
112  <tr><td class='hdr' align=right valign='top'>Offline Status: </td>
113  <td class='dtl' align=left><select name="offlinestat" size="5">
114  <option value=""
115 EOF;
116  if (trim($row['offlinestat']) == '') { print ' selected'; }
117  print ">&lt;&lt;Select&gt;&gt;</option>
118  <option value='N'";
119  if (trim($row['offlinestat']) == 'N') { print ' selected'; }
120  print ">Active</option>
121  <option value='U'";
122  if (trim($row['offlinestat']) == 'U') { print ' selected'; }
123  print ">Offline (Auto Up)</option>
124  <option value='Y'";
125  if (trim($row['offlinestat']) == 'Y') { print ' selected'; }
126  print ">Offline (Stay Down)</option>
127  <option value='R'";
128  if (trim($row['offlinestat']) == 'R') { print ' selected'; }
129  print ">Read-Only</option>
130  </select>";
131 print <<<EOF
132  <font color="green" size="2">Read-Only is for Batch systems</font>
133 </td></tr>
134  <tr><td class='hdr' align=right valign='top'>Offline Message: </td>
135  <td class='dtl' align=left>
136 <select name='reason' size='4' onChange='showblurb(this)'>
137 <option value='noconnect'>We are unable to access your information at this time. Please try back later.</option>
138 <option value='working'>We are working on the system. Please try again later.</option>
139 <option value='maintenance'> We are currently down for system maintenance. Please try again later.</option>
140 <option value='upgrade'> We are currently down for a system upgrade. We expect to be back at . Please try again then.</option>
141 <option value='badlink'>You have followed an outdated link. Please return to the credit union home page for home banking access.</option>
142 </select>
143 <br><input type="text" size=110 maxlength=255 name="offlineblurb" value="${row['offlineblurb']}"></td></tr>
144  <tr><td colspan="2" class='bar'>&nbsp;</td></tr>
145 
146  <TR>
147  <td class='dtl'>&nbsp;</td>
148  <TD CLASS="dtl" colspan=2>
149  <input type=hidden name="action" value="Change Status">
150  <input type=hidden name="rowid" value="$rowid">
151  <input type=hidden name="livebatch" value="${row['livebatch']}">
152  <input type="submit" value="Change Status" name="BtnSubmit" onclick="return val_save();">
153  </table>
154  </td></tr></table>
155  </FORM>
156  </BODY></HTML>
157 
158 EOF;
159 }
160 }
161 ?>