Check for incorrect collection agency settings

Polaris SA allows you to configure things so that you can have patron’s being submitted to collections without having a collection agency fee applied to their account.

Although there are some instances where this might be desired, you should still consider checking for misconfigurations. Especially since during COVID many libraries adjusted their policies and in changing them back they may have missed an important option.

This SQL helps you check for those instances:

select *
from (
	SELECT OrganizationID
	FROM   polaris.polaris.organizationspppp op
		   JOIN polaris.polaris.collectionagencyfees caf
			 ON caf.orgid = op.organizationid
	WHERE  op.attrid = 1365 -- CA Minimum balance
		   AND op.organizationid IN (SELECT organizationid
									 FROM   polaris.polaris.organizationspppp
									 WHERE  attrid = 1359
											AND value = 'Yes') -- CA Enabled
		   AND caf.minamount > op.value
	union all
	select 0
) d
order by d.OrganizationID desc