Esempio n. 1
0
  /** @see org.kuali.ext.mm.b2b.cxml.invoice.B2bInvoice#process() */
  @Override
  public void process() {
    if (!validate().isValid()) {
      // process only if validations are met
      return;
    }
    OrderDocument order = matchingOrder();
    Warehouse warehouse =
        MMServiceLocator.getBusinessObjectService()
            .findBySinglePrimaryKey(Warehouse.class, order.getWarehouseCd());
    List<FinancialAccountingLine> customerAcctLines = createCustomerAccountLines();
    List<FinancialAccountingLine> warehouseAccountLines =
        createWarehouseAcctLines(order, warehouse);
    HashMap<WarehouseGlGroup, WarehouseGlGroup> glGroups =
        new HashMap<WarehouseGlGroup, WarehouseGlGroup>();
    GeneralLedgerBuilderService glpeService =
        SpringContext.getBean(GeneralLedgerBuilderService.class);
    glpeService.buildBillingGlpes(
        glGroups, warehouse, customerAcctLines, warehouseAccountLines, "Stores credit");

    ArrayList<FinancialGeneralLedgerPendingEntry> billEntries =
        new ArrayList<FinancialGeneralLedgerPendingEntry>();
    for (WarehouseGlGroup group : glGroups.values()) {
      FinancialGeneralLedgerPendingEntry targetEntry = group.getTargetEntry();
      targetEntry.setWarehouseCode(warehouse.getWarehouseCd());
      billEntries.add(targetEntry);
    }
    SpringContext.getBean(GeneralLedgerProcessor.class).saveInternally(billEntries);
    setProcessed(true);
    setGlProcessed(true);
  }
Esempio n. 2
0
  /**
   * Gets the deliveryBuildingName property
   *
   * @return Returns the deliveryBuildingName
   */
  public String getDeliveryBuildingName() {

    FinancialSystemAdaptorFactory factory =
        SpringContext.getBean(FinancialSystemAdaptorFactory.class);
    if (factory.isSystemAvailable()) {
      FinancialLocationService fLocationService = factory.getFinancialLocationService();
      if (!StringUtils.isEmpty(this.deliveryBuildingCode)
          && !StringUtils.isEmpty(this.deliveryCampusCd)) {
        FinancialBuilding fBuilding =
            fLocationService.getBuilding(this.deliveryCampusCd, this.deliveryBuildingCode);
        if (fBuilding != null) {
          this.deliveryBuildingName = fBuilding.getBuildingName();
        }
      }
    }
    return this.deliveryBuildingName;
  }
Esempio n. 3
0
 @Override
 public void populate(HttpServletRequest request) {
   super.populate(request);
   setFrontPage(
       SpringContext.getBean(ShoppingFrontPageService.class).getCurrentShoppingFrontPage());
 }
 /** @see org.kuali.ext.mm.document.service.CatalogItemMaintenanceService#getNextCatalogItemId() */
 public String getNextCatalogItemId() {
   return String.valueOf(
       SpringContext.getBean(SequenceAccessorService.class)
           .getNextAvailableSequenceNumber(MM_CATALOG_ITEM_SEQ));
 }
