protected boolean beforeSave(boolean newRecord){
  if (getC_Location_ID() == 0)   return false;
  if (!newRecord)   return true;
  MLocation address=getLocation(true);
  m_uniqueName=getName();
  m_unique=MSysConfig.getIntValue("START_VALUE_BPLOCATION_NAME",0,getAD_Client_ID(),getAD_Org_ID());
  if (m_unique < 0 || m_unique > 4)   m_unique=0;
  if (m_uniqueName != null && m_uniqueName.equals(".")) {
    m_uniqueName=null;
    makeUnique(address);
  }
  MBPartnerLocation[] locations=getForBPartner(getCtx(),getC_BPartner_ID());
  boolean unique=locations.length == 0;
  while (!unique) {
    unique=true;
    for (int i=0; i < locations.length; i++) {
      MBPartnerLocation location=locations[i];
      if (location.getC_BPartner_Location_ID() == get_ID())       continue;
      if (m_uniqueName.equals(location.getName())) {
        m_unique++;
        makeUnique(address);
        unique=false;
        break;
      }
    }
  }
  setName(m_uniqueName);
  return true;
}

protected boolean beforeSave ( boolean newRecord ) { if ( getC_Location_ID ( ) == 0 ) return false ; if ( ! newRecord ) return true ; MLocation address = getLocation ( true ) ; m_uniqueName = getName ( ) ; m_unique = MSysConfig . getIntValue ( "START_VALUE_BPLOCATION_NAME" , 0 , getAD_Client_ID ( ) , getAD_Org_ID ( ) ) ; if ( m_unique < 0 || m_unique > 4 ) m_unique = 0 ; if ( m_uniqueName != null && m_uniqueName . equals ( "." ) ) { m_uniqueName = null ; makeUnique ( address ) ; } MBPartnerLocation [ ] locations = getForBPartner ( getCtx ( ) , getC_BPartner_ID ( ) ) ; boolean unique = locations . length == 0 ; while ( ! unique ) { unique = true ; for ( int i = 0 ; i < locations . length ; i ++ ) { MBPartnerLocation location = locations [ i ] ; if ( location . getC_BPartner_Location_ID ( ) == get_ID ( ) ) continue ; if ( m_uniqueName . equals ( location . getName ( ) ) ) { m_unique ++ ; makeUnique ( address ) ; unique = false ; break ; } } } setName ( m_uniqueName ) ; return true ; }
before save . - set name
