-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCSVExport.php
More file actions
393 lines (351 loc) · 14 KB
/
Copy pathCSVExport.php
File metadata and controls
393 lines (351 loc) · 14 KB
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
<?php
/*******************************************************************************
*
* filename : CSVExport.php
* last change : 2003-01-17
* description : options for creating csv file
*
* http://www.infocentral.org/
* Copyright 2001-2002 Phillip Hullquist, 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";
// If user does not have CSV Export permission, redirect to the menu.
if (!$bExportCSV)
{
Redirect("Menu.php");
exit;
}
//Get Classifications for the drop-down
$sSQL = "SELECT * FROM list_lst WHERE lst_ID = 1 ORDER BY lst_OptionSequence";
$rsClassifications = RunQuery($sSQL);
//Get Family Roles for the drop-down
$sSQL = "SELECT * FROM list_lst WHERE lst_ID = 2 ORDER BY lst_OptionSequence";
$rsFamilyRoles = RunQuery($sSQL);
// Get all the Groups
$sSQL = "SELECT * FROM group_grp ORDER BY grp_Name";
$rsGroups = RunQuery($sSQL);
$sSQL = "SELECT person_custom_master.* FROM person_custom_master ORDER BY custom_Order";
$rsCustomFields = RunQuery($sSQL);
$numCustomFields = mysql_num_rows($rsCustomFields);
$sSQL = "SELECT family_custom_master.* FROM family_custom_master ORDER BY fam_custom_Order";
$rsFamCustomFields = RunQuery($sSQL);
$numFamCustomFields = mysql_num_rows($rsFamCustomFields);
// Get Field Security List Matrix
$sSQL = "SELECT * FROM list_lst WHERE lst_ID = 5 ORDER BY lst_OptionSequence";
$rsSecurityGrp = RunQuery($sSQL);
while ($aRow = mysql_fetch_array($rsSecurityGrp))
{
extract ($aRow);
$aSecurityType[$lst_OptionID] = $lst_OptionName;
}
// Set the page title and include HTML header
$sPageTitle = gettext("CSV Export");
require "Include/Header.php";
?>
<form method="post" action="CSVCreateFile.php">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" valign="top" align="left">
<h3><?php echo gettext("Standard Fields"); ?></h3>
<table cellpadding="4" align="left">
<tr>
<td class="LabelColumn"><?php echo gettext("Last Name:"); ?></td>
<td class="TextColumn"><?php echo gettext("Required"); ?></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Title:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Title" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("First Name:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="FirstName" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Middle Name:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="MiddleName" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Suffix:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Suffix" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Address1:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Address1" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Address2:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Address2" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("City:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="City" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("State:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="State" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Zip:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Zip" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Envelope:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Envelope" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Country:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Country" value="1" checked></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Home Phone:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="HomePhone" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Work Phone:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="WorkPhone" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Mobile Phone:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="CellPhone" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Email:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="Email" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Work/Other Email:"); ?></td>
<td class="TextColumn"><input type="checkbox" name="WorkEmail" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Membership Date:"); ?></td>
<td class="TextColumnWithBottomBorder"><input type="checkbox" name="MembershipDate" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("* Birth / Anniversary Date:"); ?></td>
<td class="TextColumnWithBottomBorder"><input type="checkbox" name="BirthdayDate" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("* Age / Years Married:"); ?></td>
<td class="TextColumnWithBottomBorder"><input type="checkbox" name="Age" value="1"></td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Family Role:"); ?></td>
<td class="TextColumnWithBottomBorder"><input type="checkbox" name="PrintFamilyRole" value="1"></td>
</tr>
<tr>
<td colspan="2"><?php echo gettext("* Depends whether using person or family output method"); ?></td>
</tr>
</table>
</td>
<?php if (($numCustomFields > 0) or ($numFamCustomFields > 0)) {?>
<td width="20%" valign="top"><table border="0">
<?php if ($numCustomFields > 0) { ?>
<tr><td width="100%" valign="top" align="left">
<h3><?php echo gettext("Custom Person Fields"); ?></h3>
<table cellpadding="4" align="left">
<?php
// Display the custom fields
while ($Row = mysql_fetch_array($rsCustomFields)) {
extract($Row);
if (($aSecurityType[$fam_custom_FieldSec] == 'bAll') or ($_SESSION[$aSecurityType[$fam_custom_FieldSec]]))
{
$currentData = trim($aCustomData[$custom_Field]);
echo "<tr><td class=\"LabelColumn\">" . $custom_Name . "</td>";
echo "<td class=\"TextColumn\"><input type=\"checkbox\" name=" . $custom_Field . " value=\"1\"></td></tr>";
}
}
?>
</table>
</td></tr>
<?php } ?>
<?php if ($numFamCustomFields > 0) { ?>
<tr><td width="100%" valign="top" align="left">
<h3><?php echo gettext("Custom Family Fields"); ?></h3>
<table cellpadding="4" align="left">
<?php
// Display the family custom fields
while ($Row = mysql_fetch_array($rsFamCustomFields)) {
extract($Row);
if (($aSecurityType[$fam_custom_FieldSec] == 'bAll') or ($_SESSION[$aSecurityType[$fam_custom_FieldSec]]))
{
$currentData = trim($aFamCustomData[$fam_custom_Field]);
echo "<tr><td class=\"LabelColumn\">" . $fam_custom_Name . "</td>";
echo "<td class=\"TextColumn\"><input type=\"checkbox\" name=" . $fam_custom_Field . " value=\"1\"></td></tr>";
}
}
?>
</table>
</td></tr>
<?php } ?>
</table></td>
<?php } ?>
<td valign="top" align="left">
<h3><?php echo gettext("Filters"); ?></h3>
<table cellpadding="4" align="left">
<tr>
<td class="LabelColumn"><?php echo gettext("Records to export:"); ?></td>
<td class="TextColumnWithBottomBorder">
<select name="Source">
<option value="filters"><?php echo gettext("Based on filters below.."); ?></option>
<option value="cart" <?php if ($_GET["Source"] == 'cart') echo "selected";?>><?php echo gettext("People in Cart (filters ignored)"); ?></option>
</select>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Classification:"); ?></td>
<td class="TextColumn">
<div class="SmallText"><?php echo gettext("Use Ctrl Key to select multiple"); ?></div>
<select name="Classification[]" size="5" multiple>
<?php
while ($aRow =mysql_fetch_array($rsClassifications))
{
extract($aRow);
?>
<option value="<?php echo $lst_OptionID ?>"><?php echo $lst_OptionName ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Family Role:"); ?></td>
<td class="TextColumn">
<div class="SmallText"><?php echo gettext("Use Ctrl Key to select multiple"); ?></div>
<select name="FamilyRole[]" size="5" multiple>
<?php
while ($aRow = mysql_fetch_array($rsFamilyRoles))
{
extract($aRow);
?>
<option value="<?php echo $lst_OptionID ?>"><?php echo $lst_OptionName ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Gender:"); ?></td>
<td class="TextColumn">
<select name="Gender">
<option value="0"><?php echo gettext("Don't Filter"); ?></option>
<option value="1"><?php echo gettext("Male"); ?></option>
<option value="2"><?php echo gettext("Female"); ?></option>
</select>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Group Membership:"); ?></td>
<td class="TextColumn">
<div class="SmallText"><?php echo gettext("Use Ctrl Key to select multiple"); ?></div>
<select name="GroupID[]" size="5" multiple>
<?php
while ($aRow = mysql_fetch_array($rsGroups))
{
extract($aRow);
echo "<option value=\"" . $grp_ID . "\">" . $grp_Name . "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Membership Date:"); ?></td>
<td class="TextColumn">
<table border=0 cellpadding=0 cellspacing=0>
<tr><td><b><?php echo gettext("From:"); ?> </b></td><td><input id="sell" type="text" name="MembershipDate1" size="11" maxlength="10">
<input type="image" value="cal" onclick="return showCalendar('sell', 'y-mm-dd');" src="Images/calendar.gif"></td></tr>
<tr><td><b><?php echo gettext("To:"); ?> </b></td><td><input id="DateField" type="text" name="MembershipDate2" size="11" maxlength="10" value="<?php echo(date("Y-m-d")); ?>">
<input type="image" value="cal" onclick="return showCalendar('DateField', 'y-mm-dd');" src="Images/calendar.gif"></td></tr>
<tr><td> </td><td><div class="SmallText"><?php echo gettext("[format: YYYY-MM-DD]"); ?></div></td></tr>
</table>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Birthday Date:"); ?></td>
<td class="TextColumn">
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<b><?php echo gettext("From:"); ?> </b>
</td>
<td>
<input id="BD1" type="text" name="BirthDate1" size="11" maxlength="10">
<input type="image" value="cal" onclick="return showCalendar('BD1', 'y-mm-dd');" src="Images/calendar.gif">
</td>
</tr>
<tr>
<td>
<b><?php echo gettext("To:"); ?> </b>
</td>
<td>
<input id="BD2" type="text" name="BirthDate2" size="11" maxlength="10" value="<?php echo(date("Y-m-d")); ?>">
<input type="image" value="cal" onclick="return showCalendar('BD2', 'y-mm-dd');" src="Images/calendar.gif">
</td>
</tr>
<tr><td> </td><td><div class="SmallText"><?php echo gettext("[format: YYYY-MM-DD]"); ?></div></td></tr>
</table>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Anniversary Date:"); ?></td>
<td class="TextColumn">
<table border=0 cellpadding=0 cellspacing=0>
<tr><td><b><?php echo gettext("From:"); ?> </b></td><td><input id="AD1" type="text" name="AnniversaryDate1" size="11" maxlength="10">
<input type="image" value="cal" onclick="return showCalendar('AD1', 'y-mm-dd');" src="Images/calendar.gif"></td></tr>
<tr><td><b><?php echo gettext("To:"); ?> </b></td><td><input id="AD2" type="text" name="AnniversaryDate2" size="11" maxlength="10" value="<?php echo(date("Y-m-d")); ?>">
<input type="image" value="cal" onclick="return showCalendar('AD2', 'y-mm-dd');" src="Images/calendar.gif"></td></tr>
<tr><td> </td><td><div class="SmallText"><?php echo gettext("[format: YYYY-MM-DD]"); ?></div></td></tr>
</table>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Date Entered:"); ?></td>
<td class="TextColumn">
<table border=0 cellpadding=0 cellspacing=0>
<tr><td><b><?php echo gettext("From:"); ?> </b></td><td><input id="ED1" type="text" name="EnterDate1" size="11" maxlength="10">
<input type="image" value="cal" onclick="return showCalendar('ED1', 'y-mm-dd');" src="Images/calendar.gif"></td></tr>
<tr><td><b><?php echo gettext("To:"); ?> </b></td><td><input id="ED2" type="text" name="EnterDate2" size="11" maxlength="10" value="<?php echo(date("Y-m-d")); ?>">
<input type="image" value="cal" onclick="return showCalendar('ED2', 'y-mm-dd');" src="Images/calendar.gif"></td></tr>
<tr><td> </td><td><div class="SmallText"><?php echo gettext("[format: YYYY-MM-DD]"); ?></div></td></tr>
</table>
</td>
</tr>
<tr>
<td class="LabelColumn"><?php echo gettext("Output Method:"); ?></td>
<td class="TextColumnWithBottomBorder">
<select name="Format">
<option value="Default"><?php echo gettext("CSV Individual Records"); ?></option>
<option value="Rollup"><?php echo gettext("CSV Combine Families"); ?></option>
<option value="AddToCart"><?php echo gettext("Add Individuals to Cart"); ?></option>
</select>
</td>
</tr>
<tr>
<td colspan=2 align="center"><input type="checkbox" name="SkipIncompleteAddr" value="1"><?php echo gettext("Skip records with incomplete mail address"); ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" class="icButton" value=<?php echo "\"" . gettext("Create File") . "\""; ?> name="Submit"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php
require "Include/Footer.php";
?>