yes, the block should be something like

			$has_attachment = (bool) $this->db->sql_fetchfield('nb_attachments');
			$this->db->sql_freeresult($result);

			if ($has_attachment && $visibility == ITEM_APPROVED)
			{
					$update_topic_attachments_flag = true;
					$topic_update_array[] = 'topic_attachment = 1';
			}
			else
			{
				$update_topic_attachments_flag = true;
				$topic_update_array[] = 'topic_attachment = 0';
			}