/** * Standard aed_module delete actualiser. * * @param ID_TEXT The entry being deleted */ function delete_actualisation($id) { delete_workflow(intval($id)); }
/** * Deleting an approval point will remove it from any workflow it is a * part of. Any content which has been approved for this requirement * will be unaffected, whilst those not-yet-approved will first be * approved, then have the requirement removed. This is to prevent any * content asking to be approved on a point which doesn't exist. * * @param AUTO_LINK The workflow approval point name (translation table ID) */ function delete_approval_point($name) { // Grab all content awaiting this approval $content = $GLOBALS['SITE_DB']->query_select('workflow_content_status', array('status_code', 'workflow_content_id'), array('workflow_approval_name' => $name)); // Now go through each, approving them if needed foreach ($content as $content_item) { // 0 means unapproved if ($content['status_code'] == 0) { // Set the approval approve_content_for_point($content['workflow_content_id'], $name); } } // Now remove these requirements en-mass from the content $GLOBALS['SITE_DB']->query_delete('workflow_content_status', array('workflow_content_id' => $name)); // We have to be careful about removing requirements from workflows, // since a workflow is defined by the approval points it requires. // We must check to see if we're about to throw out any workflows as // a result of removing this point. If so then we'd like to remove // the workflow sanely and completely. $affected_workflows = $GLOBALS['SITE_DB']->query_select('workflow_requirements', array('workflow_name'), array('workflow_approval_name' => $name)); foreach ($affected_workflows as $workflow) { // If there is only one requirement then it's the one we've been // asked to remove. Let's just remove the whole workflow. if (count(get_requirements_for_workflow($workflow['workflow_name'])) == 1) { delete_workflow($workflow['workflow_name']); } else { $GLOBALS['SITE_DB']->query_delete('workflow_requirements', array('workflow_approval_name' => $name, 'workflow_name' => $workflow['workflow_name']), '', 1); } } // Now we remove the permissions associated with this approval point $GLOBALS['SITE_DB']->query_delete('workflow_permissions', array('workflow_approval_name' => $name)); }