src/org/openbravo/erpCommon/ad_callouts/SE_InOut_DocType.java
author Sandra Huguet <sandra.huguet@openbravo.com>
Thu, 25 Apr 2019 13:12:34 +0200
changeset 35703 cfc6ddc67eb0
parent 32538 2ab8016a2353
permissions -rw-r--r--
related to issue 40522 code review changes
carlos@0
     1
/*
carlos@0
     2
 *************************************************************************
carlos@0
     3
 * The contents of this file are subject to the Openbravo  Public  License
priya@9072
     4
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
     5
 * Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
     6
 * file except in compliance with the License. You  may  obtain  a copy of
carlos@0
     7
 * the License at http://www.openbravo.com/legal/license.html 
carlos@0
     8
 * Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
     9
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    10
 * License for the specific  language  governing  rights  and  limitations
carlos@0
    11
 * under the License. 
carlos@0
    12
 * The Original Code is Openbravo ERP. 
ggi@6701
    13
 * The Initial Developer of the Original Code is Openbravo SLU 
markmm82@32538
    14
 * All portions are Copyright (C) 2001-2017 Openbravo SLU 
carlos@0
    15
 * All Rights Reserved. 
carlos@0
    16
 * Contributor(s):  ______________________________________.
carlos@0
    17
 ************************************************************************
martin@2462
    18
 */
carlos@0
    19
package org.openbravo.erpCommon.ad_callouts;
carlos@0
    20
markmm82@32538
    21
import javax.servlet.ServletException;
martin@2598
    22
markmm82@32538
    23
import org.apache.commons.lang.StringUtils;
markmm82@32538
    24
import org.openbravo.base.filter.IsIDFilter;
martin@2598
    25
markmm82@32538
    26
public class SE_InOut_DocType extends SimpleCallout {
carlos@0
    27
markmm82@32538
    28
  @Override
markmm82@32538
    29
  protected void execute(CalloutInfo info) throws ServletException {
carlos@0
    30
markmm82@32538
    31
    String strChanged = info.getLastFieldChanged();
markmm82@32538
    32
    if (log4j.isDebugEnabled()) {
markmm82@32538
    33
      log4j.debug("CHANGED: " + strChanged);
carlos@0
    34
    }
carlos@0
    35
markmm82@32538
    36
    // Parameter
markmm82@32538
    37
    String strDocType = info.getStringParameter("inpcDoctypeId", IsIDFilter.instance);
markmm82@32538
    38
markmm82@32538
    39
    // Movement Type and Document No.
markmm82@32538
    40
    SEInOutDocTypeData[] data = SEInOutDocTypeData.select(this, strDocType);
markmm82@32538
    41
    if (data != null && data.length > 0) {
markmm82@32538
    42
      if (StringUtils.equals(data[0].docbasetype, "MMS")) {
markmm82@32538
    43
        info.addResult("inpmovementtype", "C-");
markmm82@32538
    44
      } else if (StringUtils.equals(data[0].docbasetype, "MMR")) {
markmm82@32538
    45
        info.addResult("inpmovementtype", "V+");
markmm82@32538
    46
      } else {
markmm82@32538
    47
        info.addResult("inpmovementtype", null);
markmm82@32538
    48
      }
markmm82@32538
    49
      if (StringUtils.equals(data[0].isdocnocontrolled, "Y")) {
markmm82@32538
    50
        info.addResult("inpdocumentno", "<" + data[0].currentnext + ">");
markmm82@32538
    51
      }
markmm82@32538
    52
    }
markmm82@32538
    53
martin@2868
    54
  }
carlos@0
    55
}