# HG changeset patch # User Alain Mazy # Date 1777987465 -7200 # Node ID 2110a445e088616beb28990dd8747ebe0a6c6051 # Parent f3ef0c4ee0b91183d8777874d1e7db6011230260 clarify error message when a tag is missing when modifying a study to attach it to an existing patient diff -r f3ef0c4ee0b9 -r 2110a445e088 OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp --- 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::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)) {