Finish Hotfix-1
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit

This commit is contained in:
2025-11-24 11:54:01 +01:00
2 changed files with 11 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.base.EquatableEntityInterface;
import it.integry.ems_model.entity._enum.IBaseEnum;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.UtilityBigDecimal;
import it.integry.ems_model.utility.UtilityString;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -664,12 +665,13 @@ public class MtbColr extends EntityBase implements EquatableEntityInterface<MtbC
return this;
}
public boolean hasQuantity() {
return UtilityBigDecimal.isNullOrZero(qtaCol);
}
public boolean hasDocument() {
MtbColt parent = (MtbColt) getParent();
if ( getOperation() == OperationType.DELETE && this.getQtaCol().equals(BigDecimal.ZERO))
return false;
else
return !(UtilityString.isNullOrEmpty(parent.getCodDtip()) && UtilityString.isNullOrEmpty(parent.getSerDoc()) && parent.getNumDoc() == null && parent.getDataDoc() == null );
return !(UtilityString.isNullOrEmpty(parent.getCodDtip()) && UtilityString.isNullOrEmpty(parent.getSerDoc()) && parent.getNumDoc() == null && parent.getDataDoc() == null);
}
protected void insertChilds() throws Exception {
@@ -695,7 +697,7 @@ public class MtbColr extends EntityBase implements EquatableEntityInterface<MtbC
if (this == other)
return true;
if(hashCodeKey() != other.hashCodeKey())
if (hashCodeKey() != other.hashCodeKey())
return false;
return Objects.equals(getDataCollo(), other.getDataCollo()) && Objects.equals(getGestione(), other.getGestione()) && Objects.equals(getSerCollo(), other.getSerCollo()) && Objects.equals(getNumCollo(), other.getNumCollo()) && Objects.equals(getRiga(), other.getRiga());

View File

@@ -308,7 +308,7 @@ rule "checkDeleteMtbColtWithDoc"
no-loop
when
eval(checkRulesEnabled)
$entity : MtbColt(operation == OperationType.DELETE && hasDocument)
$entity : MtbColt(operation == OperationType.DELETE && hasDocument && hasQuantity)
then
throw new CheckConstraintException("Impossibile eliminare un collo agganciato a documento");
end
@@ -318,7 +318,7 @@ rule "checkDeleteMtbColtWithoutDoc"
no-loop
when
eval(checkRulesEnabled)
$entity : MtbColt(operation == OperationType.DELETE && !hasDocument)
$entity : MtbColt(operation == OperationType.DELETE && !hasDocument || !hasQuantity)
then
PackagesRules.checkForAnyColloRif(conn, $entity.getGestione(), $entity.getSerCollo(), $entity.getNumCollo(), $entity.getDataCollo());
end
@@ -328,7 +328,7 @@ rule "checkDeleteMtbColrWithDoc"
no-loop
when
eval(checkRulesEnabled)
$entity : MtbColr(operation == OperationType.DELETE && hasDocument)
$entity : MtbColr(operation == OperationType.DELETE && hasDocument && hasQuantity)
then
throw new CheckConstraintException("Impossibile eliminare un collo agganciato a documento");
end
@@ -338,7 +338,7 @@ rule "checkDeleteMtbColrWithoutDoc"
no-loop
when
eval(checkRulesEnabled)
$entity : MtbColr(operation == OperationType.DELETE && !hasDocument)
$entity : MtbColr(operation == OperationType.DELETE && !hasDocument || !hasQuantity)
then
PackagesRules.checkForAnyColloRif(conn, $entity.getGestione(), $entity.getSerCollo(), $entity.getNumCollo(), $entity.getDataCollo());
end