Functie toevoegen aan php script
Ik hoop dat jullie mij kunnen helpen.
Ik maak voor een goede vriend een website. Echter krijg ik een ding niet aan de praat.
Het gaat om een boekingsformulier. Hierin moeten de klanten een aanbetaling doen.
Nu gebruikt de plug-in (joomla met jomres) een percentage van het totaal bedrag. In mijn geval 20%. Echter wil ik ook een minimum hebben van 100 euro. Volgens mij moet ik hier iets aanpassen, maar ik zou niet weten waar.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Calculates how much deposit should be charged.
*/
public function calcDeposit()
{
$mrConfig = $this->mrConfig;
$datesTilBooking = $this->findDateRangeForDates($this->today, $this->arrivalDate);
$this->setErrorLog('calcDeposit::Use variable deposits : '.$mrConfig[ 'use_variable_deposits' ]);
$this->setErrorLog('calcDeposit::Variable deposit threashold : '.(int) $mrConfig[ 'variable_deposit_threashold' ]);
$this->setErrorLog('calcDeposit::Days til booking : '.count($datesTilBooking));
if ($mrConfig[ 'depositIsOneNight' ] == '1') {
if ($this->stayDays == 1) {
$depositValue = $this->billing_grandtotal;
} else {
$depositValue = $this->rate_pernight;
// This line can be modified, if we want the deposit to be first night X number of rooms you'd change the above line to
// $depositValue = $this->rate_pernight*count ($this->requestedRoom);
$basic_property_details = jomres_singleton_abstract::getInstance('basic_property_details');
$depositValue = $basic_property_details->get_gross_accommodation_price($depositValue, $this->property_uid);
}
} else {
if ($mrConfig[ 'use_variable_deposits' ] == '1' && count($datesTilBooking) <= (int) $mrConfig[ 'variable_deposit_threashold' ]) {
$depositValue = $this->contract_total;
} else {
// Calculate deposit
$depositValue = 0;
// Depreciating this next if, but leaving the stuff inside on. This is because a few folks are setting the show deposit to No, but still sending the deposit value to
// paypal/gateway. Commenting out this if will mean that the deposit is still calculated.
//if ($this->cfg_chargeDepositYesNo=="1")
// {
$depositValue = $this->cfg_depositValue;
$totalBooking = $this->contract_total;
if ($this->cfg_depAmount == '1') {
$depositValue = $this->contract_total;
} else {
if ($this->cfg_depositIsPercentage == '1') {
if ($this->cfg_roundupDepositYesNo == '1') {
$depositValue = ceil(($totalBooking / 100) * $depositValue);
} else {
$depositValue = ($totalBooking / 100) * $depositValue;
}
} else {
if ($this->cfg_roundupDepositYesNo == '1') {
$depositValue = ceil($depositValue);
} else {
$depositValue = $depositValue;
}
}
}
//}
?>
/**
* Calculates how much deposit should be charged.
*/
public function calcDeposit()
{
$mrConfig = $this->mrConfig;
$datesTilBooking = $this->findDateRangeForDates($this->today, $this->arrivalDate);
$this->setErrorLog('calcDeposit::Use variable deposits : '.$mrConfig[ 'use_variable_deposits' ]);
$this->setErrorLog('calcDeposit::Variable deposit threashold : '.(int) $mrConfig[ 'variable_deposit_threashold' ]);
$this->setErrorLog('calcDeposit::Days til booking : '.count($datesTilBooking));
if ($mrConfig[ 'depositIsOneNight' ] == '1') {
if ($this->stayDays == 1) {
$depositValue = $this->billing_grandtotal;
} else {
$depositValue = $this->rate_pernight;
// This line can be modified, if we want the deposit to be first night X number of rooms you'd change the above line to
// $depositValue = $this->rate_pernight*count ($this->requestedRoom);
$basic_property_details = jomres_singleton_abstract::getInstance('basic_property_details');
$depositValue = $basic_property_details->get_gross_accommodation_price($depositValue, $this->property_uid);
}
} else {
if ($mrConfig[ 'use_variable_deposits' ] == '1' && count($datesTilBooking) <= (int) $mrConfig[ 'variable_deposit_threashold' ]) {
$depositValue = $this->contract_total;
} else {
// Calculate deposit
$depositValue = 0;
// Depreciating this next if, but leaving the stuff inside on. This is because a few folks are setting the show deposit to No, but still sending the deposit value to
// paypal/gateway. Commenting out this if will mean that the deposit is still calculated.
//if ($this->cfg_chargeDepositYesNo=="1")
// {
$depositValue = $this->cfg_depositValue;
$totalBooking = $this->contract_total;
if ($this->cfg_depAmount == '1') {
$depositValue = $this->contract_total;
} else {
if ($this->cfg_depositIsPercentage == '1') {
if ($this->cfg_roundupDepositYesNo == '1') {
$depositValue = ceil(($totalBooking / 100) * $depositValue);
} else {
$depositValue = ($totalBooking / 100) * $depositValue;
}
} else {
if ($this->cfg_roundupDepositYesNo == '1') {
$depositValue = ceil($depositValue);
} else {
$depositValue = $depositValue;
}
}
}
//}
?>
Weet iemand van jullie hoe het moet?
- Ariën -:
Gelieve in het vervolg bij code de [code][/code]-tags gebruiken.
Hier kan je meer lezen over de mogelijke opmaakcodes.
Alvast bedankt!
Hier kan je meer lezen over de mogelijke opmaakcodes.
Alvast bedankt!
Gewijzigd op 06/01/2017 11:10:37 door - Ariën -
Mijn eerste ingeving zou zijn:
kijk of hier een instelling voor is.
Mijn tweede ingeving:
Neem contact op met de makers van deze code.
Als laatste optie / redmiddel zou je kunnen proberen de code aan te passen, na het maken van een backup van de huidige code.
Ik zou verwachten (natte vingerwerk) dat er aan het einde zoiets staat als:
Je zou hier direct het volgende voor kunnen zetten (aanname: $depositValue is in euro's):
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
<?php
/**
* Core file.
*
* @author Vince Wooll <[email protected]>
*
* @version Jomres 9.8.24
*
* @copyright 2005-2016 Vince Wooll
* Jomres (tm) PHP, CSS & Javascript files are released under both MIT and GPL2 licenses. This means that you can choose the license that best suits your project, and use it accordingly
**/
// ################################################################
defined('_JOMRES_INITCHECK') or die('');
// ################################################################
/**
* This file is the main code block that manages the booking engine.
#
*
#
* It is not designed to be implemented or called directly. Instead it is called by the j05000bookingobject.class.php file which inherits from this file.
*/
class dobooking
{
/**
* Constructor for the jomres_booking object, sets a bunch of variables, finds configuration settings & gets the current state of the booking from the tmpbooking table.
*/
public function __construct()
{
$siteConfig = jomres_getSingleton('jomres_config_site_singleton');
$jrConfig = $siteConfig->get();
$this->jrConfig = $jrConfig; // Importing the site config settings
$this->suppress_output = true;
if (get_showtime('task') == 'handlereq' || get_showtime('task') == 'dobooking') {
$this->suppress_output = false;
}
$this->requestedRoom = array();
$this->rate_pernight = 0.00;
$this->rate_pernight_nodiscount = 0.00;
$this->room_total_nodiscount = 0.00;
$this->discounts = array();
$this->total_in_party = 0;
$this->variancetypes = array();
$this->varianceuids = array();
$this->varianceqty = array();
$this->variancevals = array();
$this->variancevals_nodiscount = array();
//$this->coupon_id = "";
//$this->coupon = "";
$this->lastminute_id = '';
$this->arrivalDate = '';
$this->departureDate = '';
$this->stayDays = 1;
$this->dateRangeString = '';
$this->guests_uid = '';
$this->property_uid = '';
$this->rates_uid = '';
$this->tag = '';
$this->resource = '';
$this->rate_rules = 0.00;
$this->single_person_suppliment = 0.00;
$this->deposit_required = 0.00;
$this->contract_total = 0.00;
$this->extrasvalue = 0.00;
$this->tax = 0.00;
$this->extras = '';
$this->third_party_extras = array();
$this->third_party_extras_private_data = array();
$this->total_discount = 0.00;
$this->depositpaidsuccessfully = false;
$this->booker_class = '000';
$this->ok_to_book = false;
$this->referrer = '';
$this->error_log = '';
$this->total_in_party = 0;
$this->mininterval = 1;
$this->unixArrivalDate = null;
$this->unixDepartureDate = null;
$this->beds_available = 0;
$this->monitoringMessages = array();
$this->room_feature_filter = array();
$this->vt = '';
$this->vu = '';
$this->vq = '';
$this->vv = '';
$this->rr = '';
$this->existing_id = '';
$this->mos_userid = 0;
$this->firstname = '';
$this->surname = '';
$this->house = '';
$this->street = '';
$this->town = '';
$this->region = '';
$this->postcode = '';
$this->tel_landline = '';
$this->tel_mobile = '';
$this->email = '';
$this->guest_specific_discount = 0;
$this->additional_line_items = array();
//$this->today = date("Y/m/d");
// Should be better at detecting today's date subject DST
$this->today = date('Y/m/d', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
$this->error = '';
$this->error_code = '';
$this->billing_roomtotal = 0.00;
//$this->customTextArray = array();
$this->resetPricingOutput = false;
$this->roomImageHTML = '';
$this->allPropertyRooms = array();
$this->allPropertyRoomUids = array();
$this->allPropertyTariffs = array();
$this->allFeatureDetails = array();
$this->allFeatureIds = array();
$this->allRoomClasses = array();
$this->allRoomClassIds = array();
$this->allBookings = array();
$this->rebuildIgnoreList = array();
$this->currentField = '';
$this->singlePersonSupplimentCalculated = false;
$this->email_address_can_be_used = true;
$bookingDeets = $this->getTmpBookingData();
$this->setErrorLog('Queried session data for existing booking');
if (count($bookingDeets) > 0) {
if (!isset($bookingDeets[ 'email_address_can_be_used' ])) {
$bookingDeets[ 'email_address_can_be_used' ] = true;
}
$this->email_address_can_be_used = $bookingDeets[ 'email_address_can_be_used' ];
$this->rr = $bookingDeets[ 'requestedRoom' ];
$this->rate_pernight = $bookingDeets[ 'rate_pernight' ];
$this->vt = $bookingDeets[ 'variancetypes' ];
$this->vu = $bookingDeets[ 'varianceuids' ];
$this->vq = $bookingDeets[ 'varianceqty' ];
$this->vv = $bookingDeets[ 'variancevals' ];
$this->vv_nodiscount = $bookingDeets[ 'variancevals_nodiscount' ];
//$this->coupon_id = $bookingDeets['coupon_id'];
//$this->coupon = $bookingDeets['coupon'];
$this->lastminute_id = $bookingDeets[ 'lastminute_id' ];
if (!isset($bookingDeets[ 'arrivalDate' ])) {
$bookingDeets[ 'arrivalDate' ] = '';
$bookingDeets[ 'departureDate' ] = '';
}
$this->arrivalDate = $bookingDeets[ 'arrivalDate' ];
$this->departureDate = $bookingDeets[ 'departureDate' ];
$this->stayDays = $bookingDeets[ 'stayDays' ];
$this->dateRangeString = $bookingDeets[ 'dateRangeString' ];
$this->guests_uid = $bookingDeets[ 'guests_uid' ];
$this->property_uid = (int) $bookingDeets[ 'property_uid' ];
$this->rates_uid = $bookingDeets[ 'rates_uid' ];
$this->resource = $bookingDeets[ 'resource' ];
$this->single_person_suppliment = $bookingDeets[ 'single_person_suppliment' ];
$this->deposit_required = $bookingDeets[ 'deposit_required' ];
$this->contract_total = $bookingDeets[ 'contract_total' ];
$this->extrasvalue = $bookingDeets[ 'extrasvalue' ];
$this->extrasvalues_items = unserialize($bookingDeets[ 'extrasvalues_items' ]);
$this->third_party_extras = unserialize($bookingDeets[ 'third_party_extras' ]);
$this->third_party_extras_private_data = unserialize($bookingDeets[ 'third_party_extras_private_data' ]);
$this->room_allocations = unserialize($bookingDeets[ 'room_allocations' ]);
$this->room_allocations_note = $bookingDeets[ 'room_allocations_note' ];
$this->property_currencycode = $bookingDeets[ 'property_currencycode' ];
$this->tax = $bookingDeets[ 'tax' ];
$this->extras = $bookingDeets[ 'extras' ];
$this->extrasquantities = $bookingDeets[ 'extrasquantities' ];
$this->total_discount = $bookingDeets[ 'total_discount' ];
$this->depositpaidsuccessfully = $bookingDeets[ 'depositpaidsuccessfully' ];
$this->booker_class = $bookingDeets[ 'booker_class' ];
$this->ok_to_book = $bookingDeets[ 'ok_to_book' ];
$this->beds_available = $bookingDeets[ 'beds_available' ];
$this->referrer = $bookingDeets[ 'referrer' ];
$this->error = $bookingDeets[ 'error_log' ];
$this->room_total = $bookingDeets[ 'room_total' ];
$this->room_total_nodiscount = $bookingDeets[ 'room_total_nodiscount' ];
//$this->discounts = $bookingDeets[ 'discounts' ];
$this->total_in_party = $bookingDeets[ 'total_in_party' ];
//if ($this->booker_class == "100")
// $this->mininterval = 1;
//else
// $this->mininterval = $bookingDeets['mininterval'];
// if ($this->mininterval == 0)
// $this->mininterval = 1;
$this->amend_contract = false;
if (isset($bookingDeets[ 'amend_contract' ])) {
$this->amend_contract = $bookingDeets[ 'amend_contract' ];
}
$this->coupon_id = $bookingDeets[ 'coupon_id' ];
$this->coupon_code = $bookingDeets[ 'coupon_code' ];
$this->coupon_details = $bookingDeets[ 'coupon_details' ];
$this->coupon_discount_value = $bookingDeets[ 'coupon_discount_value' ];
$this->booking_notes = $bookingDeets[ 'booking_notes' ];
$this->additional_line_items = unserialize($bookingDeets[ 'additional_line_items' ]);
$this->room_feature_filter = unserialize($bookingDeets[ 'room_feature_filter' ]);
$this->override_room_total = $bookingDeets[ 'override_room_total' ];
$this->override_deposit = $bookingDeets[ 'override_deposit' ];
if (isset($bookingDeets[ 'thirdparty_vars' ])) {
$this->thirdparty_vars = $bookingDeets[ 'thirdparty_vars' ];
}
}
$dbdata = serialize($bookingDeets);
$dbdata = str_replace(';', ' ', $dbdata);
$this->setErrorLog("<font color='grey'>Constructor::Data pulled from Session variables ".$dbdata.'</font>');
if (!empty($this->rr)) {
$this->requestedRoom = explode(',', $this->rr);
}
$this->variancetypes = explode(',', $this->vt);
$this->varianceuids = explode(',', $this->vu);
$this->varianceqty = explode(',', $this->vq);
$this->variancevals = explode(',', $this->vv);
$this->variancevals_nodiscount = explode(',', $this->vv_nodiscount);
foreach ($this->varianceuids as $key => $variance_uid) {
if ((int) $variance_uid == 0 || !$this->checkGuestVariantIdAndQty($variance_uid, 1)) {
$this->setErrorLog('init::Unsetting variances with key '.$key);
unset($this->variancetypes[ $key ]);
unset($this->varianceuids[ $key ]);
unset($this->varianceqty[ $key ]);
unset($this->variancevals[ $key ]);
unset($this->variancevals_nodiscount[ $key ]);
}
}
$userDeets = $this->getTmpGuestData();
//$this->errorLog( "Set booking variables " );
$this->mos_userid = $userDeets[ 'mos_userid' ];
$this->existing_id = $userDeets[ 'existing_id' ];
$this->firstname = $userDeets[ 'firstname' ];
$this->surname = $userDeets[ 'surname' ];
$this->house = $userDeets[ 'house' ];
$this->street = $userDeets[ 'street' ];
$this->town = $userDeets[ 'town' ];
$this->region = $userDeets[ 'region' ];
$this->country = $userDeets[ 'country' ];
$this->postcode = $userDeets[ 'postcode' ];
$this->tel_landline = $userDeets[ 'tel_landline' ];
$this->tel_mobile = $userDeets[ 'tel_mobile' ];
$this->email = $userDeets[ 'email' ];
$this->guest_specific_discount = $userDeets[ 'discount' ];
$mrConfig = getPropertySpecificSettings($this->property_uid);
$this->mrConfig = $mrConfig;
if (isset($mrConfig[ 'margin' ]) && !empty($mrConfig[ 'margin' ])) {
$this->margin = $mrConfig[ 'margin' ];
} else {
$this->margin = '0.00';
}
$this->tariffModel = $mrConfig[ 'newTariffModels' ];
if ($this->tariffModel != '1' && $this->tariffModel != '2') {
$this->tariffModel = '1';
}
if (!isset($mrConfig[ 'cal_input' ])) {
echo "Error: Configuration settings don't appear to be set. There are ".count($mrConfig).' elements in the mrConfig var and '.count($jrConfig).' in the jrConfig var. If you have just installed Jomres you should log into the frontend as a property manager. This will set up sufficient data so that you can proceed.';
exit;
}
$this->cfg_tariffmode = $mrConfig[ 'tariffmode' ];
$this->cfg_errorChecking = $mrConfig[ 'errorChecking' ];
$this->cfg_singlePersonSuppliment = $mrConfig[ 'singlePersonSuppliment' ];
$this->cfg_supplimentChargeIsPercentage = $mrConfig[ 'supplimentChargeIsPercentage' ];
$this->cfg_singlePersonSupplimentCost = $mrConfig[ 'singlePersonSupplimentCost' ];
$this->cfg_perPersonPerNight = $mrConfig[ 'perPersonPerNight' ];
$this->cfg_depositIsPercentage = $mrConfig[ 'depositIsPercentage' ];
$this->cfg_depositValue = $mrConfig[ 'depositValue' ];
$this->cfg_visitorscanbookonline = $mrConfig[ 'visitorscanbookonline' ];
$this->cfg_fixedPeriodBookings = $mrConfig[ 'fixedPeriodBookings' ];
$this->cfg_fixedPeriodBookingsNumberOfDays = $mrConfig[ 'fixedPeriodBookingsNumberOfDays' ];
$this->cfg_numberofFixedPeriods = $mrConfig[ 'numberofFixedPeriods' ];
$this->cfg_fixedArrivalDateYesNo = $mrConfig[ 'fixedArrivalDateYesNo' ];
$this->cfg_fixedArrivalDay = $mrConfig[ 'fixedArrivalDay' ];
$this->cfg_fixedPeriodBookingsShortYesNo = $mrConfig[ 'fixedPeriodBookingsShortYesNo' ];
$this->cfg_fixedPeriodBookingsShortNumberOfDays = $mrConfig[ 'fixedPeriodBookingsShortNumberOfDays' ];
$this->cfg_singleRoomProperty = $mrConfig[ 'singleRoomProperty' ];
$this->cfg_cal_output = $mrConfig[ 'cal_output' ];
$this->cfg_cal_input = $jrConfig[ 'cal_input' ];
$this->cfg_templatePack = 'basic';
$this->cfg_limitAdvanceBookingsYesNo = $mrConfig[ 'limitAdvanceBookingsYesNo' ];
$this->cfg_advanceBookingsLimit = $mrConfig[ 'advanceBookingsLimit' ];
$this->cfg_roomTaxYesNo = $mrConfig[ 'roomTaxYesNo' ];
$this->cfg_roomTaxFixed = $mrConfig[ 'roomTaxFixed' ];
$this->cfg_roomTaxPercentage = $mrConfig[ 'roomTaxPercentage' ];
$this->cfg_euroTaxYesNo = $mrConfig[ 'euroTaxYesNo' ];
$this->cfg_euroTaxPercentage = $mrConfig[ 'euroTaxPercentage' ];
$this->cfg_depAmount = $mrConfig[ 'depAmount' ];
$this->cfg_showdepartureinput = $mrConfig[ 'showdepartureinput' ];
$this->cfg_ratemultiplier = $mrConfig[ 'ratemultiplier' ];
$this->cfg_dateFormatStyle = $mrConfig[ 'dateFormatStyle' ];
$this->cfg_inputBoxErrorBackground = $mrConfig[ 'inputBoxErrorBackground' ];
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
if (!isset($mrConfig[ 'auto_detect_country_for_booking_form' ])) {
$mrConfig[ 'auto_detect_country_for_booking_form' ] = '1';
}
if ($mrConfig[ 'auto_detect_country_for_booking_form' ] == '1' && isset($tmpBookingHandler->user_settings[ 'geolocated_country' ])) {
$this->cfg_defaultcountry = $tmpBookingHandler->user_settings[ 'geolocated_country' ];
} else {
$this->cfg_defaultcountry = $mrConfig[ 'defaultcountry' ];
}
//if ($this->booker_class == "100")
// $this->cfg_minimuminterval = 1;
//else
$this->cfg_minimuminterval = $mrConfig[ 'minimuminterval' ];
$this->cfg_showDeposit = $mrConfig[ 'chargeDepositYesNo' ];
$this->cfg_showRoomImageInBookingFormOverlib = $mrConfig[ 'showRoomImageInBookingFormOverlib' ];
if ($this->booker_class == '100') {
$this->cfg_mindaysbeforearrival = 0;
} else {
$this->cfg_mindaysbeforearrival = $mrConfig[ 'mindaysbeforearrival' ];
}
$this->cfg_defaultNumberOfFirstGuesttype = $mrConfig[ 'defaultNumberOfFirstGuesttype' ];
$this->cfg_roundupDepositYesNo = $mrConfig[ 'roundupDepositYesNo' ];
$this->cfg_chargeDepositYesNo = $mrConfig[ 'chargeDepositYesNo' ];
$this->cfg_tariffChargesStoredWeeklyYesNo = $mrConfig[ 'tariffChargesStoredWeeklyYesNo' ];
$this->cfg_fixedArrivalDatesRecurring = $mrConfig[ 'fixedArrivalDatesRecurring' ];
$this->cfg_returnRoomsLimit = $mrConfig[ 'returnRoomsLimit' ];
if (!isset($mrConfig[ 'cfg_weekenddays' ])) {
$mrConfig[ 'cfg_weekenddays' ] = '5,6';
}
$this->cfg_weekenddays = explode(',', $mrConfig[ 'weekenddays' ]);
$this->cfg_bookingform_roomlist_showroomno = $mrConfig[ 'bookingform_roomlist_showroomno' ];
$this->cfg_bookingform_roomlist_showroomname = $mrConfig[ 'bookingform_roomlist_showroomname' ];
$this->cfg_bookingform_roomlist_showdisabled = $mrConfig[ 'bookingform_roomlist_showdisabled' ];
$this->cfg_bookingform_roomlist_showmaxpeople = $mrConfig[ 'bookingform_roomlist_showmaxpeople' ];
$this->cfg_bookingform_requiredfields_name = $mrConfig[ 'bookingform_requiredfields_name' ];
$this->cfg_bookingform_requiredfields_surname = $mrConfig[ 'bookingform_requiredfields_surname' ];
$this->cfg_bookingform_requiredfields_houseno = $mrConfig[ 'bookingform_requiredfields_houseno' ];
$this->cfg_bookingform_requiredfields_street = $mrConfig[ 'bookingform_requiredfields_street' ];
$this->cfg_bookingform_requiredfields_town = $mrConfig[ 'bookingform_requiredfields_town' ];
$this->cfg_bookingform_requiredfields_postcode = $mrConfig[ 'bookingform_requiredfields_postcode' ];
$this->cfg_bookingform_requiredfields_region = $mrConfig[ 'bookingform_requiredfields_region' ];
$this->cfg_bookingform_requiredfields_country = $mrConfig[ 'bookingform_requiredfields_country' ];
$this->cfg_bookingform_requiredfields_tel = $mrConfig[ 'bookingform_requiredfields_tel' ];
$this->cfg_bookingform_requiredfields_mobile = $mrConfig[ 'bookingform_requiredfields_mobile' ];
$this->cfg_bookingform_requiredfields_email = $mrConfig[ 'bookingform_requiredfields_email' ];
$this->property_currencycode = $mrConfig[ 'property_currencycode' ];
if (!isset($mrConfig[ 'booking_form_rooms_list_style' ])) {
$mrConfig[ 'booking_form_rooms_list_style' ] = '1';
}
if (!isset($mrConfig[ 'booking_form_daily_weekly_monthly' ])) {
$mrConfig[ 'booking_form_daily_weekly_monthly' ] = 'D';
}
$this->cfg_booking_form_daily_weekly_monthly = $mrConfig[ 'booking_form_daily_weekly_monthly' ];
$amend_contract = $tmpBookingHandler->getBookingFieldVal('amend_contract');
if ($amend_contract) {
$mrConfig[ 'booking_form_rooms_list_style' ] = '1';
}
$this->cfg_booking_form_rooms_list_style = $mrConfig[ 'booking_form_rooms_list_style' ];
$mrConfig = $this->mrConfig;
$this->accommodation_tax_rate = 0.0;
if (isset($mrConfig[ 'accommodation_tax_code' ]) && (int) $mrConfig[ 'accommodation_tax_code' ] > 0) {
$jrportal_taxrate = jomres_singleton_abstract::getInstance('jrportal_taxrate');
$cfgcode = $mrConfig[ 'accommodation_tax_code' ];
$this->accommodation_tax_rate = (float) $jrportal_taxrate->taxrates[ $cfgcode ][ 'rate' ];
}
// Let's get the room, tariff, room type (class) and room feature information for this property
if (get_showtime('include_room_booking_functionality')) {
$this->getAllRoomsData();
$this->getAllTariffsData();
$this->getAllRoomFeatureDetails();
$this->getAllRoomClasses();
$this->getAllRoomFeatures();
$this->getAllBookings();
$this->getAllTaxRates();
$this->get_all_tariff_types();
$this->checkAllGuestsAllocatedToRooms();
}
$this->checkAllGuestsAllocatedToRooms();
return true;
}
/**
*Queries the database for the temporary booking data.
*/
public function getTmpBookingData()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$bookingDeets = $tmpBookingHandler->getBookingData();
if (!isset($bookingDeets[ 'show_extras' ])) {
$bookingDeets[ 'show_extras' ] = '1';
}
$this->cfg_showExtras = $bookingDeets[ 'show_extras' ];
return $bookingDeets;
}
/**
*Queries the database for the temporary booking data.
*/
public function getTmpGuestData()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$userDeets = $tmpBookingHandler->getGuestData();
return $userDeets;
}
/**
* Save the details of the booking object.
*/
public function storeBookingDetails()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$this->writeToLogfile("<font color='grey'>".serialize($tmpBookingHandler->tmpguest).'</font>');
$tmpBookingHandler->tmpguest[ 'mos_userid' ] = $this->mos_userid;
$tmpBookingHandler->tmpguest[ 'existing_id' ] = getEscaped($this->existing_id);
$tmpBookingHandler->tmpguest[ 'firstname' ] = getEscaped($this->firstname);
$tmpBookingHandler->tmpguest[ 'surname' ] = getEscaped($this->surname);
$tmpBookingHandler->tmpguest[ 'house' ] = getEscaped($this->house);
$tmpBookingHandler->tmpguest[ 'street' ] = getEscaped($this->street);
$tmpBookingHandler->tmpguest[ 'town' ] = getEscaped($this->town);
$tmpBookingHandler->tmpguest[ 'region' ] = getEscaped($this->region);
$tmpBookingHandler->tmpguest[ 'country' ] = getEscaped($this->country);
$tmpBookingHandler->tmpguest[ 'postcode' ] = getEscaped($this->postcode);
$tmpBookingHandler->tmpguest[ 'tel_landline' ] = getEscaped($this->tel_landline);
$tmpBookingHandler->tmpguest[ 'tel_mobile' ] = getEscaped($this->tel_mobile);
$tmpBookingHandler->tmpguest[ 'email' ] = getEscaped($this->email);
$tmpBookingHandler->tmpguest[ 'discount' ] = getEscaped($this->guest_specific_discount);
$tmpBookingHandler->saveGuestData();
$rr = implode(',', $this->requestedRoom);
$this->implodeVariances();
$this->writeToLogfile($this->error);
$this->error = '';
$tmpBookingHandler->tmpbooking[ 'requestedRoom' ] = $rr;
$tmpBookingHandler->tmpbooking[ 'rate_pernight' ] = $this->rate_pernight;
$tmpBookingHandler->tmpbooking[ 'variancetypes' ] = $this->vt;
$tmpBookingHandler->tmpbooking[ 'varianceuids' ] = $this->vu;
$tmpBookingHandler->tmpbooking[ 'varianceqty' ] = $this->vq;
$tmpBookingHandler->tmpbooking[ 'variancevals' ] = $this->vv;
$tmpBookingHandler->tmpbooking[ 'variancevals_nodiscount' ] = $this->vv_nodiscount;
//$tmpBookingHandler->tmpbooking["coupon_id"] = $this->coupon_id;
//$tmpBookingHandler->tmpbooking["coupon"] = $this->coupon;
$tmpBookingHandler->tmpbooking[ 'lastminute_id' ] = $this->lastminute_id;
$tmpBookingHandler->tmpbooking[ 'arrivalDate' ] = $this->arrivalDate;
$tmpBookingHandler->tmpbooking[ 'departureDate' ] = $this->departureDate;
$tmpBookingHandler->tmpbooking[ 'stayDays' ] = $this->stayDays;
$tmpBookingHandler->tmpbooking[ 'dateRangeString' ] = $this->dateRangeString;
$tmpBookingHandler->tmpbooking[ 'guests_uid' ] = $this->guests_uid;
$tmpBookingHandler->tmpbooking[ 'property_uid' ] = $this->property_uid;
$tmpBookingHandler->tmpbooking[ 'rates_uid' ] = $this->rates_uid;
$tmpBookingHandler->tmpbooking[ 'resource' ] = $this->resource;
$tmpBookingHandler->tmpbooking[ 'single_person_suppliment' ] = $this->single_person_suppliment;
$tmpBookingHandler->tmpbooking[ 'deposit_required' ] = $this->deposit_required;
$tmpBookingHandler->tmpbooking[ 'contract_total' ] = $this->contract_total;
$tmpBookingHandler->tmpbooking[ 'extrasvalue' ] = $this->extrasvalue;
$tmpBookingHandler->tmpbooking[ 'extrasvalues_items' ] = serialize($this->extrasvalues_items);
$tmpBookingHandler->tmpbooking[ 'extras' ] = $this->extras;
$tmpBookingHandler->tmpbooking[ 'extrasquantities' ] = $this->extrasquantities;
$tmpBookingHandler->tmpbooking[ 'third_party_extras' ] = serialize($this->third_party_extras);
$tmpBookingHandler->tmpbooking[ 'third_party_extras_private_data' ] = serialize($this->third_party_extras_private_data);
$tmpBookingHandler->tmpbooking[ 'room_allocations' ] = serialize($this->room_allocations);
$tmpBookingHandler->tmpbooking[ 'room_allocations_note' ] = serialize($this->room_allocations_note);
$tmpBookingHandler->tmpbooking[ 'total_discount' ] = $this->total_discount;
$tmpBookingHandler->tmpbooking[ 'depositpaidsuccessfully' ] = $this->depositpaidsuccessfully;
$tmpBookingHandler->tmpbooking[ 'tax' ] = $this->tax;
$tmpBookingHandler->tmpbooking[ 'booker_class' ] = $this->booker_class;
$tmpBookingHandler->tmpbooking[ 'ok_to_book' ] = $this->ok_to_book;
$tmpBookingHandler->tmpbooking[ 'beds_available' ] = $this->beds_available;
$tmpBookingHandler->tmpbooking[ 'referrer' ] = $this->referrer;
$tmpBookingHandler->tmpbooking[ 'error_log' ] = $this->error;
$tmpBookingHandler->tmpbooking[ 'total_in_party' ] = $this->total_in_party;
$tmpBookingHandler->tmpbooking[ 'room_total' ] = $this->room_total;
$tmpBookingHandler->tmpbooking[ 'room_total_nodiscount' ] = $this->room_total_nodiscount;
$tmpBookingHandler->tmpbooking[ 'discounts' ] = $this->discounts;
$tmpBookingHandler->tmpbooking[ 'timestamp' ] = date('Y-m-d H:i:s');
$tmpBookingHandler->tmpbooking[ 'mininterval' ] = $this->mininterval;
$tmpBookingHandler->tmpbooking[ 'coupon_id' ] = $this->coupon_id;
$tmpBookingHandler->tmpbooking[ 'coupon_code' ] = $this->coupon_code;
$tmpBookingHandler->tmpbooking[ 'coupon_details' ] = $this->coupon_details;
$tmpBookingHandler->tmpbooking[ 'coupon_discount_value' ] = $this->coupon_discount_value;
$tmpBookingHandler->tmpbooking[ 'booking_notes' ] = $this->booking_notes;
$tmpBookingHandler->tmpbooking[ 'additional_line_items' ] = serialize($this->additional_line_items);
$tmpBookingHandler->tmpbooking[ 'room_feature_filter' ] = serialize($this->room_feature_filter);
$tmpBookingHandler->tmpbooking[ 'override_room_total' ] = $this->override_room_total;
$tmpBookingHandler->tmpbooking[ 'override_deposit' ] = $this->override_deposit;
$tmpBookingHandler->tmpbooking[ 'show_extras' ] = $this->cfg_showExtras;
$tmpBookingHandler->tmpbooking[ 'property_currencycode' ] = $this->property_currencycode;
$tmpBookingHandler->tmpbooking[ 'email_address_can_be_used' ] = $this->email_address_can_be_used;
if (isset($this->thirdparty_vars)) {
$tmpBookingHandler->tmpbooking[ 'thirdparty_vars' ] = $this->thirdparty_vars;
}
//store the new search dates
$tmpBookingHandler->tmpsearch_data[ 'jomsearch_availability' ] = $this->arrivalDate;
$tmpBookingHandler->tmpsearch_data[ 'jomsearch_availability_departure' ] = $this->departureDate;
$tmpBookingHandler->saveBookingData();
}
public function getAllRoomsData()
{
$basic_room_details = jomres_singleton_abstract::getInstance('basic_room_details');
$basic_room_details->get_all_rooms($this->property_uid);
$jomres_media_centre_images = jomres_singleton_abstract::getInstance('jomres_media_centre_images');
$images = $jomres_media_centre_images->get_images($this->property_uid, array('rooms')); // Gets the rooms images
$room_images = $images [ 'rooms' ];
foreach ($basic_room_details->rooms as $r) {
$this->allPropertyRooms[ $r['room_uid'] ] = array(
'room_uid' => $r['room_uid'],
'room_classes_uid' => $r['room_classes_uid'],
'propertys_uid' => $r['propertys_uid'],
'room_features_uid' => $r['room_features_uid'],
'room_name' => $r['room_name'],
'room_number' => $r['room_number'],
'room_floor' => $r['room_floor'],
'max_people' => $r['max_people'],
'singleperson_suppliment' => $r['singleperson_suppliment'],
'small_room_image' => $room_images [ $r['room_uid'] ] [0] ['small'],
'medium_room_image' => $room_images [ $r['room_uid'] ] [0] ['medium'],
);
$this->allPropertyRoomUids[ ] = $r['room_uid'];
if (!in_array($r['room_classes_uid'], $this->allRoomClassIds)) {
$this->allRoomClassIds[ ] = $r['room_classes_uid'];
}
}
if (count($basic_room_details->all_room_features) > 0) {
$this->allFeatureIds = array_keys($basic_room_details->all_room_features);
}
}
public function getAllTariffsData()
{
$query = "SELECT `rates_uid`,`rate_title`,`rate_description`,`validfrom`,`validto`,
`roomrateperday`,`mindays`,`maxdays`,`minpeople`,`maxpeople`,`roomclass_uid`,
`ignore_pppn`,`allow_ph`,`allow_we`,`weekendonly`,`dayofweek`,`minrooms_alreadyselected`,`maxrooms_alreadyselected`
FROM #__jomres_rates WHERE property_uid = '$this->property_uid'
AND DATE_FORMAT(`validto`, '%Y/%m/%d') >= DATE_FORMAT('".$this->today."', '%Y/%m/%d')
";
$tariffs = doSelectSql($query);
//$this->setErrorLog("getAllTariffsData:: ".$query );
//$this->setErrorLog("Finding tariffs");
//$this->setErrorLog($query);
//$this->setErrorLog(serialize($tariffs) );
$interval = new DateInterval('P1D');
foreach ($tariffs as $t) {
$roomrate = $this->get_nett_price($t->roomrateperday, $this->accommodation_tax_rate);
$dates = $this->get_periods($t->validfrom, $t->validto.' 23:59:59', $interval);
$this->allPropertyTariffs[ $t->rates_uid ] = array(
'rates_uid' => $t->rates_uid,
'rate_title' => $t->rate_title,
'rate_description' => $t->rate_description,
'validfrom' => $t->validfrom,
'validto' => $t->validto,
'roomrateperday' => $roomrate,
'mindays' => $t->mindays,
'maxdays' => $t->maxdays,
'minpeople' => $t->minpeople,
'maxpeople' => $t->maxpeople,
'roomclass_uid' => $t->roomclass_uid,
'ignore_pppn' => $t->ignore_pppn,
'allow_ph' => $t->allow_ph,
'allow_we' => $t->allow_we,
'weekendonly' => $t->weekendonly,
'dayofweek' => $t->dayofweek,
'minrooms_alreadyselected' => $t->minrooms_alreadyselected,
'maxrooms_alreadyselected' => $t->maxrooms_alreadyselected,
'tariff_dates' => $dates,
);
}
}
public function getAllRoomFeatureDetails()
{
$jomres_media_centre_images = jomres_singleton_abstract::getInstance('jomres_media_centre_images');
$jomres_media_centre_images->get_images($this->property_uid, array('room_features'));
$basic_room_details = jomres_singleton_abstract::getInstance('basic_room_details');
$basic_room_details->get_all_rooms($this->property_uid);
foreach ($basic_room_details->all_room_features as $f) {
$this->allFeatureDetails[ $f['room_features_uid'] ] = array('room_features_uid' => $f['room_features_uid'], 'feature_description' => $f['feature_description'], 'image' => $f['image'], 'tooltip' => $f['tooltip']);
}
}
public function getAllRoomClasses()
{
$query = 'SELECT room_classes_uid,room_class_abbv,room_class_full_desc,image FROM #__jomres_room_classes WHERE room_classes_uid IN ('.jomres_implode($this->allRoomClassIds).') ';
$roomClasses = doSelectSql($query);
foreach ($roomClasses as $c) {
$roomtype_abbv = jr_gettext('_JOMRES_CUSTOMTEXT_ROOMTYPES_ABBV'.(int) $c->room_classes_uid, stripslashes($c->room_class_abbv), false, false);
$roomtype_desc = jr_gettext('_JOMRES_CUSTOMTEXT_ROOMTYPES_DESC'.(int) $c->room_classes_uid, stripslashes($c->room_class_full_desc), false, false);
$this->allRoomClasses[ $c->room_classes_uid ] = array('room_class_abbv' => $roomtype_abbv, 'room_class_full_desc' => $roomtype_desc, 'image' => $c->image);
}
}
public function getAllRoomFeatures()
{
$basic_room_details = jomres_singleton_abstract::getInstance('basic_room_details');
$basic_room_details->get_all_rooms($this->property_uid);
if (count($basic_room_details->all_room_features) > 0) {
foreach ($basic_room_details->all_room_features as $f) {
$this->allRoomFeatures[ $f['room_features_uid'] ] = $f['feature_description'];
}
}
}
public function getAllBookings()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$amend_contract = $tmpBookingHandler->getBookingFieldVal('amend_contract');
$amend_contractuid = $tmpBookingHandler->getBookingFieldVal('amend_contractuid');
if (!$amend_contract) {
$query = "SELECT room_uid,date FROM #__jomres_room_bookings WHERE property_uid = '$this->property_uid' AND room_uid IN (".jomres_implode($this->allPropertyRoomUids).') ';
} else {
$query = "SELECT room_uid,date FROM #__jomres_room_bookings WHERE property_uid = '$this->property_uid' AND contract_uid != '$amend_contractuid' AND room_uid IN (".jomres_implode($this->allPropertyRoomUids).') ';
}
$bookings = doSelectSql($query);
foreach ($bookings as $c) {
//$date=str_replace("/","",$c->date);
$this->allBookings[ $c->date ][ $c->room_uid ] = array('room_uid' => $c->room_uid);
}
if (count($this->allBookings) > 0) {
ksort($this->allBookings);
}
}
public function get_all_tariff_types()
{
$mrConfig = $this->mrConfig;
$this->all_tariff_types_to_tariff_id_xref = array();
$this->all_tariff_id_to_tariff_type_xref = array();
if ($mrConfig[ 'tariffmode' ] == '2') {
$query = "SELECT tarifftype_id,tariff_id FROM #__jomcomp_tarifftype_rate_xref WHERE property_uid = '$this->property_uid'";
$tariff_type_list = doSelectSql($query);
if (count($tariff_type_list) > 0) {
foreach ($tariff_type_list as $type) {
$this->all_tariff_types_to_tariff_id_xref[ $type->tarifftype_id ][ ] = $type->tariff_id;
$this->all_tariff_id_to_tariff_type_xref[ $type->tariff_id ][ ] = $type->tarifftype_id;
}
}
}
}
public function getAllTaxRates()
{
$jrportal_taxrate = jomres_singleton_abstract::getInstance('jrportal_taxrate');
$this->taxrates = $jrportal_taxrate->taxrates;
//$this->setErrorLog( "Init found tax rates " . serialize( $this->taxrates ) );
}
public function sanitise_for_eval($string)
{
$string = str_replace('"', '\"', $string);
$string = str_replace("'", "\'", $string);
$string = trim(preg_replace('/\s+/', ' ', $string)); // strips carriage returns from strings generated through templates
return $string;
}
public function get_fullybooked_dates()
{
$fully_booked_dates = array();
$MiniComponents = jomres_getSingleton('mcHandler');
if ($MiniComponents->eventFileExistsCheck('05060')) {
$result = $MiniComponents->triggerEvent('05060', $this);
if (isset($result[ 'plugin_manages_fully_booked_dates' ]) && $result[ 'plugin_manages_fully_booked_dates' ]) {
$booked_dates = $result[ 'fully_booked_dates' ];
foreach ($booked_dates as $date) {
$tmpdate = date('Y-n-j', strtotime($date));
$fully_booked_dates[ ] = $tmpdate;
}
}
}
if (!isset($result[ 'plugin_manages_fully_booked_dates' ])) {
$total_number_of_rooms = count($this->allPropertyRooms);
foreach ($this->allBookings as $date => $bookings) {
$number_of_bookings_this_date = count($bookings);
if ($number_of_bookings_this_date == $total_number_of_rooms) {
$tmpdate = date('Y-n-j', strtotime($date));
$fully_booked_dates[ ] = $tmpdate;
}
}
$all_tariffs_are_specific_days_of_week = true;
foreach ($this->allPropertyTariffs as $tariff) {
if ($tariff[ 'dayofweek' ] == 7) {
$all_tariffs_are_specific_days_of_week = false;
}
}
if ($all_tariffs_are_specific_days_of_week) {
$days_of_week_allowed = array();
foreach ($this->allPropertyTariffs as $tariff) {
$days_of_week_allowed[ ] = $tariff[ 'dayofweek' ];
}
$days_of_week_allowed = array_unique($days_of_week_allowed);
$start = date('Y/m/d');
$end = date('Y/m/d', strtotime('+4 years'));
$dates = $this->findDateRangeForDates($start, $end);
$count = count($dates);
for ($i = 0; $i <= $count; ++$i) {
$date = $dates[ $i ];
$day_of_week_of_date = $this->getDayOfWeek($date);
if (in_array($day_of_week_of_date, $days_of_week_allowed)) {
unset($dates[ $i ]);
}
}
foreach ($dates as $d) {
$tmpdate = date('Y-n-j', strtotime($d));
$fully_booked_dates[ ] = $tmpdate;
}
}
}
return $fully_booked_dates;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Generic variant handling
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
*Sanitises the input from the ajax query.
*/
public function sanitiseInput($type, $value)
{
switch ($type) {
case 'int':
$value = (int) $value;
break;
case 'string':
$value = $this->makeStringSafe($value);
break;
case 'date':
$tmpDate = explode('/', $value);
if (count($tmpDate) != 3) {
$value = null;
}
break;
default:
$value = null;
break;
}
return $value;
}
/**
* Sanitises the output before it's sent to the form. As the third phase of the form is generated from evaluated javascript queries any ' characters etc have to be stripped out before they're returned to the booking form.
*/
public function sanitiseOutput($data)
{
//$this->error($data);
//$data=str_replace("'","\'",$data); // These two lines commented out for 4.7.8 as they were removing ' from translated/editing mode stuff such as extras.
//$data=str_replace("'","\'",$data);
//$data=htmlentities($data);
return $data;
}
/**
* Make the string escaped.
*/
public function makeStringSafe($data)
{
$data = filter_var($data, FILTER_SANITIZE_SPECIAL_CHARS);
return $data;
}
/**
* Resets the requested room array to nuthin. When the currently available rooms list is re-generated the available rooms list is completely re-calculated.
*/
public function resetRequestedRoom()
{
jr_import('jomres_roomlocks');
$room_locker = new jomres_roomlocks();
$room_locker->unlock_all_rooms_for_session();
$this->requestedRoom = array();
}
/**
* Returns whether or not error checking flag is on or off.
*/
public function errorChecking()
{
if ($this->cfg_errorChecking == '1') {
return true;
} else {
return false;
}
}
/**
* Receives debugging messages and stores them in an array $this->error.
*/
public function setErrorLog($errorText)
{
$this->error .= $errorText.' <br/> ';
}
public function setErrorLogFirst($title)
{
$this->error = '<b>'.$title.'</b><br/>'.$this->error;
}
/**
* Returns the contents of $this->error.
*/
public function getErrorLog()
{
$errorString = '';
$errorString .= htmlentities($this->error);
return $this->error;
}
public function writeToLogfile($text)
{
logging::log_message($text, 'Dobooking', 'DEBUG');
}
public function getGrowlMessages()
{
$messages = ';';
if ($this->jrConfig[ 'useJomresMessaging' ] == '1') {
if (isset($this->growlmessages[ 'messages' ]) && count($this->growlmessages[ 'messages' ]) > 0) {
foreach ($this->growlmessages[ 'messages' ] as $message) {
if ($message != '') {
$messages .= 'jomresJquery.jGrowl(\''.$message.'\', { life: 20000,sticky:true });';
}
}
}
if (isset($this->growlmessages[ 'guest_feedback' ]) && count($this->growlmessages[ 'guest_feedback' ]) > 0) {
$messages .= 'jomresJquery.jGrowl(\''.$this->growlmessages[ 'guest_feedback' ].'\', { life: 10000 });';
}
$messages = substr($messages, 0, -1);
return $messages;
} elseif (isset($this->growlmessages[ 'messages' ]) && count($this->growlmessages[ 'messages' ]) > 0) { // normal messages are useful when developing the booking engine, so even if popups are disabled by default, we still want to see messages coded by the developer.
foreach ($this->growlmessages[ 'messages' ] as $message) {
if ($message != '') {
$messages .= 'jomresJquery.jGrowl(\''.$message.'\', { life: 20000,sticky:true });';
}
}
return $messages;
}
}
public function setPopupMessage($message)
{
$msg = $this->sanitiseOutput($message);
if ($_REQUEST[ 'field' ] != 'property_uid_check') {
$this->growlmessages[ 'messages' ][ ] = $msg;
}
}
public function setGuestPopupMessage($message)
{
$msg = $this->sanitiseOutput($message);
if (isset($_REQUEST[ 'field' ]) && $_REQUEST[ 'field' ] != 'property_uid_check') {
$this->growlmessages[ 'guest_feedback' ] = $msg;
}
}
public function echo_populate_div($message)
{
if (!$this->suppress_output) {
echo $message;
}
}
/**
* Returns true if this property is an SRP.
*/
public function getSingleRoomPropertyStatus()
{
if ($this->cfg_singleRoomProperty == '1') {
return true;
} else {
return false;
}
}
/**
* Make the Optional Extras.
*/
public function makeExtras($selectedProperty)
{
$jomres_media_centre_images = jomres_singleton_abstract::getInstance('jomres_media_centre_images');
$jomres_media_centre_images->get_images($this->property_uid, array('extras'));
$mrConfig = $this->mrConfig;
$extra_details = array();
if ($mrConfig[ 'showExtras' ] == '1') {
$query = "SELECT `uid`,`name`,`desc`,`maxquantity`,`price`,`auto_select`,`tax_rate`,`chargabledaily`,`property_uid`,`published`,`validfrom`,`validto`,`limited_to_room_type` FROM `#__jomres_extras` where property_uid = '$selectedProperty' AND published = '1' ORDER BY name";
$exList = doSelectSql($query);
$selected_rooms_room_types = array();
if (count($this->requestedRoom) > 0) {
foreach ($this->requestedRoom as $rm) {
$room = explode('^', $rm);
$tariff_id = $room[ 1 ];
$booking_room_type_id = $this->allPropertyTariffs[ $tariff_id ] ['roomclass_uid'];
$selected_rooms_room_types [] = $booking_room_type_id;
}
}
foreach ($exList as $ex) {
$show_extra = true;
$arrival_ts = strtotime(str_replace('/', '-', $this->arrivalDate));
$validfrom_ts = strtotime($ex->validfrom);
$validto_ts = strtotime($ex->validto);
if ($ex->validfrom > '1970-01-01 00:00:01' && !is_null($ex->validfrom) && $ex->validfrom != '1999-11-30 00:00:00') { // takes into account older optional extras
if (!(($arrival_ts >= $validfrom_ts) && ($arrival_ts <= $validto_ts))) {
$show_extra = false;
}
}
// add checks for room types
if ((int) $ex->limited_to_room_type > 0 && count($selected_rooms_room_types) > 0) {
if (!in_array((int) $ex->limited_to_room_type, $selected_rooms_room_types)) {
$show_extra = false;
}
}
if (!$show_extra) {
$this->removeExtra($ex->uid);
} else {
$extra_deets[ 'UID' ] = $ex->uid;
$query = "SELECT `force`,`model` FROM #__jomcomp_extrasmodels_models WHERE extra_id = '$ex->uid'";
$model = doSelectSql($query, 2);
switch ($model[ 'model' ]) {
case '1': // Per week
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERWEEK', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERWEEK'));
break;
case '2': // per days
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYS', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYS'));
break;
case '3': // per booking
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERBOOKING', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERBOOKING'));
break;
case '4': // per person per booking
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERBOOKING', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERBOOKING'));
break;
case '5': // per person per day
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERDAY', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERDAY'));
break;
case '6': // per person per week
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERWEEK', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERWEEK'));
break;
case '7': // per person per days min days
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSMINDAYS', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSMINDAYS'));
break;
case '8': // per days per room
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSPERROOM', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSPERROOM'));
break;
case '9': // per room
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERROOMPERBOOKING', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERROOMPERBOOKING'));
break;
case '100': // commission
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_COMMISSION', '_JOMRES_COMMISSION'));
break;
}
$rate = (float) $this->taxrates[ $ex->tax_rate ][ 'rate' ];
if ($model[ 'model' ] != '100') { // Model 10 is commission, so it's a percentage.
$price = $ex->price;
if ($mrConfig[ 'prices_inclusive' ] == 1) {
$divisor = ($rate / 100) + 1;
$price = $price / $divisor;
}
$tax = ($price / 100) * $rate;
$inc_price = $price + $tax;
} else {
$inc_price = ($this->room_total / 100) * $ex->price;
$commission_rate = $ex->price;
}
$tax_output = '';
if ($rate > 0) {
$tax_output = ' ('.$rate.'%)';
}
$extra_deets[ 'NAME' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRANAME'.$ex->uid, jomres_decode($ex->name)));
$extra_deets[ 'MODELTEXT' ] = $tax_output.' ( '.$model_text.' )';
if ($model[ 'model' ] != '100') {
$extra_deets[ 'PRICE' ] = output_price($inc_price);
} else {
$extra_deets[ 'PRICE' ] = output_price($inc_price).' ('.$commission_rate.'%)';
}
$extra_deets[ 'EXTRA_IMAGE' ] = $jomres_media_centre_images->multi_query_images['noimage-small'];
if (isset($jomres_media_centre_images->images['extras'][$ex->uid][0]['small'])) {
$extra_deets[ 'EXTRA_IMAGE' ] = $jomres_media_centre_images->images['extras'][$ex->uid][0]['small'];
}
if ($mrConfig[ 'wholeday_booking' ] == '1') {
if ($ex->chargabledaily == '1') {
$extra_deets[ 'PERNIGHT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY', '_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY', false, true));
} else {
$extra_deets[ 'PERNIGHT' ] = '';
}
} else {
if ($ex->chargabledaily == '1') {
$extra_deets[ 'PERNIGHT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_PERDAY', '_JOMRES_COM_PERDAY', false, true));
} else {
$extra_deets[ 'PERNIGHT' ] = '';
}
}
$extra_deets[ 'DESCRIPTION' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRADESC'.$ex->uid, jomres_decode($ex->desc)));
$descriptionForOverlib = jr_gettext('_JOMRES_CUSTOMTEXT_EXTRADESC'.$ex->uid, jomres_decode($ex->desc), false, true);
$extra_deets[ 'OVERLIB_DESCRIPTION' ] = $descriptionForOverlib;
$checked = '';
if ($this->extraAlreadySelected($ex->uid) || (int) $ex->auto_select == 1) {
$checked = ' checked ';
$this->setExtras($ex->uid);
$extraDefaultQuantity = $this->extrasquantities[ $ex->uid ];
} else {
$extraDefaultQuantity = 1;
}
$inputId = preg_replace('/[^A-Za-z0-9_-]+/', '', $ex->name);
if (strlen($inputId) == 0) {
$inputId = generateJomresRandomString(10);
}
$firstChar = $inputId[ 0 ]; // We'll add a simple test here to change the first char to X if the first character's actually a number, otherwise the getResponse_extras will not work.
if ($firstChar == '0' || $firstChar == '1' || $firstChar == '2' || $firstChar == '3' || $firstChar == '4' || $firstChar == '5' || $firstChar == '6' || $firstChar == '7' || $firstChar == '8' || $firstChar == '9') {
$inputId = 'X'.$inputId;
}
$clickUnlock = '';
if ($model[ 'force' ] != '1') {
$extra_deets[ 'INPUTBOX' ] = '<input id="extras_'.$ex->uid.'" type="checkbox" name="extras['.$ex->uid.']" value="'.$ex->uid.'" '.$checked.' autocomplete="off" onClick="'.$clickUnlock.'getResponse_extras(\'extras\',this.value,'.$ex->uid.');" />';
} else {
$this->forcedExtras[ ] = $ex->uid;
$this->setExtras($ex->uid);
$extra_deets[ 'INPUTBOX' ] = '<input id="extras_'.$ex->uid.'" type="checkbox" checked disabled=" " name="extras['.$ex->uid.']" value="'.$ex->uid.'" />';
}
$extra_deets[ 'FIELDNAME' ] = 'extras['.$ex->uid.']';
$extra_quantity_dropdown_disabled = ' disabled=" " ';
if ($this->extraAlreadySelected($ex->uid)) {
$extra_quantity_dropdown_disabled = ' ';
}
if ($ex->maxquantity > 1) {
$extra_deets[ 'INPUTBOX' ] =
$extra_deets[ 'INPUTBOX' ].' '.
jomresHTML::integerSelectList(01, $ex->maxquantity, 1, 'quantity'.$ex->uid, 'size="1" class="input-mini" autocomplete="off" '.$extra_quantity_dropdown_disabled.' onchange="getResponse_extrasquantity(\'extrasquantity\',this.value,'.$ex->uid.');"', $extraDefaultQuantity, '%02d', $use_bootstrap_radios = false);
}
$extra_deets[ 'AJAXFORM_EXTRAS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_EXTRAS', '_JOMRES_AJAXFORM_EXTRAS'));
$extra_deets[ 'AJAXFORM_EXTRAS_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_EXTRAS_DESC', '_JOMRES_AJAXFORM_EXTRAS_DESC', false));
$extra_deets[ 'EXTRAS_TOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_EXTRAS_TOTAL', '_JOMRES_AJAXFORM_EXTRAS_TOTAL'));
$extra_details[ ] = $extra_deets;
}
}
}
if (count($extra_details) > 0) {
$tmpl = new patTemplate();
$tmpl->setRoot(JOMRES_TEMPLATEPATH_FRONTEND);
$tmpl->addRows('extras', $extra_details);
$tmpl->readTemplatesFromInput('dobooking_extras.html');
$extras_template = $tmpl->getParsedTemplate();
} else {
$extras_template = $this->sanitiseOutput(jr_gettext('_JOMRES_EXTRAS_NOEXTRAS', '_JOMRES_EXTRAS_NOEXTRAS'));
}
return array('core_extras' => $extras_template);
}
public function makeThirdPartyExtras($selectedProperty)
{
$third_party_extras = array();
$MiniComponents = jomres_getSingleton('mcHandler');
if ($MiniComponents->eventFileExistsCheck('05030')) {
$MiniComponents->triggerEvent('05030', $this);
$mcOutput = $MiniComponents->getAllEventPointsData('05030');
if (count($mcOutput) > 0) {
foreach ($mcOutput as $key => $val) {
$tpe = array();
$tpe[ 'THIRD_PARTY_EXTRA' ] = $val;
$third_party_extras[ ] = $tpe;
}
}
}
return array('third_party_extras' => $third_party_extras);
}
/**
* Make the Output text, put them into an array for patTemplate and return the array.
*/
public function makeOutputText()
{
$mrConfig = $this->mrConfig;
$thisJRUser = jomres_getSingleton('jr_user');
$tax_output = '';
if ($this->accommodation_tax_rate > 0) {
$tax_output = ' ('.$this->accommodation_tax_rate.'%)';
}
$output = array();
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'HARRIVALDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL_WHOLEDAY', '_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL_WHOLEDAY'));
} else {
$output[ 'HARRIVALDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL', '_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL'));
}
if ($mrConfig[ 'showdepartureinput' ] == '1') {
if ($mrConfig[ 'fixedPeriodBookings' ] == '1') {
$output[ 'HDEPARTUREDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_MR_FIXEDPRIOD1', '_JOMRES_FRONT_MR_FIXEDPRIOD1'));
} else {
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'HDEPARTUREDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE_WHOLEDAY', '_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE_WHOLEDAY'));
} else {
$output[ 'HDEPARTUREDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE', '_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE'));
}
}
} else {
$output[ 'HDEPARTUREDATE' ] = ' ';
}
$output[ 'BOOKINGHEADER' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_QUICKRESDESC', '_JOMRES_COM_MR_QUICKRESDESC'));
$output[ 'ADDRESSHEADER' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_PROPERTIESLISTING_THISPROPERTYADDRESS', '_JOMRES_COM_MR_PROPERTIESLISTING_THISPROPERTYADDRESS'));
$output[ 'HEXTITLE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_MR_BOOKING_EXTRAS_HELP', '_JOMRES_FRONT_MR_BOOKING_EXTRAS_HELP'));
$output[ 'REQUIREDTEXT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_JAVASCRIPT_', '_JOMRES_JAVASCRIPT_'));
if ($mrConfig[ 'tariffChargesStoredWeeklyYesNo' ] == '0') {
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'BILLING_ROOM' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY', '_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY'));
} else {
$output[ 'BILLING_ROOM' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_ROOM', '_JOMRES_AJAXFORM_BILLING_ROOM'));
}
}
$output[ 'BILLING_ROOMTOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_ROOM_TOTAL', '_JOMRES_AJAXFORM_BILLING_ROOM_TOTAL'));
if ($mrConfig[ 'showExtras' ] == '1') {
$output[ 'BILLING_EXTRAS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_EXTRAS', '_JOMRES_AJAXFORM_BILLING_EXTRAS'));
}
if (get_showtime('include_room_booking_functionality')) {
$output[ 'BILLING_TAX' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_TAX', '_JOMRES_AJAXFORM_BILLING_TAX'));
}
$output[ 'BILLING_DISCOUNT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_DISCOUNT', '_JOMRES_AJAXFORM_BILLING_DISCOUNT'));
$output[ 'BILLING_TOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_TOTAL', '_JOMRES_AJAXFORM_BILLING_TOTAL'));
if ($mrConfig[ 'chargeDepositYesNo' ] == '1') {
$output[ 'DEPOSIT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_EB_PAYM_DEPOSITREQUIRED', '_JOMRES_COM_MR_EB_PAYM_DEPOSITREQUIRED'));
}
//$output['CURRENCY_SYMBOL'] =$mrConfig['currency'];
$output[ 'BILLING_TOTALINPARTY' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_TOTALINPARTY', '_JOMRES_AJAXFORM_BILLING_TOTALINPARTY'));
$output[ 'AJAXFORM_PARTICULARS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_PARTICULARS', '_JOMRES_AJAXFORM_PARTICULARS'));
$output[ 'AJAXFORM_PARTICULARS_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_PARTICULARS_DESC', '_JOMRES_AJAXFORM_PARTICULARS_DESC'));
$output[ 'AJAXFORM_AVAILABLE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLE', '_JOMRES_AJAXFORM_AVAILABLE'));
if ($thisJRUser->is_partner) {
$output[ 'AJAXFORM_ADDRESS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_PARTNERS_GUEST_ADDRESS', '_JOMRES_PARTNERS_GUEST_ADDRESS'));
} else {
$output[ 'AJAXFORM_ADDRESS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ADDRESS', '_JOMRES_AJAXFORM_ADDRESS'));
}
$output[ 'AJAXFORM_ADDRESS_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ADDRESS_DESC', '_JOMRES_AJAXFORM_ADDRESS_DESC', false));
$output[ 'AJAXFORM_AVAILABLEROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLEROOMS', '_JOMRES_AJAXFORM_AVAILABLEROOMS'));
$output[ 'AJAXFORM_SELECTEDROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_SELECTEDROOMS', '_JOMRES_AJAXFORM_SELECTEDROOMS', false));
if ($mrConfig[ 'singleRoomProperty' ] == '0') {
$output[ 'AJAXFORM_AVAILABLEROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLEROOMS', '_JOMRES_AJAXFORM_AVAILABLEROOMS'));
$output[ 'AJAXFORM_SELECTEDROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_SELECTEDROOMS', '_JOMRES_AJAXFORM_SELECTEDROOMS', false));
$output[ 'AJAXFORM_AVAILABLE_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLE_DESC', '_JOMRES_AJAXFORM_AVAILABLE_DESC', false));
$output[ 'AJAXFORM_INSTRUCTIONS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_INSTRUCTIONS', '_JOMRES_AJAXFORM_INSTRUCTIONS'));
} else {
$output[ 'AJAXFORM_AVAILABLEROOMS' ] = '';
$output[ 'AJAXFORM_SELECTEDROOMS' ] = '';
$output[ 'AJAXFORM_AVAILABLE_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLE_DESC_SRP', '_JOMRES_AJAXFORM_AVAILABLE_DESC_SRP', false));
$output[ 'AJAXFORM_INSTRUCTIONS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_INSTRUCTIONS_SRP', '_JOMRES_AJAXFORM_INSTRUCTIONS_SRP'));
}
$output[ 'ACCOMMODATION_TOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_TOTAL', '_JOMRES_AJAXFORM_ACCOMMODATION_TOTAL')).$tax_output;
switch ($this->cfg_booking_form_daily_weekly_monthly) {
case 'D':
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS_WHOLEDAY', '_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS_WHOLEDAY'));
} else {
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS', '_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS'));
}
break;
case 'W':
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_WEEKS', '_JOMRES_AJAXFORM_ACCOMMODATION_WEEKS'));
break;
case 'M':
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_MONTHS', '_JOMRES_AJAXFORM_ACCOMMODATION_MONTHS'));
brea
/**
* Core file.
*
* @author Vince Wooll <[email protected]>
*
* @version Jomres 9.8.24
*
* @copyright 2005-2016 Vince Wooll
* Jomres (tm) PHP, CSS & Javascript files are released under both MIT and GPL2 licenses. This means that you can choose the license that best suits your project, and use it accordingly
**/
// ################################################################
defined('_JOMRES_INITCHECK') or die('');
// ################################################################
/**
* This file is the main code block that manages the booking engine.
#
*
#
* It is not designed to be implemented or called directly. Instead it is called by the j05000bookingobject.class.php file which inherits from this file.
*/
class dobooking
{
/**
* Constructor for the jomres_booking object, sets a bunch of variables, finds configuration settings & gets the current state of the booking from the tmpbooking table.
*/
public function __construct()
{
$siteConfig = jomres_getSingleton('jomres_config_site_singleton');
$jrConfig = $siteConfig->get();
$this->jrConfig = $jrConfig; // Importing the site config settings
$this->suppress_output = true;
if (get_showtime('task') == 'handlereq' || get_showtime('task') == 'dobooking') {
$this->suppress_output = false;
}
$this->requestedRoom = array();
$this->rate_pernight = 0.00;
$this->rate_pernight_nodiscount = 0.00;
$this->room_total_nodiscount = 0.00;
$this->discounts = array();
$this->total_in_party = 0;
$this->variancetypes = array();
$this->varianceuids = array();
$this->varianceqty = array();
$this->variancevals = array();
$this->variancevals_nodiscount = array();
//$this->coupon_id = "";
//$this->coupon = "";
$this->lastminute_id = '';
$this->arrivalDate = '';
$this->departureDate = '';
$this->stayDays = 1;
$this->dateRangeString = '';
$this->guests_uid = '';
$this->property_uid = '';
$this->rates_uid = '';
$this->tag = '';
$this->resource = '';
$this->rate_rules = 0.00;
$this->single_person_suppliment = 0.00;
$this->deposit_required = 0.00;
$this->contract_total = 0.00;
$this->extrasvalue = 0.00;
$this->tax = 0.00;
$this->extras = '';
$this->third_party_extras = array();
$this->third_party_extras_private_data = array();
$this->total_discount = 0.00;
$this->depositpaidsuccessfully = false;
$this->booker_class = '000';
$this->ok_to_book = false;
$this->referrer = '';
$this->error_log = '';
$this->total_in_party = 0;
$this->mininterval = 1;
$this->unixArrivalDate = null;
$this->unixDepartureDate = null;
$this->beds_available = 0;
$this->monitoringMessages = array();
$this->room_feature_filter = array();
$this->vt = '';
$this->vu = '';
$this->vq = '';
$this->vv = '';
$this->rr = '';
$this->existing_id = '';
$this->mos_userid = 0;
$this->firstname = '';
$this->surname = '';
$this->house = '';
$this->street = '';
$this->town = '';
$this->region = '';
$this->postcode = '';
$this->tel_landline = '';
$this->tel_mobile = '';
$this->email = '';
$this->guest_specific_discount = 0;
$this->additional_line_items = array();
//$this->today = date("Y/m/d");
// Should be better at detecting today's date subject DST
$this->today = date('Y/m/d', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
$this->error = '';
$this->error_code = '';
$this->billing_roomtotal = 0.00;
//$this->customTextArray = array();
$this->resetPricingOutput = false;
$this->roomImageHTML = '';
$this->allPropertyRooms = array();
$this->allPropertyRoomUids = array();
$this->allPropertyTariffs = array();
$this->allFeatureDetails = array();
$this->allFeatureIds = array();
$this->allRoomClasses = array();
$this->allRoomClassIds = array();
$this->allBookings = array();
$this->rebuildIgnoreList = array();
$this->currentField = '';
$this->singlePersonSupplimentCalculated = false;
$this->email_address_can_be_used = true;
$bookingDeets = $this->getTmpBookingData();
$this->setErrorLog('Queried session data for existing booking');
if (count($bookingDeets) > 0) {
if (!isset($bookingDeets[ 'email_address_can_be_used' ])) {
$bookingDeets[ 'email_address_can_be_used' ] = true;
}
$this->email_address_can_be_used = $bookingDeets[ 'email_address_can_be_used' ];
$this->rr = $bookingDeets[ 'requestedRoom' ];
$this->rate_pernight = $bookingDeets[ 'rate_pernight' ];
$this->vt = $bookingDeets[ 'variancetypes' ];
$this->vu = $bookingDeets[ 'varianceuids' ];
$this->vq = $bookingDeets[ 'varianceqty' ];
$this->vv = $bookingDeets[ 'variancevals' ];
$this->vv_nodiscount = $bookingDeets[ 'variancevals_nodiscount' ];
//$this->coupon_id = $bookingDeets['coupon_id'];
//$this->coupon = $bookingDeets['coupon'];
$this->lastminute_id = $bookingDeets[ 'lastminute_id' ];
if (!isset($bookingDeets[ 'arrivalDate' ])) {
$bookingDeets[ 'arrivalDate' ] = '';
$bookingDeets[ 'departureDate' ] = '';
}
$this->arrivalDate = $bookingDeets[ 'arrivalDate' ];
$this->departureDate = $bookingDeets[ 'departureDate' ];
$this->stayDays = $bookingDeets[ 'stayDays' ];
$this->dateRangeString = $bookingDeets[ 'dateRangeString' ];
$this->guests_uid = $bookingDeets[ 'guests_uid' ];
$this->property_uid = (int) $bookingDeets[ 'property_uid' ];
$this->rates_uid = $bookingDeets[ 'rates_uid' ];
$this->resource = $bookingDeets[ 'resource' ];
$this->single_person_suppliment = $bookingDeets[ 'single_person_suppliment' ];
$this->deposit_required = $bookingDeets[ 'deposit_required' ];
$this->contract_total = $bookingDeets[ 'contract_total' ];
$this->extrasvalue = $bookingDeets[ 'extrasvalue' ];
$this->extrasvalues_items = unserialize($bookingDeets[ 'extrasvalues_items' ]);
$this->third_party_extras = unserialize($bookingDeets[ 'third_party_extras' ]);
$this->third_party_extras_private_data = unserialize($bookingDeets[ 'third_party_extras_private_data' ]);
$this->room_allocations = unserialize($bookingDeets[ 'room_allocations' ]);
$this->room_allocations_note = $bookingDeets[ 'room_allocations_note' ];
$this->property_currencycode = $bookingDeets[ 'property_currencycode' ];
$this->tax = $bookingDeets[ 'tax' ];
$this->extras = $bookingDeets[ 'extras' ];
$this->extrasquantities = $bookingDeets[ 'extrasquantities' ];
$this->total_discount = $bookingDeets[ 'total_discount' ];
$this->depositpaidsuccessfully = $bookingDeets[ 'depositpaidsuccessfully' ];
$this->booker_class = $bookingDeets[ 'booker_class' ];
$this->ok_to_book = $bookingDeets[ 'ok_to_book' ];
$this->beds_available = $bookingDeets[ 'beds_available' ];
$this->referrer = $bookingDeets[ 'referrer' ];
$this->error = $bookingDeets[ 'error_log' ];
$this->room_total = $bookingDeets[ 'room_total' ];
$this->room_total_nodiscount = $bookingDeets[ 'room_total_nodiscount' ];
//$this->discounts = $bookingDeets[ 'discounts' ];
$this->total_in_party = $bookingDeets[ 'total_in_party' ];
//if ($this->booker_class == "100")
// $this->mininterval = 1;
//else
// $this->mininterval = $bookingDeets['mininterval'];
// if ($this->mininterval == 0)
// $this->mininterval = 1;
$this->amend_contract = false;
if (isset($bookingDeets[ 'amend_contract' ])) {
$this->amend_contract = $bookingDeets[ 'amend_contract' ];
}
$this->coupon_id = $bookingDeets[ 'coupon_id' ];
$this->coupon_code = $bookingDeets[ 'coupon_code' ];
$this->coupon_details = $bookingDeets[ 'coupon_details' ];
$this->coupon_discount_value = $bookingDeets[ 'coupon_discount_value' ];
$this->booking_notes = $bookingDeets[ 'booking_notes' ];
$this->additional_line_items = unserialize($bookingDeets[ 'additional_line_items' ]);
$this->room_feature_filter = unserialize($bookingDeets[ 'room_feature_filter' ]);
$this->override_room_total = $bookingDeets[ 'override_room_total' ];
$this->override_deposit = $bookingDeets[ 'override_deposit' ];
if (isset($bookingDeets[ 'thirdparty_vars' ])) {
$this->thirdparty_vars = $bookingDeets[ 'thirdparty_vars' ];
}
}
$dbdata = serialize($bookingDeets);
$dbdata = str_replace(';', ' ', $dbdata);
$this->setErrorLog("<font color='grey'>Constructor::Data pulled from Session variables ".$dbdata.'</font>');
if (!empty($this->rr)) {
$this->requestedRoom = explode(',', $this->rr);
}
$this->variancetypes = explode(',', $this->vt);
$this->varianceuids = explode(',', $this->vu);
$this->varianceqty = explode(',', $this->vq);
$this->variancevals = explode(',', $this->vv);
$this->variancevals_nodiscount = explode(',', $this->vv_nodiscount);
foreach ($this->varianceuids as $key => $variance_uid) {
if ((int) $variance_uid == 0 || !$this->checkGuestVariantIdAndQty($variance_uid, 1)) {
$this->setErrorLog('init::Unsetting variances with key '.$key);
unset($this->variancetypes[ $key ]);
unset($this->varianceuids[ $key ]);
unset($this->varianceqty[ $key ]);
unset($this->variancevals[ $key ]);
unset($this->variancevals_nodiscount[ $key ]);
}
}
$userDeets = $this->getTmpGuestData();
//$this->errorLog( "Set booking variables " );
$this->mos_userid = $userDeets[ 'mos_userid' ];
$this->existing_id = $userDeets[ 'existing_id' ];
$this->firstname = $userDeets[ 'firstname' ];
$this->surname = $userDeets[ 'surname' ];
$this->house = $userDeets[ 'house' ];
$this->street = $userDeets[ 'street' ];
$this->town = $userDeets[ 'town' ];
$this->region = $userDeets[ 'region' ];
$this->country = $userDeets[ 'country' ];
$this->postcode = $userDeets[ 'postcode' ];
$this->tel_landline = $userDeets[ 'tel_landline' ];
$this->tel_mobile = $userDeets[ 'tel_mobile' ];
$this->email = $userDeets[ 'email' ];
$this->guest_specific_discount = $userDeets[ 'discount' ];
$mrConfig = getPropertySpecificSettings($this->property_uid);
$this->mrConfig = $mrConfig;
if (isset($mrConfig[ 'margin' ]) && !empty($mrConfig[ 'margin' ])) {
$this->margin = $mrConfig[ 'margin' ];
} else {
$this->margin = '0.00';
}
$this->tariffModel = $mrConfig[ 'newTariffModels' ];
if ($this->tariffModel != '1' && $this->tariffModel != '2') {
$this->tariffModel = '1';
}
if (!isset($mrConfig[ 'cal_input' ])) {
echo "Error: Configuration settings don't appear to be set. There are ".count($mrConfig).' elements in the mrConfig var and '.count($jrConfig).' in the jrConfig var. If you have just installed Jomres you should log into the frontend as a property manager. This will set up sufficient data so that you can proceed.';
exit;
}
$this->cfg_tariffmode = $mrConfig[ 'tariffmode' ];
$this->cfg_errorChecking = $mrConfig[ 'errorChecking' ];
$this->cfg_singlePersonSuppliment = $mrConfig[ 'singlePersonSuppliment' ];
$this->cfg_supplimentChargeIsPercentage = $mrConfig[ 'supplimentChargeIsPercentage' ];
$this->cfg_singlePersonSupplimentCost = $mrConfig[ 'singlePersonSupplimentCost' ];
$this->cfg_perPersonPerNight = $mrConfig[ 'perPersonPerNight' ];
$this->cfg_depositIsPercentage = $mrConfig[ 'depositIsPercentage' ];
$this->cfg_depositValue = $mrConfig[ 'depositValue' ];
$this->cfg_visitorscanbookonline = $mrConfig[ 'visitorscanbookonline' ];
$this->cfg_fixedPeriodBookings = $mrConfig[ 'fixedPeriodBookings' ];
$this->cfg_fixedPeriodBookingsNumberOfDays = $mrConfig[ 'fixedPeriodBookingsNumberOfDays' ];
$this->cfg_numberofFixedPeriods = $mrConfig[ 'numberofFixedPeriods' ];
$this->cfg_fixedArrivalDateYesNo = $mrConfig[ 'fixedArrivalDateYesNo' ];
$this->cfg_fixedArrivalDay = $mrConfig[ 'fixedArrivalDay' ];
$this->cfg_fixedPeriodBookingsShortYesNo = $mrConfig[ 'fixedPeriodBookingsShortYesNo' ];
$this->cfg_fixedPeriodBookingsShortNumberOfDays = $mrConfig[ 'fixedPeriodBookingsShortNumberOfDays' ];
$this->cfg_singleRoomProperty = $mrConfig[ 'singleRoomProperty' ];
$this->cfg_cal_output = $mrConfig[ 'cal_output' ];
$this->cfg_cal_input = $jrConfig[ 'cal_input' ];
$this->cfg_templatePack = 'basic';
$this->cfg_limitAdvanceBookingsYesNo = $mrConfig[ 'limitAdvanceBookingsYesNo' ];
$this->cfg_advanceBookingsLimit = $mrConfig[ 'advanceBookingsLimit' ];
$this->cfg_roomTaxYesNo = $mrConfig[ 'roomTaxYesNo' ];
$this->cfg_roomTaxFixed = $mrConfig[ 'roomTaxFixed' ];
$this->cfg_roomTaxPercentage = $mrConfig[ 'roomTaxPercentage' ];
$this->cfg_euroTaxYesNo = $mrConfig[ 'euroTaxYesNo' ];
$this->cfg_euroTaxPercentage = $mrConfig[ 'euroTaxPercentage' ];
$this->cfg_depAmount = $mrConfig[ 'depAmount' ];
$this->cfg_showdepartureinput = $mrConfig[ 'showdepartureinput' ];
$this->cfg_ratemultiplier = $mrConfig[ 'ratemultiplier' ];
$this->cfg_dateFormatStyle = $mrConfig[ 'dateFormatStyle' ];
$this->cfg_inputBoxErrorBackground = $mrConfig[ 'inputBoxErrorBackground' ];
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
if (!isset($mrConfig[ 'auto_detect_country_for_booking_form' ])) {
$mrConfig[ 'auto_detect_country_for_booking_form' ] = '1';
}
if ($mrConfig[ 'auto_detect_country_for_booking_form' ] == '1' && isset($tmpBookingHandler->user_settings[ 'geolocated_country' ])) {
$this->cfg_defaultcountry = $tmpBookingHandler->user_settings[ 'geolocated_country' ];
} else {
$this->cfg_defaultcountry = $mrConfig[ 'defaultcountry' ];
}
//if ($this->booker_class == "100")
// $this->cfg_minimuminterval = 1;
//else
$this->cfg_minimuminterval = $mrConfig[ 'minimuminterval' ];
$this->cfg_showDeposit = $mrConfig[ 'chargeDepositYesNo' ];
$this->cfg_showRoomImageInBookingFormOverlib = $mrConfig[ 'showRoomImageInBookingFormOverlib' ];
if ($this->booker_class == '100') {
$this->cfg_mindaysbeforearrival = 0;
} else {
$this->cfg_mindaysbeforearrival = $mrConfig[ 'mindaysbeforearrival' ];
}
$this->cfg_defaultNumberOfFirstGuesttype = $mrConfig[ 'defaultNumberOfFirstGuesttype' ];
$this->cfg_roundupDepositYesNo = $mrConfig[ 'roundupDepositYesNo' ];
$this->cfg_chargeDepositYesNo = $mrConfig[ 'chargeDepositYesNo' ];
$this->cfg_tariffChargesStoredWeeklyYesNo = $mrConfig[ 'tariffChargesStoredWeeklyYesNo' ];
$this->cfg_fixedArrivalDatesRecurring = $mrConfig[ 'fixedArrivalDatesRecurring' ];
$this->cfg_returnRoomsLimit = $mrConfig[ 'returnRoomsLimit' ];
if (!isset($mrConfig[ 'cfg_weekenddays' ])) {
$mrConfig[ 'cfg_weekenddays' ] = '5,6';
}
$this->cfg_weekenddays = explode(',', $mrConfig[ 'weekenddays' ]);
$this->cfg_bookingform_roomlist_showroomno = $mrConfig[ 'bookingform_roomlist_showroomno' ];
$this->cfg_bookingform_roomlist_showroomname = $mrConfig[ 'bookingform_roomlist_showroomname' ];
$this->cfg_bookingform_roomlist_showdisabled = $mrConfig[ 'bookingform_roomlist_showdisabled' ];
$this->cfg_bookingform_roomlist_showmaxpeople = $mrConfig[ 'bookingform_roomlist_showmaxpeople' ];
$this->cfg_bookingform_requiredfields_name = $mrConfig[ 'bookingform_requiredfields_name' ];
$this->cfg_bookingform_requiredfields_surname = $mrConfig[ 'bookingform_requiredfields_surname' ];
$this->cfg_bookingform_requiredfields_houseno = $mrConfig[ 'bookingform_requiredfields_houseno' ];
$this->cfg_bookingform_requiredfields_street = $mrConfig[ 'bookingform_requiredfields_street' ];
$this->cfg_bookingform_requiredfields_town = $mrConfig[ 'bookingform_requiredfields_town' ];
$this->cfg_bookingform_requiredfields_postcode = $mrConfig[ 'bookingform_requiredfields_postcode' ];
$this->cfg_bookingform_requiredfields_region = $mrConfig[ 'bookingform_requiredfields_region' ];
$this->cfg_bookingform_requiredfields_country = $mrConfig[ 'bookingform_requiredfields_country' ];
$this->cfg_bookingform_requiredfields_tel = $mrConfig[ 'bookingform_requiredfields_tel' ];
$this->cfg_bookingform_requiredfields_mobile = $mrConfig[ 'bookingform_requiredfields_mobile' ];
$this->cfg_bookingform_requiredfields_email = $mrConfig[ 'bookingform_requiredfields_email' ];
$this->property_currencycode = $mrConfig[ 'property_currencycode' ];
if (!isset($mrConfig[ 'booking_form_rooms_list_style' ])) {
$mrConfig[ 'booking_form_rooms_list_style' ] = '1';
}
if (!isset($mrConfig[ 'booking_form_daily_weekly_monthly' ])) {
$mrConfig[ 'booking_form_daily_weekly_monthly' ] = 'D';
}
$this->cfg_booking_form_daily_weekly_monthly = $mrConfig[ 'booking_form_daily_weekly_monthly' ];
$amend_contract = $tmpBookingHandler->getBookingFieldVal('amend_contract');
if ($amend_contract) {
$mrConfig[ 'booking_form_rooms_list_style' ] = '1';
}
$this->cfg_booking_form_rooms_list_style = $mrConfig[ 'booking_form_rooms_list_style' ];
$mrConfig = $this->mrConfig;
$this->accommodation_tax_rate = 0.0;
if (isset($mrConfig[ 'accommodation_tax_code' ]) && (int) $mrConfig[ 'accommodation_tax_code' ] > 0) {
$jrportal_taxrate = jomres_singleton_abstract::getInstance('jrportal_taxrate');
$cfgcode = $mrConfig[ 'accommodation_tax_code' ];
$this->accommodation_tax_rate = (float) $jrportal_taxrate->taxrates[ $cfgcode ][ 'rate' ];
}
// Let's get the room, tariff, room type (class) and room feature information for this property
if (get_showtime('include_room_booking_functionality')) {
$this->getAllRoomsData();
$this->getAllTariffsData();
$this->getAllRoomFeatureDetails();
$this->getAllRoomClasses();
$this->getAllRoomFeatures();
$this->getAllBookings();
$this->getAllTaxRates();
$this->get_all_tariff_types();
$this->checkAllGuestsAllocatedToRooms();
}
$this->checkAllGuestsAllocatedToRooms();
return true;
}
/**
*Queries the database for the temporary booking data.
*/
public function getTmpBookingData()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$bookingDeets = $tmpBookingHandler->getBookingData();
if (!isset($bookingDeets[ 'show_extras' ])) {
$bookingDeets[ 'show_extras' ] = '1';
}
$this->cfg_showExtras = $bookingDeets[ 'show_extras' ];
return $bookingDeets;
}
/**
*Queries the database for the temporary booking data.
*/
public function getTmpGuestData()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$userDeets = $tmpBookingHandler->getGuestData();
return $userDeets;
}
/**
* Save the details of the booking object.
*/
public function storeBookingDetails()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$this->writeToLogfile("<font color='grey'>".serialize($tmpBookingHandler->tmpguest).'</font>');
$tmpBookingHandler->tmpguest[ 'mos_userid' ] = $this->mos_userid;
$tmpBookingHandler->tmpguest[ 'existing_id' ] = getEscaped($this->existing_id);
$tmpBookingHandler->tmpguest[ 'firstname' ] = getEscaped($this->firstname);
$tmpBookingHandler->tmpguest[ 'surname' ] = getEscaped($this->surname);
$tmpBookingHandler->tmpguest[ 'house' ] = getEscaped($this->house);
$tmpBookingHandler->tmpguest[ 'street' ] = getEscaped($this->street);
$tmpBookingHandler->tmpguest[ 'town' ] = getEscaped($this->town);
$tmpBookingHandler->tmpguest[ 'region' ] = getEscaped($this->region);
$tmpBookingHandler->tmpguest[ 'country' ] = getEscaped($this->country);
$tmpBookingHandler->tmpguest[ 'postcode' ] = getEscaped($this->postcode);
$tmpBookingHandler->tmpguest[ 'tel_landline' ] = getEscaped($this->tel_landline);
$tmpBookingHandler->tmpguest[ 'tel_mobile' ] = getEscaped($this->tel_mobile);
$tmpBookingHandler->tmpguest[ 'email' ] = getEscaped($this->email);
$tmpBookingHandler->tmpguest[ 'discount' ] = getEscaped($this->guest_specific_discount);
$tmpBookingHandler->saveGuestData();
$rr = implode(',', $this->requestedRoom);
$this->implodeVariances();
$this->writeToLogfile($this->error);
$this->error = '';
$tmpBookingHandler->tmpbooking[ 'requestedRoom' ] = $rr;
$tmpBookingHandler->tmpbooking[ 'rate_pernight' ] = $this->rate_pernight;
$tmpBookingHandler->tmpbooking[ 'variancetypes' ] = $this->vt;
$tmpBookingHandler->tmpbooking[ 'varianceuids' ] = $this->vu;
$tmpBookingHandler->tmpbooking[ 'varianceqty' ] = $this->vq;
$tmpBookingHandler->tmpbooking[ 'variancevals' ] = $this->vv;
$tmpBookingHandler->tmpbooking[ 'variancevals_nodiscount' ] = $this->vv_nodiscount;
//$tmpBookingHandler->tmpbooking["coupon_id"] = $this->coupon_id;
//$tmpBookingHandler->tmpbooking["coupon"] = $this->coupon;
$tmpBookingHandler->tmpbooking[ 'lastminute_id' ] = $this->lastminute_id;
$tmpBookingHandler->tmpbooking[ 'arrivalDate' ] = $this->arrivalDate;
$tmpBookingHandler->tmpbooking[ 'departureDate' ] = $this->departureDate;
$tmpBookingHandler->tmpbooking[ 'stayDays' ] = $this->stayDays;
$tmpBookingHandler->tmpbooking[ 'dateRangeString' ] = $this->dateRangeString;
$tmpBookingHandler->tmpbooking[ 'guests_uid' ] = $this->guests_uid;
$tmpBookingHandler->tmpbooking[ 'property_uid' ] = $this->property_uid;
$tmpBookingHandler->tmpbooking[ 'rates_uid' ] = $this->rates_uid;
$tmpBookingHandler->tmpbooking[ 'resource' ] = $this->resource;
$tmpBookingHandler->tmpbooking[ 'single_person_suppliment' ] = $this->single_person_suppliment;
$tmpBookingHandler->tmpbooking[ 'deposit_required' ] = $this->deposit_required;
$tmpBookingHandler->tmpbooking[ 'contract_total' ] = $this->contract_total;
$tmpBookingHandler->tmpbooking[ 'extrasvalue' ] = $this->extrasvalue;
$tmpBookingHandler->tmpbooking[ 'extrasvalues_items' ] = serialize($this->extrasvalues_items);
$tmpBookingHandler->tmpbooking[ 'extras' ] = $this->extras;
$tmpBookingHandler->tmpbooking[ 'extrasquantities' ] = $this->extrasquantities;
$tmpBookingHandler->tmpbooking[ 'third_party_extras' ] = serialize($this->third_party_extras);
$tmpBookingHandler->tmpbooking[ 'third_party_extras_private_data' ] = serialize($this->third_party_extras_private_data);
$tmpBookingHandler->tmpbooking[ 'room_allocations' ] = serialize($this->room_allocations);
$tmpBookingHandler->tmpbooking[ 'room_allocations_note' ] = serialize($this->room_allocations_note);
$tmpBookingHandler->tmpbooking[ 'total_discount' ] = $this->total_discount;
$tmpBookingHandler->tmpbooking[ 'depositpaidsuccessfully' ] = $this->depositpaidsuccessfully;
$tmpBookingHandler->tmpbooking[ 'tax' ] = $this->tax;
$tmpBookingHandler->tmpbooking[ 'booker_class' ] = $this->booker_class;
$tmpBookingHandler->tmpbooking[ 'ok_to_book' ] = $this->ok_to_book;
$tmpBookingHandler->tmpbooking[ 'beds_available' ] = $this->beds_available;
$tmpBookingHandler->tmpbooking[ 'referrer' ] = $this->referrer;
$tmpBookingHandler->tmpbooking[ 'error_log' ] = $this->error;
$tmpBookingHandler->tmpbooking[ 'total_in_party' ] = $this->total_in_party;
$tmpBookingHandler->tmpbooking[ 'room_total' ] = $this->room_total;
$tmpBookingHandler->tmpbooking[ 'room_total_nodiscount' ] = $this->room_total_nodiscount;
$tmpBookingHandler->tmpbooking[ 'discounts' ] = $this->discounts;
$tmpBookingHandler->tmpbooking[ 'timestamp' ] = date('Y-m-d H:i:s');
$tmpBookingHandler->tmpbooking[ 'mininterval' ] = $this->mininterval;
$tmpBookingHandler->tmpbooking[ 'coupon_id' ] = $this->coupon_id;
$tmpBookingHandler->tmpbooking[ 'coupon_code' ] = $this->coupon_code;
$tmpBookingHandler->tmpbooking[ 'coupon_details' ] = $this->coupon_details;
$tmpBookingHandler->tmpbooking[ 'coupon_discount_value' ] = $this->coupon_discount_value;
$tmpBookingHandler->tmpbooking[ 'booking_notes' ] = $this->booking_notes;
$tmpBookingHandler->tmpbooking[ 'additional_line_items' ] = serialize($this->additional_line_items);
$tmpBookingHandler->tmpbooking[ 'room_feature_filter' ] = serialize($this->room_feature_filter);
$tmpBookingHandler->tmpbooking[ 'override_room_total' ] = $this->override_room_total;
$tmpBookingHandler->tmpbooking[ 'override_deposit' ] = $this->override_deposit;
$tmpBookingHandler->tmpbooking[ 'show_extras' ] = $this->cfg_showExtras;
$tmpBookingHandler->tmpbooking[ 'property_currencycode' ] = $this->property_currencycode;
$tmpBookingHandler->tmpbooking[ 'email_address_can_be_used' ] = $this->email_address_can_be_used;
if (isset($this->thirdparty_vars)) {
$tmpBookingHandler->tmpbooking[ 'thirdparty_vars' ] = $this->thirdparty_vars;
}
//store the new search dates
$tmpBookingHandler->tmpsearch_data[ 'jomsearch_availability' ] = $this->arrivalDate;
$tmpBookingHandler->tmpsearch_data[ 'jomsearch_availability_departure' ] = $this->departureDate;
$tmpBookingHandler->saveBookingData();
}
public function getAllRoomsData()
{
$basic_room_details = jomres_singleton_abstract::getInstance('basic_room_details');
$basic_room_details->get_all_rooms($this->property_uid);
$jomres_media_centre_images = jomres_singleton_abstract::getInstance('jomres_media_centre_images');
$images = $jomres_media_centre_images->get_images($this->property_uid, array('rooms')); // Gets the rooms images
$room_images = $images [ 'rooms' ];
foreach ($basic_room_details->rooms as $r) {
$this->allPropertyRooms[ $r['room_uid'] ] = array(
'room_uid' => $r['room_uid'],
'room_classes_uid' => $r['room_classes_uid'],
'propertys_uid' => $r['propertys_uid'],
'room_features_uid' => $r['room_features_uid'],
'room_name' => $r['room_name'],
'room_number' => $r['room_number'],
'room_floor' => $r['room_floor'],
'max_people' => $r['max_people'],
'singleperson_suppliment' => $r['singleperson_suppliment'],
'small_room_image' => $room_images [ $r['room_uid'] ] [0] ['small'],
'medium_room_image' => $room_images [ $r['room_uid'] ] [0] ['medium'],
);
$this->allPropertyRoomUids[ ] = $r['room_uid'];
if (!in_array($r['room_classes_uid'], $this->allRoomClassIds)) {
$this->allRoomClassIds[ ] = $r['room_classes_uid'];
}
}
if (count($basic_room_details->all_room_features) > 0) {
$this->allFeatureIds = array_keys($basic_room_details->all_room_features);
}
}
public function getAllTariffsData()
{
$query = "SELECT `rates_uid`,`rate_title`,`rate_description`,`validfrom`,`validto`,
`roomrateperday`,`mindays`,`maxdays`,`minpeople`,`maxpeople`,`roomclass_uid`,
`ignore_pppn`,`allow_ph`,`allow_we`,`weekendonly`,`dayofweek`,`minrooms_alreadyselected`,`maxrooms_alreadyselected`
FROM #__jomres_rates WHERE property_uid = '$this->property_uid'
AND DATE_FORMAT(`validto`, '%Y/%m/%d') >= DATE_FORMAT('".$this->today."', '%Y/%m/%d')
";
$tariffs = doSelectSql($query);
//$this->setErrorLog("getAllTariffsData:: ".$query );
//$this->setErrorLog("Finding tariffs");
//$this->setErrorLog($query);
//$this->setErrorLog(serialize($tariffs) );
$interval = new DateInterval('P1D');
foreach ($tariffs as $t) {
$roomrate = $this->get_nett_price($t->roomrateperday, $this->accommodation_tax_rate);
$dates = $this->get_periods($t->validfrom, $t->validto.' 23:59:59', $interval);
$this->allPropertyTariffs[ $t->rates_uid ] = array(
'rates_uid' => $t->rates_uid,
'rate_title' => $t->rate_title,
'rate_description' => $t->rate_description,
'validfrom' => $t->validfrom,
'validto' => $t->validto,
'roomrateperday' => $roomrate,
'mindays' => $t->mindays,
'maxdays' => $t->maxdays,
'minpeople' => $t->minpeople,
'maxpeople' => $t->maxpeople,
'roomclass_uid' => $t->roomclass_uid,
'ignore_pppn' => $t->ignore_pppn,
'allow_ph' => $t->allow_ph,
'allow_we' => $t->allow_we,
'weekendonly' => $t->weekendonly,
'dayofweek' => $t->dayofweek,
'minrooms_alreadyselected' => $t->minrooms_alreadyselected,
'maxrooms_alreadyselected' => $t->maxrooms_alreadyselected,
'tariff_dates' => $dates,
);
}
}
public function getAllRoomFeatureDetails()
{
$jomres_media_centre_images = jomres_singleton_abstract::getInstance('jomres_media_centre_images');
$jomres_media_centre_images->get_images($this->property_uid, array('room_features'));
$basic_room_details = jomres_singleton_abstract::getInstance('basic_room_details');
$basic_room_details->get_all_rooms($this->property_uid);
foreach ($basic_room_details->all_room_features as $f) {
$this->allFeatureDetails[ $f['room_features_uid'] ] = array('room_features_uid' => $f['room_features_uid'], 'feature_description' => $f['feature_description'], 'image' => $f['image'], 'tooltip' => $f['tooltip']);
}
}
public function getAllRoomClasses()
{
$query = 'SELECT room_classes_uid,room_class_abbv,room_class_full_desc,image FROM #__jomres_room_classes WHERE room_classes_uid IN ('.jomres_implode($this->allRoomClassIds).') ';
$roomClasses = doSelectSql($query);
foreach ($roomClasses as $c) {
$roomtype_abbv = jr_gettext('_JOMRES_CUSTOMTEXT_ROOMTYPES_ABBV'.(int) $c->room_classes_uid, stripslashes($c->room_class_abbv), false, false);
$roomtype_desc = jr_gettext('_JOMRES_CUSTOMTEXT_ROOMTYPES_DESC'.(int) $c->room_classes_uid, stripslashes($c->room_class_full_desc), false, false);
$this->allRoomClasses[ $c->room_classes_uid ] = array('room_class_abbv' => $roomtype_abbv, 'room_class_full_desc' => $roomtype_desc, 'image' => $c->image);
}
}
public function getAllRoomFeatures()
{
$basic_room_details = jomres_singleton_abstract::getInstance('basic_room_details');
$basic_room_details->get_all_rooms($this->property_uid);
if (count($basic_room_details->all_room_features) > 0) {
foreach ($basic_room_details->all_room_features as $f) {
$this->allRoomFeatures[ $f['room_features_uid'] ] = $f['feature_description'];
}
}
}
public function getAllBookings()
{
$tmpBookingHandler = jomres_getSingleton('jomres_temp_booking_handler');
$amend_contract = $tmpBookingHandler->getBookingFieldVal('amend_contract');
$amend_contractuid = $tmpBookingHandler->getBookingFieldVal('amend_contractuid');
if (!$amend_contract) {
$query = "SELECT room_uid,date FROM #__jomres_room_bookings WHERE property_uid = '$this->property_uid' AND room_uid IN (".jomres_implode($this->allPropertyRoomUids).') ';
} else {
$query = "SELECT room_uid,date FROM #__jomres_room_bookings WHERE property_uid = '$this->property_uid' AND contract_uid != '$amend_contractuid' AND room_uid IN (".jomres_implode($this->allPropertyRoomUids).') ';
}
$bookings = doSelectSql($query);
foreach ($bookings as $c) {
//$date=str_replace("/","",$c->date);
$this->allBookings[ $c->date ][ $c->room_uid ] = array('room_uid' => $c->room_uid);
}
if (count($this->allBookings) > 0) {
ksort($this->allBookings);
}
}
public function get_all_tariff_types()
{
$mrConfig = $this->mrConfig;
$this->all_tariff_types_to_tariff_id_xref = array();
$this->all_tariff_id_to_tariff_type_xref = array();
if ($mrConfig[ 'tariffmode' ] == '2') {
$query = "SELECT tarifftype_id,tariff_id FROM #__jomcomp_tarifftype_rate_xref WHERE property_uid = '$this->property_uid'";
$tariff_type_list = doSelectSql($query);
if (count($tariff_type_list) > 0) {
foreach ($tariff_type_list as $type) {
$this->all_tariff_types_to_tariff_id_xref[ $type->tarifftype_id ][ ] = $type->tariff_id;
$this->all_tariff_id_to_tariff_type_xref[ $type->tariff_id ][ ] = $type->tarifftype_id;
}
}
}
}
public function getAllTaxRates()
{
$jrportal_taxrate = jomres_singleton_abstract::getInstance('jrportal_taxrate');
$this->taxrates = $jrportal_taxrate->taxrates;
//$this->setErrorLog( "Init found tax rates " . serialize( $this->taxrates ) );
}
public function sanitise_for_eval($string)
{
$string = str_replace('"', '\"', $string);
$string = str_replace("'", "\'", $string);
$string = trim(preg_replace('/\s+/', ' ', $string)); // strips carriage returns from strings generated through templates
return $string;
}
public function get_fullybooked_dates()
{
$fully_booked_dates = array();
$MiniComponents = jomres_getSingleton('mcHandler');
if ($MiniComponents->eventFileExistsCheck('05060')) {
$result = $MiniComponents->triggerEvent('05060', $this);
if (isset($result[ 'plugin_manages_fully_booked_dates' ]) && $result[ 'plugin_manages_fully_booked_dates' ]) {
$booked_dates = $result[ 'fully_booked_dates' ];
foreach ($booked_dates as $date) {
$tmpdate = date('Y-n-j', strtotime($date));
$fully_booked_dates[ ] = $tmpdate;
}
}
}
if (!isset($result[ 'plugin_manages_fully_booked_dates' ])) {
$total_number_of_rooms = count($this->allPropertyRooms);
foreach ($this->allBookings as $date => $bookings) {
$number_of_bookings_this_date = count($bookings);
if ($number_of_bookings_this_date == $total_number_of_rooms) {
$tmpdate = date('Y-n-j', strtotime($date));
$fully_booked_dates[ ] = $tmpdate;
}
}
$all_tariffs_are_specific_days_of_week = true;
foreach ($this->allPropertyTariffs as $tariff) {
if ($tariff[ 'dayofweek' ] == 7) {
$all_tariffs_are_specific_days_of_week = false;
}
}
if ($all_tariffs_are_specific_days_of_week) {
$days_of_week_allowed = array();
foreach ($this->allPropertyTariffs as $tariff) {
$days_of_week_allowed[ ] = $tariff[ 'dayofweek' ];
}
$days_of_week_allowed = array_unique($days_of_week_allowed);
$start = date('Y/m/d');
$end = date('Y/m/d', strtotime('+4 years'));
$dates = $this->findDateRangeForDates($start, $end);
$count = count($dates);
for ($i = 0; $i <= $count; ++$i) {
$date = $dates[ $i ];
$day_of_week_of_date = $this->getDayOfWeek($date);
if (in_array($day_of_week_of_date, $days_of_week_allowed)) {
unset($dates[ $i ]);
}
}
foreach ($dates as $d) {
$tmpdate = date('Y-n-j', strtotime($d));
$fully_booked_dates[ ] = $tmpdate;
}
}
}
return $fully_booked_dates;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Generic variant handling
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
*Sanitises the input from the ajax query.
*/
public function sanitiseInput($type, $value)
{
switch ($type) {
case 'int':
$value = (int) $value;
break;
case 'string':
$value = $this->makeStringSafe($value);
break;
case 'date':
$tmpDate = explode('/', $value);
if (count($tmpDate) != 3) {
$value = null;
}
break;
default:
$value = null;
break;
}
return $value;
}
/**
* Sanitises the output before it's sent to the form. As the third phase of the form is generated from evaluated javascript queries any ' characters etc have to be stripped out before they're returned to the booking form.
*/
public function sanitiseOutput($data)
{
//$this->error($data);
//$data=str_replace("'","\'",$data); // These two lines commented out for 4.7.8 as they were removing ' from translated/editing mode stuff such as extras.
//$data=str_replace("'","\'",$data);
//$data=htmlentities($data);
return $data;
}
/**
* Make the string escaped.
*/
public function makeStringSafe($data)
{
$data = filter_var($data, FILTER_SANITIZE_SPECIAL_CHARS);
return $data;
}
/**
* Resets the requested room array to nuthin. When the currently available rooms list is re-generated the available rooms list is completely re-calculated.
*/
public function resetRequestedRoom()
{
jr_import('jomres_roomlocks');
$room_locker = new jomres_roomlocks();
$room_locker->unlock_all_rooms_for_session();
$this->requestedRoom = array();
}
/**
* Returns whether or not error checking flag is on or off.
*/
public function errorChecking()
{
if ($this->cfg_errorChecking == '1') {
return true;
} else {
return false;
}
}
/**
* Receives debugging messages and stores them in an array $this->error.
*/
public function setErrorLog($errorText)
{
$this->error .= $errorText.' <br/> ';
}
public function setErrorLogFirst($title)
{
$this->error = '<b>'.$title.'</b><br/>'.$this->error;
}
/**
* Returns the contents of $this->error.
*/
public function getErrorLog()
{
$errorString = '';
$errorString .= htmlentities($this->error);
return $this->error;
}
public function writeToLogfile($text)
{
logging::log_message($text, 'Dobooking', 'DEBUG');
}
public function getGrowlMessages()
{
$messages = ';';
if ($this->jrConfig[ 'useJomresMessaging' ] == '1') {
if (isset($this->growlmessages[ 'messages' ]) && count($this->growlmessages[ 'messages' ]) > 0) {
foreach ($this->growlmessages[ 'messages' ] as $message) {
if ($message != '') {
$messages .= 'jomresJquery.jGrowl(\''.$message.'\', { life: 20000,sticky:true });';
}
}
}
if (isset($this->growlmessages[ 'guest_feedback' ]) && count($this->growlmessages[ 'guest_feedback' ]) > 0) {
$messages .= 'jomresJquery.jGrowl(\''.$this->growlmessages[ 'guest_feedback' ].'\', { life: 10000 });';
}
$messages = substr($messages, 0, -1);
return $messages;
} elseif (isset($this->growlmessages[ 'messages' ]) && count($this->growlmessages[ 'messages' ]) > 0) { // normal messages are useful when developing the booking engine, so even if popups are disabled by default, we still want to see messages coded by the developer.
foreach ($this->growlmessages[ 'messages' ] as $message) {
if ($message != '') {
$messages .= 'jomresJquery.jGrowl(\''.$message.'\', { life: 20000,sticky:true });';
}
}
return $messages;
}
}
public function setPopupMessage($message)
{
$msg = $this->sanitiseOutput($message);
if ($_REQUEST[ 'field' ] != 'property_uid_check') {
$this->growlmessages[ 'messages' ][ ] = $msg;
}
}
public function setGuestPopupMessage($message)
{
$msg = $this->sanitiseOutput($message);
if (isset($_REQUEST[ 'field' ]) && $_REQUEST[ 'field' ] != 'property_uid_check') {
$this->growlmessages[ 'guest_feedback' ] = $msg;
}
}
public function echo_populate_div($message)
{
if (!$this->suppress_output) {
echo $message;
}
}
/**
* Returns true if this property is an SRP.
*/
public function getSingleRoomPropertyStatus()
{
if ($this->cfg_singleRoomProperty == '1') {
return true;
} else {
return false;
}
}
/**
* Make the Optional Extras.
*/
public function makeExtras($selectedProperty)
{
$jomres_media_centre_images = jomres_singleton_abstract::getInstance('jomres_media_centre_images');
$jomres_media_centre_images->get_images($this->property_uid, array('extras'));
$mrConfig = $this->mrConfig;
$extra_details = array();
if ($mrConfig[ 'showExtras' ] == '1') {
$query = "SELECT `uid`,`name`,`desc`,`maxquantity`,`price`,`auto_select`,`tax_rate`,`chargabledaily`,`property_uid`,`published`,`validfrom`,`validto`,`limited_to_room_type` FROM `#__jomres_extras` where property_uid = '$selectedProperty' AND published = '1' ORDER BY name";
$exList = doSelectSql($query);
$selected_rooms_room_types = array();
if (count($this->requestedRoom) > 0) {
foreach ($this->requestedRoom as $rm) {
$room = explode('^', $rm);
$tariff_id = $room[ 1 ];
$booking_room_type_id = $this->allPropertyTariffs[ $tariff_id ] ['roomclass_uid'];
$selected_rooms_room_types [] = $booking_room_type_id;
}
}
foreach ($exList as $ex) {
$show_extra = true;
$arrival_ts = strtotime(str_replace('/', '-', $this->arrivalDate));
$validfrom_ts = strtotime($ex->validfrom);
$validto_ts = strtotime($ex->validto);
if ($ex->validfrom > '1970-01-01 00:00:01' && !is_null($ex->validfrom) && $ex->validfrom != '1999-11-30 00:00:00') { // takes into account older optional extras
if (!(($arrival_ts >= $validfrom_ts) && ($arrival_ts <= $validto_ts))) {
$show_extra = false;
}
}
// add checks for room types
if ((int) $ex->limited_to_room_type > 0 && count($selected_rooms_room_types) > 0) {
if (!in_array((int) $ex->limited_to_room_type, $selected_rooms_room_types)) {
$show_extra = false;
}
}
if (!$show_extra) {
$this->removeExtra($ex->uid);
} else {
$extra_deets[ 'UID' ] = $ex->uid;
$query = "SELECT `force`,`model` FROM #__jomcomp_extrasmodels_models WHERE extra_id = '$ex->uid'";
$model = doSelectSql($query, 2);
switch ($model[ 'model' ]) {
case '1': // Per week
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERWEEK', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERWEEK'));
break;
case '2': // per days
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYS', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYS'));
break;
case '3': // per booking
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERBOOKING', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERBOOKING'));
break;
case '4': // per person per booking
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERBOOKING', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERBOOKING'));
break;
case '5': // per person per day
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERDAY', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERDAY'));
break;
case '6': // per person per week
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERWEEK', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERPERSONPERWEEK'));
break;
case '7': // per person per days min days
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSMINDAYS', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSMINDAYS'));
break;
case '8': // per days per room
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSPERROOM', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERDAYSPERROOM'));
break;
case '9': // per room
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERROOMPERBOOKING', '_JOMRES_CUSTOMTEXT_EXTRAMODEL_PERROOMPERBOOKING'));
break;
case '100': // commission
$model_text = $this->sanitiseOutput(jr_gettext('_JOMRES_COMMISSION', '_JOMRES_COMMISSION'));
break;
}
$rate = (float) $this->taxrates[ $ex->tax_rate ][ 'rate' ];
if ($model[ 'model' ] != '100') { // Model 10 is commission, so it's a percentage.
$price = $ex->price;
if ($mrConfig[ 'prices_inclusive' ] == 1) {
$divisor = ($rate / 100) + 1;
$price = $price / $divisor;
}
$tax = ($price / 100) * $rate;
$inc_price = $price + $tax;
} else {
$inc_price = ($this->room_total / 100) * $ex->price;
$commission_rate = $ex->price;
}
$tax_output = '';
if ($rate > 0) {
$tax_output = ' ('.$rate.'%)';
}
$extra_deets[ 'NAME' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRANAME'.$ex->uid, jomres_decode($ex->name)));
$extra_deets[ 'MODELTEXT' ] = $tax_output.' ( '.$model_text.' )';
if ($model[ 'model' ] != '100') {
$extra_deets[ 'PRICE' ] = output_price($inc_price);
} else {
$extra_deets[ 'PRICE' ] = output_price($inc_price).' ('.$commission_rate.'%)';
}
$extra_deets[ 'EXTRA_IMAGE' ] = $jomres_media_centre_images->multi_query_images['noimage-small'];
if (isset($jomres_media_centre_images->images['extras'][$ex->uid][0]['small'])) {
$extra_deets[ 'EXTRA_IMAGE' ] = $jomres_media_centre_images->images['extras'][$ex->uid][0]['small'];
}
if ($mrConfig[ 'wholeday_booking' ] == '1') {
if ($ex->chargabledaily == '1') {
$extra_deets[ 'PERNIGHT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY', '_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY', false, true));
} else {
$extra_deets[ 'PERNIGHT' ] = '';
}
} else {
if ($ex->chargabledaily == '1') {
$extra_deets[ 'PERNIGHT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_PERDAY', '_JOMRES_COM_PERDAY', false, true));
} else {
$extra_deets[ 'PERNIGHT' ] = '';
}
}
$extra_deets[ 'DESCRIPTION' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_CUSTOMTEXT_EXTRADESC'.$ex->uid, jomres_decode($ex->desc)));
$descriptionForOverlib = jr_gettext('_JOMRES_CUSTOMTEXT_EXTRADESC'.$ex->uid, jomres_decode($ex->desc), false, true);
$extra_deets[ 'OVERLIB_DESCRIPTION' ] = $descriptionForOverlib;
$checked = '';
if ($this->extraAlreadySelected($ex->uid) || (int) $ex->auto_select == 1) {
$checked = ' checked ';
$this->setExtras($ex->uid);
$extraDefaultQuantity = $this->extrasquantities[ $ex->uid ];
} else {
$extraDefaultQuantity = 1;
}
$inputId = preg_replace('/[^A-Za-z0-9_-]+/', '', $ex->name);
if (strlen($inputId) == 0) {
$inputId = generateJomresRandomString(10);
}
$firstChar = $inputId[ 0 ]; // We'll add a simple test here to change the first char to X if the first character's actually a number, otherwise the getResponse_extras will not work.
if ($firstChar == '0' || $firstChar == '1' || $firstChar == '2' || $firstChar == '3' || $firstChar == '4' || $firstChar == '5' || $firstChar == '6' || $firstChar == '7' || $firstChar == '8' || $firstChar == '9') {
$inputId = 'X'.$inputId;
}
$clickUnlock = '';
if ($model[ 'force' ] != '1') {
$extra_deets[ 'INPUTBOX' ] = '<input id="extras_'.$ex->uid.'" type="checkbox" name="extras['.$ex->uid.']" value="'.$ex->uid.'" '.$checked.' autocomplete="off" onClick="'.$clickUnlock.'getResponse_extras(\'extras\',this.value,'.$ex->uid.');" />';
} else {
$this->forcedExtras[ ] = $ex->uid;
$this->setExtras($ex->uid);
$extra_deets[ 'INPUTBOX' ] = '<input id="extras_'.$ex->uid.'" type="checkbox" checked disabled=" " name="extras['.$ex->uid.']" value="'.$ex->uid.'" />';
}
$extra_deets[ 'FIELDNAME' ] = 'extras['.$ex->uid.']';
$extra_quantity_dropdown_disabled = ' disabled=" " ';
if ($this->extraAlreadySelected($ex->uid)) {
$extra_quantity_dropdown_disabled = ' ';
}
if ($ex->maxquantity > 1) {
$extra_deets[ 'INPUTBOX' ] =
$extra_deets[ 'INPUTBOX' ].' '.
jomresHTML::integerSelectList(01, $ex->maxquantity, 1, 'quantity'.$ex->uid, 'size="1" class="input-mini" autocomplete="off" '.$extra_quantity_dropdown_disabled.' onchange="getResponse_extrasquantity(\'extrasquantity\',this.value,'.$ex->uid.');"', $extraDefaultQuantity, '%02d', $use_bootstrap_radios = false);
}
$extra_deets[ 'AJAXFORM_EXTRAS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_EXTRAS', '_JOMRES_AJAXFORM_EXTRAS'));
$extra_deets[ 'AJAXFORM_EXTRAS_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_EXTRAS_DESC', '_JOMRES_AJAXFORM_EXTRAS_DESC', false));
$extra_deets[ 'EXTRAS_TOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_EXTRAS_TOTAL', '_JOMRES_AJAXFORM_EXTRAS_TOTAL'));
$extra_details[ ] = $extra_deets;
}
}
}
if (count($extra_details) > 0) {
$tmpl = new patTemplate();
$tmpl->setRoot(JOMRES_TEMPLATEPATH_FRONTEND);
$tmpl->addRows('extras', $extra_details);
$tmpl->readTemplatesFromInput('dobooking_extras.html');
$extras_template = $tmpl->getParsedTemplate();
} else {
$extras_template = $this->sanitiseOutput(jr_gettext('_JOMRES_EXTRAS_NOEXTRAS', '_JOMRES_EXTRAS_NOEXTRAS'));
}
return array('core_extras' => $extras_template);
}
public function makeThirdPartyExtras($selectedProperty)
{
$third_party_extras = array();
$MiniComponents = jomres_getSingleton('mcHandler');
if ($MiniComponents->eventFileExistsCheck('05030')) {
$MiniComponents->triggerEvent('05030', $this);
$mcOutput = $MiniComponents->getAllEventPointsData('05030');
if (count($mcOutput) > 0) {
foreach ($mcOutput as $key => $val) {
$tpe = array();
$tpe[ 'THIRD_PARTY_EXTRA' ] = $val;
$third_party_extras[ ] = $tpe;
}
}
}
return array('third_party_extras' => $third_party_extras);
}
/**
* Make the Output text, put them into an array for patTemplate and return the array.
*/
public function makeOutputText()
{
$mrConfig = $this->mrConfig;
$thisJRUser = jomres_getSingleton('jr_user');
$tax_output = '';
if ($this->accommodation_tax_rate > 0) {
$tax_output = ' ('.$this->accommodation_tax_rate.'%)';
}
$output = array();
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'HARRIVALDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL_WHOLEDAY', '_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL_WHOLEDAY'));
} else {
$output[ 'HARRIVALDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL', '_JOMRES_COM_MR_VIEWBOOKINGS_ARRIVAL'));
}
if ($mrConfig[ 'showdepartureinput' ] == '1') {
if ($mrConfig[ 'fixedPeriodBookings' ] == '1') {
$output[ 'HDEPARTUREDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_MR_FIXEDPRIOD1', '_JOMRES_FRONT_MR_FIXEDPRIOD1'));
} else {
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'HDEPARTUREDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE_WHOLEDAY', '_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE_WHOLEDAY'));
} else {
$output[ 'HDEPARTUREDATE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE', '_JOMRES_COM_MR_VIEWBOOKINGS_DEPARTURE'));
}
}
} else {
$output[ 'HDEPARTUREDATE' ] = ' ';
}
$output[ 'BOOKINGHEADER' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_QUICKRESDESC', '_JOMRES_COM_MR_QUICKRESDESC'));
$output[ 'ADDRESSHEADER' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_PROPERTIESLISTING_THISPROPERTYADDRESS', '_JOMRES_COM_MR_PROPERTIESLISTING_THISPROPERTYADDRESS'));
$output[ 'HEXTITLE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_MR_BOOKING_EXTRAS_HELP', '_JOMRES_FRONT_MR_BOOKING_EXTRAS_HELP'));
$output[ 'REQUIREDTEXT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_JAVASCRIPT_', '_JOMRES_JAVASCRIPT_'));
if ($mrConfig[ 'tariffChargesStoredWeeklyYesNo' ] == '0') {
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'BILLING_ROOM' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY', '_JOMRES_FRONT_TARIFFS_PN_DAY_WHOLEDAY'));
} else {
$output[ 'BILLING_ROOM' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_ROOM', '_JOMRES_AJAXFORM_BILLING_ROOM'));
}
}
$output[ 'BILLING_ROOMTOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_ROOM_TOTAL', '_JOMRES_AJAXFORM_BILLING_ROOM_TOTAL'));
if ($mrConfig[ 'showExtras' ] == '1') {
$output[ 'BILLING_EXTRAS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_EXTRAS', '_JOMRES_AJAXFORM_BILLING_EXTRAS'));
}
if (get_showtime('include_room_booking_functionality')) {
$output[ 'BILLING_TAX' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_TAX', '_JOMRES_AJAXFORM_BILLING_TAX'));
}
$output[ 'BILLING_DISCOUNT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_DISCOUNT', '_JOMRES_AJAXFORM_BILLING_DISCOUNT'));
$output[ 'BILLING_TOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_TOTAL', '_JOMRES_AJAXFORM_BILLING_TOTAL'));
if ($mrConfig[ 'chargeDepositYesNo' ] == '1') {
$output[ 'DEPOSIT' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_COM_MR_EB_PAYM_DEPOSITREQUIRED', '_JOMRES_COM_MR_EB_PAYM_DEPOSITREQUIRED'));
}
//$output['CURRENCY_SYMBOL'] =$mrConfig['currency'];
$output[ 'BILLING_TOTALINPARTY' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_BILLING_TOTALINPARTY', '_JOMRES_AJAXFORM_BILLING_TOTALINPARTY'));
$output[ 'AJAXFORM_PARTICULARS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_PARTICULARS', '_JOMRES_AJAXFORM_PARTICULARS'));
$output[ 'AJAXFORM_PARTICULARS_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_PARTICULARS_DESC', '_JOMRES_AJAXFORM_PARTICULARS_DESC'));
$output[ 'AJAXFORM_AVAILABLE' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLE', '_JOMRES_AJAXFORM_AVAILABLE'));
if ($thisJRUser->is_partner) {
$output[ 'AJAXFORM_ADDRESS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_PARTNERS_GUEST_ADDRESS', '_JOMRES_PARTNERS_GUEST_ADDRESS'));
} else {
$output[ 'AJAXFORM_ADDRESS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ADDRESS', '_JOMRES_AJAXFORM_ADDRESS'));
}
$output[ 'AJAXFORM_ADDRESS_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ADDRESS_DESC', '_JOMRES_AJAXFORM_ADDRESS_DESC', false));
$output[ 'AJAXFORM_AVAILABLEROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLEROOMS', '_JOMRES_AJAXFORM_AVAILABLEROOMS'));
$output[ 'AJAXFORM_SELECTEDROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_SELECTEDROOMS', '_JOMRES_AJAXFORM_SELECTEDROOMS', false));
if ($mrConfig[ 'singleRoomProperty' ] == '0') {
$output[ 'AJAXFORM_AVAILABLEROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLEROOMS', '_JOMRES_AJAXFORM_AVAILABLEROOMS'));
$output[ 'AJAXFORM_SELECTEDROOMS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_SELECTEDROOMS', '_JOMRES_AJAXFORM_SELECTEDROOMS', false));
$output[ 'AJAXFORM_AVAILABLE_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLE_DESC', '_JOMRES_AJAXFORM_AVAILABLE_DESC', false));
$output[ 'AJAXFORM_INSTRUCTIONS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_INSTRUCTIONS', '_JOMRES_AJAXFORM_INSTRUCTIONS'));
} else {
$output[ 'AJAXFORM_AVAILABLEROOMS' ] = '';
$output[ 'AJAXFORM_SELECTEDROOMS' ] = '';
$output[ 'AJAXFORM_AVAILABLE_DESC' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_AVAILABLE_DESC_SRP', '_JOMRES_AJAXFORM_AVAILABLE_DESC_SRP', false));
$output[ 'AJAXFORM_INSTRUCTIONS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_INSTRUCTIONS_SRP', '_JOMRES_AJAXFORM_INSTRUCTIONS_SRP'));
}
$output[ 'ACCOMMODATION_TOTAL' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_TOTAL', '_JOMRES_AJAXFORM_ACCOMMODATION_TOTAL')).$tax_output;
switch ($this->cfg_booking_form_daily_weekly_monthly) {
case 'D':
if ($mrConfig[ 'wholeday_booking' ] == '1') {
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS_WHOLEDAY', '_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS_WHOLEDAY'));
} else {
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS', '_JOMRES_AJAXFORM_ACCOMMODATION_NIGHTS'));
}
break;
case 'W':
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_WEEKS', '_JOMRES_AJAXFORM_ACCOMMODATION_WEEKS'));
break;
case 'M':
$output[ 'ACCOMMODATION_NIGHTS' ] = $this->sanitiseOutput(jr_gettext('_JOMRES_AJAXFORM_ACCOMMODATION_MONTHS', '_JOMRES_AJAXFORM_ACCOMMODATION_MONTHS'));
brea
Bovenstaande lap code bevat niet de publieke functie / methode calcDeposit en is dus niet relevant voor wat je wilt/probeert te doen.
Verder: "It is not designed to be implemented or called directly. Instead it is called by the j05000bookingobject.class.php file which inherits from this file."
Zo, subclass 'dobooking' en override 'calcDeposit'.