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