changeset 6737:2110a445e088

clarify error message when a tag is missing when modifying a study to attach it to an existing patient
author Alain Mazy <am@orthanc.team>
date Tue, 05 May 2026 15:24:25 +0200
parents f3ef0c4ee0b9
children bae99026ca97
files OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Mon May 04 19:03:37 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Tue May 05 15:24:25 2026 +0200
@@ -805,9 +805,12 @@
               for (std::set<DicomTag>::const_iterator mainPatientTag = mainPatientTags.begin();
                    mainPatientTag != mainPatientTags.end(); ++mainPatientTag)
               {
+                // if the target patient has this tag AND
+                //   if it is either missing from the Replace OR
+                //   if it is in the Replace but different from the current patient tag
                 if (targetPatientTags.HasTag(*mainPatientTag) &&
                     ((!modification_->IsReplaced(*mainPatientTag) && targetPatientTags.GetStringValue(*mainPatientTag, "", false).size() > 0) ||
-                     modification_->GetReplacementAsString(*mainPatientTag) != targetPatientTags.GetStringValue(*mainPatientTag, "", false)))
+                     (modification_->IsReplaced(*mainPatientTag) && modification_->GetReplacementAsString(*mainPatientTag) != targetPatientTags.GetStringValue(*mainPatientTag, "", false))))
                 {
                   if (!modification_->IsReplaced(*mainPatientTag))
                   {