@@ 166-194 (lines=29) @@ | ||
163 | * <li>{@link ERROR_ALREADY_EXISTS} - reminder with specified name already exists</li> |
|
164 | * </ul> |
|
165 | */ |
|
166 | function reminder_create ($reminder_name, $subject_text, $state_id, $group_id, $group_flag) |
|
167 | { |
|
168 | debug_write_log(DEBUG_TRACE, '[reminder_create]'); |
|
169 | debug_write_log(DEBUG_DUMP, '[reminder_create] $reminder_name = ' . $reminder_name); |
|
170 | debug_write_log(DEBUG_DUMP, '[reminder_create] $subject_text = ' . $subject_text); |
|
171 | debug_write_log(DEBUG_DUMP, '[reminder_create] $state_id = ' . $state_id); |
|
172 | debug_write_log(DEBUG_DUMP, '[reminder_create] $group_id = ' . $group_id); |
|
173 | debug_write_log(DEBUG_DUMP, '[reminder_create] $group_flag = ' . $group_flag); |
|
174 | ||
175 | // Check that user doesn't have another reminder with the same name. |
|
176 | $rs = dal_query('reminders/fndk.sql', $_SESSION[VAR_USERID], ustrtolower($reminder_name)); |
|
177 | ||
178 | if ($rs->rows != 0) |
|
179 | { |
|
180 | debug_write_log(DEBUG_NOTICE, '[reminder_create] Reminder already exists.'); |
|
181 | return ERROR_ALREADY_EXISTS; |
|
182 | } |
|
183 | ||
184 | // Create a reminder. |
|
185 | dal_query('reminders/create.sql', |
|
186 | $_SESSION[VAR_USERID], |
|
187 | $reminder_name, |
|
188 | ustrlen($subject_text) == 0 ? NULL : $subject_text, |
|
189 | $state_id, |
|
190 | is_null($group_id) ? NULL : $group_id, |
|
191 | $group_flag); |
|
192 | ||
193 | return NO_ERROR; |
|
194 | } |
|
195 | ||
196 | /** |
|
197 | * Modifies specified reminder. |
|
@@ 211-240 (lines=30) @@ | ||
208 | * <li>{@link ERROR_ALREADY_EXISTS} - reminder with specified name already exists</li> |
|
209 | * </ul> |
|
210 | */ |
|
211 | function reminder_modify ($id, $reminder_name, $subject_text, $state_id, $group_id, $group_flag) |
|
212 | { |
|
213 | debug_write_log(DEBUG_TRACE, '[reminder_modify]'); |
|
214 | debug_write_log(DEBUG_DUMP, '[reminder_modify] $id = ' . $id); |
|
215 | debug_write_log(DEBUG_DUMP, '[reminder_create] $reminder_name = ' . $reminder_name); |
|
216 | debug_write_log(DEBUG_DUMP, '[reminder_create] $subject_text = ' . $subject_text); |
|
217 | debug_write_log(DEBUG_DUMP, '[reminder_create] $state_id = ' . $state_id); |
|
218 | debug_write_log(DEBUG_DUMP, '[reminder_create] $group_id = ' . $group_id); |
|
219 | debug_write_log(DEBUG_DUMP, '[reminder_create] $group_flag = ' . $group_flag); |
|
220 | ||
221 | // Check that user doesn't have another reminder with the same name, besides this one. |
|
222 | $rs = dal_query('reminders/fndku.sql', $id, $_SESSION[VAR_USERID], ustrtolower($reminder_name)); |
|
223 | ||
224 | if ($rs->rows != 0) |
|
225 | { |
|
226 | debug_write_log(DEBUG_NOTICE, '[reminder_modify] Reminder already exists.'); |
|
227 | return ERROR_ALREADY_EXISTS; |
|
228 | } |
|
229 | ||
230 | // Modify the reminder. |
|
231 | dal_query('reminders/modify.sql', |
|
232 | $id, |
|
233 | $reminder_name, |
|
234 | ustrlen($subject_text) == 0 ? NULL : $subject_text, |
|
235 | $state_id, |
|
236 | is_null($group_id) ? NULL : $group_id, |
|
237 | $group_flag); |
|
238 | ||
239 | return NO_ERROR; |
|
240 | } |
|
241 | ||
242 | /** |
|
243 | * Deletes specified reminder. |
@@ 182-210 (lines=29) @@ | ||
179 | * <li>{@link ERROR_ALREADY_EXISTS} - subscription with specified name already exists</li> |
|
180 | * </ul> |
|
181 | */ |
|
182 | function subscription_create ($subscription_name, $carbon_copy, $subscription_type, $subscription_flags, $subscription_param = NULL) |
|
183 | { |
|
184 | debug_write_log(DEBUG_TRACE, '[subscription_create]'); |
|
185 | debug_write_log(DEBUG_DUMP, '[subscription_create] $subscription_name = ' . $subscription_name); |
|
186 | debug_write_log(DEBUG_DUMP, '[subscription_create] $carbon_copy = ' . $carbon_copy); |
|
187 | debug_write_log(DEBUG_DUMP, '[subscription_create] $subscription_type = ' . $subscription_type); |
|
188 | debug_write_log(DEBUG_DUMP, '[subscription_create] $subscription_flags = ' . $subscription_flags); |
|
189 | debug_write_log(DEBUG_DUMP, '[subscription_create] $subscription_param = ' . $subscription_param); |
|
190 | ||
191 | // Check that user doesn't have another subscription with the same name. |
|
192 | $rs = dal_query('subscriptions/fndk.sql', $_SESSION[VAR_USERID], ustrtolower($subscription_name)); |
|
193 | ||
194 | if ($rs->rows != 0) |
|
195 | { |
|
196 | debug_write_log(DEBUG_NOTICE, '[subscription_create] Subscription already exists.'); |
|
197 | return ERROR_ALREADY_EXISTS; |
|
198 | } |
|
199 | ||
200 | // Create a subscription. |
|
201 | dal_query('subscriptions/create.sql', |
|
202 | $_SESSION[VAR_USERID], |
|
203 | $subscription_name, |
|
204 | ustrlen($carbon_copy) == 0 ? NULL : $carbon_copy, |
|
205 | $subscription_type, |
|
206 | $subscription_flags, |
|
207 | is_null($subscription_param) ? NULL : $subscription_param); |
|
208 | ||
209 | return NO_ERROR; |
|
210 | } |
|
211 | ||
212 | /** |
|
213 | * Modifies specified subscription. |