forked from CiviMRF/cmrf_form_processor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmrf_form_processor.install
146 lines (141 loc) · 4.13 KB
/
cmrf_form_processor.install
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
<?php
require_once('cmrf_form_processor.cmrf.inc');
function cmrf_form_processor_disable() {
variable_del(cmrf_form_processor_get_connector_name());
if (function_exists('cmrf_core_list_profiles')) {
$profiles = cmrf_core_list_profiles();
foreach ($profiles as $profile_name => $profile) {
variable_del(cmrf_form_processor_get_connector_name($profile_name));
}
}
}
/**
* Implements hook_schema().
*/
function cmrf_form_processor_schema() {
return array(
'cmrf_form_processor_webforms' => array(
'description' => 'CiviMRF Form Processor settings for webforms.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Webform Node ID',
),
'cmrf_form_processor_enable' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Enabled CiviMRF Form Processor for this webform',
),
'cmrf_form_processor_queue' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Submit in background',
),
'cmrf_form_processor_clear_submission' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Clears the submission',
),
'cmrf_form_processor_profile' => array(
'description' => 'The profile',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'cmrf_form_processor_processor' => array(
'description' => 'The form processor',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'cmrf_form_processor_default_data_enable' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Enable default data retrieval for this form',
),
'cmrf_form_processor_default_data_required' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Require default data retrieval for this form',
),
'cmrf_form_processor_default_data_required_message' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 0,
'description' => 'Message when default data is missing.',
),
'cmrf_form_processor_default_data_cache' => array(
'description' => 'Cache time for the default data retrieval',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'cmrf_form_processor_default_data' => array(
'description' => 'The data for retrieving the default data',
'type' => 'text',
'not null' => FALSE,
),
),
'primary key' => array('nid'),
),
);
}
/**
* Add functionality to clear webform submissions.
*
*/
function cmrf_form_processor_update_7001() {
db_add_field(
'cmrf_form_processor_webforms',
'cmrf_form_processor_clear_submission',
array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Clears the submission',
)
);
}
/**
* Add functionality to require default data
*
*/
function cmrf_form_processor_update_7002() {
db_add_field(
'cmrf_form_processor_webforms',
'cmrf_form_processor_default_data_required',
array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => 'Require default data retrieval for this form',
)
);
db_add_field(
'cmrf_form_processor_webforms',
'cmrf_form_processor_default_data_required_message',
array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 0,
'description' => 'Message when default data is missing.',
)
);
}