-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteMaterial.cfm
160 lines (160 loc) · 3.86 KB
/
deleteMaterial.cfm
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
<cfinclude template="authenticateExe.cfm">
<cfif not isDefined("FORM.Submit")>
<cfscript>
pageTitle = "Error!";
up2snuff = 0;
em = 'Error!';
// check required variables
if (not isDefined("FORM.MatID") or not isNumeric(FORM.MatID)) {
em = "Invalid or missing parameters";
}
else {
MatID = FORM.MatID;
up2snuff = 1;
}
</cfscript>
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfscript>
// initialize variables for uspCheckRelationships stored procedure
LibID = SESSION.LibID;
CntctID = 0;
ActID = 0;
SessID = 0;
MatID = MatID;
ClassID = 0;
</cfscript>
<cfinclude template="uspCheckRelationships.cfm">
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfif Relationships.Total gt 0>
<cfinclude template="incDenyDelete.cfm">
<cfelse>
<cfscript>
// initialize variables for uspGetMaterial stored procedure
MatID = FORM.MatID;
MatTypID = 0;
LibID = 0;
ActID = 0;
CntctID = 0;
UID = 0;
sDT = '';
eDT = '';
QuartID = 0;
Yr = 0;
FiscalY = 0;
Set = "";
</cfscript>
<cfinclude template="uspGetMaterial.cfm">
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfscript>
// initialize variables for uspGetContact stored procedure
LibID = 0;
CntctID = 0;
StatID = 0;
DeptID = 0;
SessID = 0;
ActID = 0;
MatID = MatID;
UID = 0;
sDT = '';
eDT = '';
FiscalY = 0;
Set = '';
</cfscript>
<cfinclude template="uspGetContact.cfm">
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfinclude template="formDeleteMaterial.cfm">
<cfinclude template="incMaterial.cfm">
</cfif>
</cfif>
</cfif>
</cfif>
</cfif>
<cfelse>
<cfscript>
pageTitle = "Error!";
up2snuff = 0;
em = 'Error!';
// check required variables
if (not isDefined("FORM.MatID") or not isNumeric(FORM.MatID)) {
em = "Invalid or missing parameters";
}
else {
MatID = FORM.MatID;
up2snuff = 1;
}
</cfscript>
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfscript>
// initialize variables for uspGetMaterial and uspDeleteMaterial stored procedures
MatID = FORM.MatID;
MatTypID = 0;
LibID = 0;
ActID = 0;
CntctID = 0;
UID = 0;
sDT = '';
eDT = '';
QuartID = 0;
Yr = 0;
FiscalY = 0;
Set = "";
</cfscript>
<cfinclude template="uspGetMaterial.cfm">
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfif Material.IsFile>
<cfinclude template="incGetDirectory.cfm">
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfloop query="DirectoryFiles">
<cfif Material.FileName eq DirectoryFiles.Name>
<cfset fileInDir = 1>
<cfbreak>
</cfif>
</cfloop>
<cfif fileInDir>
<cftry>
<cffile action="delete" file="#SESSION.FileLocation##Material.FileName#">
<cfcatch type="Any">
<cfset up2snuff = 0>
<cfset em = "An error ocurred while attempting to delete the file.">
</cfcatch>
</cftry>
</cfif>
</cfif>
</cfif>
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cfinclude template="uspDeleteMaterial.cfm">
<cfif not up2snuff>
<cfinclude template="incBegin.cfm">
<cfinclude template="incError.cfm">
<cfelse>
<cflocation url="materials.cfm?LibID=#SESSION.LibID#" addtoken="no">
</cfif>
</cfif>
</cfif>
</cfif>
</cfif>
<cfinclude template="incEnd.cfm">