/** * Returns a customer event object with the action and customer id attributes populated. If events * aren't enabled, then null is returned. * * @param kkAppEng App eng instance * @param action Event action * @return Returns a customer event object or null if events aren't enabled */ protected CustomerEventIf getCustomerEvent(KKAppEng kkAppEng, int action) { String enabled = kkAppEng.getConfig(ConfigConstants.ENABLE_CUSTOMER_EVENTS); if (enabled != null && enabled.equalsIgnoreCase("true")) { CustomerEventIf event = new CustomerEvent(); event.setAction(action); CustomerIf currentCust = kkAppEng.getCustomerMgr().getCurrentCustomer(); if (currentCust != null) { event.setCustomerId(currentCust.getId()); } return event; } return null; }
/** * Inserts a customer event where all of the available parameters are passed * * @param kkAppEng App eng instance * @param action Event action * @param str1 * @param str2 * @param int1 * @param int2 * @param dec1 * @param dec2 * @throws KKException */ protected void insertCustomerEvent( KKAppEng kkAppEng, int action, String str1, String str2, int int1, int int2, BigDecimal dec1, BigDecimal dec2) throws KKException { CustomerEventIf event = getCustomerEvent(kkAppEng, action); if (event != null) { event.setData1Str(str1); event.setData2Str(str2); event.setData1Int(int1); event.setData2Int(int2); event.setData1Dec(dec1); event.setData2Dec(dec2); kkAppEng.getEng().insertCustomerEvent(event); } }