コード例 #1
0
 /**
  * After Save
  *
  * @param newRecord new
  * @param success success
  * @return success
  */
 @Override
 protected boolean afterSave(boolean newRecord, boolean success) {
   if (success) {
     updateHeader();
     if (newRecord || is_ValueChanged("S_ResourceAssignment_ID")) {
       int S_ResourceAssignment_ID = getS_ResourceAssignment_ID();
       int old_S_ResourceAssignment_ID = 0;
       if (!newRecord) {
         Object ii = get_ValueOld("S_ResourceAssignment_ID");
         if (ii instanceof Integer) {
           old_S_ResourceAssignment_ID = ((Integer) ii).intValue();
           //	Changed Assignment
           if (old_S_ResourceAssignment_ID != S_ResourceAssignment_ID
               && old_S_ResourceAssignment_ID != 0) {
             MResourceAssignment ra =
                 new MResourceAssignment(getCtx(), old_S_ResourceAssignment_ID, get_Trx());
             ra.delete(false);
           }
         }
       }
       //	Sync Assignment
       if (S_ResourceAssignment_ID != 0) {
         MResourceAssignment ra =
             new MResourceAssignment(getCtx(), S_ResourceAssignment_ID, get_Trx());
         if (getQty().compareTo(ra.getQty()) != 0) {
           ra.setQty(getQty());
           if (getDescription() != null && getDescription().length() > 0)
             ra.setDescription(getDescription());
           ra.save();
         }
       }
     }
   }
   return success;
 } //	afterSave
コード例 #2
0
 /**
  * After Delete
  *
  * @param success success
  * @return success
  */
 @Override
 protected boolean afterDelete(boolean success) {
   if (success) {
     updateHeader();
     //
     Object ii = get_ValueOld("S_ResourceAssignment_ID");
     if (ii instanceof Integer) {
       int old_S_ResourceAssignment_ID = ((Integer) ii).intValue();
       //	Deleted Assignment
       if (old_S_ResourceAssignment_ID != 0) {
         MResourceAssignment ra =
             new MResourceAssignment(getCtx(), old_S_ResourceAssignment_ID, get_Trx());
         ra.delete(false);
       }
     }
   }
   return success;
 } //	afterDelete