// metas: tsa: 2181: changed method name to reflect what is doing private boolean voidIt0() { if (!isActive()) throw new IllegalStateException("Allocation already reversed (not active)"); // Can we delete posting MPeriod.testPeriodOpen( getCtx(), getDateTrx(), X_C_DocType.DOCBASETYPE_PaymentAllocation, getAD_Org_ID()); // Set Inactive setIsActive(false); setDocumentNo(getDocumentNo() + "^"); setDocStatus(DOCSTATUS_Reversed); // for direct calls if (!save() || isActive()) throw new IllegalStateException("Cannot de-activate allocation"); // Delete Posting Services.get(IFactAcctDAO.class).deleteForDocument(this); // Unlink Invoices getLines(true); final Set<Integer> bpartnerIds = new HashSet<Integer>(); for (int i = 0; i < m_lines.length; i++) { MAllocationLine line = m_lines[i]; line.setIsActive(false); line.save(); final int bpartnerId = line.processIt(true); // reverse bpartnerIds.add(bpartnerId); } updateBP(bpartnerIds); return true; } // reverse
/** * Complete Document * * @return new status (Complete, In Progress, Invalid, Waiting ..) */ @Override public String completeIt() { // Re-Check if (!m_justPrepared) { String status = prepareIt(); if (!DocAction.STATUS_InProgress.equals(status)) return status; } m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); if (m_processMsg != null) return DocAction.STATUS_Invalid; // Implicit Approval if (!isApproved()) approveIt(); log.info(toString()); // Link getLines(false); final Set<Integer> bpartnerIds = new HashSet<Integer>(); for (int i = 0; i < m_lines.length; i++) { final MAllocationLine line = m_lines[i]; final int bpartnerId = line.processIt(false); // not reverse bpartnerIds.add(bpartnerId); } updateBP(bpartnerIds); // User Validation String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); if (valid != null) { m_processMsg = valid; return DocAction.STATUS_Invalid; } setProcessed(true); setDocAction(DOCACTION_Close); return DocAction.STATUS_Completed; } // completeIt