/** * @see ProjectPermissionOrganisationUnitInterface::delete() * @return bool * @throws ProjectPermissionOrganisationUnitDeleteException * @throws ProjectPermisisonOrganisationUnitDeleteVirtualFolderException */ public function delete() { global $transaction; if ($this->permission_id and $this->project_permission) { $transaction_id = $transaction->begin(); $project_id = $this->project_permission->get_project_id(); $project_folder_id = ProjectFolder::get_folder_by_project_id($project_id); $permission_string = strrev(decbin($this->project_permission->get_permission())); if (ProjectPermission_Access::count_entries_with_project_id_and_organisation_unit_id($project_id, $this->project_permission->get_organisation_unit_id()) <= 1) { $folder_id = OrganisationUnitFolder::get_folder_by_organisation_unit_id($this->project_permission->get_organisation_unit_id()); $virtual_folder = new VirtualFolder(null); $virtual_folder_array = $virtual_folder->list_entries_by_folder_id($folder_id); foreach ($virtual_folder_array as $key => $value) { $virtual_folder = new ProjectVirtualFolder($value); if ($virtual_folder->is_project_vfolder() == true) { $virtual_folder_id = $value; } } if ($virtual_folder_id) { $virtual_folder = new VirtualFolder($virtual_folder_id); if ($virtual_folder->unlink_folder($project_folder_id) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectPermissionOrganisationUnitDeleteVirtualFolderException(); } } } if (parent::delete() == true) { if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectPermissionOrganisationUnitDeleteException(); } } else { throw new ProjectPermissionOrganisationUnitDeleteException(); } }