001/* 002 * Copyright 2006 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.ole.module.purap.document; 017 018import org.apache.commons.lang.StringUtils; 019import org.kuali.ole.coa.businessobject.Account; 020import org.kuali.ole.coa.businessobject.Chart; 021import org.kuali.ole.coa.businessobject.Organization; 022import org.kuali.ole.integration.purap.CapitalAssetLocation; 023import org.kuali.ole.integration.purap.CapitalAssetSystem; 024import org.kuali.ole.integration.purap.ItemCapitalAsset; 025import org.kuali.ole.module.purap.PurapConstants; 026import org.kuali.ole.module.purap.PurapParameterConstants; 027import org.kuali.ole.module.purap.PurapPropertyConstants; 028import org.kuali.ole.module.purap.businessobject.*; 029import org.kuali.ole.module.purap.document.service.PurapService; 030import org.kuali.ole.module.purap.document.service.PurchasingDocumentSpecificService; 031import org.kuali.ole.module.purap.document.service.PurchasingService; 032import org.kuali.ole.module.purap.document.service.ReceivingAddressService; 033import org.kuali.ole.module.purap.util.ItemParser; 034import org.kuali.ole.module.purap.util.ItemParserBase; 035import org.kuali.ole.sys.context.SpringContext; 036import org.kuali.ole.sys.service.impl.OleParameterConstants; 037import org.kuali.ole.vnd.VendorPropertyConstants; 038import org.kuali.ole.vnd.businessobject.*; 039import org.kuali.ole.vnd.document.service.VendorService; 040import org.kuali.rice.core.api.datetime.DateTimeService; 041import org.kuali.rice.core.api.util.type.KualiDecimal; 042import org.kuali.rice.coreservice.framework.parameter.ParameterService; 043import org.kuali.rice.krad.rules.rule.event.ApproveDocumentEvent; 044import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent; 045import org.kuali.rice.krad.rules.rule.event.RouteDocumentEvent; 046import org.kuali.rice.krad.util.GlobalVariables; 047import org.kuali.rice.krad.util.ObjectUtils; 048import org.kuali.rice.location.api.country.Country; 049import org.kuali.rice.location.api.country.CountryService; 050 051import java.sql.Date; 052import java.util.ArrayList; 053import java.util.Iterator; 054import java.util.List; 055 056/** 057 * Base class for Purchasing Documents. 058 */ 059public abstract class PurchasingDocumentBase extends PurchasingAccountsPayableDocumentBase implements PurchasingDocument { 060 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PurchasingDocumentBase.class); 061 062 // SHARED FIELDS BETWEEN REQUISITION AND PURCHASE ORDER 063 protected String documentFundingSourceCode; 064 protected String requisitionSourceCode; 065 protected String purchaseOrderTransmissionMethodCode; 066 protected String purchaseOrderCostSourceCode; 067 protected String deliveryRequiredDateReasonCode; 068 protected String recurringPaymentTypeCode; 069 protected String chartOfAccountsCode; 070 protected String organizationCode; 071 protected String deliveryCampusCode; 072 protected KualiDecimal purchaseOrderTotalLimit; 073 protected Boolean vendorRestrictedIndicator; 074 protected String vendorPhoneNumber; 075 protected String vendorFaxNumber; 076 protected Integer vendorContractGeneratedIdentifier; 077 protected String vendorNoteText; 078 protected String requestorPersonName; 079 protected String requestorPersonEmailAddress; 080 protected String requestorPersonPhoneNumber; 081 protected String nonInstitutionFundOrgChartOfAccountsCode; 082 protected String nonInstitutionFundOrganizationCode; 083 protected String nonInstitutionFundChartOfAccountsCode; 084 protected String nonInstitutionFundAccountNumber; 085 protected boolean deliveryBuildingOtherIndicator; 086 protected String deliveryBuildingCode; 087 protected String deliveryBuildingName; 088 protected String deliveryBuildingRoomNumber; 089 protected String deliveryBuildingLine1Address; 090 protected String deliveryBuildingLine2Address; 091 protected String deliveryCityName; 092 protected String deliveryStateCode; 093 protected String deliveryPostalCode; 094 protected String deliveryCountryCode; 095 protected String deliveryToName; 096 protected String deliveryToEmailAddress; 097 protected String deliveryToPhoneNumber; 098 protected Date deliveryRequiredDate; 099 protected String deliveryInstructionText; 100 protected Date purchaseOrderBeginDate; 101 protected Date purchaseOrderEndDate; 102 protected String institutionContactName; 103 protected String institutionContactPhoneNumber; 104 protected String institutionContactEmailAddress; 105 protected String billingName; 106 protected String billingLine1Address; 107 protected String billingLine2Address; 108 protected String billingCityName; 109 protected String billingStateCode; 110 protected String billingPostalCode; 111 protected String billingCountryCode; 112 protected String billingPhoneNumber; 113 protected String billingEmailAddress; 114 protected String receivingName; 115 protected String receivingLine1Address; 116 protected String receivingLine2Address; 117 protected String receivingCityName; 118 protected String receivingStateCode; 119 protected String receivingPostalCode; 120 protected String receivingCountryCode; 121 protected boolean addressToVendorIndicator; // if true, use receiving address 122 protected String externalOrganizationB2bSupplierIdentifier; 123 protected boolean purchaseOrderAutomaticIndicator; 124 protected String vendorPaymentTermsCode; 125 protected String vendorShippingTitleCode; 126 protected String vendorShippingPaymentTermsCode; 127 protected String capitalAssetSystemTypeCode; 128 protected String capitalAssetSystemStateCode; 129 protected String justification; 130 131 // NOT PERSISTED IN DB 132 protected String supplierDiversityLabel; 133 protected String vendorContactsLabel; 134 135 // REFERENCE OBJECTS 136 protected FundingSource fundingSource; 137 protected RequisitionSource requisitionSource; 138 protected PurchaseOrderTransmissionMethod purchaseOrderTransmissionMethod; 139 protected PurchaseOrderCostSource purchaseOrderCostSource; 140 protected DeliveryRequiredDateReason deliveryRequiredDateReason; 141 protected RecurringPaymentType recurringPaymentType; 142 protected Organization organization; 143 protected Chart chartOfAccounts; 144 protected CampusParameter deliveryCampus; 145 protected Chart nonInstitutionFundOrgChartOfAccounts; 146 protected Organization nonInstitutionFundOrganization; 147 protected Account nonInstitutionFundAccount; 148 protected Chart nonInstitutionFundChartOfAccounts; 149 protected VendorContract vendorContract; 150 protected CapitalAssetSystemType capitalAssetSystemType; 151 protected CapitalAssetSystemState capitalAssetSystemState; 152 protected List<CapitalAssetSystem> purchasingCapitalAssetSystems; 153 protected List<PurchasingCapitalAssetItem> purchasingCapitalAssetItems; 154 155 protected boolean receivingDocumentRequiredIndicator; 156 protected boolean paymentRequestPositiveApprovalIndicator; 157 158 protected List<CommodityCode> commodityCodesForRouting; 159 160 /** 161 * Default Constructor. 162 */ 163 public PurchasingDocumentBase() { 164 super(); 165 166 purchasingCapitalAssetItems = new ArrayList(); 167 purchasingCapitalAssetSystems = new ArrayList(); 168 } 169 170 @Override 171 public abstract PurchasingDocumentSpecificService getDocumentSpecificService(); 172 173 /** 174 * @see org.kuali.ole.module.purap.document.PurchasingDocument#templateVendorDetail(org.kuali.ole.vnd.businessobject.VendorDetail) 175 */ 176 @Override 177 public void templateVendorDetail(VendorDetail vendorDetail) { 178 if (ObjectUtils.isNotNull(vendorDetail)) { 179 this.setVendorDetail(vendorDetail); 180 this.setVendorName(vendorDetail.getVendorName()); 181 this.setVendorShippingTitleCode(vendorDetail.getVendorShippingTitleCode()); 182 this.setVendorPaymentTermsCode(vendorDetail.getVendorPaymentTermsCode()); 183 this.setVendorShippingPaymentTermsCode(vendorDetail.getVendorShippingPaymentTermsCode()); 184 this.setVendorCustomerNumber(""); 185 } 186 } 187 188 /** 189 * @see org.kuali.ole.module.purap.document.PurchasingDocument#templateVendorContract(org.kuali.ole.vnd.businessobject.VendorContract) 190 */ 191 @Override 192 public void templateVendorContract(VendorContract vendorContract) { 193 if (ObjectUtils.isNotNull(vendorContract)) { 194 this.setVendorContract(vendorContract); 195 this.setVendorContractGeneratedIdentifier(vendorContract.getVendorContractGeneratedIdentifier()); 196 this.setVendorShippingTitleCode(vendorContract.getVendorShippingTitleCode()); 197 this.setVendorPaymentTermsCode(vendorContract.getVendorPaymentTermsCode()); 198 this.setVendorShippingPaymentTermsCode(vendorContract.getVendorShippingPaymentTermsCode()); 199 this.setPurchaseOrderCostSourceCode(vendorContract.getPurchaseOrderCostSourceCode()); 200 } 201 } 202 203 /** 204 * @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#templateVendorAddress(org.kuali.ole.vnd.businessobject.VendorAddress) 205 */ 206 @Override 207 public void templateVendorAddress(VendorAddress vendorAddress) { 208 super.templateVendorAddress(vendorAddress); 209 if (vendorAddress != null) { 210 this.setVendorFaxNumber(vendorAddress.getVendorFaxNumber()); 211 this.setVendorAttentionName(vendorAddress.getVendorAttentionName()); 212 } 213 } 214 215 /** 216 * @see org.kuali.ole.module.purap.document.PurchasingDocumentBase#templateBillingAddress(org.kuali.ole.module.purap.businessobject.BillingAddress). 217 */ 218 @Override 219 public void templateBillingAddress(BillingAddress billingAddress) { 220 if (ObjectUtils.isNotNull(billingAddress)) { 221 this.setBillingName(billingAddress.getBillingName()); 222 this.setBillingLine1Address(billingAddress.getBillingLine1Address()); 223 this.setBillingLine2Address(billingAddress.getBillingLine2Address()); 224 this.setBillingCityName(billingAddress.getBillingCityName()); 225 this.setBillingStateCode(billingAddress.getBillingStateCode()); 226 this.setBillingPostalCode(billingAddress.getBillingPostalCode()); 227 this.setBillingCountryCode(billingAddress.getBillingCountryCode()); 228 this.setBillingPhoneNumber(billingAddress.getBillingPhoneNumber()); 229 this.setBillingEmailAddress(billingAddress.getBillingEmailAddress()); 230 } 231 } 232 233 /** 234 * @see org.kuali.ole.module.purap.document.PurchasingDocumentBase#templateReceivingAddress(org.kuali.ole.module.purap.businessobject.ReceivingAddress). 235 */ 236 @Override 237 public void templateReceivingAddress(ReceivingAddress receivingAddress) { 238 if (receivingAddress != null) { 239 this.setReceivingName(receivingAddress.getReceivingName()); 240 this.setReceivingLine1Address(receivingAddress.getReceivingLine1Address()); 241 this.setReceivingLine2Address(receivingAddress.getReceivingLine2Address()); 242 this.setReceivingCityName(receivingAddress.getReceivingCityName()); 243 this.setReceivingStateCode(receivingAddress.getReceivingStateCode()); 244 this.setReceivingPostalCode(receivingAddress.getReceivingPostalCode()); 245 this.setReceivingCountryCode(receivingAddress.getReceivingCountryCode()); 246 this.setAddressToVendorIndicator(receivingAddress.isUseReceivingIndicator()); 247 } else { 248 this.setReceivingName(null); 249 this.setReceivingLine1Address(null); 250 this.setReceivingLine2Address(null); 251 this.setReceivingCityName(null); 252 this.setReceivingStateCode(null); 253 this.setReceivingPostalCode(null); 254 this.setReceivingCountryCode(null); 255 this.setAddressToVendorIndicator(false); 256 } 257 } 258 259 /** 260 * Loads the default receiving address from database corresponding to the chart/org of this document. 261 */ 262 @Override 263 public void loadReceivingAddress() { 264 /* 265 Map criteria = new HashMap(); 266 criteria.put(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, this.getChartOfAccountsCode()); 267 criteria.put(OLEPropertyConstants.ORGANIZATION_CODE, this.getOrganizationCode()); 268 criteria.put(PurapPropertyConstants.RCVNG_ADDR_DFLT_IND, true); 269 criteria.put(PurapPropertyConstants.RCVNG_ADDR_ACTIVE, true); 270 List<ReceivingAddress> addresses = (List)SpringContext.getBean(BusinessObjectService.class).findMatching(ReceivingAddress.class, criteria); 271 if (addresses != null && addresses.size()>0 ) 272 this.templateReceivingAddress(addresses.get(0)); 273 else // if no address is found, fill with null 274 this.templateReceivingAddress(null); 275 */ 276 String chartCode = getChartOfAccountsCode(); 277 String orgCode = getOrganizationCode(); 278 ReceivingAddress address = SpringContext.getBean(ReceivingAddressService.class).findUniqueDefaultByChartOrg(chartCode, orgCode); 279 // if default address for chart/org not found, look for chart default 280 if (address == null && orgCode != null) { 281 address = SpringContext.getBean(ReceivingAddressService.class).findUniqueDefaultByChartOrg(chartCode, null); 282 } 283 this.templateReceivingAddress(address); 284 } 285 286 /** 287 * Iterates through the purchasingCapitalAssetItems of the document and returns the purchasingCapitalAssetItem with the item id equal to the number given, or null if a 288 * match is not found. 289 * 290 * @param itemIdentifier item id to match on. 291 * @return the PurchasingCapitalAssetItem if a match is found, else null. 292 */ 293 public PurchasingCapitalAssetItem getPurchasingCapitalAssetItemByItemIdentifier(int itemIdentifier) { 294 for (Iterator iter = purchasingCapitalAssetItems.iterator(); iter.hasNext(); ) { 295 PurchasingCapitalAssetItem camsItem = (PurchasingCapitalAssetItem) iter.next(); 296 if (camsItem.getItemIdentifier().intValue() == itemIdentifier) { 297 return camsItem; 298 } 299 } 300 return null; 301 } 302 303 304 /** 305 * @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#addItem(org.kuali.ole.module.purap.businessobject.PurApItem) 306 */ 307 @Override 308 public void addItem(PurApItem item) { 309 item.refreshReferenceObject(PurapPropertyConstants.COMMODITY_CODE); 310 super.addItem(item); 311 } 312 313 /** 314 * @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#populateDocumentForRouting() 315 */ 316 @Override 317 public void populateDocumentForRouting() { 318 commodityCodesForRouting = new ArrayList<CommodityCode>(); 319 for (PurchasingItemBase item : (List<PurchasingItemBase>) this.getItems()) { 320 if (item.getCommodityCode() != null && !commodityCodesForRouting.contains(item.getCommodityCode())) { 321 commodityCodesForRouting.add(item.getCommodityCode()); 322 } 323 } 324 super.populateDocumentForRouting(); 325 } 326 327 // GETTERS AND SETTERS 328 329 /** 330 * @see org.kuali.ole.module.purap.document.PurchasingDocument.getItemParser(). 331 */ 332 @Override 333 public ItemParser getItemParser() { 334 return new ItemParserBase(); 335 } 336 337 /** 338 * Decides whether receivingDocumentRequiredIndicator functionality shall be enabled according to the controlling parameter. 339 */ 340 public boolean isEnableReceivingDocumentRequiredIndicator() { 341 return SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(OleParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.RECEIVING_DOCUMENT_REQUIRED_IND); 342 } 343 344 /** 345 * Decides whether paymentRequestPositiveApprovalIndicator functionality shall be enabled according to the controlling parameter. 346 */ 347 public boolean isEnablePaymentRequestPositiveApprovalIndicator() { 348 return SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(OleParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.PAYMENT_REQUEST_POSITIVE_APPROVAL_IND); 349 } 350 351 @Override 352 public String getBillingCityName() { 353 return billingCityName; 354 } 355 356 @Override 357 public void setBillingCityName(String billingCityName) { 358 this.billingCityName = billingCityName; 359 } 360 361 @Override 362 public String getBillingCountryCode() { 363 return billingCountryCode; 364 } 365 366 @Override 367 public void setBillingCountryCode(String billingCountryCode) { 368 this.billingCountryCode = billingCountryCode; 369 } 370 371 @Override 372 public String getBillingCountryName() { 373 if (StringUtils.isNotBlank(getBillingCountryCode())) { 374 Country country = SpringContext.getBean(CountryService.class).getCountry(getBillingCountryCode()); 375 if (country != null) { 376 return country.getName(); 377 } 378 } 379 return null; 380 } 381 382 @Override 383 public String getBillingLine1Address() { 384 return billingLine1Address; 385 } 386 387 @Override 388 public void setBillingLine1Address(String billingLine1Address) { 389 this.billingLine1Address = billingLine1Address; 390 } 391 392 @Override 393 public String getBillingLine2Address() { 394 return billingLine2Address; 395 } 396 397 @Override 398 public void setBillingLine2Address(String billingLine2Address) { 399 this.billingLine2Address = billingLine2Address; 400 } 401 402 @Override 403 public String getBillingName() { 404 return billingName; 405 } 406 407 @Override 408 public void setBillingName(String billingName) { 409 this.billingName = billingName; 410 } 411 412 @Override 413 public String getBillingPhoneNumber() { 414 return billingPhoneNumber; 415 } 416 417 @Override 418 public void setBillingPhoneNumber(String billingPhoneNumber) { 419 this.billingPhoneNumber = billingPhoneNumber; 420 } 421 422 public String getBillingEmailAddress() { 423 return billingEmailAddress; 424 } 425 426 public void setBillingEmailAddress(String billingEmailAddress) { 427 this.billingEmailAddress = billingEmailAddress; 428 } 429 430 @Override 431 public String getBillingPostalCode() { 432 return billingPostalCode; 433 } 434 435 @Override 436 public void setBillingPostalCode(String billingPostalCode) { 437 this.billingPostalCode = billingPostalCode; 438 } 439 440 @Override 441 public String getBillingStateCode() { 442 return billingStateCode; 443 } 444 445 @Override 446 public void setBillingStateCode(String billingStateCode) { 447 this.billingStateCode = billingStateCode; 448 } 449 450 @Override 451 public String getReceivingCityName() { 452 return receivingCityName; 453 } 454 455 @Override 456 public void setReceivingCityName(String receivingCityName) { 457 this.receivingCityName = receivingCityName; 458 } 459 460 @Override 461 public String getReceivingCountryCode() { 462 return receivingCountryCode; 463 } 464 465 @Override 466 public void setReceivingCountryCode(String receivingCountryCode) { 467 this.receivingCountryCode = receivingCountryCode; 468 } 469 470 @Override 471 public String getReceivingCountryName() { 472 if (StringUtils.isNotBlank(getReceivingCountryCode())) { 473 Country country = SpringContext.getBean(CountryService.class).getCountry(getReceivingCountryCode()); 474 if (country != null) { 475 return country.getName(); 476 } 477 } 478 return null; 479 } 480 481 @Override 482 public String getReceivingLine1Address() { 483 return receivingLine1Address; 484 } 485 486 @Override 487 public void setReceivingLine1Address(String receivingLine1Address) { 488 this.receivingLine1Address = receivingLine1Address; 489 } 490 491 @Override 492 public String getReceivingLine2Address() { 493 return receivingLine2Address; 494 } 495 496 @Override 497 public void setReceivingLine2Address(String receivingLine2Address) { 498 this.receivingLine2Address = receivingLine2Address; 499 } 500 501 @Override 502 public String getReceivingName() { 503 return receivingName; 504 } 505 506 @Override 507 public void setReceivingName(String receivingName) { 508 this.receivingName = receivingName; 509 } 510 511 @Override 512 public String getReceivingPostalCode() { 513 return receivingPostalCode; 514 } 515 516 @Override 517 public void setReceivingPostalCode(String receivingPostalCode) { 518 this.receivingPostalCode = receivingPostalCode; 519 } 520 521 @Override 522 public String getReceivingStateCode() { 523 return receivingStateCode; 524 } 525 526 @Override 527 public void setReceivingStateCode(String receivingStateCode) { 528 this.receivingStateCode = receivingStateCode; 529 } 530 531 @Override 532 public boolean getAddressToVendorIndicator() { 533 return addressToVendorIndicator; 534 } 535 536 @Override 537 public void setAddressToVendorIndicator(boolean addressToVendor) { 538 this.addressToVendorIndicator = addressToVendor; 539 } 540 541 @Override 542 public String getChartOfAccountsCode() { 543 return chartOfAccountsCode; 544 } 545 546 @Override 547 public void setChartOfAccountsCode(String chartOfAccountsCode) { 548 this.chartOfAccountsCode = chartOfAccountsCode; 549 } 550 551 @Override 552 public String getDeliveryBuildingCode() { 553 return deliveryBuildingCode; 554 } 555 556 @Override 557 public void setDeliveryBuildingCode(String deliveryBuildingCode) { 558 this.deliveryBuildingCode = deliveryBuildingCode; 559 } 560 561 @Override 562 public String getDeliveryBuildingLine1Address() { 563 return deliveryBuildingLine1Address; 564 } 565 566 @Override 567 public void setDeliveryBuildingLine1Address(String deliveryBuildingLine1Address) { 568 this.deliveryBuildingLine1Address = deliveryBuildingLine1Address; 569 } 570 571 @Override 572 public String getDeliveryBuildingLine2Address() { 573 return deliveryBuildingLine2Address; 574 } 575 576 @Override 577 public void setDeliveryBuildingLine2Address(String deliveryBuildingLine2Address) { 578 this.deliveryBuildingLine2Address = deliveryBuildingLine2Address; 579 } 580 581 @Override 582 public String getDeliveryBuildingName() { 583 return deliveryBuildingName; 584 } 585 586 @Override 587 public void setDeliveryBuildingName(String deliveryBuildingName) { 588 this.deliveryBuildingName = deliveryBuildingName; 589 } 590 591 @Override 592 public boolean isDeliveryBuildingOtherIndicator() { 593 return deliveryBuildingOtherIndicator; 594 } 595 596 @Override 597 public void setDeliveryBuildingOtherIndicator(boolean deliveryBuildingOtherIndicator) { 598 this.deliveryBuildingOtherIndicator = deliveryBuildingOtherIndicator; 599 } 600 601 @Override 602 public String getDeliveryBuildingRoomNumber() { 603 return deliveryBuildingRoomNumber; 604 } 605 606 @Override 607 public void setDeliveryBuildingRoomNumber(String deliveryBuildingRoomNumber) { 608 this.deliveryBuildingRoomNumber = deliveryBuildingRoomNumber; 609 } 610 611 @Override 612 public String getDeliveryCampusCode() { 613 return deliveryCampusCode; 614 } 615 616 @Override 617 public void setDeliveryCampusCode(String deliveryCampusCode) { 618 this.deliveryCampusCode = deliveryCampusCode; 619 } 620 621 @Override 622 public String getDeliveryCityName() { 623 return deliveryCityName; 624 } 625 626 @Override 627 public void setDeliveryCityName(String deliveryCityName) { 628 this.deliveryCityName = deliveryCityName; 629 } 630 631 @Override 632 public String getDeliveryCountryCode() { 633 return deliveryCountryCode; 634 } 635 636 @Override 637 public String getDeliveryCountryName() { 638 if (StringUtils.isNotBlank(getDeliveryCountryCode())) { 639 Country country = SpringContext.getBean(CountryService.class).getCountry(getDeliveryCountryCode()); 640 if (country != null) { 641 return country.getName(); 642 } 643 } 644 return null; 645 } 646 647 @Override 648 public void setDeliveryCountryCode(String deliveryCountryCode) { 649 this.deliveryCountryCode = deliveryCountryCode; 650 } 651 652 653 @Override 654 public String getDeliveryInstructionText() { 655 return deliveryInstructionText; 656 } 657 658 @Override 659 public void setDeliveryInstructionText(String deliveryInstructionText) { 660 this.deliveryInstructionText = deliveryInstructionText; 661 } 662 663 @Override 664 public String getDeliveryPostalCode() { 665 return deliveryPostalCode; 666 } 667 668 @Override 669 public void setDeliveryPostalCode(String deliveryPostalCode) { 670 this.deliveryPostalCode = deliveryPostalCode; 671 } 672 673 @Override 674 public Date getDeliveryRequiredDate() { 675 return deliveryRequiredDate; 676 } 677 678 @Override 679 public void setDeliveryRequiredDate(Date deliveryRequiredDate) { 680 this.deliveryRequiredDate = deliveryRequiredDate; 681 } 682 683 @Override 684 public String getDeliveryRequiredDateReasonCode() { 685 return deliveryRequiredDateReasonCode; 686 } 687 688 @Override 689 public void setDeliveryRequiredDateReasonCode(String deliveryRequiredDateReasonCode) { 690 this.deliveryRequiredDateReasonCode = deliveryRequiredDateReasonCode; 691 } 692 693 @Override 694 public String getDeliveryStateCode() { 695 return deliveryStateCode; 696 } 697 698 @Override 699 public void setDeliveryStateCode(String deliveryStateCode) { 700 this.deliveryStateCode = deliveryStateCode; 701 } 702 703 @Override 704 public String getDeliveryToEmailAddress() { 705 return deliveryToEmailAddress; 706 } 707 708 @Override 709 public void setDeliveryToEmailAddress(String deliveryToEmailAddress) { 710 this.deliveryToEmailAddress = deliveryToEmailAddress; 711 } 712 713 @Override 714 public String getDeliveryToName() { 715 return deliveryToName; 716 } 717 718 @Override 719 public void setDeliveryToName(String deliveryToName) { 720 this.deliveryToName = deliveryToName; 721 } 722 723 @Override 724 public String getDeliveryToPhoneNumber() { 725 return deliveryToPhoneNumber; 726 } 727 728 @Override 729 public void setDeliveryToPhoneNumber(String deliveryToPhoneNumber) { 730 this.deliveryToPhoneNumber = deliveryToPhoneNumber; 731 } 732 733 @Override 734 public String getExternalOrganizationB2bSupplierIdentifier() { 735 return externalOrganizationB2bSupplierIdentifier; 736 } 737 738 @Override 739 public void setExternalOrganizationB2bSupplierIdentifier(String externalOrganizationB2bSupplierIdentifier) { 740 this.externalOrganizationB2bSupplierIdentifier = externalOrganizationB2bSupplierIdentifier; 741 } 742 743 @Override 744 public String getDocumentFundingSourceCode() { 745 return documentFundingSourceCode; 746 } 747 748 @Override 749 public void setDocumentFundingSourceCode(String documentFundingSourceCode) { 750 this.documentFundingSourceCode = documentFundingSourceCode; 751 } 752 753 @Override 754 public String getInstitutionContactEmailAddress() { 755 return institutionContactEmailAddress; 756 } 757 758 @Override 759 public void setInstitutionContactEmailAddress(String institutionContactEmailAddress) { 760 this.institutionContactEmailAddress = institutionContactEmailAddress; 761 } 762 763 @Override 764 public String getInstitutionContactName() { 765 return institutionContactName; 766 } 767 768 @Override 769 public void setInstitutionContactName(String institutionContactName) { 770 this.institutionContactName = institutionContactName; 771 } 772 773 @Override 774 public String getInstitutionContactPhoneNumber() { 775 return institutionContactPhoneNumber; 776 } 777 778 @Override 779 public void setInstitutionContactPhoneNumber(String institutionContactPhoneNumber) { 780 this.institutionContactPhoneNumber = institutionContactPhoneNumber; 781 } 782 783 @Override 784 public String getNonInstitutionFundAccountNumber() { 785 return nonInstitutionFundAccountNumber; 786 } 787 788 @Override 789 public void setNonInstitutionFundAccountNumber(String nonInstitutionFundAccountNumber) { 790 this.nonInstitutionFundAccountNumber = nonInstitutionFundAccountNumber; 791 } 792 793 @Override 794 public String getNonInstitutionFundChartOfAccountsCode() { 795 return nonInstitutionFundChartOfAccountsCode; 796 } 797 798 @Override 799 public void setNonInstitutionFundChartOfAccountsCode(String nonInstitutionFundChartOfAccountsCode) { 800 this.nonInstitutionFundChartOfAccountsCode = nonInstitutionFundChartOfAccountsCode; 801 } 802 803 @Override 804 public String getNonInstitutionFundOrganizationCode() { 805 return nonInstitutionFundOrganizationCode; 806 } 807 808 @Override 809 public void setNonInstitutionFundOrganizationCode(String nonInstitutionFundOrganizationCode) { 810 this.nonInstitutionFundOrganizationCode = nonInstitutionFundOrganizationCode; 811 } 812 813 @Override 814 public String getNonInstitutionFundOrgChartOfAccountsCode() { 815 return nonInstitutionFundOrgChartOfAccountsCode; 816 } 817 818 @Override 819 public void setNonInstitutionFundOrgChartOfAccountsCode(String nonInstitutionFundOrgChartOfAccountsCode) { 820 this.nonInstitutionFundOrgChartOfAccountsCode = nonInstitutionFundOrgChartOfAccountsCode; 821 } 822 823 @Override 824 public String getOrganizationCode() { 825 return organizationCode; 826 } 827 828 @Override 829 public void setOrganizationCode(String organizationCode) { 830 this.organizationCode = organizationCode; 831 } 832 833 @Override 834 public boolean getPurchaseOrderAutomaticIndicator() { 835 return purchaseOrderAutomaticIndicator; 836 } 837 838 @Override 839 public void setPurchaseOrderAutomaticIndicator(boolean purchaseOrderAutomaticIndicator) { 840 this.purchaseOrderAutomaticIndicator = purchaseOrderAutomaticIndicator; 841 } 842 843 @Override 844 public Date getPurchaseOrderBeginDate() { 845 return purchaseOrderBeginDate; 846 } 847 848 @Override 849 public void setPurchaseOrderBeginDate(Date purchaseOrderBeginDate) { 850 this.purchaseOrderBeginDate = purchaseOrderBeginDate; 851 } 852 853 @Override 854 public String getPurchaseOrderCostSourceCode() { 855 return purchaseOrderCostSourceCode; 856 } 857 858 @Override 859 public void setPurchaseOrderCostSourceCode(String purchaseOrderCostSourceCode) { 860 this.purchaseOrderCostSourceCode = purchaseOrderCostSourceCode; 861 } 862 863 @Override 864 public Date getPurchaseOrderEndDate() { 865 return purchaseOrderEndDate; 866 } 867 868 @Override 869 public void setPurchaseOrderEndDate(Date purchaseOrderEndDate) { 870 this.purchaseOrderEndDate = purchaseOrderEndDate; 871 } 872 873 @Override 874 public KualiDecimal getPurchaseOrderTotalLimit() { 875 return purchaseOrderTotalLimit; 876 } 877 878 @Override 879 public void setPurchaseOrderTotalLimit(KualiDecimal purchaseOrderTotalLimit) { 880 this.purchaseOrderTotalLimit = purchaseOrderTotalLimit; 881 } 882 883 @Override 884 public String getPurchaseOrderTransmissionMethodCode() { 885 return purchaseOrderTransmissionMethodCode; 886 } 887 888 @Override 889 public void setPurchaseOrderTransmissionMethodCode(String purchaseOrderTransmissionMethodCode) { 890 this.purchaseOrderTransmissionMethodCode = purchaseOrderTransmissionMethodCode; 891 } 892 893 @Override 894 public String getRecurringPaymentTypeCode() { 895 return recurringPaymentTypeCode; 896 } 897 898 @Override 899 public void setRecurringPaymentTypeCode(String recurringPaymentTypeCode) { 900 this.recurringPaymentTypeCode = recurringPaymentTypeCode; 901 } 902 903 @Override 904 public String getRequestorPersonEmailAddress() { 905 return requestorPersonEmailAddress; 906 } 907 908 @Override 909 public void setRequestorPersonEmailAddress(String requestorPersonEmailAddress) { 910 this.requestorPersonEmailAddress = requestorPersonEmailAddress; 911 } 912 913 @Override 914 public String getRequestorPersonName() { 915 return requestorPersonName; 916 } 917 918 @Override 919 public void setRequestorPersonName(String requestorPersonName) { 920 this.requestorPersonName = requestorPersonName; 921 } 922 923 @Override 924 public String getRequestorPersonPhoneNumber() { 925 return requestorPersonPhoneNumber; 926 } 927 928 @Override 929 public void setRequestorPersonPhoneNumber(String requestorPersonPhoneNumber) { 930 this.requestorPersonPhoneNumber = requestorPersonPhoneNumber; 931 } 932 933 @Override 934 public String getRequisitionSourceCode() { 935 return requisitionSourceCode; 936 } 937 938 @Override 939 public void setRequisitionSourceCode(String requisitionSourceCode) { 940 this.requisitionSourceCode = requisitionSourceCode; 941 } 942 943 public String getVendorContactsLabel() { 944 return vendorContactsLabel; 945 } 946 947 public void setVendorContactsLabel(String vendorContactsLabel) { 948 this.vendorContactsLabel = vendorContactsLabel; 949 } 950 951 public VendorContract getVendorContract() { 952 if (ObjectUtils.isNull(vendorContract)) { 953 refreshReferenceObject(PurapPropertyConstants.VENDOR_CONTRACT); 954 } 955 return vendorContract; 956 } 957 958 public void setVendorContract(VendorContract vendorContract) { 959 this.vendorContract = vendorContract; 960 } 961 962 @Override 963 public Integer getVendorContractGeneratedIdentifier() { 964 return vendorContractGeneratedIdentifier; 965 } 966 967 @Override 968 public void setVendorContractGeneratedIdentifier(Integer vendorContractGeneratedIdentifier) { 969 this.vendorContractGeneratedIdentifier = vendorContractGeneratedIdentifier; 970 } 971 972 public String getVendorContractName() { 973 getVendorContract(); 974 if (ObjectUtils.isNull(vendorContract)) { 975 return ""; 976 } else { 977 return vendorContract.getVendorContractName(); 978 } 979 } 980 981 @Override 982 public String getVendorFaxNumber() { 983 return vendorFaxNumber; 984 } 985 986 @Override 987 public void setVendorFaxNumber(String vendorFaxNumber) { 988 this.vendorFaxNumber = vendorFaxNumber; 989 } 990 991 @Override 992 public String getVendorNoteText() { 993 return vendorNoteText; 994 } 995 996 @Override 997 public void setVendorNoteText(String vendorNoteText) { 998 this.vendorNoteText = vendorNoteText; 999 } 1000 1001 @Override 1002 public String getVendorPaymentTermsCode() { 1003 return vendorPaymentTermsCode; 1004 } 1005 1006 @Override 1007 public void setVendorPaymentTermsCode(String vendorPaymentTermsCode) { 1008 this.vendorPaymentTermsCode = vendorPaymentTermsCode; 1009 } 1010 1011 @Override 1012 public String getVendorPhoneNumber() { 1013 return vendorPhoneNumber; 1014 } 1015 1016 @Override 1017 public void setVendorPhoneNumber(String vendorPhoneNumber) { 1018 this.vendorPhoneNumber = vendorPhoneNumber; 1019 } 1020 1021 @Override 1022 public Boolean getVendorRestrictedIndicator() { 1023 return vendorRestrictedIndicator; 1024 } 1025 1026 @Override 1027 public void setVendorRestrictedIndicator(Boolean vendorRestrictedIndicator) { 1028 this.vendorRestrictedIndicator = vendorRestrictedIndicator; 1029 } 1030 1031 @Override 1032 public String getVendorShippingPaymentTermsCode() { 1033 return vendorShippingPaymentTermsCode; 1034 } 1035 1036 @Override 1037 public void setVendorShippingPaymentTermsCode(String vendorShippingPaymentTermsCode) { 1038 this.vendorShippingPaymentTermsCode = vendorShippingPaymentTermsCode; 1039 } 1040 1041 @Override 1042 public String getVendorShippingTitleCode() { 1043 return vendorShippingTitleCode; 1044 } 1045 1046 @Override 1047 public void setVendorShippingTitleCode(String vendorShippingTitleCode) { 1048 this.vendorShippingTitleCode = vendorShippingTitleCode; 1049 } 1050 1051 @Override 1052 public Chart getChartOfAccounts() { 1053 return chartOfAccounts; 1054 } 1055 1056 @Override 1057 public CampusParameter getDeliveryCampus() { 1058 return deliveryCampus; 1059 } 1060 1061 @Override 1062 public DeliveryRequiredDateReason getDeliveryRequiredDateReason() { 1063 return deliveryRequiredDateReason; 1064 } 1065 1066 @Override 1067 public FundingSource getFundingSource() { 1068 return fundingSource; 1069 } 1070 1071 @Override 1072 public Account getNonInstitutionFundAccount() { 1073 return nonInstitutionFundAccount; 1074 } 1075 1076 @Override 1077 public Chart getNonInstitutionFundChartOfAccounts() { 1078 return nonInstitutionFundChartOfAccounts; 1079 } 1080 1081 @Override 1082 public Organization getNonInstitutionFundOrganization() { 1083 return nonInstitutionFundOrganization; 1084 } 1085 1086 @Override 1087 public Chart getNonInstitutionFundOrgChartOfAccounts() { 1088 return nonInstitutionFundOrgChartOfAccounts; 1089 } 1090 1091 @Override 1092 public Organization getOrganization() { 1093 return organization; 1094 } 1095 1096 @Override 1097 public PurchaseOrderTransmissionMethod getPurchaseOrderTransmissionMethod() { 1098 return purchaseOrderTransmissionMethod; 1099 } 1100 1101 @Override 1102 public RecurringPaymentType getRecurringPaymentType() { 1103 return recurringPaymentType; 1104 } 1105 1106 @Override 1107 public RequisitionSource getRequisitionSource() { 1108 return requisitionSource; 1109 } 1110 1111 public String getSupplierDiversityLabel() { 1112 return supplierDiversityLabel; 1113 } 1114 1115 @Override 1116 public PurchaseOrderCostSource getPurchaseOrderCostSource() { 1117 if (ObjectUtils.isNull(purchaseOrderCostSource)) { 1118 refreshReferenceObject(PurapPropertyConstants.PURCHASE_ORDER_COST_SOURCE); 1119 } 1120 return purchaseOrderCostSource; 1121 } 1122 1123 /** 1124 * @deprecated 1125 */ 1126 @Deprecated 1127 @Override 1128 public void setChartOfAccounts(Chart chartOfAccounts) { 1129 this.chartOfAccounts = chartOfAccounts; 1130 } 1131 1132 /** 1133 * @deprecated 1134 */ 1135 @Deprecated 1136 @Override 1137 public void setDeliveryCampus(CampusParameter deliveryCampus) { 1138 this.deliveryCampus = deliveryCampus; 1139 } 1140 1141 /** 1142 * @deprecated 1143 */ 1144 @Deprecated 1145 @Override 1146 public void setDeliveryRequiredDateReason(DeliveryRequiredDateReason deliveryRequiredDateReason) { 1147 this.deliveryRequiredDateReason = deliveryRequiredDateReason; 1148 } 1149 1150 /** 1151 * @deprecated 1152 */ 1153 @Deprecated 1154 @Override 1155 public void setFundingSource(FundingSource fundingSource) { 1156 this.fundingSource = fundingSource; 1157 } 1158 1159 /** 1160 * @deprecated 1161 */ 1162 @Deprecated 1163 @Override 1164 public void setNonInstitutionFundAccount(Account nonInstitutionFundAccount) { 1165 this.nonInstitutionFundAccount = nonInstitutionFundAccount; 1166 } 1167 1168 /** 1169 * @deprecated 1170 */ 1171 @Deprecated 1172 @Override 1173 public void setNonInstitutionFundChartOfAccounts(Chart nonInstitutionFundChartOfAccounts) { 1174 this.nonInstitutionFundChartOfAccounts = nonInstitutionFundChartOfAccounts; 1175 } 1176 1177 /** 1178 * @deprecated 1179 */ 1180 @Deprecated 1181 @Override 1182 public void setNonInstitutionFundOrganization(Organization nonInstitutionFundOrganization) { 1183 this.nonInstitutionFundOrganization = nonInstitutionFundOrganization; 1184 } 1185 1186 /** 1187 * @deprecated 1188 */ 1189 @Deprecated 1190 @Override 1191 public void setNonInstitutionFundOrgChartOfAccounts(Chart nonInstitutionFundOrgChartOfAccounts) { 1192 this.nonInstitutionFundOrgChartOfAccounts = nonInstitutionFundOrgChartOfAccounts; 1193 } 1194 1195 /** 1196 * @deprecated 1197 */ 1198 @Deprecated 1199 @Override 1200 public void setOrganization(Organization organization) { 1201 this.organization = organization; 1202 } 1203 1204 /** 1205 * @deprecated 1206 */ 1207 @Deprecated 1208 @Override 1209 public void setPurchaseOrderCostSource(PurchaseOrderCostSource purchaseOrderCostSource) { 1210 this.purchaseOrderCostSource = purchaseOrderCostSource; 1211 } 1212 1213 /** 1214 * @deprecated 1215 */ 1216 @Deprecated 1217 @Override 1218 public void setPurchaseOrderTransmissionMethod(PurchaseOrderTransmissionMethod purchaseOrderTransmissionMethod) { 1219 this.purchaseOrderTransmissionMethod = purchaseOrderTransmissionMethod; 1220 } 1221 1222 /** 1223 * @deprecated 1224 */ 1225 @Deprecated 1226 @Override 1227 public void setRecurringPaymentType(RecurringPaymentType recurringPaymentType) { 1228 this.recurringPaymentType = recurringPaymentType; 1229 } 1230 1231 /** 1232 * @deprecated 1233 */ 1234 @Deprecated 1235 @Override 1236 public void setRequisitionSource(RequisitionSource requisitionSource) { 1237 this.requisitionSource = requisitionSource; 1238 } 1239 1240 /** 1241 * Gets the receivingDocumentRequiredIndicator attribute. 1242 * 1243 * @return Returns the receivingDocumentRequiredIndicator. 1244 */ 1245 @Override 1246 public boolean isReceivingDocumentRequiredIndicator() { 1247 return receivingDocumentRequiredIndicator; 1248 } 1249 1250 /** 1251 * Sets the receivingDocumentRequiredIndicator attribute value. 1252 * 1253 * @param receivingDocumentRequiredIndicator 1254 * The receivingDocumentRequiredIndicator to set. 1255 */ 1256 @Override 1257 public void setReceivingDocumentRequiredIndicator(boolean receivingDocumentRequiredIndicator) { 1258 // if receivingDocumentRequiredIndicator functionality is disabled, always set it to false, overriding the passed-in value 1259 if (!isEnableReceivingDocumentRequiredIndicator()) { 1260 receivingDocumentRequiredIndicator = false; 1261 } else { 1262 this.receivingDocumentRequiredIndicator = receivingDocumentRequiredIndicator; 1263 } 1264 } 1265 1266 @Override 1267 public boolean isPaymentRequestPositiveApprovalIndicator() { 1268 return paymentRequestPositiveApprovalIndicator; 1269 } 1270 1271 @Override 1272 public void setPaymentRequestPositiveApprovalIndicator(boolean paymentRequestPositiveApprovalIndicator) { 1273 // if paymentRequestPositiveApprovalIndicator functionality is disabled, always set it to false, overriding the passed-in value 1274 if (!isEnablePaymentRequestPositiveApprovalIndicator()) { 1275 paymentRequestPositiveApprovalIndicator = false; 1276 } else { 1277 this.paymentRequestPositiveApprovalIndicator = paymentRequestPositiveApprovalIndicator; 1278 } 1279 } 1280 1281 public List<CommodityCode> getCommodityCodesForRouting() { 1282 return commodityCodesForRouting; 1283 } 1284 1285 public void setCommodityCodesForRouting(List<CommodityCode> commodityCodesForRouting) { 1286 this.commodityCodesForRouting = commodityCodesForRouting; 1287 } 1288 1289 @Override 1290 public String getCapitalAssetSystemTypeCode() { 1291 return capitalAssetSystemTypeCode; 1292 } 1293 1294 @Override 1295 public void setCapitalAssetSystemTypeCode(String capitalAssetSystemTypeCode) { 1296 this.capitalAssetSystemTypeCode = capitalAssetSystemTypeCode; 1297 } 1298 1299 @Override 1300 public String getCapitalAssetSystemStateCode() { 1301 return capitalAssetSystemStateCode; 1302 } 1303 1304 @Override 1305 public void setCapitalAssetSystemStateCode(String capitalAssetSystemStateCode) { 1306 this.capitalAssetSystemStateCode = capitalAssetSystemStateCode; 1307 } 1308 1309 /** 1310 * Gets the justification attribute. 1311 * 1312 * @return Returns the justification. 1313 */ 1314 public String getJustification() { 1315 return justification; 1316 } 1317 1318 /** 1319 * Sets the justification attribute value. 1320 * 1321 * @param justification The justification to set. 1322 */ 1323 public void setJustification(String justification) { 1324 this.justification = justification; 1325 } 1326 1327 @Override 1328 public CapitalAssetSystemType getCapitalAssetSystemType() { 1329 if (ObjectUtils.isNull(capitalAssetSystemType)) { 1330 this.refreshReferenceObject("capitalAssetSystemType"); 1331 } 1332 return capitalAssetSystemType; 1333 } 1334 1335 @Override 1336 public void setCapitalAssetSystemType(CapitalAssetSystemType capitalAssetSystemType) { 1337 this.capitalAssetSystemType = capitalAssetSystemType; 1338 } 1339 1340 @Override 1341 public CapitalAssetSystemState getCapitalAssetSystemState() { 1342 if (ObjectUtils.isNull(capitalAssetSystemState)) { 1343 this.refreshReferenceObject("capitalAssetSystemState"); 1344 } 1345 return capitalAssetSystemState; 1346 } 1347 1348 @Override 1349 public void setCapitalAssetSystemState(CapitalAssetSystemState capitalAssetSystemState) { 1350 this.capitalAssetSystemState = capitalAssetSystemState; 1351 } 1352 1353 @Override 1354 public List<CapitalAssetSystem> getPurchasingCapitalAssetSystems() { 1355 return purchasingCapitalAssetSystems; 1356 } 1357 1358 @Override 1359 public void setPurchasingCapitalAssetSystems(List<CapitalAssetSystem> purchasingCapitalAssetSystems) { 1360 this.purchasingCapitalAssetSystems = purchasingCapitalAssetSystems; 1361 } 1362 1363 @Override 1364 public List<PurchasingCapitalAssetItem> getPurchasingCapitalAssetItems() { 1365 return purchasingCapitalAssetItems; 1366 } 1367 1368 @Override 1369 public void setPurchasingCapitalAssetItems(List<PurchasingCapitalAssetItem> purchasingCapitalAssetItems) { 1370 this.purchasingCapitalAssetItems = purchasingCapitalAssetItems; 1371 } 1372 1373 @Override 1374 public abstract Class getPurchasingCapitalAssetItemClass(); 1375 1376 @Override 1377 public abstract Class getPurchasingCapitalAssetSystemClass(); 1378 1379 @Override 1380 public PurchasingItem getPurchasingItem(Integer itemIdentifier) { 1381 1382 if (ObjectUtils.isNull(itemIdentifier)) { 1383 return null; 1384 } 1385 1386 PurchasingItem item = null; 1387 1388 for (PurchasingItem pi : (List<PurchasingItem>) this.getItems()) { 1389 if (itemIdentifier.equals(pi.getItemIdentifier())) { 1390 item = pi; 1391 break; 1392 } 1393 } 1394 1395 return item; 1396 } 1397 1398 @Override 1399 public PurchasingCapitalAssetItem getPurchasingCapitalAssetItem(Integer itemIdentifier) { 1400 1401 if (ObjectUtils.isNull(itemIdentifier)) { 1402 return null; 1403 } 1404 1405 PurchasingCapitalAssetItem item = null; 1406 1407 for (PurchasingCapitalAssetItem pcai : this.getPurchasingCapitalAssetItems()) { 1408 if (itemIdentifier.equals(pcai.getItemIdentifier())) { 1409 item = pcai; 1410 break; 1411 } 1412 } 1413 1414 return item; 1415 } 1416 1417 /** 1418 * @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#buildListOfDeletionAwareLists() 1419 */ 1420 @Override 1421 public List buildListOfDeletionAwareLists() { 1422 List managedLists = super.buildListOfDeletionAwareLists(); 1423 if (allowDeleteAwareCollection) { 1424 List<ItemCapitalAsset> assetLists = new ArrayList<ItemCapitalAsset>(); 1425 List<CapitalAssetLocation> capitalAssetLocationLists = new ArrayList<CapitalAssetLocation>(); 1426 if (StringUtils.equals(this.getCapitalAssetSystemTypeCode(), PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) { 1427 for (PurchasingCapitalAssetItem capitalAssetItem : this.getPurchasingCapitalAssetItems()) { 1428 //We only need to add the itemCapitalAssets to assetLists if the system is not null, otherwise 1429 //just let the assetLists be empty ArrayList. 1430 if (capitalAssetItem.getPurchasingCapitalAssetSystem() != null) { 1431 assetLists.addAll(capitalAssetItem.getPurchasingCapitalAssetSystem().getItemCapitalAssets()); 1432 capitalAssetLocationLists.addAll(capitalAssetItem.getPurchasingCapitalAssetSystem().getCapitalAssetLocations()); 1433 } 1434 } 1435 } else { 1436 for (CapitalAssetSystem system : this.getPurchasingCapitalAssetSystems()) { 1437 assetLists.addAll(system.getItemCapitalAssets()); 1438 capitalAssetLocationLists.addAll(system.getCapitalAssetLocations()); 1439 } 1440 } 1441 managedLists.add(assetLists); 1442 managedLists.add(capitalAssetLocationLists); 1443 managedLists.add(this.getPurchasingCapitalAssetSystems()); 1444 //managedLists.add(this.getPurchasingCapitalAssetItems()); 1445 } 1446 return managedLists; 1447 } 1448 1449 /** 1450 * Overrides the method in PurchasingAccountsPayableDocumentBase to remove the 1451 * purchasingCapitalAssetSystem when the system type is either ONE or MULT. 1452 * 1453 * @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#prepareForSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent) 1454 */ 1455 @Override 1456 public void prepareForSave(KualiDocumentEvent event) { 1457 super.prepareForSave(event); 1458 if (StringUtils.isNotBlank(this.getCapitalAssetSystemTypeCode())) { 1459 if (this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM) || this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.MULTIPLE)) { 1460 //If the system state is ONE or MULT, we have to remove all the systems on the items because it's not applicable. 1461 for (PurchasingCapitalAssetItem camsItem : this.getPurchasingCapitalAssetItems()) { 1462 camsItem.setPurchasingCapitalAssetSystem(null); 1463 } 1464 } 1465 } 1466 if (event instanceof RouteDocumentEvent || event instanceof ApproveDocumentEvent) { 1467 1468 boolean defaultUseTaxIndicatorValue = SpringContext.getBean(PurchasingService.class).getDefaultUseTaxIndicatorValue(this); 1469 SpringContext.getBean(PurapService.class).updateUseTaxIndicator(this, defaultUseTaxIndicatorValue); 1470 } 1471 } 1472 1473 @Override 1474 public Date getTransactionTaxDate() { 1475 return SpringContext.getBean(DateTimeService.class).getCurrentSqlDate(); 1476 } 1477 1478 @Override 1479 public void clearCapitalAssetFields() { 1480 this.getPurchasingCapitalAssetItems().clear(); 1481 this.getPurchasingCapitalAssetSystems().clear(); 1482 this.setCapitalAssetSystemStateCode(null); 1483 this.setCapitalAssetSystemTypeCode(null); 1484 this.setCapitalAssetSystemState(null); 1485 this.setCapitalAssetSystemType(null); 1486 1487 } 1488 1489 /** 1490 * @return the payment request positive approval indicator 1491 */ 1492 public boolean getPaymentRequestPositiveApprovalIndicatorForSearching() { 1493 return paymentRequestPositiveApprovalIndicator; 1494 } 1495 1496 /** 1497 * @return the receiving document required indicator 1498 */ 1499 public boolean getReceivingDocumentRequiredIndicatorForSearching() { 1500 return receivingDocumentRequiredIndicator; 1501 } 1502 1503 public String getDocumentChartOfAccountsCodeForSearching() { 1504 return chartOfAccountsCode; 1505 } 1506 1507 public String getDocumentOrganizationCodeForSearching() { 1508 return organizationCode; 1509 } 1510 1511 @Override 1512 public boolean shouldGiveErrorForEmptyAccountsProration() { 1513 return true; 1514 } 1515 1516 public String getChartAndOrgCodeForResult() { 1517 return getChartOfAccountsCode() + "-" + getOrganizationCode(); 1518 } 1519 1520 public String getDeliveryCampusCodeForSearch() { 1521 return getDeliveryCampusCode(); 1522 } 1523 1524 public boolean getHasB2BVendor() { 1525 if (getVendorHeaderGeneratedIdentifier() != null) { 1526 refreshReferenceObject(VendorPropertyConstants.VENDOR_DETAIL); 1527 String campusCode = GlobalVariables.getUserSession().getPerson().getCampusCode(); 1528 VendorDetail vendorDetail = getVendorDetail(); 1529 if (vendorDetail == null || StringUtils.isEmpty(campusCode)) { 1530 return false; // this should never happen 1531 } 1532 return SpringContext.getBean(VendorService.class).getVendorB2BContract(vendorDetail, campusCode) != null; 1533 } 1534 return false; 1535 } 1536}