Message271

Author admin
Recipients
Date 2017-07-19.15:17:16
Content
[BitBucket user: Alain Mazy]
[BitBucket date: 2017-07-19.13:17:16]

There's a workaround however by implementing a lua script (http://book.orthanc-server.com/users/lua.html) which will protect and unprotect a patient each time a new study is received for this patient.  This way, everytime a new study is received, the patient will be moved to the last position in the recycling order.

```
function OnStablePatient(patientId)
	local protectedStatus = RestApiGet('patients/' .. patientId .. '/protected')
	
	if protectedStatus == '1' then
	  RestApiPut('/patients/' .. patientId .. '/protected', '0')
	  RestApiPut('/patients/' .. patientId .. '/protected', '1')
	else
	  RestApiPut('/patients/' .. patientId .. '/protected', '1')
	  RestApiPut('/patients/' .. patientId .. '/protected', '0')
	end
end
```
History
Date User Action Args
2026-07-29 15:51:21adminlinkissue58 messages
2026-07-29 15:51:20admincreate