forked from jwigal/churchinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PropertyUnassign.php
132 lines (112 loc) · 3.85 KB
/
PropertyUnassign.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
<?php
/*******************************************************************************
*
* filename : PropertyUnassign.php
* last change : 2003-01-07
* website : http://www.infocentral.org
* copyright : Copyright 2001, 2002 Deane Barker
*
* InfoCentral is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
******************************************************************************/
//Include the function library
require "Include/Config.php";
require "Include/Functions.php";
// Security: User must have Manage Groups or Edit Records permissions
// Otherwise, re-direct them to the main menu.
if (!$_SESSION['bManageGroups'] && !$_SESSION['bEditRecords'])
{
Redirect("Menu.php");
exit;
}
//Get the new property value from the post collection
$iPropertyID = FilterInput($_GET["PropertyID"],'int');
// Is there a PersonID in the querystring?
if (isset($_GET["PersonID"]) && $_SESSION['bEditRecords'])
{
$iPersonID = FilterInput($_GET["PersonID"],'int');
$iRecordID = $iPersonID;
$sQuerystring = "?PersonID=" . $iPersonID;
$sTypeName = "Person";
$sBackPage = "PersonView.php?PersonID=" . $iPersonID;
// Get the name of the person
$sSQL = "SELECT per_FirstName, per_LastName FROM person_per WHERE per_ID = " . $iPersonID;
$rsName = RunQuery($sSQL);
$aRow = mysql_fetch_array($rsName);
$sName = $aRow["per_LastName"] . ", " . $aRow["per_FirstName"];
}
// Is there a GroupID in the querystring?
elseif (isset($_GET["GroupID"]) && $_SESSION['bManageGroups'])
{
$iGroupID = FilterInput($_GET["GroupID"],'int');
$iRecordID = $iGroupID;
$sQuerystring = "?GroupID=" . $iGroupID;
$sTypeName = "Group";
$sBackPage = "GroupView.php?GroupID=" . $iGroupID;
// Get the name of the group
$sSQL = "SELECT grp_Name FROM group_grp WHERE grp_ID = " . $iGroupID;
$rsName = RunQuery($sSQL);
$aRow = mysql_fetch_array($rsName);
$sName = $aRow["grp_Name"];
}
// Is there a FamilyID in the querystring?
elseif (isset($_GET["FamilyID"]) && $_SESSION['bEditRecords'])
{
$iFamilyID = FilterInput($_GET["FamilyID"],'int');
$iRecordID = $iFamilyID;
$sQuerystring = "?FamilyID=" . $iFamilyID;
$sTypeName = "Family";
$sBackPage = "FamilyView.php?FamilyID=" . $iFamilyID;
// Get the name of the family
$sSQL = "SELECT fam_Name FROM family_fam WHERE fam_ID = " . $iFamilyID;
$rsName = RunQuery($sSQL);
$aRow = mysql_fetch_array($rsName);
$sName = $aRow["fam_Name"];
}
// Somebody tried to call the script with no options
else
{
Redirect("Menu.php");
exit;
}
//Do we have confirmation?
if (isset($_GET["Confirmed"]))
{
$sSQL = "DELETE FROM record2property_r2p WHERE r2p_record_ID = " . $iRecordID . " AND r2p_pro_ID = " . $iPropertyID;
RunQuery($sSQL);
Redirect($sBackPage);
exit;
}
//Get the name of the property
$sSQL = "SELECT pro_Name FROM property_pro WHERE pro_ID = " . $iPropertyID;
$rsProperty = RunQuery($sSQL);
$aRow = mysql_fetch_array($rsProperty);
$sPropertyName = $aRow["pro_Name"];
//Set the page title
$sPageTitle = $sTypeName . gettext(" Property Unassignment");
//Include the header
require "Include/Header.php";
?>
<?php echo gettext("Please confirm removal of this property from this") . " " . $sTypeName;?>:
<table cellpadding="4">
<tr>
<td align="right"><b><?php echo $sTypeName ?>:</b></td>
<td><?php echo $sName; ?></td>
</tr>
<tr>
<td align="right"><b><?php echo gettext("Unassigning:"); ?></b></td>
<td><?php echo $sPropertyName ?></td>
</tr>
</table>
<p>
<a href="PropertyUnassign.php<?php echo $sQuerystring . "&PropertyID=" . $iPropertyID . "&Confirmed=Yes"; ?>"><?php echo gettext("Yes, unassign this Property"); ?></a>
</p>
<p>
<a href="<?php echo $sBackPage; ?>"><?php echo gettext("No, retain this assignment"); ?></a>
</p>
<?php
require "Include/Footer.php";
?>