ArasLabs/change-management-actions

What is the purpose of this code part?

Opened this issue · 1 comments

Hi,

the Method Convert ECR to ECR contains the following code part:

var clientList = "";
var affItems = this.getItemsByXPath("Relationships/Item[@type='ECR Affected Item']");
for (var i=0; i<affItems.getItemCount(); i++) {
 clientList += "'" + affItems.getItemByIndex(i).getID() + "',";
}
clientList+="''";
var ecrItem = this.newItem("ECR","get");
ecrItem.setID(this.getID());
ecrItem.setAttribute("select","id");
var ecrAffItems = this.newItem("ECR Affected Item","get");
ecrAffItems.setAttribute("select","id");
ecrAffItems.setProperty("id",clientList,"not in");
ecrItem.addRelationship(ecrAffItems);
ecrItem = ecrItem.apply();
ecrAffItems = ecrItem.getItemsByXPath("Relationships/Item[@type='ECR Affected Item']");
for (i=0; i<ecrAffItems.getItemCount(); i++) {
 top.aras.getItemRelationship(this.node, "ECR Affected Item", ecrAffItems.getItemByIndex(i).getID(), true);
}

What is the purpose of this code part? The whole block can be completly removed and the Method will still work the same way as before.

Particularities:

  1. What is the purpose of the clientList? Looks like it should handle the use case, when multible ECRs shall be converted in one ECN. But this doesn´t seem to be possible in the current version yet.
  2. affItems is redefined later in the code.
  3. ecrItem is never used in the later code. This explains, why I can remove this block without negative effects.

Is there more background information available?

Thanks and best regards!
Angela

Hi Angela,

It's likely that this code is leftover from some earlier version of the project. If removing it doesn't cause any negative behavior for you, feel free to remove it. Let's leave this issue open so we have a reminder to clean it up in the next release of the project.

Eli