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(
'action'=>
'string',
'act'=>
'string',
'user_name'=>
'string',
14 'sys_typ_asp'=>
'digits',
'sys_typ_batch'=>
'digits',
15 'sys_typ_closed'=>
'digits',
'sys_typ_ivr'=>
'digits',
'sys_typ_live'=>
'digits',
16 'sys_typ_upgrade'=>
'digits',
'sys_typ_webonly'=>
'digits',
'sys_typ_voip'=>
'digits',
17 'next_contact_date'=>
'string',
'target_launch'=>
'string',
'showrows'=>
'digits',
18 'sys_typ_upg' =>
'digits',
19 'msg'=>
'string',
'cu_products'=>
'array',
'cu_prodmaster'=>
'array');
23 $act = (empty($act) ?
"show" : $act);
24 $msg = isset($msg) ? $msg :
"";
25 $cu_products = isset($cu_products) ? $cu_products : array();
27 $self = $_SERVER[
'PHP_SELF'] .
"?" . $_SERVER[
'QUERY_STRING'];
40 $target_launch = trim( $target_launch );
41 if (strlen($target_launch) > 0) {
42 if ( $target_launch !=
"FLEX" && $target_launch !=
"TBD" && !($target_launch = mdydate($target_launch)))
43 $err_msg .=
"{Target Launch Date} is an invalid date. A valid date must be entered, or the value 'FLEX', or the value 'TBD'.<br>";
45 $err_msg .=
"Need a Target Launch Date. A valid date must be entered, or the value 'FLEX', or the value 'TBD'.<br>";
49 if (strlen($next_contact_date) > 0)
50 if ( !($next_contact_date = mdydate($next_contact_date)))
51 $err_msg .=
"{Next Contact Date} is an invalid date. A valid date must be entered or leave blank.<br>";
54 if ((!isset($sys_typ_batch) && !isset($sys_typ_live) && !isset($sys_typ_ivr) && !isset($sys_typ_voip) && !isset($sys_typ_webonly)) && !$sys_typ_closed) {
55 $err_msg .=
"<li>To complete setup, a valid HomeCU Type must be selected. Please select one of the Home CU Type options and try again.<br>";
58 if (isset($sys_typ_webonly) && (isset($sys_typ_batch) || isset($sys_typ_live) || isset($sys_typ_asp))) {
59 $err_msg .=
"<li>When Web Only is selected you may not choose one of these {live, batch, asp, upgrade}. Please select correctly and try again.<br>";
60 } elseif (isset($sys_typ_batch) && (isset($sys_typ_live))) {
61 $err_msg .=
"<li>When Batch is selected you may not choose the 'Live' options. Please correct this and try again.<br>";
68 $cuinfo_query =
"SELECT user_name,coalesce(system_options,0) FROM cuinfo WHERE user_name = '$user_name'";
70 $db_result = db_query($cuinfo_query, $link);
71 if (db_num_rows($db_result) == 0) {
72 $err_msg .=
"<li>No info record found for clien $user_name. Cannot update.<br>";
74 list($dname, $dsysops) = db_fetch_array($db_result,0);
80 (isset($sys_typ_batch) ? $sys_typ_batch : 0) +
81 (isset($sys_typ_live) ? $sys_typ_live : 0) +
82 (isset($sys_typ_asp) ? $sys_typ_asp : 0) +
83 (isset($sys_typ_ivr) ? $sys_typ_ivr : 0) +
84 (isset($sys_typ_voip) ? $sys_typ_voip : 0) +
85 (isset($sys_typ_webonly) ? $sys_typ_webonly : 0) +
86 (isset($sys_typ_upgrade) ? $sys_typ_upgrade : 0) +
87 (isset($sys_typ_closed) ? $sys_typ_closed : 0) +
88 (isset($sys_typ_upg) ? $sys_typ_upg : 0)
91 if ($dsysops > $upd_sys_opt) {
92 $err_msg .=
"<li>Cannot remove service options from here.<br>";
95 if ( $target_launch !=
"FLEX" && $target_launch !=
"TBD" ) {
96 $target_launch = dateformat(
"Y-m-d", $target_launch);
100 $qry_stmt = sprintf(
"UPDATE cuinfo\n");
101 $qry_stmt .= sprintf(
"SET system_options='%s',\n",$upd_sys_opt);
102 $qry_stmt .= sprintf(
"target_launch='%s',\n",$target_launch);
103 $qry_stmt .= sprintf(
"next_contact_date=%s\n",save_date($next_contact_date));
104 $qry_stmt .= sprintf(
"WHERE user_name = '%s'; \n",$user_name);
106 $qry_stmt .=
"DELETE from cuproducts WHERE user_name = '$user_name';";
107 if (is_array($cu_products)) {
108 foreach ($cu_products as $code=>$value) {
109 $qry_stmt .=
"INSERT into cuproducts values ('$code','$user_name');";
113 # run sql and show result 115 if ($err_msg ==
"") {
116 if (!($db_result=db_query($qry_stmt, $link)))
117 $err_msg = pg_errormessage();
119 if ($err_msg ==
"") {
120 $msg=
"Upgrade Information Saved Successfully";
122 # $msg="$qry_stmt<br>$err_msg"; 126 ## end of save -- falls through to display (with bad data in case of error) 127 ## savehide just quits 128 if ($act ==
"savehide") {
131 <link rel=stylesheet href='/monitor/css/monitor.css' type='text/css'> 132 </head><body class='dtll'><div class='msg'>$msg</div> 140 cu_header(
"Home CU - Upgrade Information");
143 <link type=
"text/css" href=
"/monitor/css/jquery-ui-1.8.18.custom.css" rel=
"stylesheet" />
144 <script type=
"text/javascript" src=
"/monitor/js/jquery-1.7.1.min.js"></script>
145 <script type=
"text/javascript" src=
"/monitor/js/jquery-ui-1.8.18.custom.min.js"></script>
146 <script type=
"text/javascript">
150 $(
'#targetlaunch').datepicker({
154 $(
'#nextcontact').datepicker({
158 $(
'#dialog_link, ul#icons li').hover(
159 function() { $(
this).addClass(
'ui-state-hover'); },
160 function() { $(
this).removeClass(
'ui-state-hover'); }
164 function sendform(act)
166 document.forms[0].act.value=act;
167 document.forms[0].submit();
173 print
"<form action='$self' name='cuup' method='post'>";
178 $loadrec = isset($showrows);
179 if ($loadrec == 0 ) {
180 $query =
"select system_options, target_launch, next_contact_date 181 from cuinfo where user_name = '$user_name'";
182 $result = db_query($query, $link);
184 list( $system_options, $target_launch, $next_contact_date) = db_fetch_array($result,0);
186 $sys_typ_batch = ($system_options & $SYS_TYPE_BATCH ? $SYS_TYPE_BATCH : NULL);
187 $sys_typ_live = ($system_options & $SYS_TYPE_LIVE ? $SYS_TYPE_LIVE : NULL);
188 $sys_typ_asp = ($system_options & $SYS_TYPE_ASP ? $SYS_TYPE_ASP : NULL);
189 $sys_typ_ivr = ($system_options & $SYS_TYPE_IVR ? $SYS_TYPE_IVR : NULL);
190 $sys_typ_voip = ($system_options & $SYS_TYPE_VOIP ? $SYS_TYPE_VOIP : NULL);
191 $sys_typ_webonly = ($system_options & $SYS_TYPE_WEBONLY ? $SYS_TYPE_WEBONLY : NULL);
192 $sys_typ_upgrade = ($system_options & $SYS_TYPE_UPGRADE ? $SYS_TYPE_UPGRADE : NULL);
193 $sys_typ_closed = ($system_options & $SYS_TYPE_CLOSED ? $SYS_TYPE_CLOSED : NULL);
199 $sys_typ_upg = $system_options;
201 $target_launch = trim($target_launch);
202 if ( $target_launch !=
"FLEX" && $target_launch !=
"TBD" ) {
203 $target_launch = dms_disphtml(dateformat(
"m/d/Y",$target_launch));
205 $next_contact_date = dateformat(
"m/d/Y",trim($next_contact_date));
207 $query =
"select trim(home_cu_code)as home_cu_code 208 from cuproducts where user_name='$user_name'";
209 $result = db_query($query, $link);
212 while ($sql_row = db_fetch_array($result, $row++)) {
213 $code=$sql_row[
'home_cu_code'];
214 $cu_products[
"$code"]=1;
216 $query =
"select trim(home_cu_code)as home_cu_code, 217 trim(home_cu_desc) as home_cu_desc from cuprodlist 218 order by home_cu_desc";
219 $result = db_query($query, $link);
222 while ($sql_row = db_fetch_array($result, $row++)) {
223 $code=$sql_row[
'home_cu_code'];
224 $product=$sql_row[
'home_cu_desc'];
225 $cu_prodmaster[
"$code"]=$product;
228 $sys_typ_upg_test = ($sys_typ_upg & $SYS_TYPE_UPG_TEST ? $SYS_TYPE_UPG_TEST : NULL);
229 $sys_typ_upg_beta = ($sys_typ_upg & $SYS_TYPE_UPG_BETA ? $SYS_TYPE_UPG_BETA : NULL);
230 $sys_typ_upg_comp = ($sys_typ_upg & $SYS_TYPE_UPG_COMP ? $SYS_TYPE_UPG_COMP : NULL);
232 print
"<table cellspacing='0' cellpadding='1' border='0' width='100%' bgcolor=white>";
234 if (isset($err_msg) && strlen($err_msg) > 0)
235 print
"<tr><td colspan='5' class='msg' align='left'>Errors occured -- changes not saved<br>$err_msg</td></tr>";
237 print
"<tr><td colspan='5' class='msg' align='left'>$msg</td></tr>";
239 print
"<tr><td colspan='5'>";
240 print
"<input type=\"hidden\" name=\"user_name\" value=\"$user_name\">";
241 print
"<input type=\"hidden\" name=\"sys_typ_batch\" value=\"". (isset($sys_typ_batch) ? $sys_typ_batch :
"") .
"\">";
242 print
"<input type=\"hidden\" name=\"sys_typ_live\" value=\"". (isset($sys_typ_live) ? $sys_typ_live :
"") .
"\">";
243 print
"<input type=\"hidden\" name=\"sys_typ_asp\" value=\"". (isset($sys_typ_asp) ? $sys_typ_asp :
"") .
"\">";
244 print
"<input type=\"hidden\" name=\"sys_typ_webonly\" value=\"". (isset($sys_typ_webonly) ? $sys_typ_webonly :
"") .
"\">";
245 print
"<input type=\"hidden\" name=\"sys_typ_closed\" value=\"". (isset($sys_typ_closed) ? $sys_typ_closed :
"") .
"\">";
246 print
"<input type=\"hidden\" name=\"showrows\" value=\"1\">";
251 <td colspan=
"2" class=
"hdr">
254 <td colspan=
"3" class=
"hdr">
259 <td
class=
'iright' width=
'12%' valign=
"top">
260 <input type=
'checkbox' name=
'show_batch' value=
'1' <?php echo (isset($sys_typ_batch) ?
"CHECKED" :
""); ?> disabled>Batch<br>
261 <input type=
'checkbox' name=
'show_live' value=
'2' <?php echo (isset($sys_typ_live) ?
"CHECKED" :
""); ?> disabled>Live<br>
262 <input type=
'checkbox' name=
'show_asp' value=
'4' <?php echo (isset($sys_typ_asp) ?
"CHECKED" :
""); ?> disabled>ASP<br>
264 <td
class=
'iright' width=
'12%' valign=
"top">
265 <input type=
'checkbox' name=
'show_webonly' value=
'16' <?php echo (isset($sys_typ_webonly) ?
"CHECKED" :
""); ?> disabled>Web ONLY<br>
266 <input type=
'checkbox' name=
'show_closed' value=
'64' <?php echo (isset($sys_typ_closed) ?
"CHECKED" :
""); ?> disabled>Closed CU<br>
268 <td
class=
'iright' valign=
"top">
269 <input type=
'checkbox' name=
'sys_typ_upgrade' value=
'32' <?php echo (isset($sys_typ_upgrade) ?
"CHECKED" :
""); ?>>Upgrade / Conversion<br>
270 <input type=
'checkbox' name=
'sys_typ_ivr' value=
'8' <?php echo (isset($sys_typ_ivr) ?
"CHECKED" :
""); ?>>IVR<br>
271 <input type=
'checkbox' name=
'sys_typ_voip' value=
'<?php echo $SYS_TYPE_VOIP; ?>' <?php echo (isset($sys_typ_voip) ?
"CHECKED" :
""); ?>>VOIP<br>
273 <td nowrap align=
"right" class=
"dtl">
274 Target Launch Date:<br>
277 <td nowrap
class=
'dtl'>
278 <input type=
"text" name=
"target_launch" size=
"11" maxlength=
"10" id=
"targetlaunch" value=
"<?php echo $target_launch ?>">
280 <font color=
"green">MM/DD/YYYY</font>
282 <a
id=
"setFlex" style=
"font-size:12px;" href=
"#" onClick=
"$('#targetlaunch').val('FLEX'); return false;">FLEX</a>
284 <a
id=
"setTbd" style=
"font-size:12px;" href=
"#" onClick=
"$('#targetlaunch').val('TBD'); return false;">TBD</a>
286 <input type=
"text" name=
"next_contact_date" size=
"11" maxlength=
"10" id=
"nextcontact" value=
"<?php echo $next_contact_date ?>">
288 <font color=
"green">MM/DD/YYYY</font>
292 <td nowrap colspan=
'5' valign=
"top" class=
"dtl">
293 Home CU Upgrade Status:
294 <select name=
"sys_typ_upg">
295 <option value=
"0">No Upgrade in Process</option>
296 <option value=
"128" <?php echo (isset($sys_typ_upg_test) ?
"SELECTED" :
""); ?>>Setup</option>
297 <option value=
"256" <?php echo (isset($sys_typ_upg_beta) ?
"SELECTED" :
""); ?>>Beta</option>
298 <option value=
"512" <?php echo (isset($sys_typ_upg_comp) ?
"SELECTED" :
""); ?>>Complete</option>
304 <td colspan=
"5" class=
"hdr">
309 <td nowrap colspan=
'5' class=
'dtll'>
311 foreach ($cu_prodmaster as $code => $product) {
312 print
"<input type='checkbox' name='cu_products[$code]' value='1'";
313 if (HCU_array_key_value($code, $cu_products)) print
" checked";
314 print
"> $product <input type='hidden' name='cu_prodmaster[$code]' value='$product'><br>";
321 <td nowrap colspan=
'5' class=
'dtlc'>
322 <input type=hidden name=
"act" value=
"">
323 <br><input type=
"submit" name=
"Save" Value=
"Save" onClick=
"sendform('save')">
333 # skinnied down to button only for inclusion in cuview iframe 334 # cu_header("Home CU - Upgrade Information"); 336 <link rel=stylesheet href='/monitor/css/monitor.css' type='text/css'> 337 </head><body class='dtll'>";
342 $query =
"select system_options, 343 case when target_launch = 'ASAP' or target_launch is null or 344 trim(target_launch)='' then null 345 when CURRENT_DATE > to_date(target_launch,'MM/DD/YYYY') 346 then null else target_launch end as target_launch, 347 case when CURRENT_DATE > next_contact_date then null 348 else next_contact_date end as next_contact_date, 349 case when date_live is null then 'PENDING' 350 else 'UPGRADE' end as data_status 351 from cuinfo where user_name = '$user_name'";
352 $result = db_query($query, $link);
354 list( $system_options, $target_launch, $next_contact_date,$data_status) = db_fetch_array($result,0);
356 $sys_typ_batch = ($system_options & $SYS_TYPE_BATCH ? $SYS_TYPE_BATCH : NULL);
357 $sys_typ_live = ($system_options & $SYS_TYPE_LIVE ? $SYS_TYPE_LIVE : NULL);
358 $sys_typ_asp = ($system_options & $SYS_TYPE_ASP ? $SYS_TYPE_ASP : NULL);
359 $sys_typ_ivr = ($system_options & $SYS_TYPE_IVR ? $SYS_TYPE_IVR : NULL);
360 $sys_typ_voip = ($system_options & $SYS_TYPE_VOIP ? $SYS_TYPE_VOIP : NULL);
361 $sys_typ_webonly = ($system_options & $SYS_TYPE_WEBONLY ? $SYS_TYPE_WEBONLY : NULL);
362 $sys_typ_upgrade = ($system_options & $SYS_TYPE_UPGRADE ? $SYS_TYPE_UPGRADE : NULL);
363 $sys_typ_closed = ($system_options & $SYS_TYPE_CLOSED ? $SYS_TYPE_CLOSED : NULL);
365 $target_launch = dateformat(
"m/d/Y",trim($target_launch));
366 $next_contact_date = dateformat(
"m/d/Y",trim($next_contact_date));
369 if (!is_null($sys_type_closed)) $msg.=
'Cannot upgrade closed client<br>';
370 if (($system_options & $SYS_TYPE_UPGRADE) || $data_status==
"PENDING") $msg.=
"$data_status Target Launch $target_launch ~ Next Contact $next_contact_date<br>";
373 print
"<div class='msg'>$msg</div> 377 print
"<form action='$self' name='cuup' method='post'>";
379 <input type=
"hidden" name=
"sys_typ_batch" value=
"$sys_typ_batch">
380 <input type=
"hidden" name=
"sys_typ_live" value=
"$sys_typ_live">
381 <input type=
"hidden" name=
"sys_typ_asp" value=
"$sys_typ_asp">
382 <input type=
"hidden" name=
"sys_typ_webonly" value=
"$sys_typ_webonly">
383 <input type=
"hidden" name=
"sys_typ_closed" value=
"$sys_typ_closed">
384 <input type=
"hidden" name=
"sys_typ_upgrade" value=
"32">
385 <input type=
"hidden" name=
"sys_typ_ivr" value=
"$sys_typ_ivr">
386 <input type=
"hidden" name=
"sys_typ_voip" value=
"$sys_typ_voip">
387 <input type=
"hidden" name=
"target_launch" value=
"$target_launch">
388 <input type=
"hidden" name=
"next_contact_date" value=
"$next_contact_date">
389 <input type=hidden name=
"act" value=
"savehide">
390 <input type=
"submit" name=
"UPD" Value=
"Upgrade Service">