forked from rmbinder/Mitgliedsbeitrag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_function.php
82 lines (70 loc) · 2.7 KB
/
delete_function.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
<?php
/**
***********************************************************************************************
* Funktionen der Deleteroutine
*
* @copyright The Admidio Team
* @see https://www.admidio.org/
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
*
* Parameters:
*
* form : The name of the form that were submitted.
*
***********************************************************************************************
*/
require_once(__DIR__ . '/../../adm_program/system/common.php');
require_once(__DIR__ . '/common_function.php');
// Initialize and check the parameters
$getForm = admFuncVariableIsValid($_GET, 'form', 'string');
$gMessage->showHtmlTextOnly(true);
$ret_message = 'success';
try
{
switch($getForm)
{
case 'delete':
$members = array();
$members = list_members(array('PAID'.$gCurrentOrgId, 'FEE'.$gCurrentOrgId, 'CONTRIBUTORY_TEXT'.$gCurrentOrgId, 'DUEDATE'.$gCurrentOrgId), 0);
foreach ($members as $key => $data)
{
$user = new User($gDb, $gProfileFields, $key);
if (!empty($data['DUEDATE'.$gCurrentOrgId])
&& isset($_POST['duedate_only']))
{
$user->setValue('DUEDATE'.$gCurrentOrgId, '');
}
if (!empty($data['PAID'.$gCurrentOrgId])
&& (isset($_POST['with_paid'])
|| isset($_POST['paid_only'])
|| isset($_POST['delete_all'])))
{
$user->setValue('PAID'.$gCurrentOrgId, '');
}
if (!empty($data['FEE'.$gCurrentOrgId])
&& ((isset($_POST['with_paid']) && !empty($data['PAID'.$gCurrentOrgId]))
|| (isset($_POST['without_paid'])&& empty($data['PAID'.$gCurrentOrgId]))
|| isset($_POST['delete_all'])))
{
$user->setValue('FEE'.$gCurrentOrgId, '');
}
if (!empty($data['CONTRIBUTORY_TEXT'.$gCurrentOrgId])
&& ((isset($_POST['with_paid']) && !empty($data['PAID'.$gCurrentOrgId]))
|| (isset($_POST['without_paid'])&& empty($data['PAID'.$gCurrentOrgId]))
|| isset($_POST['delete_all'])))
{
$user->setValue('CONTRIBUTORY_TEXT'.$gCurrentOrgId, '');
}
$user->save();
}
$ret_message = 'delete';
break;
default:
$gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
}
}
catch(AdmException $e)
{
$e->showText();
}
echo $ret_message;