Advertisement
tko_pb

RequisitionToOrder

Jul 11th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 42.26 KB | None | 0 0
  1. /*
  2.  *************************************************************************
  3.  * The contents of this file are subject to the Openbravo  Public  License
  4.  * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
  5.  * Version 1.1  with a permitted attribution clause; you may not  use this
  6.  * file except in compliance with the License. You  may  obtain  a copy of
  7.  * the License at http://www.openbravo.com/legal/license.html
  8.  * Software distributed under the License  is  distributed  on  an "AS IS"
  9.  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  10.  * License for the specific  language  governing  rights  and  limitations
  11.  * under the License.
  12.  * The Original Code is Openbravo ERP.
  13.  * The Initial Developer of the Original Code is Openbravo SLU
  14.  * All portions are Copyright (C) 2008-2017 Openbravo SLU
  15.  * All Rights Reserved.
  16.  * Contributor(s):  ______________________________________.
  17.  ************************************************************************
  18.  */
  19.  
  20. package org.openbravo.erpCommon.ad_forms;
  21.  
  22. import java.io.IOException;
  23. import java.io.PrintWriter;
  24. import java.math.BigDecimal;
  25. import java.sql.Connection;
  26. import java.util.HashMap;
  27.  
  28. import javax.servlet.ServletException;
  29. import javax.servlet.http.HttpServletRequest;
  30. import javax.servlet.http.HttpServletResponse;
  31.  
  32. import org.apache.commons.lang.StringUtils;
  33. import org.openbravo.base.filter.IsIDFilter;
  34. import org.openbravo.base.secureApp.HttpSecureAppServlet;
  35. import org.openbravo.base.secureApp.VariablesSecureApp;
  36. import org.openbravo.dal.core.OBContext;
  37. import org.openbravo.dal.service.OBDal;
  38. import org.openbravo.erpCommon.businessUtility.Preferences;
  39. import org.openbravo.erpCommon.businessUtility.Tree;
  40. import org.openbravo.erpCommon.businessUtility.WindowTabs;
  41. import org.openbravo.erpCommon.businessUtility.WindowTabsData;
  42. import org.openbravo.erpCommon.reference.PInstanceProcessData;
  43. import org.openbravo.erpCommon.utility.ComboTableData;
  44. import org.openbravo.erpCommon.utility.DateTimeData;
  45. import org.openbravo.erpCommon.utility.LeftTabsBar;
  46. import org.openbravo.erpCommon.utility.NavigationBar;
  47. import org.openbravo.erpCommon.utility.OBError;
  48. import org.openbravo.erpCommon.utility.OBMessageUtils;
  49. import org.openbravo.erpCommon.utility.PropertyException;
  50. import org.openbravo.erpCommon.utility.PropertyNotFoundException;
  51. import org.openbravo.erpCommon.utility.SequenceIdData;
  52. import org.openbravo.erpCommon.utility.ToolBar;
  53. import org.openbravo.erpCommon.utility.Utility;
  54. import org.openbravo.materialmgmt.UOMUtil;
  55. import org.openbravo.model.procurement.RequisitionLine;
  56. import org.openbravo.utils.Replace;
  57. import org.openbravo.xmlEngine.XmlDocument;
  58.  
  59. public class RequisitionToOrder extends HttpSecureAppServlet {
  60.   private static final long serialVersionUID = 1L;
  61.  
  62.   public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
  63.       ServletException {
  64.     VariablesSecureApp vars = new VariablesSecureApp(request);
  65.  
  66.     if (vars.commandIn("DEFAULT")) {
  67.       String strProductId = vars.getGlobalVariable("inpmProductId",
  68.           "RequisitionToOrder|M_Product_ID", "");
  69.       String strDateFrom = vars.getGlobalVariable("inpDateFrom", "RequisitionToOrder|DateFrom", "");
  70.       String strDateTo = vars.getGlobalVariable("inpDateTo", "RequisitionToOrder|DateTo", "");
  71.       String strRequesterId = vars.getGlobalVariable("inpRequesterId",
  72.           "RequisitionToOrder|Requester_ID", "");
  73.       String strVendorId = vars.getGlobalVariable("inpcBpartnerId",
  74.           "RequisitionToOrder|C_BPartner_ID", "");
  75.       String strIncludeVendor = vars.getGlobalVariable("inpShowNullVendor",
  76.           "RequisitionToOrder|ShowNullVendor", "Y");
  77.       String strOrgId = vars.getGlobalVariable("inpadOrgId", "RequisitionToOrder|AD_Org_ID",
  78.           vars.getOrg());
  79.       vars.setSessionValue("RequisitionToOrder|isSOTrx", "N");
  80.       printPageDataSheet(response, vars, strProductId, strDateFrom, strDateTo, strRequesterId,
  81.           strVendorId, strIncludeVendor, strOrgId);
  82.     } else if (vars.commandIn("FIND")) {
  83.       String strProductId = vars.getRequestGlobalVariable("inpmProductId",
  84.           "RequisitionToOrder|M_Product_ID");
  85.       String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
  86.           "RequisitionToOrder|DateFrom");
  87.       String strDateTo = vars.getRequestGlobalVariable("inpDateTo", "RequisitionToOrder|DateTo");
  88.       String strRequesterId = vars.getRequestGlobalVariable("inpRequesterId",
  89.           "RequisitionToOrder|Requester_ID");
  90.       String strVendorId = vars.getRequestGlobalVariable("inpcBpartnerId",
  91.           "RequisitionToOrder|C_BPartner_ID");
  92.       String strIncludeVendor = vars.getRequestGlobalVariable("inpShowNullVendor",
  93.           "RequisitionToOrder|ShowNullVendor");
  94.       String strOrgId = vars.getRequestGlobalVariable("inpadOrgId", "RequisitionToOrder|AD_Org_ID");
  95.       updateLockedLines(vars, strOrgId);
  96.       printPageDataSheet(response, vars, strProductId, strDateFrom, strDateTo, strRequesterId,
  97.           strVendorId, strIncludeVendor, strOrgId);
  98.     } else if (vars.commandIn("ADD")) {
  99.       String strProductId = vars.getRequestGlobalVariable("inpmProductId",
  100.           "RequisitionToOrder|M_Product_ID");
  101.       String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
  102.           "RequisitionToOrder|DateFrom");
  103.       String strDateTo = vars.getRequestGlobalVariable("inpDateTo", "RequisitionToOrder|DateTo");
  104.       String strRequesterId = vars.getRequestGlobalVariable("inpRequesterId",
  105.           "RequisitionToOrder|Requester_ID");
  106.       String strVendorId = vars.getRequestGlobalVariable("inpcBpartnerId",
  107.           "RequisitionToOrder|C_BPartner_ID");
  108.       String strIncludeVendor = vars.getRequestGlobalVariable("inpShowNullVendor",
  109.           "RequisitionToOrder|ShowNullVendor");
  110.       String strOrgId = vars.getRequestGlobalVariable("inpadOrgId", "RequisitionToOrder|AD_Org_ID");
  111.       String strRequisitionLines = vars.getRequiredInStringParameter("inpRequisitionLine",
  112.           IsIDFilter.instance);
  113.       updateLockedLines(vars, strOrgId);
  114.       lockRequisitionLines(vars, strRequisitionLines);
  115.       printPageDataSheet(response, vars, strProductId, strDateFrom, strDateTo, strRequesterId,
  116.           strVendorId, strIncludeVendor, strOrgId);
  117.     } else if (vars.commandIn("REMOVE")) {
  118.       String strProductId = vars.getRequestGlobalVariable("inpmProductId",
  119.           "RequisitionToOrder|M_Product_ID");
  120.       String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
  121.           "RequisitionToOrder|DateFrom");
  122.       String strDateTo = vars.getRequestGlobalVariable("inpDateTo", "RequisitionToOrder|DateTo");
  123.       String strRequesterId = vars.getRequestGlobalVariable("inpRequesterId",
  124.           "RequisitionToOrder|Requester_ID");
  125.       String strVendorId = vars.getRequestGlobalVariable("inpcBpartnerId",
  126.           "RequisitionToOrder|C_BPartner_ID");
  127.       String strIncludeVendor = vars.getRequestGlobalVariable("inpShowNullVendor",
  128.           "RequisitionToOrder|ShowNullVendor");
  129.       String strOrgId = vars.getRequestGlobalVariable("inpadOrgId", "RequisitionToOrder|AD_Org_ID");
  130.       String strSelectedLines = vars.getRequiredInStringParameter("inpSelectedReq",
  131.           IsIDFilter.instance);
  132.       unlockRequisitionLines(vars, strSelectedLines);
  133.       updateLockedLines(vars, strOrgId);
  134.       printPageDataSheet(response, vars, strProductId, strDateFrom, strDateTo, strRequesterId,
  135.           strVendorId, strIncludeVendor, strOrgId);
  136.     } else if (vars.commandIn("OPEN_CREATE")) {
  137.       String strSelectedLines = vars.getRequiredInStringParameter("inpSelectedReq",
  138.           IsIDFilter.instance);
  139.       String strOrgId = vars.getRequestGlobalVariable("inpadOrgId", "RequisitionToOrder|AD_Org_ID");
  140.       updateLockedLines(vars, strOrgId);
  141.       checkSelectedRequisitionLines(response, vars, strSelectedLines);
  142.     } else if (vars.commandIn("GENERATE")) {
  143.       String strSelectedLines = vars.getRequiredGlobalVariable("inpSelected",
  144.           "RequisitionToOrderCreate|SelectedLines");
  145.       String strOrderDate = vars.getRequiredGlobalVariable("inpOrderDate",
  146.           "RequisitionToOrderCreate|OrderDate");
  147.       String strVendor = vars.getRequiredGlobalVariable("inpOrderVendorId",
  148.           "RequisitionToOrderCreate|OrderVendor");
  149.       String strPriceListId = vars.getRequiredGlobalVariable("inpPriceListId",
  150.           "RequisitionToOrderCreate|PriceListId");
  151.       String strOrg = vars.getRequiredGlobalVariable("inpOrderOrg", "RequisitionToOrderCreate|Org");
  152.       String strWarehouse = vars.getRequiredGlobalVariable("inpWarehouse",
  153.           "RequisitionToOrderCreate|Warehouse");
  154.       OBError myMessage = processPurchaseOrder(vars, strSelectedLines, strOrderDate, strVendor,
  155.           strPriceListId, strOrg, strWarehouse);
  156.       vars.setMessage("RequisitionToOrderCreate", myMessage);
  157.       printPageCreate(response, vars, "", "", "", "", "");
  158.     } else
  159.       pageError(response);
  160.   }
  161.  
  162.   private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars,
  163.       String strProductId, String strDateFrom, String strDateTo, String strRequesterId,
  164.       String strVendorId, String strIncludeVendor, String strOrgId) throws IOException,
  165.       ServletException {
  166.     if (log4j.isDebugEnabled())
  167.       log4j.debug("Output: dataSheet");
  168.     response.setContentType("text/html; charset=UTF-8");
  169.     PrintWriter out = response.getWriter();
  170.     XmlDocument xmlDocument = null;
  171.  
  172.     String strTreeOrg = RequisitionToOrderData.treeOrg(this, vars.getClient());
  173.     RequisitionToOrderData[] datalines = RequisitionToOrderData.selectLines(this, vars
  174.         .getLanguage(), Utility.getContext(this, vars, "#User_Client", "RequisitionToOrder"), Tree
  175.         .getMembers(this, strTreeOrg, strOrgId), strDateFrom, DateTimeData.nDaysAfter(this,
  176.         strDateTo, "1"), strProductId, strRequesterId, (strIncludeVendor.equals("Y") ? strVendorId
  177.         : null), (strIncludeVendor.equals("Y") ? null : strVendorId));
  178.  
  179.     RequisitionToOrderData[] dataselected = RequisitionToOrderData.selectSelected(this,
  180.         vars.getLanguage(), vars.getUser(),
  181.         Utility.getContext(this, vars, "#User_Client", "RequisitionToOrder"),
  182.         Tree.getMembers(this, strTreeOrg, strOrgId));
  183.     String discard[] = { "" };
  184.     if (dataselected == null || dataselected.length == 0) {
  185.       dataselected = RequisitionToOrderData.set();
  186.       discard[0] = "funcSelectedEvenOddRow";
  187.     }
  188.     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_forms/RequisitionToOrder",
  189.         discard).createXmlDocument();
  190.  
  191.     ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "RequisitionToOrder", false, "", "",
  192.         "", false, "ad_forms", strReplaceWith, false, true);
  193.     toolbar.prepareSimpleToolBarTemplate();
  194.     xmlDocument.setParameter("toolbar", toolbar.toString());
  195.  
  196.     try {
  197.       WindowTabs tabs = new WindowTabs(this, vars,
  198.           "org.openbravo.erpCommon.ad_forms.RequisitionToOrder");
  199.       xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
  200.       xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
  201.       xmlDocument.setParameter("childTabContainer", tabs.childTabs());
  202.       xmlDocument.setParameter("theme", vars.getTheme());
  203.       NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "RequisitionToOrder.html",
  204.           classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb());
  205.       xmlDocument.setParameter("navigationBar", nav.toString());
  206.       LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "RequisitionToOrder.html",
  207.           strReplaceWith);
  208.       xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
  209.     } catch (Exception ex) {
  210.       throw new ServletException(ex);
  211.     }
  212.     {
  213.       OBError myMessage = vars.getMessage("RequisitionToOrder");
  214.       vars.removeMessage("RequisitionToOrder");
  215.       if (myMessage != null) {
  216.         xmlDocument.setParameter("messageType", myMessage.getType());
  217.         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
  218.         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
  219.       }
  220.     }
  221.  
  222.     xmlDocument.setParameter("calendar", vars.getLanguage().substring(0, 2));
  223.     xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
  224.     xmlDocument.setParameter("paramLanguage", "defaultLang=\"" + vars.getLanguage() + "\";");
  225.     xmlDocument.setParameter("paramProductId", strProductId);
  226.     xmlDocument.setParameter("paramProductDescription", strProductId.equals("") ? ""
  227.         : RequisitionToOrderData.mProductDescription(this, strProductId, vars.getLanguage()));
  228.     xmlDocument.setParameter("displayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
  229.     xmlDocument.setParameter("dateFrom", strDateFrom);
  230.     xmlDocument.setParameter("dateTo", strDateTo);
  231.     xmlDocument.setParameter("paramRequester", strRequesterId);
  232.     xmlDocument.setParameter("paramBPartnerId", strVendorId);
  233.     xmlDocument.setParameter("paramBPartnerDescription", strVendorId.equals("") ? ""
  234.         : RequisitionToOrderData.bPartnerDescription(this, strVendorId, vars.getLanguage()));
  235.     xmlDocument.setParameter("paramShowNullVendor", strIncludeVendor);
  236.     xmlDocument.setParameter("paramAdOrgId", strOrgId);
  237.     try {
  238.       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_User_ID", "",
  239.           "UsersWithRequisition", Utility.getContext(this, vars, "#AccessibleOrgTree",
  240.               "RequisitionToOrder"), Utility.getContext(this, vars, "#User_Client",
  241.               "RequisitionToOrder"), 0);
  242.       Utility.fillSQLParameters(this, vars, null, comboTableData, "RequisitionToOrder",
  243.           strRequesterId);
  244.       xmlDocument.setData("reportRequester_ID", "liststructure", comboTableData.select(false));
  245.       comboTableData = null;
  246.     } catch (Exception ex) {
  247.       throw new ServletException(ex);
  248.     }
  249.     try {
  250.       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
  251.           "AD_Org Security validation", Utility.getContext(this, vars, "#User_Org",
  252.               "RequisitionToOrder"), Utility.getContext(this, vars, "#User_Client",
  253.               "RequisitionToOrder"), 0);
  254.       Utility.fillSQLParameters(this, vars, null, comboTableData, "RequisitionToOrder", strOrgId);
  255.       xmlDocument.setData("reportAD_Org_ID", "liststructure", comboTableData.select(false));
  256.       comboTableData = null;
  257.     } catch (Exception ex) {
  258.       throw new ServletException(ex);
  259.     }
  260.  
  261.     boolean uomManagementPreference = UOMUtil.isUomManagementEnabled();
  262.  
  263.     boolean strHaveSecDataLines = false;
  264.     boolean strHaveAumDataLines = false;
  265.     for (int i = 0; i < datalines.length; i++) {
  266.       try {
  267.         if (!datalines[i].quantityorder.isEmpty()
  268.             && !StringUtils.equals(datalines[i].secuomname, "**")) {
  269.           strHaveSecDataLines = true;
  270.         }
  271.         if (uomManagementPreference && !datalines[i].cAum.isEmpty()
  272.             && !datalines[i].aumqty.equals("**")) {
  273.           strHaveAumDataLines = true;
  274.         }
  275.         if (strHaveSecDataLines && strHaveAumDataLines) {
  276.           break;
  277.         }
  278.       } catch (NullPointerException e) {
  279.  
  280.       }
  281.     }
  282.  
  283.     for (int i = 0; i < datalines.length; i++) {
  284.  
  285.       if (strHaveSecDataLines && strHaveAumDataLines) {
  286.         // UOM preference has value "Y" and at least one line has secondary UOM
  287.         xmlDocument.setParameter("uompreference", "");
  288.         xmlDocument.setParameter("havesecuom", "");
  289.         if (datalines[i].cAum.isEmpty() && datalines[i].aumqty.isEmpty()
  290.             && datalines[i].quantityorder.isEmpty()
  291.             && StringUtils.equals(datalines[i].secuomname, "**")) {
  292.           RequisitionToOrderData[] defaultAumData = RequisitionToOrderData.selectAUMDefault(this,
  293.               datalines[i].mProductId);
  294.           String defaultAum = (defaultAumData.length > 0) ? defaultAumData[0].cAum
  295.               : datalines[i].cUomId;
  296.           datalines[i].aumqty = datalines[i].qtytoorder;
  297.           datalines[i].cAum = defaultAum;
  298.           datalines[i].aumname = (defaultAumData.length > 0) ? defaultAumData[0].aumname
  299.               : datalines[i].uomname;
  300.           if (!defaultAum.equals(datalines[i].cUomId)) {
  301.             datalines[i].qtytoorder = UOMUtil.getConvertedQty(datalines[i].mProductId,
  302.                 new BigDecimal(datalines[i].aumqty), datalines[i].cAum).toString();
  303.           }
  304.         }
  305.       } else if (uomManagementPreference && datalines[i].quantityorder.isEmpty()
  306.           && StringUtils.equals(datalines[i].secuomname, "**")) {
  307.         // UOM preference is Y and no line has secondary UOM
  308.         datalines[i].havesecuom = "none";
  309.         xmlDocument.setParameter("uompreference", "");
  310.         xmlDocument.setParameter("havesecuom", "display:none;");
  311.         if (datalines[i].cAum.isEmpty() && datalines[i].aumqty.isEmpty()) {
  312.           RequisitionToOrderData[] defaultAumData = RequisitionToOrderData.selectAUMDefault(this,
  313.               datalines[i].mProductId);
  314.           String defaultAum = (defaultAumData.length > 0) ? defaultAumData[0].cAum
  315.               : datalines[i].cUomId;
  316.           datalines[i].aumqty = datalines[i].qtytoorder;
  317.           datalines[i].cAum = defaultAum;
  318.           datalines[i].aumname = (defaultAumData.length > 0) ? defaultAumData[0].aumname
  319.               : datalines[i].uomname;
  320.           if (!defaultAum.equals(datalines[i].cUomId)) {
  321.             datalines[i].qtytoorder = UOMUtil.getConvertedQty(datalines[i].mProductId,
  322.                 new BigDecimal(datalines[i].aumqty), datalines[i].cAum).toString();
  323.           }
  324.         }
  325.       } else {
  326.         // UOM preference is N
  327.         datalines[i].uompreference = "none";
  328.         xmlDocument.setParameter("uompreference", "display:none;");
  329.         xmlDocument.setParameter("havesecuom", "");
  330.       }
  331.     }
  332.  
  333.     boolean strHaveSecDataSelected = false;
  334.     boolean strHaveAumDataSelected = false;
  335.     for (int i = 0; i < dataselected.length; i++) {
  336.       try {
  337.         if (!dataselected[i].quantityorder.isEmpty()
  338.             && !StringUtils.equals(dataselected[i].secuomname, "**")) {
  339.           strHaveSecDataSelected = true;
  340.         }
  341.         if (uomManagementPreference && !dataselected[i].cAum.isEmpty()
  342.             && !dataselected[i].aumqty.equals("**")) {
  343.           strHaveAumDataSelected = true;
  344.         }
  345.         if (strHaveSecDataSelected && strHaveAumDataSelected) {
  346.           break;
  347.         }
  348.       } catch (NullPointerException e) {
  349.  
  350.       }
  351.     }
  352.  
  353.     for (int i = 0; i < dataselected.length; i++) {
  354.  
  355.       if (strHaveSecDataSelected && strHaveAumDataSelected) {
  356.         // UOM preference is Y and at least one line has secondary UOM
  357.         xmlDocument.setParameter("uompreferencesel", "");
  358.         xmlDocument.setParameter("havesecuomsel", "");
  359.         if (dataselected[i].cAum.isEmpty() && dataselected[i].aumqty.isEmpty()
  360.             && dataselected[i].quantityorder.isEmpty()
  361.             && StringUtils.equals(dataselected[i].secuomname, "**")) {
  362.           RequisitionToOrderData[] defaultAumData = RequisitionToOrderData.selectAUMDefault(this,
  363.               dataselected[i].mProductId);
  364.           String defaultAum = (defaultAumData.length > 0) ? defaultAumData[0].cAum
  365.               : dataselected[i].cUomId;
  366.           dataselected[i].aumqty = dataselected[i].lockqty;
  367.           dataselected[i].cAum = defaultAum;
  368.           dataselected[i].aumname = (defaultAumData.length > 0) ? defaultAumData[0].aumname
  369.               : dataselected[i].uomname;
  370.           if (!defaultAum.equals(dataselected[i].cUomId)) {
  371.             dataselected[i].lockqty = UOMUtil.getConvertedQty(dataselected[i].mProductId,
  372.                 new BigDecimal(dataselected[i].aumqty), dataselected[i].cAum).toString();
  373.           }
  374.         }
  375.       } else if (uomManagementPreference && dataselected[i].quantityorder.isEmpty()
  376.           && StringUtils.equals(dataselected[i].secuomname, "**")) {
  377.         // UOM preference is Y and no line has secondary UOM
  378.         dataselected[i].havesecuom = "none";
  379.         xmlDocument.setParameter("uompreferencesel", "");
  380.         xmlDocument.setParameter("havesecuomsel", "display:none;");
  381.         if (dataselected[i].cAum.isEmpty() && dataselected[i].aumqty.isEmpty()) {
  382.           RequisitionToOrderData[] defaultAumData = RequisitionToOrderData.selectAUMDefault(this,
  383.               dataselected[i].mProductId);
  384.           String defaultAum = (defaultAumData.length > 0) ? defaultAumData[0].cAum
  385.               : dataselected[i].cUomId;
  386.           dataselected[i].aumqty = dataselected[i].lockqty;
  387.           dataselected[i].cAum = defaultAum;
  388.           dataselected[i].aumname = (defaultAumData.length > 0) ? defaultAumData[0].aumname
  389.               : dataselected[i].uomname;
  390.           if (!defaultAum.equals(dataselected[i].cUomId)) {
  391.             dataselected[i].lockqty = UOMUtil.getConvertedQty(dataselected[i].mProductId,
  392.                 new BigDecimal(dataselected[i].aumqty), dataselected[i].cAum).toString();
  393.           }
  394.         }
  395.       } else {
  396.         // UOM preference is N
  397.         dataselected[i].uompreference = "none";
  398.         xmlDocument.setParameter("uompreferencesel", "display:none;");
  399.         xmlDocument.setParameter("havesecuomsel", "");
  400.       }
  401.     }
  402.     xmlDocument.setData("structureSearch", datalines);
  403.     xmlDocument.setData("structureSelected", dataselected);
  404.     out.println(xmlDocument.print());
  405.     out.close();
  406.   }
  407.  
  408.   private void lockRequisitionLines(VariablesSecureApp vars, String strRequisitionLines)
  409.       throws IOException, ServletException {
  410.     if (log4j.isDebugEnabled())
  411.       log4j.debug("Locking requisition lines: " + strRequisitionLines);
  412.     RequisitionToOrderData.lock(this, vars.getUser(), strRequisitionLines);
  413.   }
  414.  
  415.   private void unlockRequisitionLines(VariablesSecureApp vars, String strRequisitionLines)
  416.       throws IOException, ServletException {
  417.     if (log4j.isDebugEnabled())
  418.       log4j.debug("Unlocking requisition lines: " + strRequisitionLines);
  419.     RequisitionToOrderData.unlock(this, strRequisitionLines);
  420.   }
  421.  
  422.   private void updateLockedLines(VariablesSecureApp vars, String strOrgId) throws IOException,
  423.       ServletException {
  424.     if (log4j.isDebugEnabled())
  425.       log4j.debug("Update locked lines");
  426.     String strTreeOrg = RequisitionToOrderData.treeOrg(this, vars.getClient());
  427.     RequisitionToOrderData[] dataselected = RequisitionToOrderData.selectSelected(this,
  428.         vars.getLanguage(), vars.getUser(),
  429.         Utility.getContext(this, vars, "#User_Client", "RequisitionToOrder"),
  430.         Tree.getMembers(this, strTreeOrg, strOrgId));
  431.  
  432.     boolean uomManagementPreference = UOMUtil.isUomManagementEnabled();
  433.  
  434.     for (int i = 0; dataselected != null && i < dataselected.length; i++) {
  435.       String strLockQty = "";
  436.       String strLockAqumQty = null;
  437.       if (uomManagementPreference && dataselected[i].quantityorder.isEmpty()
  438.           && StringUtils.equals(dataselected[i].secuomname, "**")) {
  439.         strLockQty = vars.getNumericParameter("inpQty" + dataselected[i].mRequisitionlineId);
  440.         strLockAqumQty = vars.getNumericParameter("inpAumQty" + dataselected[i].mRequisitionlineId);
  441.       } else {
  442.         strLockQty = vars.getNumericParameter("inpQty" + dataselected[i].mRequisitionlineId);
  443.       }
  444.  
  445.       String strLockPrice = vars.getNumericParameter("inpPrice"
  446.           + dataselected[i].mRequisitionlineId);
  447.       RequisitionToOrderData.updateLock(this, strLockQty, strLockPrice, strLockAqumQty,
  448.           dataselected[i].mRequisitionlineId);
  449.     }
  450.   }
  451.  
  452.   private void checkSelectedRequisitionLines(HttpServletResponse response, VariablesSecureApp vars,
  453.       String strSelected) throws IOException, ServletException {
  454.     if (log4j.isDebugEnabled())
  455.       log4j.debug("Check selected requisition lines");
  456.  
  457.     // Check unique partner
  458.     String strVendorId = "";
  459.     String strOrderDate = DateTimeData.today(this);
  460.     String strPriceListId = "";
  461.     String strOrgId = "";
  462.     String strMessage = "";
  463.     if (!strSelected.equals("")) {
  464.       RequisitionToOrderData[] vendor = RequisitionToOrderData.selectVendor(this, strSelected);
  465.       if (vendor != null && vendor.length == 1) {
  466.         strVendorId = vendor[0].vendorId;
  467.         strMessage = Utility.messageBD(this, "AllLinesSameVendor", vars.getLanguage())
  468.             + ": "
  469.             + RequisitionToOrderData.bPartnerDescription(this, vendor[0].vendorId,
  470.                 vars.getLanguage());
  471.       } else if (vendor != null && vendor.length > 1) {
  472.         // Error, the selected lines are of different vendors, it is
  473.         // necessary to set one.
  474.         strMessage = Utility.messageBD(this, "MoreThanOneVendor", vars.getLanguage());
  475.       } else {
  476.         // Error, it is necessary to select a vendor.
  477.         strMessage = Utility.messageBD(this, "AllLinesNullVendor", vars.getLanguage());
  478.       }
  479.       // Check unique pricelist
  480.       RequisitionToOrderData[] pricelist = RequisitionToOrderData.selectPriceList(this,
  481.           vars.getLanguage(), strSelected);
  482.       if (pricelist != null && pricelist.length == 1) {
  483.         strPriceListId = pricelist[0].mPricelistId;
  484.         strMessage += "<br>" + Utility.messageBD(this, "AllLinesSamePricelist", vars.getLanguage())
  485.             + ": " + pricelist[0].pricelistid;
  486.       } else if (pricelist != null && pricelist.length > 1) {
  487.         // Error, the selected lines are of different pricelists, it is
  488.         // necessary to set one.
  489.         strMessage += "<br>" + Utility.messageBD(this, "MoreThanOnePricelist", vars.getLanguage());
  490.       } else {
  491.         // Error, it is necessary to select a pricelist.
  492.         strMessage += "<br>" + Utility.messageBD(this, "AllLinesNullVendor", vars.getLanguage());
  493.       }
  494.  
  495.       // Check unique org
  496.       RequisitionToOrderData[] org = RequisitionToOrderData.selectOrg(this, vars.getLanguage(),
  497.           strSelected);
  498.       if (org != null && org.length == 1) {
  499.         strOrgId = org[0].adOrgId;
  500.         strMessage += "<br>" + Utility.messageBD(this, "AllLinesSameOrg", vars.getLanguage())
  501.             + ": " + org[0].org;
  502.       } else {
  503.         // Error, the selected lines are of different orgs, it is
  504.         // necessary to set one.
  505.         strMessage += "<br>" + Utility.messageBD(this, "MoreThanOneOrg", vars.getLanguage());
  506.       }
  507.       OBError myMessage = new OBError();
  508.       myMessage.setTitle("");
  509.       myMessage.setType("Info");
  510.       myMessage.setMessage(strMessage);
  511.       vars.setMessage("RequisitionToOrderCreate", myMessage);
  512.     } else {
  513.       OBError myMessage = new OBError();
  514.       myMessage.setTitle("");
  515.       myMessage.setType("Info");
  516.       myMessage.setMessage(Utility.messageBD(this, "MustSelectLines", vars.getLanguage()));
  517.       vars.setMessage("RequisitionToOrderCreate", myMessage);
  518.     }
  519.  
  520.     printPageCreate(response, vars, strOrderDate, strVendorId, strPriceListId, strOrgId,
  521.         strSelected);
  522.   }
  523.  
  524.   private void printPageCreate(HttpServletResponse response, VariablesSecureApp vars,
  525.       String strOrderDate, String strVendorId, String strPriceListId, String strOrgId,
  526.       String strSelected) throws IOException, ServletException {
  527.     if (log4j.isDebugEnabled())
  528.       log4j.debug("Print Create Purchase order");
  529.     String strDescription = Utility.messageBD(this, "RequisitionToOrderCreate", vars.getLanguage());
  530.     XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
  531.         "org/openbravo/erpCommon/ad_forms/RequisitionToOrderCreate").createXmlDocument();
  532.     xmlDocument.setParameter("calendar", vars.getLanguage().substring(0, 2));
  533.     xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
  534.     xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\r\n");
  535.     xmlDocument.setParameter("theme", vars.getTheme());
  536.     xmlDocument.setParameter("help", Replace.replace(strDescription, "\\n", "\n"));
  537.     xmlDocument.setParameter("paramLoginWarehouseId", vars.getSessionValue("#M_WAREHOUSE_ID"));
  538.     {
  539.       OBError myMessage = vars.getMessage("RequisitionToOrderCreate");
  540.       vars.removeMessage("RequisitionToOrderCreate");
  541.       if (myMessage != null) {
  542.         xmlDocument.setParameter("messageType", myMessage.getType());
  543.         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
  544.         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
  545.       }
  546.     }
  547.     xmlDocument.setParameter("paramSelected", strSelected);
  548.     xmlDocument.setParameter("paramOrderVendorId", strVendorId);
  549.     xmlDocument.setParameter("paramOrderVendorDescription", strVendorId.equals("") ? ""
  550.         : RequisitionToOrderData.bPartnerDescription(this, strVendorId, vars.getLanguage()));
  551.     xmlDocument.setParameter("orderDate", strOrderDate);
  552.     xmlDocument.setParameter("displayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
  553.     xmlDocument.setParameter("paramOrderOrgId", strOrgId);
  554.     xmlDocument.setParameter(
  555.         "arrayWarehouse",
  556.         Utility.arrayDobleEntrada(
  557.             "arrWarehouse",
  558.             RequisitionToOrderData.selectWarehouseDouble(this, vars.getClient(),
  559.                 Utility.getContext(this, vars, "#AccessibleOrgTree", "RequisitionToOrder"),
  560.                 Utility.getContext(this, vars, "#User_Client", "RequisitionToOrder"))));
  561.     xmlDocument.setParameter("paramPriceListId", strPriceListId);
  562.     try {
  563.       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_Org_ID", "",
  564.           "AD_Org is transactions allowed", Utility.getContext(this, vars, "#User_Org",
  565.               "RequisitionToOrder"), Utility.getContext(this, vars, "#User_Client",
  566.               "RequisitionToOrder"), 0);
  567.       Utility.fillSQLParameters(this, vars, null, comboTableData, "RequisitionToOrder", strOrgId);
  568.       xmlDocument.setData("reportOrderOrg_ID", "liststructure", comboTableData.select(false));
  569.       comboTableData = null;
  570.     } catch (Exception ex) {
  571.       throw new ServletException(ex);
  572.     }
  573.     try {
  574.       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "M_Pricelist_ID",
  575.           "", "Purchase Pricelist", Utility.getContext(this, vars, "#AccessibleOrgTree",
  576.               "RequisitionToOrder"), Utility.getContext(this, vars, "#User_Client",
  577.               "RequisitionToOrder"), 0);
  578.       Utility.fillSQLParameters(this, vars, null, comboTableData, "RequisitionToOrder",
  579.           strPriceListId);
  580.       xmlDocument.setData("reportPriceList_ID", "liststructure", comboTableData.select(false));
  581.       comboTableData = null;
  582.     } catch (Exception ex) {
  583.       throw new ServletException(ex);
  584.     }
  585.     response.setContentType("text/html; charset=UTF-8");
  586.     PrintWriter out = response.getWriter();
  587.     out.println(xmlDocument.print());
  588.     out.close();
  589.   }
  590.  
  591.   private OBError processPurchaseOrder(VariablesSecureApp vars, String strSelected,
  592.       String strOrderDate, String strVendor, String strPriceListId, String strOrg,
  593.       String strWarehouse) throws IOException, ServletException {
  594.     StringBuffer textMessage = new StringBuffer();
  595.     Connection conn = null;
  596.  
  597.     OBError myMessage = null;
  598.     myMessage = new OBError();
  599.     myMessage.setTitle("");
  600.  
  601.     String strPriceListVersionId = RequisitionToOrderData.getPricelistVersion(this, strPriceListId,
  602.         strOrderDate);
  603.     RequisitionToOrderData[] noprice = RequisitionToOrderData.selectNoPrice(this,
  604.         vars.getLanguage(), strPriceListVersionId, strSelected);
  605.     if (noprice != null && noprice.length > 0) {
  606.       textMessage.append(Utility.messageBD(this, "LinesWithNoPrice", vars.getLanguage())).append(
  607.           "<br><ul>");
  608.       for (int i = 0; i < noprice.length; i++) {
  609.         textMessage.append("<li>").append(noprice[i].product);
  610.       }
  611.       textMessage.append("</ul>");
  612.       myMessage.setType("Error");
  613.       myMessage.setMessage(textMessage.toString());
  614.       return myMessage;
  615.     }
  616.  
  617.     RequisitionToOrderData[] data1 = RequisitionToOrderData.selectVendorData(this, strVendor);
  618.     if (data1[0].poPaymenttermId == null || data1[0].poPaymenttermId.equals("")) {
  619.       myMessage.setType("Error");
  620.       myMessage.setMessage(Utility.messageBD(this, "VendorWithNoPaymentTerm", vars.getLanguage()));
  621.       return myMessage;
  622.     }
  623.     if ("".equals(RequisitionToOrderData.cBPartnerLocationId(this, strVendor))) {
  624.       myMessage.setType("Error");
  625.       myMessage.setMessage(Utility.messageBD(this, "NoBPLocation", vars.getLanguage()));
  626.       return myMessage;
  627.     }
  628.  
  629.     try {
  630.       conn = getTransactionConnection();
  631.       String strCOrderId = SequenceIdData.getUUID();
  632.       String docTargetType = RequisitionToOrderData.cDoctypeTarget(conn, this, vars.getClient(),
  633.           strOrg);
  634.       String strDocumentNo = Utility.getDocumentNo(this, vars, "", "C_Order", docTargetType,
  635.           docTargetType, false, true);
  636.       String cCurrencyId = RequisitionToOrderData.selectCurrency(this, strPriceListId);
  637.  
  638.       try {
  639.         RequisitionToOrderData.insertCOrder(
  640.             conn,
  641.             this,
  642.             strCOrderId,
  643.             vars.getClient(),
  644.             strOrg,
  645.             vars.getUser(),
  646.             strDocumentNo,
  647.             "DR",
  648.             "CO",
  649.             "0",
  650.             docTargetType,
  651.             strOrderDate,
  652.             strOrderDate,
  653.             strOrderDate,
  654.             strVendor,
  655.             RequisitionToOrderData.cBPartnerLocationId(this, strVendor),
  656.             RequisitionToOrderData.billto(this, strVendor).equals("") ? RequisitionToOrderData
  657.                 .cBPartnerLocationId(this, strVendor) : RequisitionToOrderData.billto(this,
  658.                 strVendor), cCurrencyId, isAlternativeFinancialFlow() ? "P"
  659.                 : data1[0].paymentrulepo, data1[0].poPaymenttermId,
  660.             data1[0].invoicerule.equals("") ? "I" : data1[0].invoicerule, data1[0].deliveryrule
  661.                 .equals("") ? "A" : data1[0].deliveryrule, "I",
  662.             data1[0].deliveryviarule.equals("") ? "D" : data1[0].deliveryviarule, strWarehouse,
  663.             strPriceListId, "", "", "", data1[0].poPaymentmethodId);
  664.       } catch (ServletException ex) {
  665.         myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
  666.         releaseRollbackConnection(conn);
  667.         return myMessage;
  668.       }
  669.  
  670.       RequisitionToOrderData[] lines = RequisitionToOrderData.linesToOrder(this, cCurrencyId,
  671.           strOrderDate, strOrg, strWarehouse, RequisitionToOrderData.billto(this, strVendor)
  672.               .equals("") ? RequisitionToOrderData.cBPartnerLocationId(this, strVendor)
  673.               : RequisitionToOrderData.billto(this, strVendor), RequisitionToOrderData
  674.               .cBPartnerLocationId(this, strVendor), strPriceListVersionId, strSelected);
  675.  
  676.       boolean uomManagementPreference = UOMUtil.isUomManagementEnabled();
  677.       HashMap<String, String[]> hashLines = new HashMap<String, String[]>();
  678.       int line = 0;
  679.       for (int i = 0; lines != null && i < lines.length; i++) {
  680.         if ("".equals(lines[i].tax)) {
  681.           RequisitionLine rl = OBDal.getInstance().get(RequisitionLine.class,
  682.               lines[i].mRequisitionlineId);
  683.           myMessage.setType("Error");
  684.           myMessage.setMessage(String.format(OBMessageUtils.messageBD("NoTaxRequisition"),
  685.               rl.getLineNo(), rl.getRequisition().getDocumentNo()));
  686.           releaseRollbackConnection(conn);
  687.           return myMessage;
  688.         }
  689.  
  690.         // Group entries with same attributes set into a hash map
  691.         String strGroupId = String.format("%s-%s-%s-%s-%s", lines[i].mProductId,
  692.             lines[i].mAttributesetinstanceId, lines[i].description, lines[i].priceactual,
  693.             lines[i].mProductUomId);
  694.         String[] hashLine = hashLines.get(strGroupId);
  695.  
  696.         lines[i].aumqty = lines[i].lockaumqty;
  697.         if (uomManagementPreference && lines[i].quantityorder.isEmpty()
  698.             && StringUtils.equals(lines[i].secuomname, "**")) {
  699.           try {
  700.             if (lines[i].cAum.isEmpty()) {
  701.               RequisitionToOrderData[] defaultAumData = RequisitionToOrderData.selectAUMDefault(
  702.                   this, lines[i].mProductId);
  703.               lines[i].cAum = (defaultAumData.length > 0) ? defaultAumData[0].cAum
  704.                   : lines[i].cUomId;
  705.             }
  706.             if (!lines[i].cUomId.equals(lines[i].cAum)) {
  707.               lines[i].aumqty = new BigDecimal(UOMUtil.getConvertedQty(lines[i].mProductId,
  708.                   new BigDecimal(lines[i].lockaumqty), lines[i].cAum).toString()).toPlainString();
  709.             }
  710.           } catch (NumberFormatException e) {
  711.           }
  712.         }
  713.         // Insert new line
  714.         if (hashLine == null) {
  715.           lines[i].cOrderlineId = SequenceIdData.getUUID();
  716.           line += 10;
  717.           hashLines.put(strGroupId, new String[] { lines[i].cOrderlineId, lines[i].lockqty,
  718.               lines[i].quantityorder, lines[i].aumqty });
  719.           try {
  720.             RequisitionToOrderData.insertCOrderline(conn, this, lines[i].cOrderlineId,
  721.                 vars.getClient(), strOrg, vars.getUser(), strCOrderId, Integer.toString(line),
  722.                 strVendor, RequisitionToOrderData.cBPartnerLocationId(this, strVendor),
  723.                 strOrderDate, lines[i].needbydate, lines[i].description, lines[i].mProductId,
  724.                 lines[i].mAttributesetinstanceId, strWarehouse, lines[i].mProductUomId,
  725.                 lines[i].cUomId, lines[i].cAum, lines[i].quantityorder, lines[i].lockqty,
  726.                 lines[i].aumqty, cCurrencyId, lines[i].pricelist, lines[i].priceactual,
  727.                 strPriceListId, lines[i].pricelimit, lines[i].tax, "", lines[i].discount,
  728.                 lines[i].grossUnit, lines[i].grossAmt);
  729.           } catch (ServletException ex) {
  730.             myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
  731.             releaseRollbackConnection(conn);
  732.             return myMessage;
  733.           }
  734.         }
  735.  
  736.         // Update existing line
  737.         else {
  738.           lines[i].cOrderlineId = hashLine[0];
  739.           BigDecimal qtyOrder = new BigDecimal(hashLine[1]).add(new BigDecimal(lines[i].lockqty));
  740.           BigDecimal quantityOrder = (StringUtils.isEmpty(hashLine[2]) ? BigDecimal.ZERO
  741.               : new BigDecimal(hashLine[2]))
  742.               .add(StringUtils.isEmpty(lines[i].quantityorder) ? BigDecimal.ZERO : new BigDecimal(
  743.                   lines[i].quantityorder));
  744.           BigDecimal qtyAumOrder = (StringUtils.isEmpty(hashLine[3]) ? BigDecimal.ZERO
  745.               : new BigDecimal(hashLine[3]))
  746.               .add(StringUtils.isEmpty(lines[i].aumqty) ? BigDecimal.ZERO : new BigDecimal(
  747.                   lines[i].aumqty));
  748.           hashLine[1] = qtyOrder.toPlainString();
  749.           hashLine[2] = BigDecimal.ZERO.compareTo(quantityOrder) == 0 ? "" : quantityOrder
  750.               .toPlainString();
  751.           hashLine[3] = qtyAumOrder.toPlainString();
  752.           try {
  753.             RequisitionToOrderData.updateCOrderline(conn, this, hashLine[1], hashLine[2],
  754.                 hashLine[3], hashLine[0]);
  755.           } catch (ServletException ex) {
  756.             myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
  757.             releaseRollbackConnection(conn);
  758.             return myMessage;
  759.           }
  760.         }
  761.  
  762.         if (log4j.isDebugEnabled()) {
  763.           log4j.debug("Lockqty: " + lines[i].lockqty + " - Quantityorder: "
  764.               + lines[i].quantityorder);
  765.         }
  766.       }
  767.  
  768.       unlockRequisitionLines(vars, strSelected);
  769.       for (int i = 0; lines != null && i < lines.length; i++) {
  770.         String strRequisitionOrderId = SequenceIdData.getUUID();
  771.         try {
  772.           RequisitionToOrderData.insertRequisitionOrder(conn, this, strRequisitionOrderId,
  773.               vars.getClient(), strOrg, vars.getUser(), lines[i].mRequisitionlineId,
  774.               lines[i].cOrderlineId, lines[i].lockqty);
  775.         } catch (ServletException ex) {
  776.           myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
  777.           releaseRollbackConnection(conn);
  778.           return myMessage;
  779.         }
  780.         if (lines[i].toClose.equals("Y"))
  781.           RequisitionToOrderData.requisitionStatus(conn, this, lines[i].mRequisitionlineId,
  782.               vars.getUser());
  783.       }
  784.  
  785.       OBError myMessageAux = cOrderPost(conn, vars, strCOrderId);
  786.       releaseCommitConnection(conn);
  787.       String strWindowName = WindowTabsData.selectWindowInfo(this, vars.getLanguage(), "181");
  788.       textMessage.append(strWindowName).append(" ").append(strDocumentNo).append(": ");
  789.       if (myMessageAux.getMessage().equals(""))
  790.         textMessage.append(Utility.messageBD(this, "Success", vars.getLanguage()));
  791.       else
  792.         textMessage.append(myMessageAux.getMessage());
  793.  
  794.       myMessage.setType(myMessageAux.getType());
  795.       myMessage.setMessage(textMessage.toString());
  796.       return myMessage;
  797.     } catch (Exception e) {
  798.       try {
  799.         if (conn != null)
  800.           releaseRollbackConnection(conn);
  801.       } catch (Exception ignored) {
  802.       }
  803.       e.printStackTrace();
  804.       log4j.warn("Rollback in transaction");
  805.       myMessage.setType("Error");
  806.       myMessage.setMessage(Utility.messageBD(this, "ProcessRunError", vars.getLanguage()));
  807.       return myMessage;
  808.     }
  809.   }
  810.  
  811.   private OBError cOrderPost(Connection conn, VariablesSecureApp vars, String strcOrderId)
  812.       throws IOException, ServletException {
  813.     String pinstance = SequenceIdData.getUUID();
  814.  
  815.     PInstanceProcessData.insertPInstance(conn, this, pinstance, "104", strcOrderId, "N",
  816.         vars.getUser(), vars.getClient(), vars.getOrg());
  817.  
  818.     PInstanceProcessData[] pinstanceData = PInstanceProcessData.selectConnection(conn, this,
  819.         pinstance);
  820.     OBError myMessage = Utility.getProcessInstanceMessage(this, vars, pinstanceData);
  821.     return myMessage;
  822.   }
  823.  
  824.   /**
  825.    * Checks if the any module implements and alternative Financial Management preference. It should
  826.    * be the Advanced Payables and Receivables module.
  827.    *
  828.    * @return true if any module implements and alternative Financial Management preference.
  829.    */
  830.   private boolean isAlternativeFinancialFlow() {
  831.     try {
  832.       try {
  833.         Preferences.getPreferenceValue("FinancialManagement", true, null, null, OBContext
  834.             .getOBContext().getUser(), null, null);
  835.       } catch (PropertyNotFoundException e) {
  836.         return false;
  837.       }
  838.     } catch (PropertyException e) {
  839.       return false;
  840.     }
  841.     return true;
  842.   }
  843.  
  844.   public String getServletInfo() {
  845.     return "Servlet RequisitionToOrder.";
  846.   } // end of getServletInfo() method
  847. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement