· 9 years ago · Jan 13, 2017, 05:16 AM
1<?php
2require_once 'includes/init.php';
3
4$PAGE['css'] = '
5 /* Qualifier Picker - System/Component */
6 #qualifier-changers { display:none; }
7 #qualifer_method { margin-bottom:1em; }
8 #qualifer_method_system, #qualifier_method_serial { display:none; }
9 #qualifer_method label { vertical-align:middle; }
10 label.required { font-weight:bold; }
11 #qualifer_method input { vertical-align:middle; }
12 #system-picker { padding:0 8px 8px 8px; border:1px solid #ccc; background:#eee; margin-bottom:1em; }
13 #system-picker label { display:block; }
14 #system-picker-results { margin-top:1em; }
15 ul.system-picker-results { margin:0; padding:0; }
16 ul.system-picker-results li { margin:0; padding:0; }
17 a#invoke-system-picker { display:none; }
18 #btn-system-picker-submit { margin-right:20px; }
19 #system-name-wrapper { margin-bottom:1em; }
20 #sku-wrapper { margin-bottom:1em; }
21 #fi_system_picker_q { margin-top:0; }
22 #serial_component_wrapper { margin-top:1em; }
23
24 #fi_request_subcategory_ext { margin-right:15px; }
25 #fi_request_subcategory { margin-right:15px; margin-bottom:1.5em; }
26
27 #qualifier-db-info { }
28 #qualifier-db-info ul { margin-bottom:1em; }
29 #qualifier-db-info li { border:none; padding:0 20px; }
30 #qualifier-db-info li.first { padding-left:0; }
31 #qualifier-db-info .lbl { font-weight:bold; }
32 a.url-change-qualifier { }
33 #real-qualifier-data { display:none; }
34 .warranty-expires-soon { color:#EB8E16; }
35 .warranty-available { color:#006600; }
36 .warranty-expired { color:#F00; }
37 #lbl_no_satisfaction_survey, #lbl_do_not_auto_close { vertical-align:middle; }
38 #fi_no_satisfaction_survey, #fi_do_not_auto_close { vertical-align:middle; margin-left:20px; }
39';
40
41$PAGE['onload'] .= "
42
43 $('#fi_request_category_ext').change(function() {
44 $.ajax({
45 type: 'GET',
46 url: '/ajax/list-values.php',
47 dataType: 'json',
48 data: { list: 'Customer Symptoms', cat: $('#fi_request_category_ext').val() },
49 async: false,
50 success: function(json) {
51 $('#fi_request_subcategory_ext').html(json);
52 }
53 });
54 });
55
56
57 $('#fi_request_category').change(function() {
58 $.ajax({
59 type: 'GET',
60 url: '/ajax/list-values.php',
61 dataType: 'json',
62 data: { list: 'Support Logging', cat: $('#fi_request_category').val() },
63 async: false,
64 success: function(json) {
65 $('#fi_request_subcategory').html(json);
66 }
67 });
68 });
69
70 // Focus Tracking code
71
72 $('#btn-create-new1').click(function() {
73 $('#fi_focus_tracker').val('');
74 });
75 $('#btn-create-new2').click(function() {
76 $('#fi_focus_tracker').val('');
77 });
78
79 $('#form-request-create').submit(function() {
80 if ($('#fi_focus_tracker').val() == 'serial') {
81 $('#btn-serial-submit').click();
82 return false;
83 }
84 else if ($('#fi_focus_tracker').val() == 'system') {
85 $('#btn-system-picker-submit').click();
86 return false;
87 }
88 });
89
90 $('#fi_serial_num').focus(function() {
91 $('#fi_focus_tracker').val('serial');
92 });
93 $('#fi_serial_num').blur(function() {
94 $('#fi_focus_tracker').val('');
95 });
96 $('#btn-serial-submit').focus(function() {
97 $('#fi_focus_tracker').val('serial');
98 });
99 $('#btn-serial-submit').blur(function() {
100 $('#fi_focus_tracker').val('');
101 });
102
103 $('#fi_system_picker_q').focus(function() {
104 $('#fi_focus_tracker').val('system');
105 });
106 $('#fi_system_picker_q').blur(function() {
107 $('#fi_focus_tracker').val('');
108 });
109 $('#btn-system-picker-submit').focus(function() {
110 $('#fi_focus_tracker').val('system');
111 });
112 $('#btn-system-picker-submit').blur(function() {
113 $('#fi_focus_tracker').val('');
114 });
115
116
117
118
119 // Radio buttons for Qualifer Method
120 $('#fi_qualifier_method_none').click(function() {
121 update_qualifier_method();
122 $('#fi_sku_none').focus();
123 });
124
125 $('#fi_qualifier_method_serial').click(function() {
126 update_qualifier_method();
127 $('#fi_serial_num').focus();
128 });
129
130 $('#fi_qualifier_method_system').click(function() {
131 update_qualifier_method();
132 $('#fi_system_picker_q').focus();
133 });
134
135 $('input[name=qualifier_method]').change(function() {
136 $('#fi_request_system_id').val('');
137 $('#fi_request_qualifier').val('');
138 $('#fi_request_subqualifier').val('');
139 });
140
141
142
143 // Serial Num Qualifier Method
144
145 $('#fi_serial_num').change(function() {
146 $('#btn-serial-submit').click();
147 });
148
149 $('#fi_component_id').change(function() {
150 var component_id_val = $(this).val();
151 var split_arr = component_id_val.split(\"\t\");
152 $('#fi_request_component_id').val(split_arr[0]);
153 $('#fi_request_system_id').val(split_arr[1]);
154 $('#fi_request_qualifier').val(split_arr[2]);
155 });
156
157 $('#btn-serial-submit').click(function() {
158
159 //$(this).val(serial_num);
160
161 update_serial_components(1);
162 });
163
164
165
166 function update_serial_components(submitting) {
167 var serial_num = $('#fi_serial_num').val();
168 /*
169 for (var i = serial_num.length; i < 12; i++) {
170 serial_num = '0' + serial_num;
171 }
172 */
173
174 $.getJSON('/ajax/components-for-serial.php?serial=' + encodeURIComponent(serial_num), function(data){
175 if (data.length < 1) {
176 $('#fi_component_id').hide();
177 $('#lbl_component_id').hide();
178 if (submitting) {
179 alert('No components could be identified using the serial number you entered.');
180 $('#fi_serial_num').focus().select();
181 }
182 }
183 else {
184 $('#fi_request_subqualifier').val(serial_num);
185 var html_options = '<option value=\"\">Select Component...</option>';
186 var option_cnt = data.length;
187 for (var i = 0; i < option_cnt; i++) {
188 html_options += '<option ' + (data.length == 1 ? 'selected=\"selected\" ' : '') + 'value=\"' + data[i].component_id + \"\t\" + data[i].system_id + \"\t\" + data[i].sku + '\">' + data[i].system_name + ' (ID: ' + data[i].system_id + ') - ' + data[i].sku + ' (ID: ' + data[i].component_id + ')</option>';
189 }
190 $('#fi_component_id').show().html(html_options);
191 $('#lbl_component_id').show();
192
193 if (data.length == 1) {
194 $('#fi_component_id').change();
195 }
196 }
197 });
198 }
199
200
201
202
203 // System Qualifier Method
204
205 $('a#url-cancel-system-picker').click(function() {
206 $('#system-picker-results').hide('');
207 return false;
208 });
209
210 $('a#url-reset-system-picker').click(function() {
211 $('#system-picker-results').html('');
212 $('#fi_system_picker_q').val('');
213 return false;
214 });
215
216 $('#fi_system_picker_q').change(function() {
217 $('#btn-system-picker-submit').click();
218 });
219
220 $('#fi_sku').change(function() {
221 update_qualifier_method();
222 });
223
224 $('a#url-clear-system').click(function() {
225 if (confirm('Are you sure you want to clear the selected System?')) {
226 $('#fi_request_system_id').val('');
227 $('#fi_request_qualifier').val('');
228 $('#fi_request_subqualifier').val('');
229 $('#fi_request_component_id').val('');
230
231 $('#fi_system_picker_q').val('');
232 $('#system-name').html('--');
233 $('#system-picker-results').hide();
234 $('#fi_sku').hide();
235 $('#lbl_sku').hide();
236 }
237 return false;
238 });
239
240 $('#system-picker').on('click', 'a.choose', function() {
241 var system_name = $(this).html();
242 var system_id = $(this).attr('title');
243
244 $('#fi_request_system_id').val(system_id);
245 $('#system-picker-results').hide();
246
247 $('#system-name').html(system_name + ' (ID: <a href=\"/system-update.php?system_id=' + system_id + '\" target=\"_blank\">' + system_id + '</a>)');
248
249 $.getJSON('/ajax/system-search.php?q=' + system_id, function(systems) {
250 var html_options_sku = '<option value=\"\">Select Component...</option><option value=\"\">Not Applicable/Does Not Apply</option>';
251 for (var i = 0; i < systems[0].components.length; i++) {
252 html_options_sku += '<option value=\"' + systems[0].components[i].id + \"\t\" + systems[0].components[i].sku + \"\t\" + systems[0].components[i].serial + '\">';
253 if ($('#fi_request_component_id').val() == systems[0].components[i].serial) {
254 html_options_sku += ' selected=\"selected\"';
255 }
256 html_options_sku += systems[0].components[i].sku + ' - ' + systems[0].components[i].serial + '</option>';
257 }
258 $('#fi_sku').html(html_options_sku).show().focus();
259 $('#lbl_sku').show();
260 });
261
262 return false;
263 });
264
265
266
267 $('#system-picker').on('click', '#btn-system-picker-submit', function() {
268
269
270 var q = $('#fi_system_picker_q').val();
271 var sku = $('#fi_sku').val();
272 if ($('#fi_system_picker_q').val() == '') {
273 alert('Please enter a System ID or System Name.');
274 }
275 else {
276 $.getJSON('/ajax/system-search.php?q=' + encodeURIComponent(q), function(data){
277 if (data.length < 1) {
278 alert('No System IDs or System Names match your query.');
279 }
280 else if (data.length > 20) {
281 alert('Query returned more than 20 systems. Please be more specific.');
282 }
283 else {
284 var option_cnt = data.length;
285 var system_picker_results = '<ul class=\"system-picker-results\">';
286 for (var i = 0; i < option_cnt; i++) {
287 system_picker_results += '<li><a href=\"#\" class=\"choose\" title=\"' + data[i].system_id + '\">' + data[i].system_name + '</a> (ID: <a href=\"' + data[i].url_kbase_update + '\" target=\"_blank\">' + data[i].system_id + '</a>)</li>';
288 }
289 system_picker_results += '</ul>';
290 $('#system-picker-results').html(system_picker_results);
291
292 $('#system-picker-results').html(system_picker_results);
293 if (data.length == 1) {
294 $('ul.system-picker-results a.choose').click();
295 }
296 else {
297 $('#system-picker-results').show();
298 }
299 }
300 });
301 }
302 });
303
304
305
306
307
308
309 // No Qualifier Methods
310
311 $('#fi_sku_none').change(function() {
312 $('#fi_request_qualifier').val($('#fi_sku_none').val());
313 });
314
315
316
317 function update_qualifier_method() {
318 if (request_component_id > 0) {
319 return;
320 }
321
322 var qualifier_method = $('input[name=qualifier_method]:checked').val();
323
324 switch (qualifier_method) {
325 case 'serial':
326 $('#qualifier_method_serial').show();
327 $('#qualifier_method_system').hide();
328 $('#qualifier_method_none').hide();
329
330 if ($('#fi_component_id').val() == '') {
331 $('#fi_component_id').hide();
332 $('#lbl_component_id').hide();
333 }
334
335 $('#fi_sku').val('').hide();
336 $('#lbl_sku').hide();
337 $('#fi_sku_none').val('');
338 $('#system-name').html('--');
339
340 update_serial_components(0);
341
342 break;
343 case 'system':
344 $('#qualifier_method_serial').hide();
345 $('#qualifier_method_system').show();
346 $('#qualifier_method_none').hide();
347
348 $('#fi_serial_num').val('');
349 $('#fi_component_id').val('').hide();
350 $('#lbl_component_id').hide();
351
352 var split_arr = $('#fi_sku').val().split(\"\t\");
353 $('#fi_request_component_id').val(split_arr[0] == null ? '' : split_arr[0]);
354 $('#fi_request_qualifier').val(split_arr[1] == null ? '' : split_arr[1]);
355 $('#fi_request_subqualifier').val(split_arr[2] == null ? '' : split_arr[2]);
356
357 $('#fi_sku_none').val('');
358
359 break;
360 default:
361 $('#qualifier_method_serial').hide();
362 $('#qualifier_method_system').hide();
363 $('#qualifier_method_none').show();
364
365 $('#fi_serial_num').val('');
366 $('#fi_component_id').val('').hide();
367 $('#lbl_component_id').hide();
368
369 $('#fi_sku').val('').hide();
370 $('#lbl_sku').hide();
371 $('#system-name').html('--');
372
373 $('#fi_request_system_id').val('');
374 $('#fi_request_qualifier').val($('#fi_sku_none').val());
375
376 $('#fi_request_subqualifier').val('');
377 $('#fi_request_component_id').val('');
378
379 }
380 }
381
382 $('#fi_request_subcategory_ext').change(function() {
383 update_subcategory_other();
384 if ($(this).val().substring(0, 5) == 'Other') {
385 $('#fi_request_subcategory_ext_other').focus();
386 $('label[for=fi_request_subcategory_ext_other]').addClass('required');
387 }
388 else {
389 $('label[for=fi_request_subcategory_ext_other]').removeClass('required');
390 $('#fi_request_subcategory_ext_other').val('');
391 }
392
393 });
394
395 $('#fi_request_subcategory').change(function() {
396 update_subcategory_other();
397 if ($(this).val().substring(0, 5) == 'Other') {
398 $('#fi_request_subcategory_other').focus();
399 $('label[for=fi_request_subcategory_other]').addClass('required');
400 }
401 else {
402 $('label[for=fi_request_subcategory_other]').removeClass('required');
403 $('#fi_request_subcategory_other]').val('');
404 }
405 });
406
407 function update_subcategory_other() {
408 if ($('#fi_request_subcategory_ext').val() != null && $('#fi_request_subcategory_ext').val().substring(0, 5) == 'Other') {
409 $('#fi_request_subcategory_ext_other').removeAttr('disabled');
410 }
411 else {
412 $('#fi_request_subcategory_ext_other').attr('disabled', 'disabled');
413 }
414
415 if ($('#fi_request_subcategory').val() != null && $('#fi_request_subcategory').val().substring(0, 5) == 'Other') {
416 $('#fi_request_subcategory_other').removeAttr('disabled');
417 }
418 else {
419 $('#fi_request_subcategory_other').attr('disabled', 'disabled');
420 }
421 }
422
423
424
425
426
427 // Legacy JS onload function calls
428 checkValue();
429 initDynamicOptionLists();
430
431
432 update_subcategory_other();
433 update_qualifier_method();
434
435";
436$PAGE['head'] .= "
437<script type='text/javascript'>
438
439 function ShowDescription()
440 {
441 var priority = document.requestcreate.request_priority_int.value;
442 var requestDesc = 'System is functioning; Some features are not available';
443
444 if (priority == 'Priority 1') {
445 requestDesc = 'Affects integrity of imported movies; Limited time to resolve';
446 } else if (priority == 'Priority 2') {
447 requestDesc = 'No Movies may be played back or imported';
448 } else if (priority == 'Priority 3') {
449 requestDesc = 'System is functioning; Some features are not available';
450 } else if (priority == 'Priority 4') {
451 requestDesc = 'System is functioning normally; Questions re: performance, config, or use';
452 }
453
454 // Dynamically write out the country in the heading
455 var spanElm = document.getElementById('requestPriorityDesc');
456 var newSpan = document.createElement('span');
457 newSpan.id = 'requestPriorityDesc';
458 var newText = document.createTextNode(requestDesc);
459 newSpan.appendChild(newText);
460 document.getElementById('desc').replaceChild(newSpan,spanElm);
461 }
462
463 function checkValue() {
464 var kbSelection = document.getElementById('request_kb_applicable').options[document.getElementById('request_kb_applicable').selectedIndex].value;
465 if (kbSelection == 'NO - KB N/A' || kbSelection == 'YES - KB Unwritten') {
466 document.getElementById('request_kb_id').disabled = true;
467 } else {
468 document.getElementById('request_kb_id').disabled = false;
469
470 }
471 }
472
473</script>
474";
475# Set default data if this is coming from a Component record...
476if ((isset($_GET["system_id"])) and (strcmp($_GET["system_id"],"")!=0))
477{
478 $PAGE['onload'] .= "
479 $('#fi_qualifier_method_system').click();
480 update_qualifier_method();
481 $('#fi_system_picker_q').val(".$_GET["system_id"].")
482 $('#btn-system-picker-submit').click();
483 ";
484}
485
486
487
488
489
490# Database Includes/Variables -- General
491$kmart_db = $DBO->db_kmart();
492
493# Special Handling of this page variable to include it in the referer variable...
494$get_variable = "";
495
496if (! isset($_REQUEST['qualifier_method'])) {
497 $_REQUEST['qualifier_method'] = 'serial';
498}
499if (! isset($_REQUEST['serial_num']) || strlen($_REQUEST['serial_num']) < 1) {
500 $_REQUEST['serial_num'] = '';
501}
502
503// Disk Serials should not have 0's pre-pended
504if (strlen($_POST['request_subqualifier']) > 0) {
505 if (preg_match('/^KDISK/i', $_POST['request_qualifier'])) {
506 $_POST['request_subqualifier'] = preg_replace('/^0+/', '', $_POST['request_subqualifier']);
507 }
508 else {
509 $_POST['request_subqualifier'] = sprintf('%012s', $_POST['request_subqualifier']);
510 }
511}
512
513
514# Set default data if this is coming from a Component record...
515if ((isset($_GET["request_component_id"])) and (strcmp($_GET["request_component_id"],"")!=0))
516{
517 settype($_GET["request_component_id"],"integer");
518 $request_component_id = $_GET["request_component_id"];
519 # Validate Component record exists and redirect to error page if it does not...
520 $sql = "select count(component_id) as 'component_exists' from component where component_id = '".$request_component_id."'";
521 $rid = odbc_exec($db,$sql);
522 if (!(odbc_result($rid,'component_exists')))
523 {
524 header("Location:access-item.php?item=Component&id=".$request_component_id);
525 odbc_free_result($rid);
526 exit();
527 }
528 odbc_free_result($rid);
529
530 $get_variable = "request_component_id=".$request_component_id."&";
531
532 $sql = "select * from component_v where component_id = '".$request_component_id."'";
533 $rid = odbc_exec($db,$sql);
534 if (odbc_result($rid,"admin_id"))
535 {
536 $request_system_id = odbc_result($rid,"component_system_id");
537 $request_contact_id_ext = odbc_result($rid,"admin_id");
538 $request_qualifier = odbc_result($rid,"sku");
539 $request_subqualifier = odbc_result($rid,"component_serial_number");
540 $request_reseller_id = odbc_result($rid,"admin_company_id");
541 $enduser_type = odbc_result($rid,"enduser_type");
542 $enduser_company_id = odbc_result($rid,"enduser_company_id");
543 }
544
545 if ((isset($_GET["case_type"])) and (strcmp($_GET["case_type"],"disk")==0)) {
546 $rid2 = odbc_exec($db, "SELECT TOP 1 sku FROM component_v WHERE component_serial_number = '".odbc_result($rid, "component_parent_sn")."' ORDER BY component_id DESC;");
547 $component_parent_sku = odbc_result($rid2, "sku");
548 odbc_free_result($rid2);
549
550 $request_summary = 'Slot '.odbc_result($rid, "component_slot_index").' of '.$component_parent_sku.' - SN '.odbc_result($rid, "component_parent_sn");
551 $request_category = "K-Disks";
552 $request_category_ext = 'K-Disks';
553 $request_subcategory = "Other";
554 $request_subcategory_ext = 'Other Disk questions';
555 $request_log_item = 'Yes';
556 $request_kb_applicable = 'NO - KB N/A';
557 $request_escalation_status = 'None';
558 $request_system_id = odbc_result($rid,"component_system_id");
559 $request_source = 'Phone';
560 $request_priority_int = 'Priority 3';
561 $request_disposition = sprintf('%s [%s]: ',
562 date("Y-n-j G:i",time()),
563 $USER->get('first_name').' '.substr($USER->get('last_name'),0,1)
564 );
565 $get_variable .= "case_type=disk&";
566 }
567 odbc_free_result($rid);
568} else if ((isset($_GET["system_id"])) and (strcmp($_GET["system_id"],"")!=0)) {
569 $system = new System($db, $_GET["system_id"]);
570
571 if ($system->id() > 0) {
572 $request_system_id = $system->id();
573 $request_contact_id_ext = $system->admin()->id();
574 $request_reseller_id = $system->reseller()->id();
575 $enduser_type = $system->enduser()->get("contact_type");
576 $enduser_company_id = $system->enduser()->get("company_id");
577 }
578}
579
580# Set default data if this is coming from a Component record...
581if ((isset($_GET["request_subqualifier"])) and (strcmp($_GET["request_subqualifier"],"")!=0))
582{
583 $request_subqualifier = $_GET["request_subqualifier"];
584 $request_qualifier = $_GET["request_qualifier"];
585 # Validate Component record exists and redirect to error page if it does not...
586 $sql = "select count(component_id) as 'component_exists' from component_v where component_serial_number = '".$request_subqualifier."' and sku = '".$request_qualifier."'";
587 $rid = odbc_exec($db,$sql);
588 if (!(odbc_result($rid,'component_exists')))
589 {
590 $request_component_id = "UNDEFINED";
591 header("Location:access-item.php?item=Component&id=".$request_component_id);
592 odbc_free_result($rid);
593 exit();
594 }
595 odbc_free_result($rid);
596
597 $sql = "select * from component_v where component_serial_number = '".$request_subqualifier."' and sku = '".$request_qualifier."'";
598 $rid = odbc_exec($db,$sql);
599 if (odbc_result($rid,"admin_id"))
600 {
601 $request_component_id = odbc_result($rid,"component_id");
602 $request_system_id = odbc_result($rid,"component_system_id");
603 $request_contact_id_ext = odbc_result($rid,"admin_id");
604 $request_qualifier = odbc_result($rid,"sku");
605 $request_reseller_id = odbc_result($rid,"admin_company_id");
606 $enduser_type = odbc_result($rid,"enduser_type");
607 $enduser_company_id = odbc_result($rid,"enduser_company_id");
608 }
609 odbc_free_result($rid);
610 $get_variable = "request_subqualifier=".$request_subqualifier."&";
611}
612
613# Set default data if this is coming from a Case record...
614if ((isset($_GET["request_id"])) and (strcmp($_GET["request_id"],"")!=0))
615{
616 $request_id = $_GET["request_id"];
617 # Validate Case record exists and redirect to error page if it does not...
618 $sql = "select count(request_id) as 'request_exists' from request where request_id = '".$request_id."'";
619 $rid = odbc_exec($db,$sql);
620 if (!(odbc_result($rid,'request_exists')))
621 {
622 header("Location:access-item.php?item=Case&id=".$request_id);
623 odbc_free_result($rid);
624 exit();
625 }
626 odbc_free_result($rid);
627
628 $sql = "select * from request_v where request_id = ".$request_id;
629 $rid = odbc_exec($db,$sql);
630 if (odbc_result($rid,"request_contact_id_ext"))
631 {
632 $request_contact_id_ext = odbc_result($rid,"request_contact_id_ext");
633 $request_contact_id_int = odbc_result($rid,"request_contact_id_int");
634 $request_type = odbc_result($rid,"request_type");
635 $request_qualifier = odbc_result($rid,"request_qualifier");
636 $request_subqualifier = odbc_result($rid,"request_subqualifier");
637 $request_reseller_id = odbc_result($rid,"request_reseller_id");
638 }
639 odbc_free_result($rid);
640 $get_variable = "request_id=".$request_id."&";
641}
642
643# If $request_contact_id_ext was not established via the above process, attempt to set it intelligently here...
644if (!(isset($request_contact_id_ext)))
645{
646 if ((isset($_REQUEST["request_contact_id_ext"])) and (strcmp($_REQUEST["request_contact_id_ext"],"")!=0))
647 {
648 $request_contact_id_ext = $_REQUEST["request_contact_id_ext"];
649 }
650 else
651 {
652 $request_contact_id_ext = $_SESSION["contact_id"];
653 }
654}
655
656# If $get_variable was not established via the component process, set it using the $request_contact_id_ext value...
657if (strcmp($get_variable,"")==0)
658{
659 $get_variable = "request_contact_id_ext=".$request_contact_id_ext."&";
660}
661
662# Check Authentication for page access and redirect as necessary...
663$auth = "reqd";
664$referer = $_SERVER['PHP_SELF']."?".$get_variable."auth=".$auth;
665$authmessage = authcheck($referer);
666if ((isset($authmessage)) and (strlen($authmessage) > 0))
667{
668 header($authmessage);
669 exit();
670}
671
672# Additional Authentication check for "special" pages
673if (!in_array ($GLOBALS["user_group_id_insert_request"], $_SESSION["user_group_map"]))
674{
675 header("Location:access-denied.php");
676 exit();
677}
678
679# Page Variables
680$pagemessage = "";
681
682$fields = array(
683 "request_status" => array("Status"),
684 'request_escalation_status' => array('Escalation Status'),
685 'queue_priority' => array('Queue Priority'),
686 'no_satisfaction_survey' => array('Do not send Satisfaction Survey for this item'),
687 'do_not_auto_close' => array('Do not auto close'),
688 "request_substatus" => array("Substatus"),
689 "request_kb_id" => array("KB Article ID"),
690 "request_kb_applicable" => array("KB Applicable?"),
691 "request_summary" => array("Summary"),
692 "request_description" => array("Diagnostic Data"),
693 "request_disposition" => array("Current Status"),
694 "request_contact_id_ext" => array("External Contact"),
695 "request_reseller_id" => array("Reseller"),
696 "request_contact_id_int" => array("Internal Contact"),
697 "request_contact_id_esc" => array("Escalation Contact"),
698 "request_type" => array("Contact Type"),
699 "request_category" => array("Support Logging"),
700 "request_subcategory" => array("Subcategory"),
701 "request_category_ext" => array("External Category"),
702 "request_subcategory_ext" => array("External Subcategory"),
703 #"request_priority_ext" => array("Priority-Ext"),
704 "request_priority_int" => array("Priority-Int"),
705 "request_source" => array("Source"),
706 "request_jira_id" => array("Jira ID"),
707 "request_qualifier" => array("Product"),
708 "request_subqualifier" => array("Serial #"),
709 "request_component_id" => array("Component ID"),
710 "request_notes_ext" => array("External Notes"),
711 "request_notes_int" => array("Internal Notes"),
712 "request_resolution_ext" => array("External Solution"),
713 "request_resolution_int" => array("Internal Solution"),
714 'request_system_id' => array('System ID'),
715 'request_subcategory_ext_other' => array('Other Detail - Customer'),
716 'request_subcategory_other' => array('Other Detail - Support')
717 );
718
719$request_contact_id_int_options = buildselectoptions($db,"contact","contact_id, last_name+', '+first_name as 'contact_full_name'","contact_status='ACTIVE' and (company_id = ".$GLOBALS["kls_company_id"]." or company_id = ".$GLOBALS["kls_canada_company_id"]." or company_id = 2366) ","contact_id","contact_full_name","contact_full_name");
720
721$request_contact_id_esc_options = buildselectoptions($db,"contact","contact_id, last_name+', '+first_name as 'contact_full_name'","contact_status='ACTIVE' and (company_id = ".$GLOBALS["kls_company_id"]." or company_id = ".$GLOBALS["kls_canada_company_id"]." or company_id = 2366) ","contact_id","contact_full_name","contact_full_name");
722
723
724# Extract "default" address info, etc. from database using contact information if $_SESSION["requestnew"] isn't already set
725if ((!isset($_SESSION["requestnew"])) and (isset($request_contact_id_ext)))
726{
727 $sql = "select * from contact where contact_id = ".$request_contact_id_ext;
728 $rid = odbc_exec($db,$sql);
729 if (odbc_fetch_row($rid))
730 {
731 $contactfields = array(
732 "enduser_company_id" => array("company_id"),
733 "enduser_type" => array("contact_type"),
734 );
735
736 foreach($contactfields as $fieldname => $fieldlabel)
737 {
738 if (odbc_result($rid,$contactfields[$fieldname][0]))
739 {
740 $$fieldname = odbc_result($rid,$contactfields[$fieldname][0]);
741 }
742 }
743 }
744 odbc_free_result($rid);
745 if ((!isset($request_reseller_id)) and (strcmp(substr($enduser_type,0,6),"Dealer")==0))
746 {
747 $request_reseller_id = $enduser_company_id;
748 }
749}
750
751# Set values for fields based on submitted session/post values
752foreach($fields as $fieldname => $fieldlabel)
753{
754 if (isset($_SESSION["requestnew"][$fieldname]))
755 {
756 $$fieldname = $_SESSION["requestnew"][$fieldname];
757 }
758 elseif (!isset($$fieldname)) # If the field hasn't been set by either process above, set it to ""
759 {
760 if (strcmp($fieldname, "request_reseller_id")==0)
761 {
762 $$fieldname = "";
763 }
764 elseif (strcmp($fieldname, "request_type")==0)
765 {
766 $$fieldname = "";
767 }
768 elseif (strcmp($fieldname, "request_category")==0)
769 {
770 $$fieldname = "";
771 }
772 elseif (strcmp($fieldname, "request_source")==0)
773 {
774 $$fieldname = "";
775 }
776/* elseif (strcmp($fieldname, "request_priority_ext")==0)
777 {
778 $$fieldname = "";
779 }
780*/ elseif (strcmp($fieldname, "request_priority_int")==0)
781 {
782 $$fieldname = "Priority 3";
783 }
784 elseif (strcmp($fieldname, "request_qualifier")==0)
785 {
786 $$fieldname = "";
787 }
788 elseif (strcmp($fieldname, "request_subqualifier")==0)
789 {
790 $$fieldname = "000000000000";
791 }
792 elseif (strcmp($fieldname, "request_contact_id_int")==0)
793 {
794 $$fieldname = $_SESSION["contact_id"];
795 }
796 elseif (strcmp($fieldname, "request_status")==0)
797 {
798 $$fieldname = "OPEN";
799 }
800 else
801 {
802 $$fieldname = "";
803 }
804 $$fieldname = htmlentities($$fieldname,ENT_QUOTES);
805 }
806}
807
808# Enumerate "Contact-Ext" values
809$sql = "select first_name, last_name, company_id, company_name, address_1, address_2, city, postal, state_prov, country, phone_day, phone_mobile, email from contact where contact_id = ".$request_contact_id_ext;
810$rid = odbc_exec($db,$sql);
811if (odbc_fetch_row($rid))
812{
813 $ext_first_name = odbc_result($rid,"first_name");
814 $ext_last_name = odbc_result($rid,"last_name");
815 $ext_company_name = odbc_result($rid,"company_name");
816 $ext_company_id = odbc_result($rid,"company_id");
817 $ext_address_1 = odbc_result($rid,"address_1");
818 $ext_address_2 = odbc_result($rid,"address_2");
819 $ext_city = odbc_result($rid,"city");
820 $ext_postal = odbc_result($rid,"postal");
821 $ext_state_prov = odbc_result($rid,"state_prov");
822 $ext_country = odbc_result($rid,"country");
823 $ext_phone = odbc_result($rid,"phone_day");
824 $ext_mobile = odbc_result($rid,"phone_mobile");
825 $ext_email = odbc_result($rid,"email");
826}
827odbc_free_result($rid);
828
829# Enumerate "Contact Name" value for Contact-Int Select List
830$sql = "select first_name, last_name from contact where contact_id = ".$request_contact_id_int;
831$rid = odbc_exec($db,$sql);
832if (odbc_result($rid,"first_name"))
833{
834 $int_contact_name = odbc_result($rid,"last_name").", ".odbc_result($rid,"first_name");
835}
836odbc_free_result($rid);
837
838# Enumerate "Contact Name" value for Contact-Esc Select List
839if (strcmp($request_contact_id_esc,"")!=0)
840{
841 $sql = "select first_name, last_name from contact where contact_id = ".$request_contact_id_esc;
842 $rid = odbc_exec($db,$sql);
843 if (odbc_fetch_row($rid))
844 {
845 $esc_contact_name = odbc_result($rid,"last_name").", ".odbc_result($rid,"first_name");
846 }
847 odbc_free_result($rid);
848}
849else
850{
851 $esc_contact_name = "";
852}
853
854# Enumerate "Reseller Company Name" value for Reseller Select List
855$reseller_company_name = "";
856if ((isset($request_reseller_id)) and (strcmp($request_reseller_id,"")!=0))
857{
858 $sql = "select company_name from company where company_id = ".$request_reseller_id;
859 $rid = odbc_exec($db,$sql);
860 if (odbc_result($rid,"company_name"))
861 {
862 $reseller_company_name = odbc_result($rid,"company_name");
863 }
864 odbc_free_result($rid);
865}
866
867
868// Enumerate Account Manager Info
869if ((isset($request_reseller_id)) and (strcmp($request_reseller_id,"")!=0)) {
870 $sql = "select contact_id, first_name, last_name, email from contact where contact_id = (select company_acct_mgr_id from company where company_id = ".$request_reseller_id.")";
871 $rid = odbc_exec($db,$sql);
872 if (odbc_result($rid,"first_name"))
873 {
874 $account_mgr_contact_id = odbc_result($rid,"contact_id");
875 $account_mgr_first_name = odbc_result($rid,"first_name");
876 $account_mgr_last_name = odbc_result($rid,"last_name");
877 }
878 odbc_free_result($rid);
879} else {
880 $account_mgr_contact_id = 0;
881}
882
883// Build JS array of products with their categories
884$sql = "select sku, product_name, product_type from price_product where kbase_active = '1';";
885$rid = odbc_exec($db,$sql);
886$products_array = array();
887$count = 0;
888while (odbc_fetch_row($rid))
889{
890 $products_array[$count] = odbc_result($rid,"sku")."|".odbc_result($rid,"product_type")."|".odbc_result($rid,"product_name");
891 $count++;
892}
893odbc_free_result($rid);
894
895
896if (! preg_match('/^\d{2}\-\d{2}\-\d{4}$/', $request_remind_date)) {
897 $request_remind_date = date('m-d-Y');
898}
899
900
901# If the submit page generated a message, capture it to display it as the process message.
902if (isset($_SESSION["requestsubmitmsg"]))
903{
904 $processmsg = $_SESSION["requestsubmitmsg"];
905}
906
907# If we get here, we need to clean up after ourselves and unset the warning messages...
908unset($_SESSION["requestsubmitmsg"]);
909unset($_SESSION["requestnew"]);
910
911if ((isset($_GET["request_id"])) and (strcmp($_GET["request_id"],"")!=0))
912{
913 $case = new Request ($db, $_GET["request_id"]);
914 $fields_do_not_duplicate = array('request_disposition','request_notes_ext','request_notes_int', 'request_status');
915 foreach($fields as $fieldname => $fieldlabel)
916 {
917 if (!in_array($fieldname, $fields_do_not_duplicate)) {
918 $$fieldname = $case->get("$fieldname");
919 }
920 }
921 $request_disposition = sprintf('%s [%s]: Duplicated this case from case ID: %d.
922%s',
923 date("Y-n-j G:i",time()),
924 $USER->get('first_name').' '.substr($USER->get('last_name'),0,1),
925 $case->id(),
926 $case->get('request_disposition')
927 );
928 $_REQUEST['qualifier_method'] = $case->qualifier_method();
929 $_REQUEST['sku_none'] = $case->get('request_qualifier');
930}
931
932$create_for = " for ".$ext_first_name." ".$ext_last_name.", ID: ".$request_contact_id_ext;
933$htmlpagetitle = "Kaleidescape > K.base > Create a New Case".$create_for;
934
935$PAGE['onload'] = sprintf("var request_component_id = %d;\n", $request_component_id) . $PAGE['onload'];
936if ($request_component_id > 0) {
937 $PAGE['css'] .= '#qualifier_method, #qualifier_method_serial, #qualifier_method_system, #qualifier_method_none { display:none; border:1px solid red; } ';
938}
939
940require_once 'templates/kbase-header.php';
941
942?>
943
944
945 <h1>Create a New Case<?php print $create_for; ?></h1>
946 <?php
947 if (isset($processmsg) and (strlen($processmsg) > 0))
948 {
949 print $GLOBALS["processmsg_display_begin"].$processmsg.$GLOBALS["processmsg_display_end"];
950 }
951 ?>
952
953 <span class="sms-form">
954 <form action="case-submit.php" name="requestcreate" method="post" id="form-request-create">
955 <input type="hidden" name="request_contact_id_ext" value="<?php print $request_contact_id_ext; ?>">
956 <table border="0" cellpadding="2" cellspacing="1" class="formTable">
957 <tr>
958 <th nowrap>Status / <a href="https://confluence.kaleidescape.com/display/SPPT/General+Escalation+Policy" target="_blank">Escalation</a> </th>
959 <td>
960 <select name="request_status" class="select">
961 <option value="<?php print $request_status; ?>" selected><?php print $request_status; ?></option>
962 <option value="OPEN">OPEN</option>
963 <option value="CLOSED">CLOSED</option>
964 </select>
965 /
966 <select id="fi_request_escalation_status" name="request_escalation_status" class="select">
967 <?php
968 foreach ($REQUEST_ESCALATION_STATII as $res) {
969 echo sprintf('<option value="%s"%s>%s</option>',
970 htmlentities($res),
971 strcasecmp($res, $request_escalation_status) ? '' : ' selected="selected"',
972 htmlentities($res)
973 );
974 }
975 ?>
976 </select>
977
978
979 <input id="fi_no_satisfaction_survey" name="no_satisfaction_survey" type="checkbox" class="checkbox" <?= $no_satisfaction_survey ? 'checked="checked"' : '' ?> value="1" />
980 <label id="lbl_no_satisfaction_survey" for="fi_no_satisfaction_survey">Do not send Satisfaction Survey</label>
981
982 <input id="fi_do_not_auto_close" name="do_not_auto_close" type="checkbox" class="checkbox" <?= $do_not_auto_close ? 'checked="checked"' : '' ?> value="1" />
983 <label id="lbl_do_not_auto_close" for="fi_do_not_auto_close">Do not auto close</label>
984 </td>
985 </tr>
986
987 <tr>
988 <th nowrap>Queue Priority</th>
989 <td>
990 <select id="fi_queue_priority" name="queue_priority" class="select">
991 <?php
992 $queue_priority == '' ? $queue_priority = 'Major' : '';
993 foreach ($REQUEST_QUEUE_PRIORITY as $queue_priorities) {
994 echo sprintf('<option value="%s"%s>%s</option>',
995 htmlentities($queue_priorities),
996 strcasecmp($queue_priorities, $queue_priority) ? '' : ' selected="selected"',
997 htmlentities($queue_priorities)
998 );
999 }
1000 ?>
1001 </select>
1002 </td>
1003 </tr>
1004
1005 <tr>
1006 <th nowrap><span class="optional">Substatus </span></th>
1007 <td>
1008 <select name="request_substatus" class="select">
1009 <option value="<?php print $request_substatus; ?>" selected><?php print $request_substatus; ?></option>
1010 <option value=""></option>
1011 <option value="Disk-Waiting Support">Disk-Waiting Support</option>
1012 <option value="Needs RMA">Needs RMA</option>
1013 <option value="Waiting-Control Systems">Waiting-Control Systems</option>
1014 <option value="Waiting-Dealer">Waiting-Dealer</option>
1015 <option value="Waiting-Distributor">Waiting-Distributor</option>
1016 <option value="Waiting-End User">Waiting-End User</option>
1017 <option value="Waiting-Engineering (Investigating)">Waiting-Engineering (Investigating)</option>
1018 <option value="Waiting-Engineering (Solved but not implemented)">Waiting-Engineering (Solved but not implemented)</option>
1019 <option value="Waiting-IADB">Waiting-IADB</option>
1020 <option value="Waiting-Legal">Waiting-Legal</option>
1021 <option value="Waiting-Manufacturing">Waiting-Manufacturing</option>
1022 <option value="Waiting-Manufacturing Rep Firm">Waiting-Manufacturing Rep Firm</option>
1023 <option value="Waiting-Media Guide">Waiting-Media Guide</option>
1024 <option value="Waiting-Order Processing">Waiting-Order Processing</option>
1025 <option value="Waiting-Payment/PO">Waiting-Payment/PO</option>
1026 <option value="Waiting-Product Management">Waiting-Product Management</option>
1027 <option value="Waiting-Sales">Waiting-Sales</option>
1028 <option value="Waiting-Support">Waiting-Support</option>
1029 <option value="Waiting-Support Management">Waiting-Support Management</option>
1030 <option value="Waiting-Warehouse">Waiting-Warehouse</option>
1031 <option value="Waiting-Other">Waiting Other</option>
1032 </select>
1033 </td>
1034 </tr>
1035
1036 <tr>
1037 <th valign="top" style="white-space:nowrap"><strong>Customer Symptoms</strong></th>
1038 <td>
1039
1040 <select class="select" name="request_category_ext" id="fi_request_category_ext" size="1">
1041 <option value=""></option>
1042 <?php
1043 foreach ($DBO->list_value_categories('Customer Symptoms') as $cat) {
1044 echo sprintf('<option value="%s"%s>%s</option>',
1045 htmlentities($cat),
1046 strcasecmp($cat, $request_category_ext) == 0 ? ' selected="selected"' : '',
1047 htmlentities($cat)
1048 );
1049 }
1050 ?>
1051 </select>
1052
1053 <select class="select" name="request_subcategory_ext" size="1" id="fi_request_subcategory_ext">
1054 <option value=""></option>
1055 <?php
1056 foreach ($DBO->list_value_subcategories('Customer Symptoms', $request_category_ext) as $subcat) {
1057 echo sprintf('<option value="%s"%s>%s</option>',
1058 htmlentities($subcat),
1059 strcasecmp($subcat, $request_subcategory_ext) == 0 ? ' selected="selected"' : '',
1060 htmlentities($subcat)
1061 );
1062 }
1063 ?>
1064 </select>
1065
1066 <label for="fi_request_subcategory_ext_other"<?= preg_match('/other/i', $request_subcategory_ext) ? ' class="required"' : '' ?>>"Other" Detail</label>
1067 <input id="fi_request_subcategory_ext_other" type="text" name="request_subcategory_ext_other" size="30" class="text" value="<?= htmlentities($request_subcategory_ext_other) ?>" maxlength="64" />
1068 </td>
1069 </tr>
1070
1071
1072 <tr>
1073 <th valign="top"><strong>Support Logging</strong></th>
1074 <td>
1075 <select class="select" name="request_category" size="1" id="fi_request_category">
1076 <option></option>
1077 <?php
1078 foreach ($DBO->list_value_categories('Support Logging') as $cat) {
1079 echo sprintf('<option value="%s"%s>%s</option>',
1080 htmlentities($cat),
1081 strcasecmp($cat, $request_category) == 0 ? ' selected="selected"' : '',
1082 htmlentities($cat)
1083 );
1084 }
1085 ?>
1086 </select>
1087
1088 <select class="select" name="request_subcategory" size="1" id="fi_request_subcategory">
1089 <?php
1090 foreach ($DBO->list_value_subcategories('Support Logging', $request_category) as $subcat) {
1091 if (preg_match('/other/i', $subcat)) { $subcat = 'Other'; }
1092 echo sprintf('<option value="%s"%s>%s</option>',
1093 htmlentities($subcat),
1094 strcasecmp($subcat, $request_subcategory) == 0 ? ' selected="selected"' : '',
1095 htmlentities($subcat)
1096 );
1097 }
1098 ?>
1099 </select>
1100
1101
1102 <label for="fi_request_subcategory_other"<?= preg_match('/other/i', $request_subcategory) ? ' class="required"' : '' ?>>"Other" Detail</label>
1103 <input id="fi_request_subcategory_other" type="text" name="request_subcategory_other" size="30" class="text" value="<?= htmlentities($request_subcategory_other) ?>" maxlength="64" />
1104 </td>
1105 </tr>
1106
1107
1108 <tr>
1109 <th id="desc" class="optional" style="color:#6699CC; font-weight:normal; text-align:right; width:100px;"><span id="requestPriorityDesc">System is functioning; Some features are not available</span></th>
1110 <td style="border-top:1px solid #6699CC; padding-top:10px; padding-bottom:10px;"> <table width="100%" border="0" cellspacing="0" cellpadding="3">
1111 <tr>
1112 <td><strong>Priority</strong></td>
1113 <td><strong>Internal Contact</strong></td>
1114 <td><span class="optional">Escalation Contact</span></td>
1115 <td><strong>Contact Type</strong></td>
1116 <td><strong>Source</strong></td>
1117 </tr>
1118 <tr>
1119 <td>
1120 <select name="request_priority_int" class="select" onchange="ShowDescription()">
1121 <option value="<?php print $request_priority_int; ?>" selected><?php print $request_priority_int; ?></option>
1122 <option value="Priority 1">Priority 1</option>
1123 <option value="Priority 2">Priority 2</option>
1124 <option value="Priority 3">Priority 3</option>
1125 <option value="Priority 4">Priority 4</option>
1126 </select>
1127 </td>
1128 <td>
1129 <select name="request_contact_id_int" class="select">
1130 <!--<option value="<?php print $request_contact_id_int; ?>" selected><?php print $int_contact_name; ?></option>-->
1131 <option value="55" selected>Support, Technical</option>
1132 <?php print $request_contact_id_int_options; ?>
1133 </select>
1134 </td>
1135 <td>
1136 <select name="request_contact_id_esc" class="select">
1137 <option value="<?=$request_contact_id_esc;?>" selected><?=$esc_contact_name;?></option>
1138 <option value=""></option>
1139 <?=$request_contact_id_esc_options;?>
1140 </select>
1141 </td>
1142 <td>
1143 <select name="request_type" class="select">
1144 <option value="<?=$request_type?>" selected><?=$request_type?></option>
1145 <option value="Dealer">Dealer</option>
1146 <option value="Distributor">Distributor</option>
1147 <option value="End User">End User</option>
1148 <option value="End User - No Dealer">End User - No Dealer</option>
1149 <option value="Non-K Dealer/Technical Contact">Non-K Dealer/Technical Contact</option>
1150 <option value="Partner">Partner</option>
1151 <option value="Rep Firm">Rep Firm</option>
1152 <option value="Other">Other</option>
1153 </select>
1154 </td>
1155 <td>
1156 <?php $request_source == '' ? $request_source = 'Phone' : ''; ?>
1157 <select name="request_source" class="select">
1158 <option value="<?=$request_source;?>" selected="selected"><?=$request_source;?></option>
1159 <option value="CEP">CEP</option>
1160 <option value="Email">Email</option>
1161 <option value="Phone">Phone</option>
1162 <option value="System Logs">System Logs</option>
1163 <option value="Tradeshow">Tradeshow</option>
1164 <option value="Voicemail">Voicemail</option>
1165 <option value="Website-Extranet">Website-Extranet</option>
1166 <option value="Other">Other</option>
1167 <option value="Not Known">Not Known</option>
1168 <option value="Not Applicable">Not Applicable</option>
1169 </select>
1170 </td>
1171 </tr>
1172 </table>
1173 </td>
1174 </tr>
1175 <tr>
1176 <th nowrap style="padding-top:10px;"> <br /></th>
1177 <td style="border-top:1px solid #6699CC; padding-top:10px; padding-bottom:10px;">
1178 <table width="100%" border="0" cellspacing="0" cellpadding="3">
1179 <tr>
1180 <td>KB Applicable?</td>
1181 <td><span class="optional">KB Article ID</span></td>
1182 <td><span class="optional">JIRA ID </span></td>
1183 <td> </td>
1184 <td> </td>
1185 </tr>
1186 <tr>
1187 <td><select name="request_kb_applicable" id="request_kb_applicable" class="select" onchange="checkValue()">
1188 <option value="<?=$request_kb_applicable;?>" selected="selected">
1189 <?=$request_kb_applicable;?>
1190 </option>
1191 <option value="NO - KB N/A">NO - KB N/A</option>
1192 <option value="YES - KB Approved">YES - KB Approved</option>
1193 <option value="YES - KB Unapproved">YES - KB Unapproved</option>
1194 <option value="YES - KB Unwritten">YES - KB Unwritten</option>
1195 </select></td>
1196 <td><input name="request_kb_id" id="request_kb_id" maxlength="7" value="<?=$request_kb_id;?>" class="input" /></td>
1197 <td><input name="request_jira_id" size="12" maxlength="12"value="<?php print $request_jira_id; ?>" class="input" /></td>
1198 <td> </td>
1199 <td> </td>
1200 </tr>
1201 </table>
1202 </td>
1203 </tr>
1204
1205 <tr>
1206 <th>
1207 <td nowrap="nowrap" style="border-top:1px solid #6699CC; padding-top:10px; padding-bottom:10px;">
1208
1209
1210 <?php
1211
1212 if ($request_component_id > 0) {
1213 $component = new Component($db, $request_component_id);
1214 $system = $component->system();
1215 $end_user = $system->enduser();
1216 echo sprintf('
1217 <div id="qualifier-db-info">
1218 <ul class="piped">
1219 <li class="first"><span class="lbl">System:</span> %s</li>
1220 <li><span class="lbl">Product:</span> %s</li>
1221 <li class="last"><span class="lbl">SN:</span> %s%s</li>
1222 </ul>
1223 </div>',
1224 $system->id() ? sprintf('%s (ID: <a href="%s">%d</a>)',
1225 htmlentities($system->name()), $system->url_kbase_update(NO_DOMAIN), $system->id()
1226 ) : '--',
1227 strlen($request_qualifier) ? htmlentities($request_qualifier) : '--',
1228 strlen($request_subqualifier) ? htmlentities($request_subqualifier) : '--',
1229 $component->id() ? sprintf(' (<span class="warranty-%s">%s</span>, ID: <a href="%s">%d</a>)',
1230 $component->warranty_status(),
1231 substr($component->warranty_end_date(), 0, 10),
1232 $component->url_kbase_update(NO_DOMAIN),
1233 $component->id()
1234 ) : ''
1235 );
1236 }
1237
1238 ?>
1239
1240
1241 <input type="hidden" name="focus_tracker" value="" id="fi_focus_tracker" />
1242
1243 <div id="qualifier_method">
1244 <input type="radio" name="qualifier_method" value="serial" id="fi_qualifier_method_serial"'
1245 <?= strcasecmp($_REQUEST['qualifier_method'], 'serial') ? '' : ' checked="checked"' ?> />
1246 <label for="fi_qualifier_method_serial" class="required">Identify System by Component Serial Number</label>
1247
1248 <input type="radio" name="qualifier_method" value="system" id="fi_qualifier_method_system"
1249 <?= strcasecmp($_REQUEST['qualifier_method'], 'system') ? '' : ' checked="checked"' ?> />
1250 <label for="fi_qualifier_method_system" class="required">Identify System by System ID or Name</label>
1251
1252 <input type="radio" name="qualifier_method" value="none" id="fi_qualifier_method_none"'
1253 <?= strcasecmp($_REQUEST['qualifier_method'], 'none') ? '' : ' checked="checked"' ?> />
1254 <label for="fi_qualifier_method_none" class="required">System Not Applicable/Does Not Apply</label>
1255 </div> <!-- end #qualifier_method -->
1256
1257
1258
1259 <div id="qualifier_method_serial">
1260 <label id="lbl_serial_num" for="fi_serial_num" class="required">Serial #</label>
1261 <input type="text" id="fi_serial_num" name="serial_num" class="text" value="<?= htmlentities($_REQUEST['serial_num']) ?>" maxlength="20" size="40" />
1262 <button type="button" id="btn-serial-submit" class="button">Go</button>
1263
1264 <div id="serial_component_wrapper">
1265 <label id="lbl_component_id" for="fi_component_id" class="required">Component</label>
1266 <select id="fi_component_id" name="component_id" class="select">
1267 <option value="">Select System/Component</option>
1268 </select>
1269 </div>
1270 </div> <!-- end #qualifier_method_serial -->
1271
1272
1273
1274 <div id="qualifier_method_system">
1275
1276 <div id="system-picker">
1277 <label for="fi_system_picker_q" class="required">Enter System ID or full/partial System Name</label>
1278 <input type="text" class="text" id="fi_system_picker_q" name="system_picker_q" size="30" />
1279 <button type="button" id="btn-system-picker-submit" class="button">Go</button>
1280 <a href="#" id="url-reset-system-picker">Reset Form</a> |
1281 <a href="#" id="url-clear-system">Clear Selected System</a>
1282
1283 <div id="system-picker-results"></div>
1284 </div>
1285
1286
1287 <div id="system-name-wrapper">
1288 <b>System:</b> <span id="system-name">
1289
1290 <?php
1291 $system = new System($db, $request_system_id);
1292
1293 if ($system->id() > 0) {
1294
1295 echo sprintf('<a href="%s" target="_blank">%s</a>',
1296 $system->url_kbase_update(NO_DOMAIN),
1297 htmlentities($system->name())
1298 );
1299 }
1300 else {
1301 echo '--';
1302 }
1303 ?>
1304 </span>
1305 </div>
1306
1307 <div id="sku-wrapper">
1308 <label id="lbl_sku" for="fi_sku" class="required">Component</label>
1309 <select id="fi_sku" name="sku" class="select">
1310 <option value="">Select Component...</option>
1311 <option value="">Not Applicable/Does Not Apply</option>
1312 <?php
1313 foreach ($system->components() as $component) {
1314 if (! in_array($component->product()->get('product_type'), $REQUEST_EXCLUDED_PRODUCT_TYPES)) {
1315 echo sprintf("<option value=\"%d\t%s\t%s\"%s>%s - %s</option>\n",
1316 $component->id(),
1317 htmlentities($component->sku()),
1318 htmlentities($component->serial()),
1319 $request_component_id == $component->id() ? ' selected="selected"' : '',
1320 htmlentities($component->sku()),
1321 htmlentities($component->serial())
1322 );
1323 }
1324 }
1325
1326 ?>
1327 </select>
1328 </div>
1329
1330 </div> <!-- end #qualifier_method_system -->
1331
1332
1333
1334 <div id="qualifier_method_none">
1335 <label id="lbl_sku" for="fi_sku" class="required">Product</label>
1336 <select id="fi_sku_none" name="sku_none" class="select">
1337 <option value="">Select Product...</option>
1338 <option value="">Not Applicable/Does Not Apply</option>
1339 <?php
1340 $products_by_type = $DBO->products_by_type(array('kbase_active' => 1));
1341 foreach ($products_by_type as $product_type => $products) {
1342 if (! in_array($product_type, $REQUEST_EXCLUDED_PRODUCT_TYPES)) {
1343 echo sprintf('<optgroup label="%s">', htmlentities($product_type));
1344 foreach ($products as $product) {
1345 echo sprintf('<option value="%s"%s>%s - %s</option>',
1346 htmlentities($product->sku()),
1347 strcasecmp($product->sku(), $_REQUEST['sku_none']) ? '' : ' selected="selected"',
1348 htmlentities($product->sku()),
1349 htmlentities($product->name_short())
1350 );
1351 }
1352 echo '</optgroup>';
1353 }
1354 }
1355 ?>
1356 </select>
1357 </div> <!-- end #qualifier_method_none -->
1358
1359
1360
1361
1362 <div id="real-qualifier-data">
1363 System ID: <input type="text" id="fi_request_system_id" name="request_system_id" value="<?= $request_system_id ?>" class="text" />
1364 Qualifier: <input type="text" id="fi_request_qualifier" name="request_qualifier" value="<?= $request_qualifier ?>" class="text" />
1365 SubQualifier: <input type="text" id="fi_request_subqualifier" name="request_subqualifier" value="<?= $request_subqualifier ?>" class="text" />
1366 Component ID: <input type="text" id="fi_request_component_id" name="request_component_id" value="<?= $request_component_id ?>" class="text" size="10" />
1367 </div>
1368
1369
1370
1371 </td>
1372
1373 </tr>
1374
1375 <tr>
1376 <th nowrap> </th>
1377 <td style="border-top:1px solid #6699CC; padding-top:10px;">
1378 <input id="btn-create-new1" type="submit" accesskey="s" value="Create New Case" name="submit" style="float:left;" class="button" />
1379 <span style="float:right"><?php print "<a href='#ExternalContact'>".$ext_first_name." ".$ext_last_name."</a> <a href=\"contact-update.php?contact_id=".$request_contact_id_ext."\"><img align='absmiddle' src=\"images/house.png\" border=\"0\" alt=\"View this External Contact's Record...\"></a> <a href=\"picker-contact-create.php?object_table=request&contact_id_existing=".$request_contact_id_ext."\"><img align='absmiddle' src=\"images/group_link.png\" border=\"0\" alt=\"Associate a different External Contact with this Case...\"></a>"; ?></span></td>
1380 </tr>
1381
1382 <tr>
1383 <th nowrap valign="top" ><br />Summary </th>
1384 <td><br /><input name="request_summary" style="width:99%;" maxlength="255" value="<?php print $request_summary; ?>" class="input" /></td>
1385 </tr>
1386
1387 <tr>
1388 <th nowrap valign="top"><span class="optional">Diagnostic Data </span><br />
1389 <script>
1390 function padZeros(theNumber, max) {
1391 var numStr = String(theNumber);
1392
1393 while ( numStr.length < max) {
1394 numStr = '0' + numStr;
1395 }
1396
1397 return numStr;
1398 }
1399 function insertAtCursor(myField, myValue) {
1400 var currentTime = new Date();
1401 var month = currentTime.getMonth() + 1;
1402 var day = currentTime.getDate();
1403 var year = currentTime.getFullYear();
1404 var hours = currentTime.getHours();
1405 var minutes = padZeros(currentTime.getMinutes(), 2);
1406 var date = year + "-" + month + "-" + day + " " + hours + ":" + minutes;
1407
1408 if (myValue == '') { myValue = date + " [<?php print $_SESSION["first_name"]." ".substr($_SESSION["last_name"],0,1)."]:"; ?> "; }
1409 else { myValue = myValue; }
1410 //IE support
1411 if (document.selection) {
1412 myField.focus();
1413 sel = document.selection.createRange();
1414 sel.text = myValue;
1415 myField.focus();
1416 }
1417 //MOZILLA/NETSCAPE support
1418 else if (myField.selectionStart || myField.selectionStart == '0') {
1419 var startPos = myField.selectionStart;
1420 var endPos = myField.selectionEnd;
1421 myField.value = myField.value.substring(0, startPos)
1422 + myValue
1423 + myField.value.substring(endPos, myField.value.length);
1424 myField.focus();
1425 } else {
1426 myField.value += myValue;
1427 myField.focus();
1428 }
1429 }
1430
1431 </script>
1432 <a href="javascript:void(0);" onclick="insertAtCursor(document.requestcreate.request_description, '');" style="font-weight:normal; font-style:italic;">date/time/name</a> </th>
1433 <td><textarea rows="10" cols="65" style="width:99%;" name="request_description" wrap="virtual" class="tty"><?php print $request_description; ?></textarea></td>
1434 </tr>
1435
1436 <tr>
1437 <th valign="top" nowrap><span class="optional">Current Status </span><br />
1438 <a href="javascript:void(0);" onclick="insertAtCursor(document.requestcreate.request_disposition, '');" style="font-weight:normal; font-style:italic;">date/time/name</a><br /><br />
1439 <a href="javascript:void(0);" onclick="insertAtCursor(document.requestcreate.request_disposition, 'Email sent to <?php print $ext_first_name." ".$ext_last_name; ?> ');" style="font-weight:normal; font-style:italic;">Email sent</a><br />
1440 <a href="javascript:void(0);" onclick="insertAtCursor(document.requestcreate.request_disposition, 'Email received from <?php print $ext_first_name." ".$ext_last_name; ?> ');" style="font-weight:normal; font-style:italic;">Email rec'd</a></th>
1441 <td><textarea rows="6" cols="65" style="width:99%;" name="request_disposition" wrap="virtual" class="tty"><?php print $request_disposition; ?></textarea></td>
1442 </tr>
1443
1444 <tr>
1445 <th nowrap> </th>
1446 <td></td>
1447 </tr>
1448
1449 <tr>
1450 <th nowrap style="vertical-align:top;">External Contact </th>
1451 <td>
1452 <table border="0" cellspacing="0" cellpadding="0">
1453 <tr>
1454 <td>
1455 <a name='ExternalContact'></a><select name="request_contact_id_ext" class="select">
1456 <?php
1457 ! $request_reseller_id ? $request_reseller_id = $ext_company_id : '';
1458 $company = new Company($db, $request_reseller_id);
1459
1460 if (sizeof($company->contacts()) > 0) {
1461 print '<optgroup label="Dealer Contacts">';
1462 foreach ($company->contacts() as $user) {
1463 printf('<option value="%d"%s>%s, %s</option>',
1464 $user->id(),
1465 $user->id() == $request_contact_id_ext ? ' selected = "selected"' : '',
1466 htmlentities($user->get('last_name')),
1467 htmlentities($user->get('first_name'))
1468 );
1469
1470 }
1471 print '</optgroup>';
1472 }
1473
1474 if (sizeof($company->contacts_inactive()) > 0) {
1475 print '<optgroup label="Inactive Dealer Contacts">';
1476 foreach ($company->contacts_inactive() as $user) {
1477 printf('<option value="%d"%s>%s, %s</option>',
1478 $user->id(),
1479 $user->id() == $request_contact_id_ext ? ' selected = "selected"' : '',
1480 htmlentities($user->get('last_name')),
1481 htmlentities($user->get('first_name'))
1482 );
1483
1484 }
1485 print '</optgroup>';
1486 }
1487
1488 if ($end_user) {
1489 printf('<optgroup label="End User"><option value="%d"%s>%s, %s</option></optgroup>',
1490 $end_user->id(),
1491 $end_user->id() == $request_contact_id_ext ? ' selected = "selected"' : '',
1492 htmlentities($end_user->get('last_name')),
1493 htmlentities($end_user->get('first_name'))
1494 );
1495 }
1496
1497 if ($account_mgr_contact_id && $account_mgr_contact_id != DEFAULT_AM) {
1498 printf('<optgroup label="Account Manager"><option value="%d"%s>%s, %s</option></optgroup>',
1499 $account_mgr_contact_id,
1500 $account_mgr_contact_id == $request_contact_id_ext ? ' selected = "selected"' : '',
1501 $account_mgr_last_name,
1502 $account_mgr_first_name
1503 );
1504 }
1505 ?>
1506 </select>
1507 <a href="contact-update.php?contact_id=<?=$request_contact_id_ext?>"><img src="images/house.png" align="absmiddle" border="0" title="View this External Contact's Record..."></a>
1508 <a href="picker-contact-create.php?object_table=request&contact_id_existing=<?=request_contact_id_ext;?>"><img align="absmiddle" src="images/group_link.png" border="0" alt="Associate a different External Contact with this Case..."></a><br /><br />
1509 <?php
1510 if (strcmp($ext_company_name,"")!=0)
1511 {
1512 print $ext_company_name."<br />";
1513 }
1514 print $ext_address_1."<br />";
1515 if (strcmp($ext_address_2,"")!=0)
1516 {
1517 print $ext_address_2."<br />";
1518 }
1519 print $ext_city.", ";
1520 if(strcmp($ext_state_prov,"Not Applicable")!=0)
1521 {
1522 print $ext_state_prov." ";
1523 }
1524 print $ext_postal."<br>".$ext_country."<br />".$ext_phone."<br />";
1525 if (strcmp($ext_mobile,"")!=0)
1526 {
1527 print $ext_mobile." cell<br />";
1528 }
1529 print "<a href=\"mailto:".$ext_email."\">".$ext_email."</a>";
1530 ?>
1531 </td>
1532 <td> </td>
1533 <td style="vertical-align:top;">
1534 <strong>Reseller</strong>
1535 <select name="request_reseller_id" class="select">
1536
1537 <?php
1538 $options_kaleidescape = $options_non_kaleidescape = '';
1539
1540 foreach ($DBO->company_names() as $company_id => $company_name) {
1541 $option = sprintf('<option value="%d"%s>%s (ID: %d)</option>',
1542 $company_id,
1543 $request_reseller_id == $company_id ? ' selected="selected"' : '',
1544 $company_name,
1545 $company_id
1546 );
1547
1548 if (preg_match('/kaleidescape/i', $company_name)) {
1549 $options_kaleidescape .= $option;
1550 echo 'fig';
1551 }
1552 else {
1553 $options_non_kaleidescape .= $option;
1554 }
1555 }
1556
1557 echo $options_kaleidescape, $options_non_kaleidescape;
1558 ?>
1559 </select>
1560 </td>
1561 </tr>
1562 </table>
1563 </td>
1564 </tr>
1565
1566 <tr>
1567 <th nowrap> </th>
1568 <td></td>
1569 </tr>
1570
1571 <tr>
1572 <th nowrap valign="top"><span class="optional">External Notes </span></th>
1573 <td><textarea rows="10" cols="65" style="width:99%;" name="request_notes_ext" wrap="virtual" class="tty"><?php print $request_notes_ext; ?></textarea></td>
1574 </tr>
1575
1576 <tr>
1577 <th nowrap valign="top"><span class="optional">Internal Notes </span></th>
1578 <td><textarea rows="10" cols="65" style="width:99%;" name="request_notes_int" wrap="virtual" class="tty"><?php print $request_notes_int; ?></textarea></td>
1579 </tr>
1580
1581 <tr>
1582 <th nowrap valign="top"><span class="optional">External Solution </span></th>
1583 <td><textarea rows="10" cols="65" style="width:99%;" name="request_resolution_ext" wrap="virtual" class="tty"><?php print $request_resolution_ext; ?></textarea></td>
1584 </tr>
1585
1586 <tr>
1587 <th nowrap valign="top"><span class="optional">Internal Solution </span></th>
1588 <td><textarea rows="10" cols="65" style="width:99%;" name="request_resolution_int" wrap="virtual" class="tty"><?php print $request_resolution_int; ?></textarea><br /> </td>
1589 </tr>
1590
1591 <tr>
1592 <th nowrap> </th><td><input type="hidden" name="supportmail" checked="checked" value="0">
1593 <input id="btn-create-new2" type="submit" accesskey="s" value="Create New Case" name="submit" class="button"></td>
1594 </tr>
1595 </table>
1596 </form>
1597 </span>
1598<p><br />Fields that are required in order to create this item are specified using a bold, black typeface, e.g. <b>Required Field</b>. Optional fields may be left blank and are labeled using an italicized, grey typeface, e.g. <span class="optional">Optional Field</span>.</p>
1599
1600<?php require_once 'templates/kbase-footer.php'; ?>