1 package com.dotmarketing.portlets.order_manager.struts; 2 3 import java.util.ArrayList ; 4 import java.util.Calendar ; 5 import java.util.Date ; 6 import java.util.List ; 7 8 import javax.servlet.http.HttpServletRequest ; 9 10 import org.apache.commons.validator.CreditCardValidator; 11 import org.apache.struts.Globals; 12 import org.apache.struts.action.ActionErrors; 13 import org.apache.struts.action.ActionMapping; 14 import org.apache.struts.action.ActionMessage; 15 import org.apache.struts.validator.ValidatorForm; 16 17 import com.dotmarketing.util.Config; 18 import com.dotmarketing.util.UtilMethods; 19 import com.liferay.portal.util.Constants; 20 21 22 public class OrderForm extends ValidatorForm { 23 24 private static final long serialVersionUID = 1L; 25 private long inode; private long userInode; private String userId; 28 private int orderStatus; private int paymentStatus; private java.util.Date datePosted; private java.util.Date lastModDate; private String billingAddressType; private String billingAddress1; private String billingAddress2; private String billingCity; private String billingState; private String billingStateOtherCountryText; 38 private String billingZip; private String billingCountry; private String billingPhone; private String billingFax; private String billingContactName; private String billingContactPhone; private String billingContactEmail; private String shippingAddressType; private String shippingAddress1; private String shippingAddress2; private String shippingLabel; private String shippingCity; private String shippingState; private String shippingStateOtherCountryText; 52 private String shippingZip; private String shippingCountry; private String shippingPhone; private String shippingFax; private String paymentType; private String nameOnCard; private String cardType; private String cardNumber; private int cardExpMonth; private int cardExpYear; private String cardVerificationValue; private float orderSubTotal; private float orderDiscount; private float orderSubTotalDiscount; private float orderShipping; private int orderShipType; private float orderTax; private String taxExemptNumber; private String discountCodes; private float orderTotal; private float orderTotalPaid; private float orderTotalDue; private String invoiceNumber; private java.util.Date invoiceDate; private String checkNumber; private String checkBankName; private String poNumber; private String trackingNumber; private boolean isShippingZero; 81 private String contactName; 82 private String contactEmail; 83 private String contactSystem; 84 private String contactFacility; 85 private boolean modified_QB; private boolean modified_FH; private String backendUser; private String backendUserName; 89 private String homeAddress1; 91 private String homeAddress2; 92 private String homeLabel; 93 private String homeCity; 94 private String homeState; 95 private String homeStateOtherCountryText; 96 private String homeZip; 97 private String homeCountry; 98 private String homePhone; 99 private String homeFax; 100 private String homeContactName; 101 private String homeContactPhone; 102 private String homeContactEmail; 103 104 private String workAddress1; 105 private String workAddress2; 106 private String workLabel; 107 private String workCity; 108 private String workState; 109 private String workStateOtherCountryText; 110 private String workZip; 111 private String workCountry; 112 private String workPhone; 113 private String workFax; 114 private String workContactName; 115 private String workContactPhone; 116 private String workContactEmail; 117 118 private List <OrderItemForm> orderItemList = new ArrayList <OrderItemForm> (); 119 120 public boolean isCreditCardPayment() { 121 String creditCarType = Config.getStringProperty("ECOM_CREDIT_CARD"); 122 return creditCarType.equals(paymentType.trim()); 123 } 124 125 126 127 public OrderForm() { 128 paymentType = ""; 129 cardExpMonth = -1; 130 cardExpYear = -1; 131 this.modified_QB = true; 132 this.modified_FH = true; 133 } 134 135 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 136 if(request.getParameter("cmd")!=null && request.getParameter("cmd").equals(Constants.ADD)) { 137 return super.validate(mapping, request); 138 } 139 return null; 140 } 141 142 143 public long getInode() { 144 return this.inode; 145 } 146 147 public void setInode(long inode) { 148 this.inode = inode; 149 } 150 public long getUserInode() { 151 return this.userInode; 152 } 153 154 public void setUserInode(long userInode) { 155 this.userInode = userInode; 156 } 157 public int getOrderStatus() { 158 return this.orderStatus; 159 } 160 161 public void setOrderStatus(int orderStatus) { 162 this.orderStatus = orderStatus; 163 } 164 public int getPaymentStatus() { 165 return this.paymentStatus; 166 } 167 168 public void setPaymentStatus(int paymentStatus) { 169 this.paymentStatus = paymentStatus; 170 } 171 public java.util.Date getDatePosted() { 172 return this.datePosted; 173 } 174 175 public void setDatePosted(java.util.Date datePosted) { 176 this.datePosted = datePosted; 177 } 178 public java.util.Date getLastModDate() { 179 return this.lastModDate; 180 } 181 182 public void setLastModDate(java.util.Date lastModDate) { 183 this.lastModDate = lastModDate; 184 } 185 public String getBillingAddress1() { 186 return this.billingAddress1; 187 } 188 189 public void setBillingAddress1(String billingAddress1) { 190 this.billingAddress1 = billingAddress1; 191 } 192 public String getBillingAddress2() { 193 return this.billingAddress2; 194 } 195 196 public void setBillingAddress2(String billingAddress2) { 197 this.billingAddress2 = billingAddress2; 198 } 199 public String getBillingCity() { 200 return this.billingCity; 201 } 202 203 public void setBillingCity(String billingCity) { 204 this.billingCity = billingCity; 205 } 206 public String getBillingState() { 207 if (billingState != null) 208 return this.billingState.trim(); 209 else 210 return null; 211 } 212 213 public void setBillingState(String billingState) { 214 this.billingState = billingState; 215 } 216 public String getBillingZip() { 217 return this.billingZip; 218 } 219 220 public void setBillingZip(String billingZip) { 221 this.billingZip = billingZip; 222 } 223 public String getBillingCountry() { 224 return this.billingCountry; 225 } 226 227 public void setBillingCountry(String billingCountry) { 228 this.billingCountry = billingCountry; 229 } 230 public String getBillingPhone() { 231 return this.billingPhone; 232 } 233 234 public void setBillingPhone(String billingPhone) { 235 this.billingPhone = billingPhone; 236 } 237 public String getBillingFax() { 238 return this.billingFax; 239 } 240 241 public void setBillingFax(String billingFax) { 242 this.billingFax = billingFax; 243 } 244 public String getBillingContactName() { 245 return this.billingContactName; 246 } 247 248 public void setBillingContactName(String billingContactName) { 249 this.billingContactName = billingContactName; 250 } 251 public String getBillingContactPhone() { 252 return this.billingContactPhone; 253 } 254 255 public void setBillingContactPhone(String billingContactPhone) { 256 this.billingContactPhone = billingContactPhone; 257 } 258 public String getBillingContactEmail() { 259 return this.billingContactEmail; 260 } 261 262 public void setBillingContactEmail(String billingContactEmail) { 263 this.billingContactEmail = billingContactEmail; 264 } 265 public String getShippingAddress1() { 266 return this.shippingAddress1; 267 } 268 269 public void setShippingAddress1(String shippingAddress1) { 270 this.shippingAddress1 = shippingAddress1; 271 } 272 public String getShippingAddress2() { 273 return this.shippingAddress2; 274 } 275 276 public void setShippingAddress2(String shippingAddress2) { 277 this.shippingAddress2 = shippingAddress2; 278 } 279 public String getShippingCity() { 280 return this.shippingCity; 281 } 282 283 public void setShippingCity(String shippingCity) { 284 this.shippingCity = shippingCity; 285 } 286 public String getShippingState() { 287 if (this.shippingState != null) 288 return this.shippingState.trim(); 289 else 290 return ""; 291 } 292 293 public void setShippingState(String shippingState) { 294 this.shippingState = shippingState; 295 } 296 public String getShippingZip() { 297 return this.shippingZip; 298 } 299 300 public void setShippingZip(String shippingZip) { 301 this.shippingZip = shippingZip; 302 } 303 public String getShippingCountry() { 304 return this.shippingCountry; 305 } 306 307 public void setShippingCountry(String shippingCountry) { 308 this.shippingCountry = shippingCountry; 309 } 310 public String getShippingPhone() { 311 return this.shippingPhone; 312 } 313 314 public void setShippingPhone(String shippingPhone) { 315 this.shippingPhone = shippingPhone; 316 } 317 public String getShippingFax() { 318 return this.shippingFax; 319 } 320 321 public void setShippingFax(String shippingFax) { 322 this.shippingFax = shippingFax; 323 } 324 public String getPaymentType() { 325 return this.paymentType; 326 } 327 328 public void setPaymentType(String paymentType) { 329 this.paymentType = paymentType.trim(); 330 } 331 public String getNameOnCard() { 332 return this.nameOnCard; 333 } 334 335 public void setNameOnCard(String nameOnCard) { 336 this.nameOnCard = nameOnCard; 337 } 338 public String getCardType() { 339 return this.cardType; 340 } 341 342 public void setCardType(String cardType) { 343 this.cardType = cardType; 344 } 345 public String getCardNumber() { 346 return this.cardNumber; 347 } 348 349 public void setCardNumber(String cardNumber) { 350 this.cardNumber = cardNumber; 351 } 352 public int getCardExpMonth() { 353 return this.cardExpMonth; 354 } 355 356 public void setCardExpMonth(int cardExpMonth) { 357 this.cardExpMonth = cardExpMonth; 358 } 359 public int getCardExpYear() { 360 return this.cardExpYear; 361 } 362 363 public void setCardExpYear(int cardExpYear) { 364 this.cardExpYear = cardExpYear; 365 } 366 public String getCardVerificationValue() { 367 return this.cardVerificationValue; 368 } 369 370 public void setCardVerificationValue(String cardVerificationValue) { 371 this.cardVerificationValue = cardVerificationValue; 372 } 373 public float getOrderSubTotal() { 374 return this.orderSubTotal; 375 } 376 377 public void setOrderSubTotal(float orderSubTotal) { 378 this.orderSubTotal = orderSubTotal; 379 } 380 public float getOrderShipping() { 381 return this.orderShipping; 382 } 383 384 public void setOrderShipping(float orderShipping) { 385 this.orderShipping = orderShipping; 386 } 387 public int getOrderShipType() { 388 return this.orderShipType; 389 } 390 391 public void setOrderShipType(int orderShipType) { 392 this.orderShipType = orderShipType; 393 } 394 public float getOrderTax() { 395 return this.orderTax; 396 } 397 398 public void setOrderTax(float orderTax) { 399 this.orderTax = orderTax; 400 } 401 public String getDiscountCodes() { 402 return this.discountCodes; 403 } 404 405 public void setDiscountCodes(String discountCodes) { 406 this.discountCodes = discountCodes; 407 } 408 public float getOrderTotal() { 409 return this.orderTotal; 410 } 411 412 public void setOrderTotal(float orderTotal) { 413 this.orderTotal = orderTotal; 414 } 415 public float getOrderTotalPaid() { 416 return this.orderTotalPaid; 417 } 418 419 public void setOrderTotalPaid(float orderTotalPaid) { 420 this.orderTotalPaid = orderTotalPaid; 421 } 422 public float getOrderTotalDue() { 423 return this.orderTotalDue; 424 } 425 426 public void setOrderTotalDue(float orderTotalDue) { 427 this.orderTotalDue = orderTotalDue; 428 } 429 public String getInvoiceNumber() { 430 return this.invoiceNumber; 431 } 432 433 public void setInvoiceNumber(String invoiceNumber) { 434 this.invoiceNumber = invoiceNumber; 435 } 436 public java.util.Date getInvoiceDate() { 437 return this.invoiceDate; 438 } 439 440 public void setInvoiceDate(java.util.Date invoiceDate) { 441 this.invoiceDate = invoiceDate; 442 } 443 public String getCheckNumber() { 444 return this.checkNumber; 445 } 446 447 public void setCheckNumber(String checkNumber) { 448 this.checkNumber = checkNumber; 449 } 450 public String getCheckBankName() { 451 return this.checkBankName; 452 } 453 454 public void setCheckBankName(String checkBankName) { 455 this.checkBankName = checkBankName; 456 } 457 public String getPoNumber() { 458 return this.poNumber; 459 } 460 461 public void setPoNumber(String poNumber) { 462 this.poNumber = poNumber; 463 } 464 465 public ActionErrors validate() 466 { 467 ActionErrors ae = new ActionErrors(); 468 if(!UtilMethods.isSet(billingAddressType)) 470 { 471 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Address")); 472 } 473 if(!UtilMethods.isSet(billingAddress1)) 474 { 475 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Address Street 1")); 476 } 477 if(!UtilMethods.isSet(billingCity)) 478 { 479 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing City")); 480 } 481 if(!UtilMethods.isSet(billingCountry)) 482 { 483 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Country")); 484 } 485 if(!UtilMethods.isSet(billingState)) 486 { 487 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing State")); 488 } 489 else 490 { 491 if(UtilMethods.isSet(billingCountry)){ 492 if ((billingCountry.equals(Config.getStringProperty("DEFAULT_COUNTRY_CODE")))&& (billingState.equals("otherCountry"))) 493 ae.add(Globals.ERROR_KEY,new ActionMessage("error.invalid.state.US")); 494 else{ 495 if (!(billingState.equals("otherCountry"))) 496 if (billingState.length() != 2) 497 { 498 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.length","Billing State","2")); 499 } 500 } 501 } 502 } 503 504 if(!UtilMethods.isSet(billingZip)) 505 { 506 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Zip")); 507 } 508 if(!UtilMethods.isSet(shippingAddress1)) 510 { 511 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shippig Address Street 1")); 512 } 513 if(!UtilMethods.isSet(shippingCity)) 514 { 515 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping City")); 516 } 517 if(!UtilMethods.isSet(shippingState)) 518 { 519 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping State")); 520 } 521 else 522 { 523 if(UtilMethods.isSet(shippingCountry)){ 524 if ((shippingCountry.equals(Config.getStringProperty("DEFAULT_COUNTRY_CODE")))&& (shippingState.equals("otherCountry"))) 525 ae.add(Globals.ERROR_KEY,new ActionMessage("error.invalid.state.US")); 526 else{ 527 if (!(shippingState.equals("otherCountry"))) 528 if (shippingState.length() != 2) 529 { 530 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.length","Shipping State","2")); 531 } 532 } 533 } 534 } 535 536 if(!UtilMethods.isSet(shippingZip)) 537 { 538 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping Zip")); 539 } 540 if(!UtilMethods.isSet(shippingPhone)) 541 { 542 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping Phone")); 543 } 544 if(!UtilMethods.isSet(shippingAddressType)) 545 { 546 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping Address")); 547 } 548 if (paymentType.equals("cc")) 550 { 551 if(!UtilMethods.isSet(nameOnCard)) 552 { 553 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Name On Card")); 554 } 555 if(!UtilMethods.isSet(cardNumber)) 556 { 557 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Card Number")); 558 } 559 else 560 { 561 CreditCardValidator cardValidator = new CreditCardValidator (); 562 if (cardType.equals("vs")) { 563 cardValidator = new CreditCardValidator (CreditCardValidator.VISA); 564 } else if (cardType.equals("mc")) { 565 cardValidator = new CreditCardValidator (CreditCardValidator.MASTERCARD); 566 } else if (cardType.equals("dc")) { 567 cardValidator = new CreditCardValidator (CreditCardValidator.DISCOVER); 568 } else if (cardType.equals("ae")) { 569 cardValidator = new CreditCardValidator (CreditCardValidator.AMEX); 570 } 571 if (!cardNumber.equals("5111111111111111") && !cardNumber.equals("4111111111111111") && !cardValidator.isValid(cardNumber)) 572 { 573 ae.add(Globals.ERROR_KEY, new ActionMessage("error.invalid.credit.card.number")); 574 } 575 } 576 591 Date now = new Date (); 592 Calendar calendar = Calendar.getInstance(); 593 calendar.setTime(now); 594 if ((cardExpYear < calendar.get(Calendar.YEAR)) || 595 ((cardExpYear == calendar.get(Calendar.YEAR)) && (cardExpMonth < calendar.get(Calendar.MONTH)))) 596 { 597 ae.add(Globals.ERROR_KEY, new ActionMessage("error.invalid.credit.card.expiration")); 598 } 599 } 600 else if (paymentType.equals("ch")) 601 { 602 610 } 611 else if (paymentType.equals("po")) 612 { 613 617 } 618 if(UtilMethods.isSet(billingAddressType) && billingAddressType.equals("Work")) 620 { 621 if(!UtilMethods.isSet(billingContactName)) 622 { 623 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Contact Person Name")); 624 } 625 if(!UtilMethods.isSet(billingContactPhone)) 626 { 627 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Phone")); 628 } 629 if(!UtilMethods.isSet(billingContactEmail)) 630 { 631 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Email")); 632 } 633 } 634 return ae; 635 } 636 637 public String getBillingAddressType() { 638 return billingAddressType; 639 } 640 641 public void setBillingAddressType(String billingAddressType) { 642 this.billingAddressType = billingAddressType; 643 } 644 645 public String getShippingAddressType() { 646 return shippingAddressType; 647 } 648 649 public void setShippingAddressType(String shippingAddressType) { 650 this.shippingAddressType = shippingAddressType; 651 } 652 653 public float getOrderDiscount() { 654 return orderDiscount; 655 } 656 657 public void setOrderDiscount(float orderDiscount) { 658 this.orderDiscount = orderDiscount; 659 } 660 661 public float getOrderSubTotalDiscount() { 662 return orderSubTotalDiscount; 663 } 664 665 public void setOrderSubTotalDiscount(float orderSubTotalDiscount) { 666 this.orderSubTotalDiscount = orderSubTotalDiscount; 667 } 668 669 public List <OrderItemForm> getOrderItemList() { 670 return orderItemList; 671 } 672 673 public void setOrderItemList(List <OrderItemForm> orderItemList) { 674 this.orderItemList = orderItemList; 675 } 676 677 public String getTrackingNumber() { 678 return trackingNumber; 679 } 680 681 public void setTrackingNumber(String trackingNumber) { 682 this.trackingNumber = trackingNumber; 683 } 684 685 public String getTaxExemptNumber() { 686 return taxExemptNumber; 687 } 688 689 public void setTaxExemptNumber(String taxExemptNumber) { 690 this.taxExemptNumber = taxExemptNumber; 691 } 692 693 public ActionErrors validateBackEnd() 694 { 695 ActionErrors ae = new ActionErrors(); 696 if(!UtilMethods.isSet(billingAddress1)) 698 { 699 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Address Street 1")); 700 } 701 if(!UtilMethods.isSet(billingCity)) 702 { 703 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing City")); 704 } 705 if(!UtilMethods.isSet(billingState)) 706 { 707 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing State")); 708 } 709 else 710 { 711 if(UtilMethods.isSet(billingCountry)){ 712 if ((billingCountry.equals(Config.getStringProperty("DEFAULT_COUNTRY_CODE")))&& (billingState.equals("otherCountry"))) 713 ae.add(Globals.ERROR_KEY,new ActionMessage("error.invalid.state.US")); 714 else{ 715 if (!(billingState.equals("otherCountry"))) 716 if (billingState.length() != 2) 717 { 718 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.length","Billing State","2")); 719 } 720 } 721 } 722 } 723 724 if(!UtilMethods.isSet(billingZip)) 725 { 726 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Zip")); 727 } 728 729 if(!UtilMethods.isSet(billingPhone)) 730 { 731 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Phone")); 732 } 733 if(!UtilMethods.isSet(shippingAddress1)) 735 { 736 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shippig Address Street 1")); 737 } 738 if(!UtilMethods.isSet(shippingCity)) 739 { 740 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping City")); 741 } 742 if(!UtilMethods.isSet(shippingState)) 743 { 744 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping State")); 745 } 746 else 747 { 748 if(UtilMethods.isSet(shippingCountry)){ 749 if ((shippingCountry.equals(Config.getStringProperty("DEFAULT_COUNTRY_CODE")))&& (shippingState.equals("otherCountry"))) 750 ae.add(Globals.ERROR_KEY,new ActionMessage("error.invalid.state.US")); 751 else{ 752 if (!(shippingState.equals("otherCountry"))) 753 if (shippingState.length() != 2) 754 { 755 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.length","Shipping State","2")); 756 } 757 } 758 } 759 } 760 761 if(!UtilMethods.isSet(shippingZip)) 762 { 763 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping Zip")); 764 } 765 if(!UtilMethods.isSet(shippingPhone)) 766 { 767 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping Phone")); 768 } 769 if (paymentType.equals("cc")) 771 { 772 if(!UtilMethods.isSet(nameOnCard)) 773 { 774 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Name On Card")); 775 } 776 if(!UtilMethods.isSet(cardNumber)) 777 { 778 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Card Number")); 779 } 780 else 781 { 782 CreditCardValidator cardValidator = new CreditCardValidator (); 783 if (cardType.equals("vs")) { 784 cardValidator = new CreditCardValidator (CreditCardValidator.VISA); 785 } else if (cardType.equals("mc")) { 786 cardValidator = new CreditCardValidator (CreditCardValidator.MASTERCARD); 787 } else if (cardType.equals("dc")) { 788 cardValidator = new CreditCardValidator (CreditCardValidator.DISCOVER); 789 } else if (cardType.equals("ae")) { 790 cardValidator = new CreditCardValidator (CreditCardValidator.AMEX); 791 } 792 if (!cardNumber.equals("5111111111111111") && !cardNumber.equals("4111111111111111") && !cardValidator.isValid(cardNumber)) 793 { 794 ae.add(Globals.ERROR_KEY, new ActionMessage("error.invalid.credit.card.number")); 795 } 796 } 797 812 Date now = new Date (); 813 Calendar calendar = Calendar.getInstance(); 814 calendar.setTime(now); 815 if ((cardExpYear < calendar.get(Calendar.YEAR)) || 816 ((cardExpYear == calendar.get(Calendar.YEAR)) && (cardExpMonth < calendar.get(Calendar.MONTH)))) 817 { 818 ae.add(Globals.ERROR_KEY, new ActionMessage("error.invalid.credit.card.expiration")); 819 } 820 } 821 else if (paymentType.equals("ch")) 822 { 823 831 } 832 else if (paymentType.equals("po")) 833 { 834 838 } 839 return ae; 840 } 841 842 public ActionErrors validateBackEndEdit() 843 { 844 ActionErrors ae = new ActionErrors(); 845 if(!UtilMethods.isSet(billingAddress1)) 847 { 848 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Address Street 1")); 849 } 850 if(!UtilMethods.isSet(billingCity)) 851 { 852 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing City")); 853 } 854 if(!UtilMethods.isSet(billingState)) 855 { 856 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing State")); 857 } 858 else 859 { 860 if(UtilMethods.isSet(billingCountry)){ 861 if ((billingCountry.equals(Config.getStringProperty("DEFAULT_COUNTRY_CODE")))&& (billingState.equals("otherCountry"))) 862 ae.add(Globals.ERROR_KEY,new ActionMessage("error.invalid.state.US")); 863 else{ 864 if (!(billingState.equals("otherCountry"))) 865 if (billingState.length() != 2) 866 { 867 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.length","Billing State","2")); 868 } 869 } 870 } 871 } 872 873 if(!UtilMethods.isSet(billingZip)) 874 { 875 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Billing Zip")); 876 } 877 883 if(!UtilMethods.isSet(shippingAddress1)) 885 { 886 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shippig Address Street 1")); 887 } 888 if(!UtilMethods.isSet(shippingCity)) 889 { 890 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping City")); 891 } 892 if(!UtilMethods.isSet(shippingState)) 893 { 894 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping State")); 895 } 896 else 897 { 898 if(UtilMethods.isSet(shippingCountry)){ 899 if ((shippingCountry.equals(Config.getStringProperty("DEFAULT_COUNTRY_CODE")))&& (shippingState.equals("otherCountry"))) 900 ae.add(Globals.ERROR_KEY,new ActionMessage("error.invalid.state.US")); 901 else{ 902 if (!(shippingState.equals("otherCountry"))) 903 if (shippingState.length() != 2) 904 { 905 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.length","Shipping State","2")); 906 } 907 } 908 } 909 } 910 911 if(!UtilMethods.isSet(shippingZip)) 912 { 913 ae.add(Globals.ERROR_KEY,new ActionMessage("error.form.mandatory","Shipping Zip")); 914 } 915 921 if (paymentType.equals("cc")) 923 { 924 944 } 945 else if (paymentType.equals("ch")) 946 { 947 955 } 956 else if (paymentType.equals("po")) 957 { 958 962 } 963 return ae; 964 } 965 966 967 public boolean getIsShippingZero() { 968 return isShippingZero; 969 } 970 971 public void setIsShippingZero(boolean isShippingZero) { 972 this.isShippingZero = isShippingZero; 973 } 974 975 979 public void setContactName(String contactName) { 980 this.contactName = contactName; 981 } 982 983 984 987 public String getContactName() { 988 return contactName; 989 } 990 991 995 public void setContactEmail(String contactEmail) { 996 this.contactEmail = contactEmail; 997 } 998 999 1000 1003 public String getContactEmail() { 1004 return contactEmail; 1005 } 1006 1007 1011 public void setContactSystem(String contactSystem) { 1012 this.contactSystem = contactSystem; 1013 } 1014 1015 1016 1019 public String getContactSystem() { 1020 return contactSystem; 1021 } 1022 1023 1027 public void setContactFacility(String contactFacility) { 1028 this.contactFacility = contactFacility; 1029 } 1030 1031 1032 1035 public String getContactFacility() { 1036 return contactFacility; 1037 } 1038 1039 1042 public boolean isModified_FH() { 1043 return modified_FH; 1044 } 1045 1046 1050 public void setModified_FH(boolean modified_FH) { 1051 this.modified_FH = modified_FH; 1052 } 1053 1054 1057 public boolean isModified_QB() { 1058 return modified_QB; 1059 } 1060 1061 1065 public void setModified_QB(boolean modified_QB) { 1066 this.modified_QB = modified_QB; 1067 } 1068 1069 1070 1071 public String getBillingStateOtherCountryText() { 1072 return billingStateOtherCountryText; 1073 } 1074 1075 1076 1077 public void setBillingStateOtherCountryText(String billingStateText) { 1078 this.billingStateOtherCountryText = billingStateText; 1079 } 1080 1081 1082 1083 public String getShippingStateOtherCountryText() { 1084 return shippingStateOtherCountryText; 1085 } 1086 1087 1088 1089 public void setShippingStateOtherCountryText(String shippingStateText) { 1090 this.shippingStateOtherCountryText = shippingStateText; 1091 } 1092 1093 1094 1095 1098 public String getUserId() { 1099 return userId; 1100 } 1101 1102 1103 1104 1107 public void setUserId(String userId) { 1108 this.userId = userId; 1109 } 1110 1111 1112 1113 public String getBackendUser() { 1114 return backendUser; 1115 } 1116 1117 1118 1119 public void setBackendUser(String backendUser) { 1120 this.backendUser = backendUser; 1121 } 1122 1123 1124 1125 public String getBackendUserName() { 1126 return backendUserName; 1127 } 1128 1129 1130 1131 public void setBackendUserName(String backendUserName) { 1132 this.backendUserName = backendUserName; 1133 } 1134 1135 1136 1137 public String getShippingLabel() { 1138 return shippingLabel; 1139 } 1140 1141 1142 1143 public void setShippingLabel(String shippingLabel) { 1144 this.shippingLabel = shippingLabel; 1145 } 1146 1147 1148 1149 public String getHomeAddress1() { 1150 return homeAddress1; 1151 } 1152 1153 1154 1155 public void setHomeAddress1(String homeAddress1) { 1156 this.homeAddress1 = homeAddress1; 1157 } 1158 1159 1160 1161 public String getHomeAddress2() { 1162 return homeAddress2; 1163 } 1164 1165 1166 1167 public void setHomeAddress2(String homeAddress2) { 1168 this.homeAddress2 = homeAddress2; 1169 } 1170 1171 1172 1173 public String getHomeCity() { 1174 return homeCity; 1175 } 1176 1177 1178 1179 public void setHomeCity(String homeCity) { 1180 this.homeCity = homeCity; 1181 } 1182 1183 1184 1185 public String getHomeCountry() { 1186 return homeCountry; 1187 } 1188 1189 1190 1191 public void setHomeCountry(String homeCountry) { 1192 this.homeCountry = homeCountry; 1193 } 1194 1195 1196 1197 public String getHomeFax() { 1198 return homeFax; 1199 } 1200 1201 1202 1203 public void setHomeFax(String homeFax) { 1204 this.homeFax = homeFax; 1205 } 1206 1207 1208 1209 public String getHomeLabel() { 1210 return homeLabel; 1211 } 1212 1213 1214 1215 public void setHomeLabel(String homeLabel) { 1216 this.homeLabel = homeLabel; 1217 } 1218 1219 1220 1221 public String getHomePhone() { 1222 return homePhone; 1223 } 1224 1225 1226 1227 public void setHomePhone(String homePhone) { 1228 this.homePhone = homePhone; 1229 } 1230 1231 1232 1233 public String getHomeState() { 1234 return homeState; 1235 } 1236 1237 1238 1239 public void setHomeState(String homeState) { 1240 this.homeState = homeState; 1241 } 1242 1243 1244 1245 public String getHomeStateOtherCountryText() { 1246 return homeStateOtherCountryText; 1247 } 1248 1249 1250 1251 public void setHomeStateOtherCountryText(String homeStateOtherCountryText) { 1252 this.homeStateOtherCountryText = homeStateOtherCountryText; 1253 } 1254 1255 1256 1257 public String getHomeZip() { 1258 return homeZip; 1259 } 1260 1261 1262 1263 public void setHomeZip(String homeZip) { 1264 this.homeZip = homeZip; 1265 } 1266 1267 1268 1269 public String getWorkAddress1() { 1270 return workAddress1; 1271 } 1272 1273 1274 1275 public void setWorkAddress1(String workAddress1) { 1276 this.workAddress1 = workAddress1; 1277 } 1278 1279 1280 1281 public String getWorkAddress2() { 1282 return workAddress2; 1283 } 1284 1285 1286 1287 public void setWorkAddress2(String workAddress2) { 1288 this.workAddress2 = workAddress2; 1289 } 1290 1291 1292 1293 public String getWorkCity() { 1294 return workCity; 1295 } 1296 1297 1298 1299 public void setWorkCity(String workCity) { 1300 this.workCity = workCity; 1301 } 1302 1303 1304 1305 public String getWorkCountry() { 1306 return workCountry; 1307 } 1308 1309 1310 1311 public void setWorkCountry(String workCountry) { 1312 this.workCountry = workCountry; 1313 } 1314 1315 1316 1317 public String getWorkFax() { 1318 return workFax; 1319 } 1320 1321 1322 1323 public void setWorkFax(String workFax) { 1324 this.workFax = workFax; 1325 } 1326 1327 1328 1329 public String getWorkLabel() { 1330 return workLabel; 1331 } 1332 1333 1334 1335 public void setWorkLabel(String workLabel) { 1336 this.workLabel = workLabel; 1337 } 1338 1339 1340 1341 public String getWorkPhone() { 1342 return workPhone; 1343 } 1344 1345 1346 1347 public void setWorkPhone(String workPhone) { 1348 this.workPhone = workPhone; 1349 } 1350 1351 1352 1353 public String getWorkState() { 1354 return workState; 1355 } 1356 1357 1358 1359 public void setWorkState(String workState) { 1360 this.workState = workState; 1361 } 1362 1363 1364 1365 public String getWorkStateOtherCountryText() { 1366 return workStateOtherCountryText; 1367 } 1368 1369 1370 1371 public void setWorkStateOtherCountryText(String workStateOtherCountryText) { 1372 this.workStateOtherCountryText = workStateOtherCountryText; 1373 } 1374 1375 1376 1377 public String getWorkZip() { 1378 return workZip; 1379 } 1380 1381 1382 1383 public void setWorkZip(String workZip) { 1384 this.workZip = workZip; 1385 } 1386 1387 1388 1389 public String getHomeContactEmail() { 1390 return homeContactEmail; 1391 } 1392 1393 1394 1395 public void setHomeContactEmail(String homeContactEmail) { 1396 this.homeContactEmail = homeContactEmail; 1397 } 1398 1399 1400 1401 public String getHomeContactName() { 1402 return homeContactName; 1403 } 1404 1405 1406 1407 public void setHomeContactName(String homeContactName) { 1408 this.homeContactName = homeContactName; 1409 } 1410 1411 1412 1413 public String getHomeContactPhone() { 1414 return homeContactPhone; 1415 } 1416 1417 1418 1419 public void setHomeContactPhone(String homeContactPhone) { 1420 this.homeContactPhone = homeContactPhone; 1421 } 1422 1423 1424 1425 public String getWorkContactEmail() { 1426 return workContactEmail; 1427 } 1428 1429 1430 1431 public void setWorkContactEmail(String workContactEmail) { 1432 this.workContactEmail = workContactEmail; 1433 } 1434 1435 1436 1437 public String getWorkContactName() { 1438 return workContactName; 1439 } 1440 1441 1442 1443 public void setWorkContactName(String workContactName) { 1444 this.workContactName = workContactName; 1445 } 1446 1447 1448 1449 public String getWorkContactPhone() { 1450 return workContactPhone; 1451 } 1452 1453 1454 1455 public void setWorkContactPhone(String workContactPhone) { 1456 this.workContactPhone = workContactPhone; 1457 } 1458 1459 1460} 1461 | Popular Tags |