Esempio n. 5
0
  /**
   * @see
   *     org.kuali.ext.mm.service.ProfileService#isValidNewCustomerProfile(org.kuali.ext.mm.businessobject.Profile)
   */
  public boolean isValidNewCustomerProfile(Profile profile) {
    boolean isValid = true;
    FinancialDataService finDataService = SpringContext.getBean(FinancialDataService.class);

    if (!getAddressService().isPhoneNumberFormatValid(profile.getProfilePhoneNumber())) {
      GlobalVariables.getMessageMap()
          .putError(
              ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                  + "."
                  + MMConstants.Profile.PROFILE_PHONE_NUMBER,
              ShopCartKeyConstants.ERROR_PROFILE_PHONE_NUMBER);
      isValid = false;
    }

    if (!profile.isPersonalUseIndicator()) {
      if (StringUtils.isBlank(profile.getFinacialChartOfAccountsCode())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.FIN_COA_CODE,
                ShopCartKeyConstants.ERROR_PROFILE_COA_CODE);
        isValid = false;
      } else {
        if (!finDataService.validateChart(profile.getFinacialChartOfAccountsCode())) {
          GlobalVariables.getMessageMap()
              .putError(
                  ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                      + "."
                      + MMConstants.Profile.FIN_COA_CODE,
                  ShopCartKeyConstants.ERROR_PROFILE_COA_CODE);
          isValid = false;
        }
      }
      if (StringUtils.isBlank(profile.getOrganizationCode())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.ORGANIZATION_CODE,
                ShopCartKeyConstants.ERROR_PROFILE_ORG_CODE_BLANK,
                profile.getOrganizationCode());
        isValid = false;
      } else {
        if (!finDataService.validateOrg(
            profile.getFinacialChartOfAccountsCode(), profile.getOrganizationCode())) {
          GlobalVariables.getMessageMap()
              .putError(
                  ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                      + "."
                      + MMConstants.Profile.ORGANIZATION_CODE,
                  ShopCartKeyConstants.ERROR_PROFILE_ORG_CODE,
                  profile.getOrganizationCode(),
                  profile.getFinacialChartOfAccountsCode());
          isValid = false;
        }
      }
      if (StringUtils.isBlank(profile.getAccountNumber())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.ACCOUNT_NBR,
                ShopCartKeyConstants.ERROR_PROFILE_ACCOUNT_NUMBER);
        isValid = false;
      } else {
        if (!finDataService.validateAccount(
            profile.getFinacialChartOfAccountsCode(), profile.getAccountNumber())) {
          GlobalVariables.getMessageMap()
              .putError(
                  ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                      + "."
                      + MMConstants.Profile.ACCOUNT_NBR,
                  ShopCartKeyConstants.ERROR_PROFILE_ACCOUNT_NUMBER);
          isValid = false;
        } else {
          if (StringUtils.isNotBlank(profile.getSubAccountNumber())) {
            if (!finDataService.validateSubAccount(
                profile.getFinacialChartOfAccountsCode(),
                profile.getAccountNumber(),
                profile.getSubAccountNumber())) {
              GlobalVariables.getMessageMap()
                  .putError(
                      ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                          + "."
                          + MMConstants.Profile.SUB_ACCOUNT_NUMBER,
                      ShopCartKeyConstants.ERROR_PROFILE_SUB_ACCOUNT,
                      profile.getSubAccountNumber());
              isValid = false;
            }
          }
        }
      }
      if (StringUtils.isNotBlank(profile.getProjectCode())
          && !finDataService.validateProject(profile.getProjectCode())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.PROJECT_CODE,
                ShopCartKeyConstants.ERROR_PROFILE_PROJECT_CODE,
                profile.getProjectCode());
        isValid = false;
      }
      if (StringUtils.isBlank(profile.getCampusCode()) || !isValidCampus(profile.getCampusCode())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.CAMPUS_CODE,
                ShopCartKeyConstants.ERROR_PROFILE_CAMPUS_CODE);
        isValid = false;
      }
      if (StringUtils.isBlank(profile.getDeliveryBuildingCode())
          || !finDataService.validateBuilding(
              profile.getCampusCode(), profile.getDeliveryBuildingCode())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.DELIVERY_BUILDING_CODE,
                ShopCartKeyConstants.ERROR_PROFILE_DELIVERY_BUILDING);
        isValid = false;
      }
      if (StringUtils.isBlank(profile.getDeliveryBuildingRoomNumber())
          || !finDataService.validateBuildingRoom(
              profile.getCampusCode(),
              profile.getDeliveryBuildingCode(),
              profile.getDeliveryBuildingRoomNumber())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.DELIVERY_BUILDING_ROOM,
                ShopCartKeyConstants.ERROR_PROFILE_DELIVERY_BUILDING_ROOM);
        isValid = false;
      }
      if (StringUtils.isBlank(profile.getBillingBuildingCode())
          || !finDataService.validateBuilding(
              profile.getCampusCode(), profile.getBillingBuildingCode())) {
        GlobalVariables.getMessageMap()
            .putError(
                ShopCartConstants.ProfileForm.PROFILE_TO_EDIT
                    + "."
                    + MMConstants.Profile.BILLING_BUILDING_CODE,
                ShopCartKeyConstants.ERROR_PROFILE_BILLING_BUILDING);
        isValid = false;
      }
    }
    return isValid;
  }