forked from khoegenauer/tickets-cad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanse_regions.php
635 lines (587 loc) · 27.9 KB
/
cleanse_regions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
<?php
/**
* @package cleanse_regions.php
* @author John Doe <[email protected]>
* @since 2011-11-03
* @version 2013-09-10
*/
/* Change log - cleanse_regions.php
11/03/11 New File - accessed from Config to cleanse the region allocations where there are issues caused by duplicate entries
9/10/13 Major re-write to revise cleanse routine
*/
error_reporting(E_ALL);
@session_start();
require_once './incs/functions.inc.php';
$now = mysql_format_date(time() - (intval(get_variable('delta_mins')*60)));
if ((isset($_GET['func'])) && ($_GET['func']=='clean')) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />
<META HTTP-EQUIV="Expires" CONTENT="0" />
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" />
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript" />
<META HTTP-EQUIV="Script-date" CONTENT="<?php print date("n/j/y G:i", filemtime(basename(__FILE__)));?>" />
<TITLE>Tickets <?php print $disp_version;?></TITLE>
<LINK REL=StyleSheet HREF="stylesheet.php?version=<?php print time();?>" TYPE="text/css">
<link rel="shortcut icon" href="favicon.ico" />
<SCRIPT>
/**
*
* @returns {undefined}
*/
function ck_frames() {
if (self.location.href==parent.location.href) {
self.location.href = 'index.php';
}
else {
parent.upper.show_butts();
}
} // end function ck_frames()
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string') element = document.getElementById(element);
if (arguments.length == 1) return element;
elements.push(element);
}
return elements;
}
function do_hover(the_id) {
CngClass(the_id, 'hover');
return true;
}
function do_plain(the_id) { // 8/21/10
CngClass(the_id, 'plain');
return true;
}
function CngClass(obj, the_class) {
$(obj).className=the_class;
return true;
}
</SCRIPT>
</HEAD>
<?php
// Declare arrays for all resource ids
$region_ids = array();
$ticket_ids = array();
$user_ids = array();
$unit_ids = array();
$facility_ids = array();
// end of array declaration
// get region ids.
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]region`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$region_ids[] = $row['id'];
}
// end of region ids
// get ticket ids.
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]ticket`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$ticket_ids[] = $row['id'];
}
// end of ticket ids
// get user ids
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]user`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$user_ids[] = $row['id'];
}
// end of user ids
// get responder / unit ids
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]responder`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$unit_ids[] = $row['id'];
}
// end of responder ids
// get facility ids
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]facilities`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$facility_ids[] = $row['id'];
}
// end of facility ids
$text_output = "";
$users_text = "";
$tickets_text = "";
$units_text = "";
$facilities_text = "";
// cleanse entries for Users
$counter1 = 0;
foreach ($region_ids as $value) {
foreach ($user_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 4;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries > 1) {
$counter1++;
for ($i = 1; $i < $num_entries; $i++) {
$query_d = "DELETE FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 4 LIMIT 1;";
$result_d = mysql_query($query_d);
}
$users_text .= gettext("Duplicated region {$value} entries removed for user {$value2}") . "<BR />";
}
}
}
foreach ($user_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `type` = 4;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries ==0) {
$counter1++;
$query3 = "INSERT INTO `$GLOBALS[mysql_prefix]allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES
(1 , 4, '$now', 0, $value2, 'Inserted by list and cleanse regions routine' , 0)";
$result3 = mysql_query($query3);
$users_text .= gettext("Region entry for user {$value2} added in region 1") . "<BR />";
}
}
// end of User cleanse
// cleanse entries for Tickets
$counter2 = 0;
foreach ($region_ids as $value) {
foreach ($ticket_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 1;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries > 1) {
$counter2++;
for ($i = 1; $i < $num_entries; $i++) {
$query_d = "DELETE FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 1 LIMIT 1;";
$result_d = mysql_query($query_d);
}
$tickets_text .= gettext("Duplicated region {$value} entries removed for ticket {$value2}") . "<BR />";
}
}
}
foreach ($ticket_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `type` = 1;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries ==0) {
$counter2++;
$query3 = "INSERT INTO `$GLOBALS[mysql_prefix]allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES
(1 , 1, '$now', 0, $value2, 'Inserted by list and cleanse regions routine' , 0)";
$result3 = mysql_query($query3);
$tickets_text .= gettext("Region entry for ticket {$value2} added in region 1") . "<BR />";
}
}
// end of Ticket cleanse
// cleanse entries for Responders
$counter3 = 0;
foreach ($region_ids as $value) {
foreach ($unit_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 2;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries > 1) {
$counter3++;
for ($i = 1; $i < $num_entries; $i++) {
$query_d = "DELETE FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 2 LIMIT 1;";
$result_d = mysql_query($query_d);
}
$units_text .= gettext("Duplicated region {$value} entries removed for responder {$value2}") . "<BR />";
}
}
}
foreach ($unit_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `type` = 2;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries ==0) {
$counter3++;
$query3 = "INSERT INTO `$GLOBALS[mysql_prefix]allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES
(1 , 2, '$now', 0, $value2, 'Inserted by list and cleanse regions routine' , 0)";
$result3 = mysql_query($query3);
$units_text .= "Region entry for responder " . $value2 . " . added in region 1<BR />";
}
}
// end of Responder cleanse
// cleanse entries for Facilities
$counter4 = 0;
foreach ($region_ids as $value) {
foreach ($facility_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 3;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries > 1) {
$counter4++;
for ($i = 1; $i < $num_entries; $i++) {
$query_d = "DELETE FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 3 LIMIT 1;";
$result_d = mysql_query($query_d);
}
$facilities_text .= gettext("Duplicated region {$value} entries removed for facility {$value2}") . "<BR />";
}
}
}
foreach ($facility_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `type` = 3;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries ==0) {
$counter4++;
$query3 = "INSERT INTO `$GLOBALS[mysql_prefix]allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES
(1 , 3, '$now', 0, $value2, 'Inserted by list and cleanse regions routine' , 0)";
$result3 = mysql_query($query3);
$facilities_text .= "Region entry for facility " . $value2 . " . added in region 1<BR />";
}
}
// end of Facility cleanse
$text_output .= $counter1 >= 1 ? $users_text . gettext("User Allocations Cleansed") . "<BR />" : gettext("User Allocation Cleansing not required") . "<BR />";
$text_output .= $counter2 >= 1 ? $tickets_text . gettext("Ticket Allocations Cleansed") . "<BR />" : gettext("Ticket Allocation Cleansing not required") . "<BR />";
$text_output .= $counter3 >= 1 ? $units_text . gettext("Responder Allocations Cleansed") . "<BR />" : gettext("Responder Allocation Cleansing not required") . "<BR />";
$text_output .= $counter4 >= 1 ? $facilities_text . gettext("Facility Allocations Cleansed") . "<BR />" : gettext("Facility Allocation Cleansing not required") . "<BR />";
?>
<BODY onLoad = 'ck_frames();'>
<DIV style='font-size: 14px; position: absolute; top: 150px; left: 100px;'>
<H1><?php print gettext('Actions completed');?></H1>
<DIV style='position: relative; top: 10px; height: 150px; overflow-y: scroll; border: 3px outset #707070;'><?php print $text_output;?></DIV><BR />
<B><?php print gettext('Region table Cleansed');?></B><br /><br />
<A id='ret_but' class='plain' style='font-size: 14px;' onMouseOver="do_hover(this.id);" onMouseOut="do_plain(this.id);" href="config.php"><?php print gettext('Return to Config');?></A>
</DIV>
</BODY>
</HTML>
<?php
} elseif ((isset($_GET['func'])) && ($_GET['func']=='list')) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />
<META HTTP-EQUIV="Expires" CONTENT="0" />
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" />
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript" />
<META HTTP-EQUIV="Script-date" CONTENT="<?php print date("n/j/y G:i", filemtime(basename(__FILE__)));?>" />
<TITLE>Tickets <?php print $disp_version;?></TITLE>
<LINK REL=StyleSheet HREF="stylesheet.php?version=<?php print time();?>" TYPE="text/css">
<link rel="shortcut icon" href="favicon.ico" />
<STYLE>
.table_header { color: #FFFFFF; text-align: left; height: 20px; border: 1px solid #000000; background: #707070;}
.table_hdr_cell { color: #FFFFFF; width: 20%; font-weight: bold; font-size: 16px; border: 1px solid #000000;}
.table_row { color: #000000; text-align: left; height: 15px; border: 1px solid #000000;}
.table_cell { width: 20%; font-size: 14px; border: 1px solid #000000;}
.header { display: table-cell; color: #000000; width: 5%;}
.page_heading { font-size: 20px; font-weight: bold; text-align: left; background: #707070; color: #FFFFFF;}
.page_heading_text { font-size: 20px; font-weight: bold; text-align: left; background: #707070; color: #FFFFFF; width: 50%; dispay: inline;}
.button_bar { font-size: 1.2em; text-align: center; display: inline; width: 30%; position: fixed; right:30%; top: 0px;}
.buttons { border: 2px outset #FFFFFF; padding: 2px; background-color: #EFEFEF; font-weight: bold; display: inline; cursor: pointer;}
.flag { border: 2px outset #707070; background: #CECECE; font-size: 20px; font-weight: bold; display: inline; position: fixed; right:30%; top: 5%; max-height: 50%; overflow-y: auto;}
</STYLE>
<SCRIPT>
/**
*
* @returns {undefined}
*/
function ck_frames() {
if (self.location.href==parent.location.href) {
self.location.href = 'index.php';
}
else {
parent.upper.show_butts();
}
} // end function ck_frames()
/**
*
* @returns {Array}
*/
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string') element = document.getElementById(element);
if (arguments.length == 1) return element;
elements.push(element);
}
return elements;
}
function do_hover(the_id) {
CngClass(the_id, 'hover');
return true;
}
function do_plain(the_id) { // 8/21/10
CngClass(the_id, 'plain');
return true;
}
function CngClass(obj, the_class) {
$(obj).className=the_class;
return true;
}
</SCRIPT>
</HEAD>
<?php
// Declare arrays for all resource ids
$region_ids = array();
$ticket_ids = array();
$user_ids = array();
$unit_ids = array();
$facility_ids = array();
// end of array declaration
// get region ids.
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]region`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$region_ids[] = $row['id'];
}
// end of region ids
// get ticket ids.
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]ticket`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$ticket_ids[] = $row['id'];
}
// end of ticket ids
// get user ids
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]user`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$user_ids[] = $row['id'];
}
// end of user ids
// get responder / unit ids
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]responder`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$unit_ids[] = $row['id'];
}
// end of responder ids
// get facility ids
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]facilities`;";
$result = mysql_query($query);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$facility_ids[] = $row['id'];
}
// end of facility ids
?>
<BODY onLoad = 'ck_frames();'>
<DIV style='font-size: 20px; font-weight: bold; width:70%;'>
<DIV class='page_heading'>
<?php print gettext('Region Table Allocation List');?><DIV class='button_bar'>
<A class='buttons' href="cleanse_regions.php"><?php print gettext('Cleanse / Sanitize');?></A>
<A class='buttons' href="config.php"><?php print gettext('Cancel / Return to Config');?></A></DIV></DIV>
<DIV id='flag' class='flag'></DIV>
<DIV style='width:100%;'>
<?php
$counter = 0;
$counter2 = 0;
$the_errors = "";
print "<TABLE style='width: 100%; border: 1px;'>";
print "<TR class='table_header'>";
print "<TD class='table_hdr_cell'>" . gettext('Region') . "</TD><TD class='table_hdr_cell'>" . gettext('Users') . "</TD><TD class='table_hdr_cell'>" . gettext('Tickets') . "</TD><TD class='table_hdr_cell'>" . gettext('Responders') . "</TD><TD class='table_hdr_cell'>" . gettext('Facilities') . "</TD></TR>";
// list all allocations
foreach ($region_ids as $value) {
print "<TR>";
print "<TD class='table_cell'>" . $value . "</TD>";
print "<TD class='table_cell'>";
if (count($user_ids) > 0) {
foreach ($user_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 4;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 1) {
print "Ticket ID: " . $value2 . "<br />";
} elseif ($num_entries >=2) {
$counter++;
$the_errors .= "User ID: " . $value2 . " " . gettext('Duplicate Entries') . "<BR />";
print "<FONT COLOR='red'>User ID: " . $value2 . " " . gettext('Duplicate Entries') . "</FONT>";
}
}
} else {
$counter++;
$the_errors .= gettext("No Users Allocated to Regions") . "<BR />";
print gettext("No Users Allocated to Regions");
}
print "</TD>";
print "<TD class='table_cell'>";
if (count($ticket_ids) > 0) {
foreach ($ticket_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 1;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 1) {
print "Ticket ID: " . $value2 . "<br />";
} elseif ($num_entries >=2) {
$counter++;
$the_errors .= gettext("Ticket ID") . ": " . $value2 . " " . gettext('Duplicate Entries') . "<BR />";
print "<FONT COLOR='red'>" . gettext('Ticket ID') . ": " . $value2 . " " . gettext('Duplicate Entries') . "</FONT>";
}
}
} else {
$counter++;
$the_errors .= gettext("No Tickets Allocated to Regions") . "<BR />";
print gettext("No Tickets Allocated to Regions");
}
print "</TD>";
print "<TD class='table_cell'>";
if (count($unit_ids) > 0) {
foreach ($unit_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 2;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 1) {
print gettext("Responder ID") . ": " . $value2 . "<br />";
} elseif ($num_entries >=2) {
$counter++;
$the_errors .= gettext("Responder ID") . ": " . $value2 . " " . gettext('Duplicate Entries') . "<BR />";
print "<FONT COLOR='red'>" . gettext('Responder ID') . ": " . $value2 . " " . gettext('Duplicate Entries') . "</FONT>";
}
}
} else {
$counter++;
$the_errors .= gettext("No Tickets Allocated to Regions") . "<BR />";
print gettext("No Responders Allocated to Regions");
}
print "</TD>";
print "<TD class='table_cell'>";
if (count($facility_ids) > 0) {
foreach ($facility_ids as $value2) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value2}' AND `group` = '{$value}' AND `type` = 3;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 1) {
print gettext("Facility ID") . ": " . $value2 . "<br />";
} elseif ($num_entries >=2) {
$counter++;
$the_errors .= gettext("Facility ID") . ": " . $value2 . " " . gettext('Duplicate Entries') . "<BR />";
print "<FONT COLOR='red'>" . gettext('Facility ID') . ": " . $value2 . " " . gettext('Duplicate Entries') . "</FONT>";
}
}
} else {
$counter++;
$the_errors .= gettext("No Facilities Allocated to Regions") . "<BR />";
print gettext("No Facilities Allocated to Regions");
}
print "</TD></TR>";
}
if (count($unit_ids) >= 1) {
foreach ($user_ids as $value3) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value3}' AND `type` = 4;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 0) {
$counter++;
$the_errors .= "User ID: " . $value3 . " " . gettext('No Region Entry') . "<BR />";
}
}
}
if (count($ticket_ids) >= 1) {
foreach ($ticket_ids as $value3) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value3}' AND `type` = 1;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 0) {
$counter++;
$the_errors .= "Ticket ID: " . $value3 . " " . gettext('No Region Entry') . "<BR />";
}
}
}
if (count($unit_ids) >= 1) {
foreach ($unit_ids as $value3) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value3}' AND `type` = 2;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 0) {
$counter++;
$the_errors .= "Unit ID: " . $value3 . " " . gettext('No Region Entry') . "<BR />";
}
}
}
if (count($facility_ids) >= 1) {
foreach ($facility_ids as $value3) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]allocates` WHERE `resource_id` = '{$value3}' AND `type` = 3;";
$result = mysql_query($query);
$num_entries = mysql_num_rows($result);
if ($num_entries == 0) {
$counter++;
$the_errors .= "Facility ID: " . $value3 . " " . gettext('No Region Entry') . "<BR />";
}
}
}
if ($counter >= 1) {
$output_text = "<FONT COLOR='red'>" . gettext('THERE ARE ERRORS') . "</FONT><BR />" . $the_errors;
} else {
$output_text = "<FONT COLOR='green'>" . gettext('NO ERRORS') . "</FONT><BR />";
}
// end of allocations list
?>
</DIV>
</DIV>
<SCRIPT>
$('flag').innerHTML = "<?php print $output_text; ?>";
</SCRIPT>
</BODY>
</HTML>
<?php
} else {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />
<META HTTP-EQUIV="Expires" CONTENT="0" />
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" />
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript" />
<META HTTP-EQUIV="Script-date" CONTENT="<?php print date("n/j/y G:i", filemtime(basename(__FILE__)));?>" />
<TITLE>Tickets <?php print $disp_version;?></TITLE>
<LINK REL="StyleSheet" HREF="stylesheet.php?version=<?php print time();?>" TYPE="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
<SCRIPT>
/**
*
* @returns {undefined}
*/
function ck_frames() {
if (self.location.href==parent.location.href) {
self.location.href = 'index.php';
}
else {
parent.upper.show_butts();
}
} // end function ck_frames()
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string') element = document.getElementById(element);
if (arguments.length == 1) return element;
elements.push(element);
}
return elements;
}
function do_hover(the_id) {
CngClass(the_id, 'hover');
return true;
}
function do_plain(the_id) { // 8/21/10
CngClass(the_id, 'plain');
return true;
}
function CngClass(obj, the_class) {
$(obj).className=the_class;
return true;
}
</SCRIPT>
</HEAD>
<BODY onLoad = 'ck_frames();'>
<DIV style='font-size: 14px; position: fixed; top: 150px; left: 100px;'>
<?php print gettext('Are you sure you want to cleanse the Region allocations');?><br />
<br />
<?php print gettext('If you are SURE, click:');?> <A id='cleanse_but' class='plain' style='font-size: 14px; float: none;' onMouseOver="do_hover(this.id);" onMouseOut="do_plain(this.id);" href="cleanse_regions.php?func=clean"><?php print gettext('CLEANSE');?></A>
<br />
<br />
<?php print gettext('If NOT then click:');?> <A id='can_but' class='plain' style='font-size: 14px; float: none;' onMouseOver="do_hover(this.id);" onMouseOut="do_plain(this.id);" href="config.php"><?php print gettext('CANCEL');?></A>
</DIV>
</BODY>
</HTML>
<?php
}
?>