@@ 279-303 (lines=25) @@ | ||
276 | * <li>{@link ERROR_ALREADY_EXISTS} - another group with specified group name already exists</li> |
|
277 | * </ul> |
|
278 | */ |
|
279 | function group_modify ($id, $project_id, $group_name, $description) |
|
280 | { |
|
281 | debug_write_log(DEBUG_TRACE, '[group_modify]'); |
|
282 | debug_write_log(DEBUG_DUMP, '[group_modify] $id = ' . $id); |
|
283 | debug_write_log(DEBUG_DUMP, '[group_create] $project_id = ' . $project_id); |
|
284 | debug_write_log(DEBUG_DUMP, '[group_modify] $group_name = ' . $group_name); |
|
285 | debug_write_log(DEBUG_DUMP, '[group_modify] $description = ' . $description); |
|
286 | ||
287 | // Check that there is no group with the same group name, besides this one. |
|
288 | $rs = dal_query('groups/fndku.sql', $id, (is_null($project_id) ? 'is null' : '=' . $project_id), ustrtolower($group_name)); |
|
289 | ||
290 | if ($rs->rows != 0) |
|
291 | { |
|
292 | debug_write_log(DEBUG_NOTICE, '[group_modify] Group already exists.'); |
|
293 | return ERROR_ALREADY_EXISTS; |
|
294 | } |
|
295 | ||
296 | // Modify the group. |
|
297 | dal_query('groups/modify.sql', |
|
298 | $id, |
|
299 | $group_name, |
|
300 | ustrlen($description) == 0 ? NULL : $description); |
|
301 | ||
302 | return NO_ERROR; |
|
303 | } |
|
304 | ||
305 | /** |
|
306 | * Checks whether group can be deleted. |
@@ 225-250 (lines=26) @@ | ||
222 | * <li>{@link ERROR_ALREADY_EXISTS} - subscription with specified name already exists</li> |
|
223 | * </ul> |
|
224 | */ |
|
225 | function subscription_modify ($id, $subscription_name, $carbon_copy, $subscription_flags) |
|
226 | { |
|
227 | debug_write_log(DEBUG_TRACE, '[subscription_modify]'); |
|
228 | debug_write_log(DEBUG_DUMP, '[subscription_modify] $id = ' . $id); |
|
229 | debug_write_log(DEBUG_DUMP, '[subscription_modify] $subscription_name = ' . $subscription_name); |
|
230 | debug_write_log(DEBUG_DUMP, '[subscription_modify] $carbon_copy = ' . $carbon_copy); |
|
231 | debug_write_log(DEBUG_DUMP, '[subscription_modify] $subscription_flags = ' . $subscription_flags); |
|
232 | ||
233 | // Check that user doesn't have another subscription with the same name, besides this one. |
|
234 | $rs = dal_query('subscriptions/fndku.sql', $id, $_SESSION[VAR_USERID], ustrtolower($subscription_name)); |
|
235 | ||
236 | if ($rs->rows != 0) |
|
237 | { |
|
238 | debug_write_log(DEBUG_NOTICE, '[subscription_modify] Subscription already exists.'); |
|
239 | return ERROR_ALREADY_EXISTS; |
|
240 | } |
|
241 | ||
242 | // Modify the subscription. |
|
243 | dal_query('subscriptions/modify.sql', |
|
244 | $id, |
|
245 | $subscription_name, |
|
246 | ustrlen($carbon_copy) == 0 ? NULL : $carbon_copy, |
|
247 | $subscription_flags); |
|
248 | ||
249 | return NO_ERROR; |
|
250 | } |
|
251 | ||
252 | /** |
|
253 | * Enables selected subscriptions. |