1 <?php
2 /* --------------------------------------------------------------
3 CustomerInputValidatorSettings.inc.php 2015-05-27 gm
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 MainFactory::load_class('CustomerInputValidatorSettingsInterface');
13
14 /**
15 * Value Object
16 *
17 * Class CustomerInputValidatorSettings
18 *
19 * CustomerInputValidatorSettings stores all min length values and error messages for registration form validation
20 *
21 * @category System
22 * @package Customer
23 * @subpackage ValueObjects
24 * @implements CustomerInputValidatorSettingsInterface
25 */
26 class CustomerInputValidatorSettings implements CustomerInputValidatorSettingsInterface
27 {
28 /**
29 * Customer's first name minimum length.
30 * @var int
31 */
32 protected $firstnameMinLength;
33
34 /**
35 * Customer's last name minimum length.
36 * @var int
37 */
38 protected $lastnameMinLength;
39
40 /**
41 * Customer's date of birth minimum length.
42 * @var int
43 */
44 protected $dateOfBirthMinLength;
45
46 /**
47 * Customer's E-Mail address minimum length.
48 * @var int
49 */
50 protected $emailMinLength;
51
52 /**
53 * Customer's street minimum length.
54 * @var int
55 */
56 protected $streetMinLength;
57
58 /**
59 * Customer's company minimum length.
60 * @var int
61 */
62 protected $companyMinLength;
63
64 /**
65 * Customer's post code minimum length.
66 * @var int
67 */
68 protected $postcodeMinLength;
69
70 /**
71 * Customer's city minimum length.
72 * @var int
73 */
74 protected $cityMinLength;
75
76 /**
77 * Customer's country zone minimum length.
78 * @var int
79 */
80 protected $countryZoneMinLength;
81
82 /**
83 * Customer's telephone number minimum length.
84 * @var int
85 */
86 protected $telephoneNumberMinLength;
87
88 /**
89 * Customer's password minimum length.
90 * @var int
91 */
92 protected $passwordMinLength;
93
94 /**
95 * Customer's gender error message.
96 * @var string
97 */
98 protected $genderErrorMessage;
99
100 /**
101 * Customer's first name error message.
102 * @var string
103 */
104 protected $firstnameErrorMessage;
105
106 /**
107 * Customer's last name error message.
108 * @var string
109 */
110 protected $lastnameErrorMessage;
111
112 /**
113 * Customer's date of birth error message.
114 * @var string
115 */
116 protected $dateOfBirthErrorMessage;
117
118 /**
119 * Customer's company error message.
120 * @var string
121 */
122 protected $companyErrorMessage;
123
124 /**
125 * Customer's VAT number error message.
126 * @var string
127 */
128 protected $vatNumberErrorMessage;
129
130 /**
131 * Customer's E-Mail address error message.
132 * @var string
133 */
134 protected $emailErrorMessage;
135
136 /**
137 * Customer's E-Mail address check error message.
138 * @var string
139 */
140 protected $emailAddressCheckErrorMessage;
141
142 /**
143 * Customer's E-Mail address confirmation error message.
144 * @var string
145 */
146 protected $emailConfirmationErrorMessage;
147
148 /**
149 * Customer's E-Mail address already exists error message.
150 * @var string
151 */
152 protected $emailExistsErrorMessage;
153
154 /**
155 * Customer's street error message.
156 * @var string
157 */
158 protected $streetErrorMessage;
159
160 /**
161 * Customer's post code error message.
162 * @var string
163 */
164 protected $postcodeErrorMessage;
165
166 /**
167 * Customer's city error message.
168 * @var string
169 */
170 protected $cityErrorMessage;
171
172 /**
173 * Customer's country error message.
174 * @var string
175 */
176 protected $countryErrorMessage;
177
178 /**
179 * Customer's country zone selection error message.
180 * @var string
181 */
182 protected $countryZoneSelectionErrorMessage;
183
184 /**
185 * Customer's country tone error message.
186 * @var string
187 */
188 protected $countryZoneErrorMessage;
189
190 /**
191 * Customer's telephone number error message.
192 * @var string
193 */
194 protected $telephoneNumberErrorMessage;
195
196 /**
197 * Customer's password error message.
198 * @var string
199 */
200 protected $passwordErrorMessage;
201
202 /**
203 * Customer's password mismatch error message.
204 * @var string
205 */
206 protected $passwordMismatchErrorMessage;
207
208 /**
209 * Customer's input error error message.
210 * @var string
211 */
212 protected $invalidInputErrorMessage;
213
214 /**
215 * Display customer's gender?
216 * @var bool
217 */
218 protected $displayGender;
219
220 /**
221 * Display customer's date of birth?
222 * @var bool
223 */
224 protected $displayDateOfBirth;
225
226 /**
227 * Display customer's company?
228 * @var bool
229 */
230 protected $displayCompany;
231
232 /**
233 * Display customer's country zone?
234 * @var bool
235 */
236 protected $displayCountryZone;
237
238 /**
239 * Display customer's telephone number?
240 * @var bool
241 */
242 protected $displayTelephone;
243
244 /**
245 * Display customer's fax number?
246 * @var bool
247 */
248 protected $displayFax;
249
250 /**
251 * Display customer's suburb?
252 * @var bool
253 */
254 protected $displaySuburb;
255
256 /**
257 * Customer's first name maximum length.
258 * @var int
259 */
260 protected $firstnameMaxLength;
261
262 /**
263 * Customer's last name maximum length.
264 * @var int
265 */
266 protected $lastnameMaxLength;
267
268 /**
269 * Customer's company maximum length.
270 * @var int
271 */
272 protected $companyMaxLength;
273
274 /**
275 * Customer's VAT number maximum length.
276 * @var int
277 */
278 protected $vatNumberMaxLength;
279
280 /**
281 * Customer's street maximum length.
282 * @var int
283 */
284 protected $streetMaxLength;
285
286 /**
287 * Customer's post code maximum length.
288 * @var int
289 */
290 protected $postcodeMaxLength;
291
292 /**
293 * Customer's city maximum length.
294 * @var int
295 */
296 protected $cityMaxLength;
297
298 /**
299 * Customer's country zone maximum length.
300 * @var int
301 */
302 protected $countryZoneMaxLength;
303
304 /**
305 * Customer's suburb maximum length.
306 * @var int
307 */
308 protected $suburbMaxLength;
309
310 /**
311 * Customer's call number maximum length.
312 * @var int
313 */
314 protected $callNumberMaxLength;
315
316
317 /**
318 * Constructor of the class CustomerInputValidatorSettings.
319 *
320 * Set minimum length values and error messages texts from constants.
321 * Set maximum length values from DB field length.
322 */
323 public function __construct()
324 {
325 $this->firstnameMinLength = (int)ENTRY_FIRST_NAME_MIN_LENGTH;
326 $this->lastnameMinLength = (int)ENTRY_LAST_NAME_MIN_LENGTH;
327 $this->dateOfBirthMinLength = (int)ENTRY_DOB_MIN_LENGTH;
328 $this->emailMinLength = (int)ENTRY_EMAIL_ADDRESS_MIN_LENGTH;
329 $this->streetMinLength = (int)ENTRY_STREET_ADDRESS_MIN_LENGTH;
330 $this->companyMinLength = (int)ENTRY_COMPANY_MIN_LENGTH;
331 $this->postcodeMinLength = (int)ENTRY_POSTCODE_MIN_LENGTH;
332 $this->cityMinLength = (int)ENTRY_CITY_MIN_LENGTH;
333 $this->countryZoneMinLength = (int)ENTRY_STATE_MIN_LENGTH;
334 $this->telephoneNumberMinLength = (int)ENTRY_TELEPHONE_MIN_LENGTH;
335 $this->passwordMinLength = (int)ENTRY_PASSWORD_MIN_LENGTH;
336
337 $this->genderErrorMessage = ENTRY_GENDER_ERROR;
338 $this->firstnameErrorMessage = sprintf(ENTRY_FIRST_NAME_ERROR, ENTRY_FIRST_NAME_MIN_LENGTH);
339 $this->lastnameErrorMessage = sprintf(ENTRY_LAST_NAME_ERROR, ENTRY_LAST_NAME_MIN_LENGTH);
340 $this->dateOfBirthErrorMessage = ENTRY_DATE_OF_BIRTH_ERROR;
341 $this->companyErrorMessage = sprintf(ENTRY_COMPANY_ERROR, ENTRY_COMPANY_MIN_LENGTH);
342 $this->vatNumberErrorMessage = ENTRY_VAT_ERROR;
343 $this->emailErrorMessage = sprintf(ENTRY_EMAIL_ADDRESS_ERROR, ENTRY_EMAIL_ADDRESS_MIN_LENGTH);
344 $this->emailAddressCheckErrorMessage = ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
345 $this->emailConfirmationErrorMessage = ENTRY_EMAIL_ADDRESS_CONFIRM_DIFFERENT_ERROR;
346 $this->emailExistsErrorMessage = ENTRY_EMAIL_ADDRESS_ERROR_EXISTS;
347 $this->streetErrorMessage = sprintf(ENTRY_STREET_ADDRESS_ERROR, ENTRY_STREET_ADDRESS_MIN_LENGTH);
348 $this->postcodeErrorMessage = sprintf(ENTRY_POST_CODE_ERROR, ENTRY_POSTCODE_MIN_LENGTH);
349 $this->cityErrorMessage = sprintf(ENTRY_CITY_ERROR, ENTRY_CITY_MIN_LENGTH);
350 $this->countryErrorMessage = ENTRY_COUNTRY_ERROR;
351 $this->countryZoneErrorMessage = sprintf(ENTRY_STATE_ERROR, ENTRY_STATE_MIN_LENGTH);
352 $this->countryZoneSelectionErrorMessage = ENTRY_STATE_ERROR_SELECT;
353 $this->telephoneNumberErrorMessage = sprintf(ENTRY_TELEPHONE_NUMBER_ERROR, ENTRY_TELEPHONE_MIN_LENGTH);
354 $this->passwordErrorMessage = sprintf(ENTRY_PASSWORD_ERROR, ENTRY_PASSWORD_MIN_LENGTH);
355 $this->passwordMismatchErrorMessage = ENTRY_PASSWORD_ERROR_NOT_MATCHING;
356
357 $this->invalidInputErrorMessage = ENTRY_MAX_LENGTH_ERROR;
358
359 $this->displayGender = (ACCOUNT_GENDER === 'true') ? true : false;
360 $this->displayDateOfBirth = (ACCOUNT_DOB === 'true') ? true : false;
361 $this->displayCompany = (ACCOUNT_COMPANY === 'true') ? true : false;
362 $this->displayCountryZone = (ACCOUNT_STATE === 'true') ? true : false;
363 $this->displayTelephone = (ACCOUNT_TELEPHONE === 'true') ? true : false;
364 $this->displayFax = (ACCOUNT_FAX === 'true') ? true : false;
365 $this->displaySuburb = (ACCOUNT_SUBURB === 'true') ? true : false;
366
367 $this->firstnameMaxLength = 32;
368 $this->lastnameMaxLength = 32;
369 $this->companyMaxLength = 255;
370 $this->vatNumberMaxLength = 20;
371 $this->streetMaxLength = 64;
372 $this->postcodeMaxLength = 10;
373 $this->cityMaxLength = 32;
374 $this->countryZoneMaxLength = 32;
375 $this->suburbMaxLength = 32;
376 $this->callNumberMaxLength = 32;
377 }
378
379
380 /**
381 * Returns a city error message.
382 * @return string City error message.
383 */
384 public function getCityErrorMessage()
385 {
386 return $this->cityErrorMessage;
387 }
388
389
390 /**
391 * Returns the minimum required city character length.
392 * @return int City Minimum required city character length.
393 */
394 public function getCityMinLength()
395 {
396 return $this->cityMinLength;
397 }
398
399
400 /**
401 * Returns a company error message.
402 * @return string Company error message.
403 */
404 public function getCompanyErrorMessage()
405 {
406 return $this->companyErrorMessage;
407 }
408
409
410 /**
411 * Returns the minimum required company character length.
412 * @return int Minimum required company character length.
413 */
414 public function getCompanyMinLength()
415 {
416 return $this->companyMinLength;
417 }
418
419
420 /**
421 * Returns a country error message.
422 * @return mixed Country error message.
423 */
424 public function getCountryErrorMessage()
425 {
426 return $this->countryErrorMessage;
427 }
428
429
430 /**
431 * Returns a country zone error message.
432 * @return string Country zone error message.
433 */
434 public function getCountryZoneErrorMessage()
435 {
436 return $this->countryZoneErrorMessage;
437 }
438
439
440 /**
441 * Returns the minimum required country zone character length.
442 * @return int Minimum required country zone character length.
443 */
444 public function getCountryZoneMinLength()
445 {
446 return $this->countryZoneMinLength;
447 }
448
449
450 /**
451 * Returns a country zone selection error message.
452 * @return mixed Country zone selection error message.
453 */
454 public function getCountryZoneSelectionErrorMessage()
455 {
456 return $this->countryZoneSelectionErrorMessage;
457 }
458
459
460 /**
461 * Returns a date of birth error message.
462 * @return mixed Date of birth error message.
463 */
464 public function getDateOfBirthErrorMessage()
465 {
466 return $this->dateOfBirthErrorMessage;
467 }
468
469
470 /**
471 * Returns the minimum required date of birth character length.
472 * @return int Minimum required date of birth character length.
473 */
474 public function getDateOfBirthMinLength()
475 {
476 return $this->dateOfBirthMinLength;
477 }
478
479
480 /**
481 * Returns an email address check error message.
482 * @return mixed Email address check error message.
483 */
484 public function getEmailAddressCheckErrorMessage()
485 {
486 return $this->emailAddressCheckErrorMessage;
487 }
488
489
490 /**
491 * Returns an email confirmation error message.
492 * @return mixed Email confirmation error message.
493 */
494 public function getEmailConfirmationErrorMessage()
495 {
496 return $this->emailConfirmationErrorMessage;
497 }
498
499
500 /**
501 * Returns an email error message.
502 * @return string Email error message.
503 */
504 public function getEmailErrorMessage()
505 {
506 return $this->emailErrorMessage;
507 }
508
509
510 /**
511 * Returns an email exists error message.
512 * @return mixed Email exists error message.
513 */
514 public function getEmailExistsErrorMessage()
515 {
516 return $this->emailExistsErrorMessage;
517 }
518
519
520 /**
521 * Returns the minimum required email character length.
522 * @return int Minimum required email character length.
523 */
524 public function getEmailMinLength()
525 {
526 return $this->emailMinLength;
527 }
528
529
530 /**
531 * Returns a first name error message.
532 * @return string First name error message.
533 */
534 public function getFirstnameErrorMessage()
535 {
536 return $this->firstnameErrorMessage;
537 }
538
539
540 /**
541 * Returns the minimum required first name character length.
542 * @return int Minimum required first name character length.
543 */
544 public function getFirstnameMinLength()
545 {
546 return $this->firstnameMinLength;
547 }
548
549
550 /**
551 * Returns a gender error message.
552 * @return mixed Gender error message.
553 */
554 public function getGenderErrorMessage()
555 {
556 return $this->genderErrorMessage;
557 }
558
559
560 /**
561 * Returns a last name error message.
562 * @return string Last name error message.
563 */
564 public function getLastnameErrorMessage()
565 {
566 return $this->lastnameErrorMessage;
567 }
568
569
570 /**
571 * Returns the minimum required last name character length.
572 * @return int Minimum required last name character length.
573 */
574 public function getLastnameMinLength()
575 {
576 return $this->lastnameMinLength;
577 }
578
579
580 /**
581 * Returns a password error message.
582 * @return string Password error message.
583 */
584 public function getPasswordErrorMessage()
585 {
586 return $this->passwordErrorMessage;
587 }
588
589
590 /**
591 * Returns the minimum required password character length.
592 * @return int Minimum required password character length.
593 */
594 public function getPasswordMinLength()
595 {
596 return $this->passwordMinLength;
597 }
598
599
600 /**
601 * Returns a password mismatch error message.
602 * @return mixed Password mismatch error message.
603 */
604 public function getPasswordMismatchErrorMessage()
605 {
606 return $this->passwordMismatchErrorMessage;
607 }
608
609
610 /**
611 * Returns a post code error message.
612 * @return string Post code error message.
613 */
614 public function getPostcodeErrorMessage()
615 {
616 return $this->postcodeErrorMessage;
617 }
618
619
620 /**
621 * Returns the minimum required post code character length.
622 * @return int Minimum required post code character length.
623 */
624 public function getPostcodeMinLength()
625 {
626 return $this->postcodeMinLength;
627 }
628
629
630 /**
631 * Returns a street error message.
632 * @return string Street error message.
633 */
634 public function getStreetErrorMessage()
635 {
636 return $this->streetErrorMessage;
637 }
638
639
640 /**
641 * Returns the minimum required street character length.
642 * @return int Minimum required street character length.
643 */
644 public function getStreetMinLength()
645 {
646 return $this->streetMinLength;
647 }
648
649
650 /**
651 * Returns a telephone number error message.
652 * @return string Telephone number error message.
653 */
654 public function getTelephoneNumberErrorMessage()
655 {
656 return $this->telephoneNumberErrorMessage;
657 }
658
659
660 /**
661 * Returns the minimum required telephone number character length.
662 * @return int Minimum required telephone number character length.
663 */
664 public function getTelephoneNumberMinLength()
665 {
666 return $this->telephoneNumberMinLength;
667 }
668
669
670 /**
671 * Returns a VAT number error message.
672 * @return mixed VAT number error message.
673 */
674 public function getVatNumberErrorMessage()
675 {
676 return $this->vatNumberErrorMessage;
677 }
678
679
680 /**
681 * Retrieves state value of company displaying.
682 * @return boolean Display company?
683 */
684 public function getDisplayCompany()
685 {
686 return $this->displayCompany;
687 }
688
689
690 /**
691 * Retrieves state value of country displaying.
692 * @return boolean Display country?
693 */
694 public function getDisplayCountryZone()
695 {
696 return $this->displayCountryZone;
697 }
698
699
700 /**
701 * Retrieves state value of date of birth displaying.
702 * @return boolean Display date of birth?
703 */
704 public function getDisplayDateOfBirth()
705 {
706 return $this->displayDateOfBirth;
707 }
708
709
710 /**
711 * Retrieves state value of gender displaying.
712 * @return boolean Display gender?
713 */
714 public function getDisplayGender()
715 {
716 return $this->displayGender;
717 }
718
719
720 /**
721 * Retrieves state value of telephone number displaying
722 * @return boolean Display telephone number?
723 */
724 public function getDisplayTelephone()
725 {
726 return $this->displayTelephone;
727 }
728
729
730 /**
731 * Retrieves state value of fax displaying
732 * @return boolean Display fax?
733 */
734 public function getDisplayFax()
735 {
736 return $this->displayFax;
737 }
738
739
740 /**
741 * Retrieves state value of suburb displaying
742 * @return boolean Display suburb?
743 */
744 public function getDisplaySuburb()
745 {
746 return $this->displaySuburb;
747 }
748
749
750 /**
751 * Returns an invalid input error message.
752 * @return string Invalid input error message.
753 */
754 public function getInvalidInputErrorMessage()
755 {
756 return $this->invalidInputErrorMessage;
757 }
758
759
760 /**
761 * Returns the maximum required first name character length.
762 * @return int Maximum required first name character length.
763 */
764 public function getFirstnameMaxLength()
765 {
766 return $this->firstnameMaxLength;
767 }
768
769
770 /**
771 * Returns the maximum required last name character length.
772 * @return int Maximum required last name character length.
773 */
774 public function getLastnameMaxLength()
775 {
776 return $this->lastnameMaxLength;
777 }
778
779
780 /**
781 * Returns the maximum required company character length.
782 * @return int Maximum required company character length.
783 */
784 public function getCompanyMaxLength()
785 {
786 return $this->companyMaxLength;
787 }
788
789
790 /**
791 * Returns the maximum required VAT number character length.
792 * @return int Maximum required VAT number character length.
793 */
794 public function getVatNumberMaxLength()
795 {
796 return $this->vatNumberMaxLength;
797 }
798
799
800 /**
801 * Returns the maximum required street character length.
802 * @return int Maximum required street character length.
803 */
804 public function getStreetMaxLength()
805 {
806 return $this->streetMaxLength;
807 }
808
809
810 /**
811 * Returns the maximum required post code character length.
812 * @return int Maximum required post code character length.
813 */
814 public function getPostcodeMaxLength()
815 {
816 return $this->postcodeMaxLength;
817 }
818
819
820 /**
821 * Returns the maximum required city character length.
822 * @return int Maximum required city character length.
823 */
824 public function getCityMaxLength()
825 {
826 return $this->cityMaxLength;
827 }
828
829
830 /**
831 * Returns the maximum required country zone character length.
832 * @return int Maximum required country zone character length.
833 */
834 public function getCountryZoneMaxLength()
835 {
836 return $this->countryZoneMaxLength;
837 }
838
839
840 /**
841 * Returns the maximum required suburb character length.
842 * @return int Maximum required suburb character length.
843 */
844 public function getSuburbMaxLength()
845 {
846 return $this->suburbMaxLength;
847 }
848
849
850 /**
851 * Returns the maximum required call number character length.
852 * @return int Maximum required call number character length.
853 */
854 public function getCallNumberMaxLength()
855 {
856 return $this->callNumberMaxLength;
857 }
858 }