 				WHERE
 					flat.collection_object_id=coll_object_encumbrance.collection_object_id (+) AND
 					coll_object_encumbrance.encumbrance_id = encumbrance.encumbrance_id (+) AND
-					flat.collection_object_id IN (
+					flat.collection_object_id IN
+					<cfif len(table_name) gt 0>
+					(
 						select collection_object_id from #table_name#
 					)
+					<cfelse>
+						(#collection_object_id#)
+					</cfif>
 				ORDER BY
 					flat.collection_object_id
 			</cfquery>
 
 
-			<cfdump var=#getdata#>
 
 
 		<hr>

<cfif action is "remListedItems">
	<cfoutput>
		<cfquery name="encDetails" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
			delete from coll_object_encumbrance where encumbrance_id=#encumbrance_id# and collection_object_id in (select collection_object_id from #table_name#)
		</cfquery>
		<p>
			Listed specimens have been unencumbered.

	<cfif len(encumbrance_id) is 0>
		Didn't get an encumbrance_id!!<cfabort>
	</cfif>
	<cfif  len(table_name) is 0 AND LEN(collection_object_id) IS 0>
		Didn't get specimens<cfabort>
	</cfif>
	<CFIF LEN(table_name) GT 0>
		<cfquery name="unencumberedSpecimens" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
				INSERT INTO coll_object_encumbrance (
					encumbrance_id,
					collection_object_id
				) (
					select
						#encumbrance_id#,
						collection_object_id
					from
						#table_name#
					where
						collection_object_id not in (
							select
								collection_object_id
							from
								coll_object_encumbrance
							where
								encumbrance_id=#encumbrance_id#
						)
			)
		</cfquery>
	<CFELSEIF LEN(collection_object_id) GT 0>
		<CFTRANSACTION>
			<CFLOOP LIST="#collection_object_id#" INDEX="I">
				<cfquery name="unencumberedSpecimens" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
					INSERT INTO coll_object_encumbrance (
						encumbrance_id,
						collection_object_id
					) values (
							#encumbrance_id#,
							#i#
						)
				</cfquery>

			</CFLOOP>
		</CFTRANSACTION>
	</CFIF>

	<p>
		All items listed below have been encumbered.
