forked from webERP-team/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SystemParameters.php
1303 lines (1164 loc) · 75.6 KB
/
SystemParameters.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
<?php
/* This script is for maintenance of the system parameters. */
include('includes/session.php');
$Title = _('System Parameters');
$ViewTopic = 'CreatingNewSystem';
$BookMark = 'SystemParameters';
include('includes/header.php');
echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme,
'/images/maintenance.png" title="', // Icon image.
$Title, '" /> ', // Icon title.
$Title, '</p>';// Page title.
include('includes/CountriesArray.php');
if (isset($_POST['submit'])) {
//initialise no input errors assumed initially before we test
$InputError = 0;
/* actions to take once the user has clicked the submit button
ie the page has called itself with some user input */
//first off validate inputs sensible
/*
Note: the X_ in the POST variables, the reason for this is to overcome globals=on replacing
the actial system/overidden variables.
*/
if (mb_strlen($_POST['X_PastDueDays1']) > 3 OR !is_numeric($_POST['X_PastDueDays1']) ) {
$InputError = 1;
prnMsg(_('First overdue deadline days must be a number'),'error');
} elseif (mb_strlen($_POST['X_PastDueDays2']) > 3 OR !is_numeric($_POST['X_PastDueDays2']) ) {
$InputError = 1;
prnMsg(_('Second overdue deadline days must be a number'),'error');
} elseif (mb_strlen($_POST['X_DefaultCreditLimit']) > 12 OR !is_numeric($_POST['X_DefaultCreditLimit']) ) {
$InputError = 1;
prnMsg(_('Default Credit Limit must be a number'),'error');
} elseif (mb_strstr($_POST['X_RomalpaClause'], "'") OR mb_strlen($_POST['X_RomalpaClause']) > 5000) {
$InputError = 1;
prnMsg(_('The Romalpa Clause may not contain single quotes and may not be longer than 5000 chars'),'error');
} elseif (mb_strlen($_POST['X_QuickEntries']) > 2 OR !is_numeric($_POST['X_QuickEntries']) OR
$_POST['X_QuickEntries'] < 1 OR $_POST['X_QuickEntries'] > 99 ) {
$InputError = 1;
prnMsg(_('No less than 1 and more than 99 Quick entries allowed'),'error');
} elseif (!is_numeric($_POST['X_MaxSerialItemsIssued']) or $_POST['X_MaxSerialItemsIssued'] < 1) {
$InputError = 1;
prnMsg(_('The maximum number of serial numbers issued must be numeric and greater than zero'), 'error');
} elseif (mb_strlen($_POST['X_FreightChargeAppliesIfLessThan']) > 12 OR !is_numeric($_POST['X_FreightChargeAppliesIfLessThan']) ) {
$InputError = 1;
prnMsg(_('Freight Charge Applies If Less Than must be a number'),'error');
} elseif ( !is_numeric($_POST['X_StandardCostDecimalPlaces']) OR
$_POST['X_StandardCostDecimalPlaces'] < 0 OR $_POST['X_StandardCostDecimalPlaces'] > 4 ) {
$InputError = 1;
prnMsg(_('Standard Cost Decimal Places must be a number between 0 and 4'),'error');
} elseif (mb_strlen($_POST['X_NumberOfPeriodsOfStockUsage']) > 2 OR !is_numeric($_POST['X_NumberOfPeriodsOfStockUsage']) OR
$_POST['X_NumberOfPeriodsOfStockUsage'] < 1 OR $_POST['X_NumberOfPeriodsOfStockUsage'] > 12 ) {
$InputError = 1;
prnMsg(_('Financial period per year must be a number between 1 and 12'),'error');
} elseif (mb_strlen($_POST['X_TaxAuthorityReferenceName']) >25) {
$InputError = 1;
prnMsg(_('The Tax Authority Reference Name must be 25 characters or less long'),'error');
} elseif (mb_strlen($_POST['X_OverChargeProportion']) > 3 OR !is_numeric($_POST['X_OverChargeProportion']) OR
$_POST['X_OverChargeProportion'] < 0 OR $_POST['X_OverChargeProportion'] > 100 ) {
$InputError = 1;
prnMsg(_('Over Charge Proportion must be a percentage'),'error');
} elseif (mb_strlen($_POST['X_OverReceiveProportion']) > 3 OR !is_numeric($_POST['X_OverReceiveProportion']) OR
$_POST['X_OverReceiveProportion'] < 0 OR $_POST['X_OverReceiveProportion'] > 100 ) {
$InputError = 1;
prnMsg(_('Over Receive Proportion must be a percentage'),'error');
} elseif (mb_strlen($_POST['X_PageLength']) > 3 OR !is_numeric($_POST['X_PageLength']) OR
$_POST['X_PageLength'] < 1 ) {
$InputError = 1;
prnMsg(_('Lines per page must be greater than 1'),'error');
} elseif (mb_strlen($_POST['X_MonthsAuditTrail']) > 2 OR !is_numeric($_POST['X_MonthsAuditTrail']) OR
$_POST['X_MonthsAuditTrail'] < 0 ) {
$InputError = 1;
prnMsg(_('The number of months of audit trail to keep must be zero or a positive number less than 100 months'),'error');
}elseif (mb_strlen($_POST['X_DefaultTaxCategory']) > 1 OR !is_numeric($_POST['X_DefaultTaxCategory']) OR
$_POST['X_DefaultTaxCategory'] < 1 ) {
$InputError = 1;
prnMsg(_('DefaultTaxCategory must be between 1 and 9'),'error');
} elseif (mb_strlen($_POST['X_DefaultDisplayRecordsMax']) > 3 OR !is_numeric($_POST['X_DefaultDisplayRecordsMax']) OR
$_POST['X_DefaultDisplayRecordsMax'] < 1 ) {
$InputError = 1;
prnMsg(_('Default maximum number of records to display must be between 1 and 500'),'error');
}elseif (mb_strlen($_POST['X_MaxImageSize']) > 3 OR !is_numeric($_POST['X_MaxImageSize']) OR
$_POST['X_MaxImageSize'] < 1 ) {
$InputError = 1;
prnMsg(_('The maximum size of item image files must be between 50 and 500 (NB this figure refers to KB)'),'error');
}elseif (!IsEmailAddress($_POST['X_FactoryManagerEmail'])){
$InputError = 1;
prnMsg(_('The Factory Manager Email address does not appear to be valid'),'error');
}elseif (!IsEmailAddress($_POST['X_PurchasingManagerEmail'])){
$InputError = 1;
prnMsg(_('The Purchasing Manager Email address does not appear to be valid'),'error');
}elseif (!IsEmailAddress($_POST['X_InventoryManagerEmail']) AND $_POST['X_InventoryManagerEmail']!=''){
$InputError = 1;
prnMsg(_('The Inventory Manager Email address does not appear to be valid'),'error');
}elseif (mb_strlen($_POST['X_FrequentlyOrderedItems']) > 2 OR !is_numeric($_POST['X_FrequentlyOrderedItems'])) {
$InputError = 1;
prnMsg(_('The number of frequently ordered items to display must be numeric'),'error');
}elseif (strlen($_POST['X_SmtpSetting']) != 1 OR !is_numeric($_POST['X_SmtpSetting'])){
$InputError = 1;
prnMsg(_('The SMTP setting should be selected as Yes or No'),'error');
}elseif (strlen($_POST['X_QualityLogSamples']) != 1 OR !is_numeric($_POST['X_QualityLogSamples'])){
$InputError = 1;
prnMsg(_('The Quality Log Samples setting should be selected as Yes or No'),'error');
} elseif (mb_strstr($_POST['X_QualityProdSpecText'], "'") OR mb_strlen($_POST['X_QualityProdSpecText']) > 5000) {
$InputError = 1;
prnMsg(_('The Quality ProdSpec Text may not contain single quotes and may not be longer than 5000 chars'),'error');
} elseif (mb_strstr($_POST['X_QualityCOAText'], "'") OR mb_strlen($_POST['X_QualityCOAText']) > 5000) {
$InputError = 1;
prnMsg(_('The Quality COA Text may not contain single quotes and may not be longer than 5000 chars'),'error');
}
if ($InputError !=1){
$sql = array();
if ($_SESSION['DefaultDateFormat'] != $_POST['X_DefaultDateFormat'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultDateFormat']."' WHERE confname = 'DefaultDateFormat'";
}
if($DefaultTheme != $_POST['X_DefaultTheme']) {// If not equal, update the default theme.
// BEGIN: Update the config.php file:
$fhandle = fopen('config.php', 'r');
if($fhandle) {
$content = fread($fhandle, filesize('config.php'));
$content = str_replace(' ;\n', ';\n', $content);// Clean space before the end-of-php-line.
$content = str_replace('\''.$DefaultTheme .'\';', '\''.$_POST['X_DefaultTheme'].'\';', $content);
$fhandle = fopen('config.php','w');
if(!fwrite($fhandle,$content)) {
prnMsg(_('Cannot write to the configuration file.'), 'error');
} else {
prnMsg(_('The configuration file was updated.'), 'info');
}
fclose($fhandle);
} else {
prnMsg(_('Cannot open the configuration file.'), 'error');
}
// END: Update the config.php file.
}
if ($_SESSION['PastDueDays1'] != $_POST['X_PastDueDays1'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_PastDueDays1']."' WHERE confname = 'PastDueDays1'";
}
if ($_SESSION['PastDueDays2'] != $_POST['X_PastDueDays2'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_PastDueDays2']."' WHERE confname = 'PastDueDays2'";
}
if ($_SESSION['DefaultCreditLimit'] != $_POST['X_DefaultCreditLimit'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultCreditLimit']."' WHERE confname = 'DefaultCreditLimit'";
}
if ($_SESSION['Show_Settled_LastMonth'] != $_POST['X_Show_Settled_LastMonth'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_Show_Settled_LastMonth']."' WHERE confname = 'Show_Settled_LastMonth'";
}
if ($_SESSION['RomalpaClause'] != $_POST['X_RomalpaClause'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_RomalpaClause'] . "' WHERE confname = 'RomalpaClause'";
}
if ($_SESSION['QuickEntries'] != $_POST['X_QuickEntries'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_QuickEntries']."' WHERE confname = 'QuickEntries'";
}
if ($_SESSION['MaxSerialItemsIssued'] != $_POST['X_MaxSerialItemsIssued']) {
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_MaxSerialItemsIssued'] . "' WHERE confname = 'MaxSerialItemsIssued'";
}
if ($_SESSION['WorkingDaysWeek'] != $_POST['X_WorkingDaysWeek'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_WorkingDaysWeek']."' WHERE confname = 'WorkingDaysWeek'";
}
if ($_SESSION['DispatchCutOffTime'] != $_POST['X_DispatchCutOffTime'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DispatchCutOffTime']."' WHERE confname = 'DispatchCutOffTime'";
}
if ($_SESSION['AllowSalesOfZeroCostItems'] != $_POST['X_AllowSalesOfZeroCostItems'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_AllowSalesOfZeroCostItems']."' WHERE confname = 'AllowSalesOfZeroCostItems'";
}
if ($_SESSION['CreditingControlledItems_MustExist'] != $_POST['X_CreditingControlledItems_MustExist'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_CreditingControlledItems_MustExist']."' WHERE confname = 'CreditingControlledItems_MustExist'";
}
if ($_SESSION['DefaultPriceList'] != $_POST['X_DefaultPriceList'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultPriceList']."' WHERE confname = 'DefaultPriceList'";
}
if ($_SESSION['Default_Shipper'] != $_POST['X_Default_Shipper'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_Default_Shipper']."' WHERE confname = 'Default_Shipper'";
}
if ($_SESSION['DoFreightCalc'] != $_POST['X_DoFreightCalc'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DoFreightCalc']."' WHERE confname = 'DoFreightCalc'";
}
if ($_SESSION['FreightChargeAppliesIfLessThan'] != $_POST['X_FreightChargeAppliesIfLessThan'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_FreightChargeAppliesIfLessThan']."' WHERE confname = 'FreightChargeAppliesIfLessThan'";
}
if ($_SESSION['DefaultTaxCategory'] != $_POST['X_DefaultTaxCategory'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultTaxCategory']."' WHERE confname = 'DefaultTaxCategory'";
}
if ($_SESSION['TaxAuthorityReferenceName'] != $_POST['X_TaxAuthorityReferenceName'] ) {
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_TaxAuthorityReferenceName'] . "' WHERE confname = 'TaxAuthorityReferenceName'";
}
if ($_SESSION['CountryOfOperation'] != $_POST['X_CountryOfOperation'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_CountryOfOperation'] ."' WHERE confname = 'CountryOfOperation'";
}
if ($_SESSION['StandardCostDecimalPlaces'] != $_POST['X_StandardCostDecimalPlaces'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_StandardCostDecimalPlaces']."' WHERE confname = 'StandardCostDecimalPlaces'";
}
if ($_SESSION['NumberOfPeriodsOfStockUsage'] != $_POST['X_NumberOfPeriodsOfStockUsage'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_NumberOfPeriodsOfStockUsage']."' WHERE confname = 'NumberOfPeriodsOfStockUsage'";
}
if ($_SESSION['Check_Qty_Charged_vs_Del_Qty'] != $_POST['X_Check_Qty_Charged_vs_Del_Qty'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_Check_Qty_Charged_vs_Del_Qty']."' WHERE confname = 'Check_Qty_Charged_vs_Del_Qty'";
}
if ($_SESSION['Check_Price_Charged_vs_Order_Price'] != $_POST['X_Check_Price_Charged_vs_Order_Price'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_Check_Price_Charged_vs_Order_Price']."' WHERE confname = 'Check_Price_Charged_vs_Order_Price'";
}
if ($_SESSION['OverChargeProportion'] != $_POST['X_OverChargeProportion'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_OverChargeProportion']."' WHERE confname = 'OverChargeProportion'";
}
if ($_SESSION['OverReceiveProportion'] != $_POST['X_OverReceiveProportion'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_OverReceiveProportion']."' WHERE confname = 'OverReceiveProportion'";
}
if ($_SESSION['PO_AllowSameItemMultipleTimes'] != $_POST['X_PO_AllowSameItemMultipleTimes'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_PO_AllowSameItemMultipleTimes']."' WHERE confname = 'PO_AllowSameItemMultipleTimes'";
}
if ($_SESSION['SO_AllowSameItemMultipleTimes'] != $_POST['X_SO_AllowSameItemMultipleTimes'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_SO_AllowSameItemMultipleTimes']."' WHERE confname = 'SO_AllowSameItemMultipleTimes'";
}
if ($_SESSION['YearEnd'] != $_POST['X_YearEnd'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_YearEnd']."' WHERE confname = 'YearEnd'";
}
if ($_SESSION['PageLength'] != $_POST['X_PageLength'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_PageLength']."' WHERE confname = 'PageLength'";
}
if ($_SESSION['DefaultDisplayRecordsMax'] != $_POST['X_DefaultDisplayRecordsMax'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultDisplayRecordsMax']."' WHERE confname = 'DefaultDisplayRecordsMax'";
}
if ($_SESSION['MaxImageSize'] != $_POST['X_MaxImageSize'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_MaxImageSize']."' WHERE confname = 'MaxImageSize'";
}
if ($_SESSION['ShowStockidOnImages'] != $_POST['X_ShowStockidOnImages'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_ShowStockidOnImages']."' WHERE confname = 'ShowStockidOnImages'";
}
//new number must be shown
if ($_SESSION['NumberOfMonthMustBeShown'] != $_POST['X_NumberOfMonthMustBeShown'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_NumberOfMonthMustBeShown']."' WHERE confname = 'NumberOfMonthMustBeShown'";
}
if ($_SESSION['part_pics_dir'] != $_POST['X_part_pics_dir'] ) {
$sql[] = "UPDATE config SET confvalue = 'companies/" . $_SESSION['DatabaseName'] . '/' . $_POST['X_part_pics_dir']."' WHERE confname = 'part_pics_dir'";
}
if ($_SESSION['reports_dir'] != $_POST['X_reports_dir'] ) {
$sql[] = "UPDATE config SET confvalue = 'companies/" . $_SESSION['DatabaseName'] . '/' . $_POST['X_reports_dir']."' WHERE confname = 'reports_dir'";
}
if ($_SESSION['AutoDebtorNo'] != $_POST['X_AutoDebtorNo'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_AutoDebtorNo'])."' WHERE confname = 'AutoDebtorNo'";
}
if ($_SESSION['AutoSupplierNo'] != $_POST['X_AutoSupplierNo'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_AutoSupplierNo'])."' WHERE confname = 'AutoSupplierNo'";
}
if ($_SESSION['HTTPS_Only'] != $_POST['X_HTTPS_Only'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_HTTPS_Only'])."' WHERE confname = 'HTTPS_Only'";
}
if ($_SESSION['DB_Maintenance'] != $_POST['X_DB_Maintenance'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_DB_Maintenance'])."' WHERE confname = 'DB_Maintenance'";
}
if ($_SESSION['DefaultBlindPackNote'] != $_POST['X_DefaultBlindPackNote'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_DefaultBlindPackNote'])."' WHERE confname = 'DefaultBlindPackNote'";
}
if ($_SESSION['ShowValueOnGRN'] != $_POST['X_ShowValueOnGRN'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_ShowValueOnGRN'])."' WHERE confname = 'ShowValueOnGRN'";
}
if ($_SESSION['PackNoteFormat'] != $_POST['X_PackNoteFormat'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_PackNoteFormat'])."' WHERE confname = 'PackNoteFormat'";
}
if ($_SESSION['CheckCreditLimits'] != $_POST['X_CheckCreditLimits'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_CheckCreditLimits'])."' WHERE confname = 'CheckCreditLimits'";
}
if ($_SESSION['WikiApp'] !== $_POST['X_WikiApp'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_WikiApp']."' WHERE confname = 'WikiApp'";
}
if ($_SESSION['WikiPath'] != $_POST['X_WikiPath'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_WikiPath']."' WHERE confname = 'WikiPath'";
}
if ($_SESSION['ProhibitJournalsToControlAccounts'] != $_POST['X_ProhibitJournalsToControlAccounts'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_ProhibitJournalsToControlAccounts']."' WHERE confname = 'ProhibitJournalsToControlAccounts'";
}
if ($_SESSION['InvoiceQuantityDefault'] != $_POST['X_InvoiceQuantityDefault'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_InvoiceQuantityDefault']."' WHERE confname = 'InvoiceQuantityDefault'";
}
if ($_SESSION['InvoicePortraitFormat'] != $_POST['X_InvoicePortraitFormat'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_InvoicePortraitFormat']."' WHERE confname = 'InvoicePortraitFormat'";
}
if ($_SESSION['AllowOrderLineItemNarrative'] != $_POST['X_AllowOrderLineItemNarrative'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_AllowOrderLineItemNarrative']."' WHERE confname = 'AllowOrderLineItemNarrative'";
}
if ($_SESSION['GoogleTranslatorAPIKey'] != $_POST['X_GoogleTranslatorAPIKey'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_GoogleTranslatorAPIKey']."' WHERE confname = 'GoogleTranslatorAPIKey'";
}
if ($_SESSION['RequirePickingNote'] != $_POST['X_RequirePickingNote'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_RequirePickingNote']."' WHERE confname = 'RequirePickingNote'";
}
if ($_SESSION['geocode_integration'] != $_POST['X_geocode_integration'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_geocode_integration']."' WHERE confname = 'geocode_integration'";
}
if ($_SESSION['Extended_SupplierInfo'] != $_POST['X_Extended_SupplierInfo'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_Extended_SupplierInfo']."' WHERE confname = 'Extended_SupplierInfo'";
}
if ($_SESSION['Extended_CustomerInfo'] != $_POST['X_Extended_CustomerInfo'] ) {
$sql[] = "UPDATE config SET confvalue = '". $_POST['X_Extended_CustomerInfo']."' WHERE confname = 'Extended_CustomerInfo'";
}
if ($_SESSION['ProhibitPostingsBefore'] != $_POST['X_ProhibitPostingsBefore'] ) {
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_ProhibitPostingsBefore']."' WHERE confname = 'ProhibitPostingsBefore'";
}
if ($_SESSION['WeightedAverageCosting'] != $_POST['X_WeightedAverageCosting'] ) {
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_WeightedAverageCosting']."' WHERE confname = 'WeightedAverageCosting'";
}
if ($_SESSION['AutoIssue'] != $_POST['X_AutoIssue']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_AutoIssue'] . "' WHERE confname='AutoIssue'";
}
if ($_SESSION['ProhibitNegativeStock'] != $_POST['X_ProhibitNegativeStock']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_ProhibitNegativeStock'] . "' WHERE confname='ProhibitNegativeStock'";
}
if ($_SESSION['MonthsAuditTrail'] != $_POST['X_MonthsAuditTrail']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_MonthsAuditTrail'] . "' WHERE confname='MonthsAuditTrail'";
}
if ($_SESSION['LogSeverity'] != $_POST['X_LogSeverity']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_LogSeverity'] . "' WHERE confname='LogSeverity'";
}
if ($_SESSION['LogPath'] != $_POST['X_LogPath']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_LogPath'] . "' WHERE confname='LogPath'";
}
if ($_SESSION['UpdateCurrencyRatesDaily'] != $_POST['X_UpdateCurrencyRatesDaily']){
if ($_POST['X_UpdateCurrencyRatesDaily']==1) {
$sql[] = "UPDATE config SET confvalue='".Date('Y-m-d')."' WHERE confname='UpdateCurrencyRatesDaily'";
} else {
$sql[] = "UPDATE config SET confvalue='0' WHERE confname='UpdateCurrencyRatesDaily'";
}
}
if ($_SESSION['ExchangeRateFeed'] != $_POST['X_ExchangeRateFeed']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_ExchangeRateFeed'] . "' WHERE confname='ExchangeRateFeed'";
}
if ($_SESSION['FactoryManagerEmail'] != $_POST['X_FactoryManagerEmail']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_FactoryManagerEmail'] . "' WHERE confname='FactoryManagerEmail'";
}
if ($_SESSION['PurchasingManagerEmail'] != $_POST['X_PurchasingManagerEmail']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_PurchasingManagerEmail'] . "' WHERE confname='PurchasingManagerEmail'";
}
if ($_SESSION['InventoryManagerEmail'] != $_POST['X_InventoryManagerEmail']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_InventoryManagerEmail'] . "' WHERE confname='InventoryManagerEmail'";
}
if ($_SESSION['AutoCreateWOs'] != $_POST['X_AutoCreateWOs']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_AutoCreateWOs'] . "' WHERE confname='AutoCreateWOs'";
}
if ($_SESSION['DefaultFactoryLocation'] != $_POST['X_DefaultFactoryLocation']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_DefaultFactoryLocation'] . "' WHERE confname='DefaultFactoryLocation'";
}
if ($_SESSION['DefineControlledOnWOEntry'] != $_POST['X_DefineControlledOnWOEntry']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_DefineControlledOnWOEntry'] . "' WHERE confname='DefineControlledOnWOEntry'";
}
if ($_SESSION['FrequentlyOrderedItems'] != $_POST['X_FrequentlyOrderedItems']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_FrequentlyOrderedItems'] . "' WHERE confname='FrequentlyOrderedItems'";
}
if ($_SESSION['AutoAuthorisePO'] != $_POST['X_AutoAuthorisePO']){
$sql[] = "UPDATE config SET confvalue='" . $_POST['X_AutoAuthorisePO'] . "' WHERE confname='AutoAuthorisePO'";
}
if (isset($_POST['X_ItemDescriptionLanguages'])) {
$ItemDescriptionLanguages = '';
foreach ($_POST['X_ItemDescriptionLanguages'] as $ItemLanguage){
$ItemDescriptionLanguages .= $ItemLanguage .',';
}
if ($_SESSION['ItemDescriptionLanguages'] != $ItemDescriptionLanguages){
$sql[] = "UPDATE config SET confvalue='" . $ItemDescriptionLanguages . "' WHERE confname='ItemDescriptionLanguages'";
}
}
if ($_SESSION['SmtpSetting'] != $_POST['X_SmtpSetting']){
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_SmtpSetting'] . "' WHERE confname='SmtpSetting'";
}
if ($_SESSION['QualityLogSamples'] != $_POST['X_QualityLogSamples']){
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_QualityLogSamples'] . "' WHERE confname='QualityLogSamples'";
}
if ($_SESSION['QualityProdSpecText'] != $_POST['X_QualityProdSpecText']){
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_QualityProdSpecText'] . "' WHERE confname='QualityProdSpecText'";
}
if ($_SESSION['QualityCOAText'] != $_POST['X_QualityCOAText']){
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_QualityCOAText'] . "' WHERE confname='QualityCOAText'";
}
if ($_SESSION['ShortcutMenu'] != $_POST['X_ShortcutMenu']){
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_ShortcutMenu'] . "' WHERE confname='ShortcutMenu'";
}
if ($_SESSION['LastDayOfWeek'] != $_POST['X_LastDayOfWeek']){
$sql[] = "UPDATE config SET confvalue = '" . $_POST['X_LastDayOfWeek'] . "' WHERE confname='LastDayOfWeek'";
}
$ErrMsg = _('The system configuration could not be updated because');
if (sizeof($sql) > 1 ) {
$result = DB_Txn_Begin();
foreach ($sql as $line) {
$result = DB_query($line,$ErrMsg);
}
$result = DB_Txn_Commit();
} elseif(sizeof($sql)==1) {
$result = DB_query($sql,$ErrMsg);
}
prnMsg( _('System configuration updated'),'success');
$ForceConfigReload = True; // Required to force a load even if stored in the session vars
include('includes/GetConfig.php');
$ForceConfigReload = False;
} else {
prnMsg( _('Validation failed') . ', ' . _('no updates or deletes took place'),'warn');
}
} /* end of if submit */
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">
<div>
<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
<table cellpadding="2" class="selection" width="98%">';
$TableHeader = '<tr>
<th>' . _('System Variable Name') . '</th>
<th>' . _('Value') . '</th>
<th>' . _('Notes') . '</th>
</tr>';
echo '<tr><th colspan="3">' . _('General Settings') . '</th></tr>';
echo $TableHeader;
// DefaultDateFormat
echo '<tr style="outline: 1px solid"><td>' . _('Default Date Format') . ':</td>
<td><select name="X_DefaultDateFormat">
<option '.(($_SESSION['DefaultDateFormat']=='d/m/Y')?'selected="selected" ':'').'value="d/m/Y">' . _('d/m/Y') . '</option>
<option '.(($_SESSION['DefaultDateFormat']=='d.m.Y')?'selected="selected" ':'').'value="d.m.Y">' . _('d.m.Y') . '</option>
<option '.(($_SESSION['DefaultDateFormat']=='m/d/Y')?'selected="selected" ':'').'value="m/d/Y">' . _('m/d/Y') . '</option>
<option '.(($_SESSION['DefaultDateFormat']=='Y/m/d')?'selected="selected" ':'').'value="Y/m/d">' . _('Y/m/d') . '</option>
<option '.(($_SESSION['DefaultDateFormat']=='Y-m-d')?'selected="selected" ':'').'value="Y-m-d">' . _('Y-m-d') . '</option>
</select></td>
<td>' . _('The default date format for entry of dates and display.') . '</td></tr>';
// DefaultTheme:
if (is_writable('config.php')) {
echo '<tr style="outline: 1px solid"><td>' . _('Default Theme') . ':</td>
<td><select name="X_DefaultTheme">';
$ThemeDirectories = scandir('css');// List directories inside ~/css. Each diretory is a theme.
foreach($ThemeDirectories as $ThemeName) {
if(is_dir('css/'.$ThemeName) AND $ThemeName!='.' AND $ThemeName!='..' AND $ThemeName!='.svn') {
echo '<option';
if ($DefaultTheme == $ThemeName) {
echo ' selected="selected"';
}
echo ' value="'. $ThemeName.'">' . $ThemeName . '</option>';
}
}
echo '</select></td>
<td>' . _("The default theme to use for the login screen and the setup of new users. The users' theme selection will override it.") . '</td>
</tr>';
} else {
echo '<input type="hidden" name="X_DefaultTheme" value="' . $DefaultTheme . '" />';
}
// ---------- New section:
echo '<tr><th colspan="3">' . _('Accounts Receivable/Payable Settings') . '</th></tr>';
// PastDueDays1
echo '<tr style="outline: 1px solid"><td>' . _('First Overdue Deadline in (days)') . ':</td>
<td><input type="text" class="integer" required="required" pattern="(?!^0\d+$)[\d]+" title="'._('The input must be integer').'" name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size="3" maxlength="3" /></td>
<td>' . _('Customer and supplier balances are displayed as overdue by this many days. This parameter is used on customer and supplier enquiry screens and aged listings') . '</td></tr>';
// PastDueDays2
echo '<tr style="outline: 1px solid"><td>' . _('Second Overdue Deadline in (days)') . ':</td>
<td><input type="text" class="integer" required="required" pattern="(?!^0\d+$)[\d]+" title="'._('The input must be integer').'" name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size="3" maxlength="3" /></td>
<td>' . _('As above but the next level of overdue') . '</td></tr>';
// DefaultCreditLimit
echo '<tr style="outline: 1px solid"><td>' . _('Default Credit Limit') . ':</td>
<td><input type="text" class="number" required="required" title="'._('The input must be numeric').'" name="X_DefaultCreditLimit" value="' . $_SESSION['DefaultCreditLimit'] . '" size="12" maxlength="12" /></td>
<td>' . _('The default used in new customer set up') . '</td></tr>';
// Check Credit Limits
echo '<tr style="outline: 1px solid"><td>' . _('Check Credit Limits') . ':</td>
<td><select name="X_CheckCreditLimits">
<option '.($_SESSION['CheckCreditLimits']==0?'selected="selected" ':'').'value="0">' . _('Do not check') . '</option>
<option '.($_SESSION['CheckCreditLimits']==1?'selected="selected" ':'').'value="1">' . _('Warn on breach') . '</option>
<option '.($_SESSION['CheckCreditLimits']==2?'selected="selected" ':'').'value="2">' . _('Prohibit Sales') . '</option>
</select></td>
<td>' . _('Credit limits can be checked at order entry to warn only or to stop the order from being entered where it would take a customer account balance over their limit') . '</td></tr>';
// Show_Settled_LastMonth
echo '<tr style="outline: 1px solid"><td>' . _('Show Settled Last Month') . ':</td>
<td><select name="X_Show_Settled_LastMonth">
<option '.($_SESSION['Show_Settled_LastMonth']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['Show_Settled_LastMonth']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('This setting refers to the format of customer statements. If the invoices and credit notes that have been paid and settled during the course of the current month should be shown then select Yes. Selecting No will only show currently outstanding invoices, credits and payments that have not been allocated') . '</td></tr>';
//RomalpaClause
echo '<tr style="outline: 1px solid"><td>' . _('Romalpa Clause') . ':</td>
<td><textarea name="X_RomalpaClause" rows="3" cols="40">' . $_SESSION['RomalpaClause'] . '</textarea></td>
<td>' . _('This text appears on invoices and credit notes in small print. Normally a reservation of title clause that gives the company rights to collect goods which have not been paid for - to give some protection for bad debts.') . '</td></tr>';
// QuickEntries
echo '<tr style="outline: 1px solid"><td>' . _('Quick Entries') . ':</td>
<td><input type="text" class="integer" required="required" pattern="[1-9][\d]{0,1}" name="X_QuickEntries" value="' . $_SESSION['QuickEntries'] . '" size="3" maxlength="2" /></td>
<td>' . _('This parameter defines the layout of the sales order entry screen. The number of fields available for quick entries. Any number from 1 to 99 can be entered.') . '</td></tr>';
// MaxSerialItemsIssued
echo '<tr style="outline: 1px solid"><td>' . _('Maximum number of serial numbered items that can be issued') . ':</td>
<td><input type="text" class="integer" name="X_MaxSerialItemsIssued" value="' . $_SESSION['MaxSerialItemsIssued'] . '" size="3" required="required" maxlength="10" /></td>
<td>' . _('This parameter defines the Maximum number of serial numbered items that can be issued. It should be an integer greater than zero.') . '</td></tr>';
// Frequently Ordered Items
echo '<tr style="outline: 1px solid"><td>' . _('Frequently Ordered Items') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0[1-9]+$)[\d]{1,2}" name="X_FrequentlyOrderedItems" value="' . $_SESSION['FrequentlyOrderedItems'] . '" size="3" maxlength="2" /></td>
<td>' . _('To show the most frequently ordered items enter the number of frequently ordered items you wish to display from 1 to 99. If you do not wish to display the frequently ordered item list enter 0.') . '</td></tr>';
// SO_AllowSameItemMultipleTimes
echo '<tr style="outline: 1px solid"><td>' . _('Sales Order Allows Same Item Multiple Times') . ':</td>
<td><select name="X_SO_AllowSameItemMultipleTimes">
<option '.($_SESSION['SO_AllowSameItemMultipleTimes']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['SO_AllowSameItemMultipleTimes']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td><td> </td></tr>';
//'AllowOrderLineItemNarrative'
echo '<tr style="outline: 1px solid">
<td>' . _('Order Entry allows Line Item Narrative') . ':</td>
<td><select name="X_AllowOrderLineItemNarrative">
<option ' . ($_SESSION['AllowOrderLineItemNarrative']=='1'?'selected="selected" ':'').'value="1">' . _('Allow Narrative Entry') . '</option>
<option ' . ($_SESSION['AllowOrderLineItemNarrative']=='0'?'selected="selected" ':'').'value="0">' . _('No Narrative Line') . '</option>
</select></td>
<td>' . _('Select whether or not to allow entry of narrative on order line items. This narrative will appear on invoices and packing slips. Useful mainly for service businesses.') . '</td>
</tr>';
//ItemDescriptionLanguages
if (!isset($_POST['X_ItemDescriptionLanguages'])){
$_POST['X_ItemDescriptionLanguages'] = explode(',',$_SESSION['ItemDescriptionLanguages']);
}
echo '<tr style="outline: 1px solid">
<td>' . _('Languages to Maintain Translations for Item Descriptions') . ':</td>
<td><select name="X_ItemDescriptionLanguages[]" size="5" multiple="multiple" >';
echo '<option value=""' . (count($LanguagesArray)==0 ? '':'selected="selected"') . '>' . _('None') . '</option>';
foreach ($LanguagesArray as $LanguageEntry => $LanguageName){
if (isset($_POST['X_ItemDescriptionLanguages']) AND in_array($LanguageEntry,$_POST['X_ItemDescriptionLanguages'])){
echo '<option selected="selected" value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] . '</option>';
} elseif ($LanguageEntry != $DefaultLanguage) {
echo '<option value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] . '</option>';
}
}
echo '</select></td>
<td>' . _('Select the languages in which translations of the item description will be maintained. The default language is excluded.') . '</td>
</tr>';
// Google Translator API Key
echo '<tr style="outline: 1px solid"><td>' . _('Google Translator API Key') . ':</td>
<td><input type="text" name="X_GoogleTranslatorAPIKey" size="25" maxlength="50" value="' . $_SESSION['GoogleTranslatorAPIKey'] . '" /></td>
<td>' . _('Google Translator API Key to allow automatic translations. More info at https://cloud.google.com/translate/') . '</td></tr>';
//'RequirePickingNote'
echo '<tr style="outline: 1px solid"><td>' . _('A picking note must be produced before an order can be delivered') . ':</td>
<td><select name="X_RequirePickingNote">
<option '.($_SESSION['RequirePickingNote']=='1'?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.($_SESSION['RequirePickingNote']=='0'?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('Select whether or not a picking note must be produced before an order can be delivered to a customer.') . '</td>
</tr>';
//UpdateCurrencyRatesDaily
echo '<tr style="outline: 1px solid"><td>' . _('Auto Update Exchange Rates Daily') . ':</td>
<td><select name="X_UpdateCurrencyRatesDaily">
<option '.($_SESSION['UpdateCurrencyRatesDaily']!='1'?'selected="selected" ':'').'value="1">' . _('Automatic') . '</option>
<option '.($_SESSION['UpdateCurrencyRatesDaily']=='0'?'selected="selected" ':'').'value="0">' . _('Manually') . '</option>
</select></td>
<td>' . _('Automatic updates to exchange rates will retrieve the latest daily rates from either the European Central Bank or Google once per day - when the first user logs in for the day. Manual will never update the rates automatically - exchange rates will need to be maintained manually') . '</td>
</tr>';
echo '<tr style="outline: 1px solid"><td>' . _('Source Exchange Rates From') . ':</td>
<td><select name="X_ExchangeRateFeed">
<option '.($_SESSION['ExchangeRateFeed']!='ECB'?'selected="selected" ':'').'value="ECB">' . _('European Central Bank') . '</option>
<option '.($_SESSION['ExchangeRateFeed']=='Google'?'selected="selected" ':'').'value="Google">' . _('Google') . '</option>
</select></td>
<td>' . _('Specify the source to use for exchange rates') . '</td>
</tr>';
//Default Packing Note Format
echo '<tr style="outline: 1px solid"><td>' . _('Format of Packing Slips') . ':</td>
<td><select name="X_PackNoteFormat">
<option '.($_SESSION['PackNoteFormat']=='1'?'selected="selected" ':'').'value="1">' . _('Laser Printed') . '</option>
<option '.($_SESSION['PackNoteFormat']=='2'?'selected="selected" ':'').'value="2">' . _('Special Stationery') . '</option>
</select></td>
<td>' . _('Choose the format that packing notes should be printed by default') . '</td>
</tr>';
//Default Invoice Format
echo '<tr style="outline: 1px solid"><td>' . _('Invoice Orientation') . ':</td>
<td><select name="X_InvoicePortraitFormat">
<option '.($_SESSION['InvoicePortraitFormat']=='0'?'selected="selected" ':'').'value="0">' . _('Landscape') . '</option>
<option '.($_SESSION['InvoicePortraitFormat']=='1'?'selected="selected" ':'').'value="1">' . _('Portrait') . '</option>
</select></td>
<td>' . _('Select the invoice layout') . '</td>
</tr>';
//Default Invoice Quantity
echo '<tr style="outline: 1px solid"><td>' . _('Invoice Quantity Default') . ':</td>
<td><select name="X_InvoiceQuantityDefault">
<option '.($_SESSION['InvoiceQuantityDefault']=='0'?'selected="selected" ':'').'value="0">0</option>
<option '.($_SESSION['InvoiceQuantityDefault']=='1'?'selected="selected" ':'').'value="1">' . _('Outstanding') . '</option>
</select></td>
<td>' . _('This setting controls the default behaviour of invoicing. Setting to 0 defaults the invocie quantity to zero to force entry. Set to outstanding to default the invoice quantity to the balance outstanding, after previous deliveries, on the sales order') . '</td>
</tr>';
//Blind packing note
echo '<tr style="outline: 1px solid"><td>' . _('Show company details on packing slips') . ':</td>
<td><select name="X_DefaultBlindPackNote">
<option '.($_SESSION['DefaultBlindPackNote']=='1'?'selected="selected" ':'').'value="1">' . _('Show Company Details') . '</option>
<option '.($_SESSION['DefaultBlindPackNote']=='2'?'selected="selected" ':'').'value="2">' . _('Hide Company Details') . '</option>
</select></td>
<td>' . _('Customer branches can be set by default not to print packing slips with the company logo and address. This is useful for companies that ship to customers customers and to show the source of the shipment would be inappropriate. There is an option on the setup of customer branches to ship blind, this setting is the default applied to all new customer branches') . '</td>
</tr>';
// Working days on a week
echo '<tr style="outline: 1px solid">
<td>' . _('Working Days on a Week') . ':</td>
<td><select name="X_WorkingDaysWeek">
<option '.($_SESSION['WorkingDaysWeek']=='7'?'selected="selected" ':'').'value="7">7 '._('working days') . '</option>
<option '.($_SESSION['WorkingDaysWeek']=='6'?'selected="selected" ':'').'value="6">6 '._('working days') . '</option>
<option '.($_SESSION['WorkingDaysWeek']=='5'?'selected="selected" ':'').'value="5">5 '._('working days') . '</option>
</select></td>
<td>' . _('Number of working days on a week') . '</td>
</tr>';
// DispatchCutOffTime
echo '<tr style="outline: 1px solid">
<td>' . _('Dispatch Cut-Off Time') . ':</td>
<td><select name="X_DispatchCutOffTime">';
for ($i=0; $i < 24; $i++ )
echo '<option '.($_SESSION['DispatchCutOffTime'] == $i?'selected="selected" ':'').'value="'.$i.'">' . $i . '</option>';
echo '</select></td>
<td>' . _('Orders entered after this time will default to be dispatched the following day, this can be over-ridden at the time of sales order entry') . '</td></tr>';
// AllowSalesOfZeroCostItems
echo '<tr style="outline: 1px solid"><td>' . _('Allow Sales Of Zero Cost Items') . ':</td>
<td><select name="X_AllowSalesOfZeroCostItems">
<option '.($_SESSION['AllowSalesOfZeroCostItems']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['AllowSalesOfZeroCostItems']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('If an item selected at order entry does not have a cost set up then if this parameter is set to No then the order line will not be able to be entered') . '</td></tr>';
// CreditingControlledItems_MustExist
echo '<tr style="outline: 1px solid"><td>' . _('Controlled Items Must Exist For Crediting') . ':</td>
<td><select name="X_CreditingControlledItems_MustExist">
<option '.($_SESSION['CreditingControlledItems_MustExist']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['CreditingControlledItems_MustExist']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('This parameter relates to the behaviour of the controlled items code. If a serial numbered item has not previously existed then a credit note for it will not be allowed if this is set to Yes') . '</td></tr>';
// DefaultPriceList
$sql = "SELECT typeabbrev, sales_type FROM salestypes ORDER BY sales_type";
$ErrMsg = _('Could not load price lists');
$result = DB_query($sql,$ErrMsg);
echo '<tr style="outline: 1px solid"><td>' . _('Default Price List') . ':</td>';
echo '<td><select name="X_DefaultPriceList">';
if( DB_num_rows($result) == 0 ) {
echo '<option selected="selected" value="">' . _('Unavailable');
} else {
while( $row = DB_fetch_array($result) ) {
echo '<option '.($_SESSION['DefaultPriceList'] == $row['typeabbrev']?'selected="selected" ':'').'value="'.$row['typeabbrev'].'">' . $row['sales_type'] . '</option>';
}
}
echo '</select></td>
<td>' . _('This price list is used as a last resort where there is no price set up for an item in the price list that the customer is set up for') . '</td></tr>';
// Default_Shipper
$sql = "SELECT shipper_id, shippername FROM shippers ORDER BY shippername";
$ErrMsg = _('Could not load shippers');
$result = DB_query($sql,$ErrMsg);
echo '<tr style="outline: 1px solid"><td>' . _('Default Shipper') . ':</td>';
echo '<td><select name="X_Default_Shipper">';
if( DB_num_rows($result) == 0 ) {
echo '<option selected="selected" value="">' . _('Unavailable') . '</option>';
} else {
while( $row = DB_fetch_array($result) ) {
echo '<option '.($_SESSION['Default_Shipper'] == $row['shipper_id']?'selected="selected" ':'').'value="'.$row['shipper_id'].'">' . $row['shippername'] . '</option>';
}
}
echo '</select></td>
<td>' . _('This shipper is used where the best shipper for a customer branch has not been defined previously') . '</td></tr>';
// DoFreightCalc
echo '<tr style="outline: 1px solid"><td>' . _('Do Freight Calculation') . ':</td>
<td><select name="X_DoFreightCalc">
<option '.($_SESSION['DoFreightCalc']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['DoFreightCalc']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('If this is set to Yes then the system will attempt to calculate the freight cost of a dispatch based on the weight and cubic and the data defined for each shipper and their rates for shipping to various locations. The results of this calculation will only be meaningful if the data is entered for the item weight and volume in the stock item setup for all items and the freight costs for each shipper properly maintained.') . '</td></tr>';
//FreightChargeAppliesIfLessThan
echo '<tr style="outline: 1px solid"><td>' . _('Apply freight charges if an order is less than') . ':</td>
<td><input type="text" class="number" required="required" title="'._('The input must be numeric').'" name="X_FreightChargeAppliesIfLessThan" size="12" maxlength="12" value="' . $_SESSION['FreightChargeAppliesIfLessThan'] . '" /></td>
<td>' . _('This parameter is only effective if Do Freight Calculation is set to Yes. If it is set to 0 then freight is always charged. The total order value is compared to this value in deciding whether or not to charge freight') . '</td></tr>';
// AutoDebtorNo
echo '<tr style="outline: 1px solid"><td>' . _('Create Debtor Codes Automatically') . ':</td>
<td><select name="X_AutoDebtorNo">';
if ($_SESSION['AutoDebtorNo']==0) {
echo '<option selected="selected" value="0">' . _('Manual Entry') . '</option>';
echo '<option value="1">' . _('Automatic') . '</option>';
} else {
echo '<option selected="selected" value="1">' . _('Automatic') . '</option>';
echo '<option value="0">' . _('Manual Entry') . '</option>';
}
echo '</select></td>
<td>' . _('Set to Automatic - customer codes are automatically created - as a sequential number') . '</td></tr>';
echo '<tr style="outline: 1px solid"><td>' . _('Create Supplier Codes Automatically') . ':</td>
<td><select name="X_AutoSupplierNo">';
if ($_SESSION['AutoSupplierNo']==0) {
echo '<option selected="selected" value="0">' . _('Manual Entry') . '</option>';
echo '<option value="1">' . _('Automatic') . '</option>';
} else {
echo '<option selected="selected" value="1">' . _('Automatic') . '</option>';
echo '<option value="0">' . _('Manual Entry') . '</option>';
}
echo '</select></td>
<td>' . _('Set to Automatic - Supplier codes are automatically created - as a sequential number') . '</td></tr>';
//==HJ== drop down list for tax category
$sql = "SELECT taxcatid, taxcatname FROM taxcategories ORDER BY taxcatname";
$ErrMsg = _('Could not load tax categories table');
$result = DB_query($sql,$ErrMsg);
echo '<tr style="outline: 1px solid"><td>' . _('Default Tax Category') . ':</td>';
echo '<td><select name="X_DefaultTaxCategory">';
if( DB_num_rows($result) == 0 ) {
echo '<option selected="selected" value="">' . _('Unavailable') . '</option>';
} else {
while( $row = DB_fetch_array($result) ) {
echo '<option '.($_SESSION['DefaultTaxCategory'] == $row['taxcatid']?'selected="selected" ':'').'value="'.$row['taxcatid'].'">' . $row['taxcatname'] . '</option>';
}
}
echo '</select></td>
<td>' . _('This is the tax category used for entry of supplier invoices and the category at which freight attracts tax') . '</td></tr>';
//TaxAuthorityReferenceName
echo '<tr style="outline: 1px solid"><td>' . _('Tax Authority Reference Name') . ':</td>
<td><input type="text" name="X_TaxAuthorityReferenceName" size="16" maxlength="25" value="' . $_SESSION['TaxAuthorityReferenceName'] . '" /></td>
<td>' . _('This parameter is what is displayed on tax invoices and credits for the tax authority of the company eg. in Australian this would by A.B.N.: - in NZ it would be GST No: in the UK it would be VAT Regn. No') . '</td></tr>';
// CountryOfOperation
echo '<tr style="outline: 1px solid"><td>' . _('Country Of Operation') . ':</td>';
echo '<td><select name="X_CountryOfOperation">';
echo '<option selected="selected" value="">' . _('Unavailable') . '</option>';
foreach ($CountriesArray as $CountryEntry => $CountryName){
echo '<option ' . ($_SESSION['CountryOfOperation'] == $CountryEntry?'selected="selected" ':'') . ' value="' . $CountryEntry . '">' . $CountryName . '</option>';
}
echo '</select></td>
<td>' . _('This parameter is only effective if Do Freight Calculation is set to Yes.') . '</td></tr>';
// StandardCostDecimalPlaces
echo '<tr style="outline: 1px solid"><td>' . _('Standard Cost Decimal Places') . ':</td>
<td><select name="X_StandardCostDecimalPlaces">';
for ($i=0; $i <= 4; $i++ )
echo '<option '.($_SESSION['StandardCostDecimalPlaces'] == $i?'selected="selected" ':'').'value="'.$i.'">' . $i . '</option>';
echo '</select></td><td>' . _('Decimal Places to be used in Standard Cost') . '</td></tr>';
// NumberOfPeriodsOfStockUsage
echo '<tr style="outline: 1px solid"><td>' . _('Number Of Periods Of StockUsage') . ':</td>
<td><select name="X_NumberOfPeriodsOfStockUsage">';
for ($i=1; $i <= 12; $i++ )
echo '<option '.($_SESSION['NumberOfPeriodsOfStockUsage'] == $i?'selected="selected" ':'').'value="'.$i.'">' . $i . '</option>';
echo '</select></td><td>' . _('In stock usage inquiries this determines how many periods of stock usage to show. An average is calculated over this many periods') . '</td></tr>';
//Show values on GRN
echo '<tr style="outline: 1px solid"><td>' . _('Show order values on GRN') . ':</td>
<td><select name="X_ShowValueOnGRN">
<option '.($_SESSION['ShowValueOnGRN']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['ShowValueOnGRN']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('Should the value of the purchased stock be shown on the GRN screen') . '</td>
</tr>';
// Check_Qty_Charged_vs_Del_Qty
echo '<tr style="outline: 1px solid"><td>' . _('Check Quantity Charged vs Deliver Qty') . ':</td>
<td><select name="X_Check_Qty_Charged_vs_Del_Qty">
<option '.($_SESSION['Check_Qty_Charged_vs_Del_Qty']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['Check_Qty_Charged_vs_Del_Qty']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('In entry of AP invoices this determines whether or not to check the quantities received into stock tie up with the quantities invoiced') . '</td></tr>';
// Check_Price_Charged_vs_Order_Price
echo '<tr style="outline: 1px solid"><td>' . _('Check Price Charged vs Order Price') . ':</td>
<td><select name="X_Check_Price_Charged_vs_Order_Price">
<option '.($_SESSION['Check_Price_Charged_vs_Order_Price']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['Check_Price_Charged_vs_Order_Price']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('In entry of AP invoices this parameter determines whether or not to check invoice prices tie up to ordered prices') . '</td></tr>';
// OverChargeProportion
echo '<tr style="outline: 1px solid"><td>' . _('Allowed Over Charge Proportion') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0\d+$)[\d]{1,2}|(100)" required="required" title="'._('The input must between 0 and 100').'" name="X_OverChargeProportion" size="4" maxlength="3" value="' . $_SESSION['OverChargeProportion'] . '" placeholder="'._('integer between 0 and 100').'" /></td>
<td>' . _('If check price charges vs Order price is set to yes then this proportion determines the percentage by which invoices can be overcharged with respect to price') . '</td></tr>';
// OverReceiveProportion
echo '<tr style="outline: 1px solid"><td>' . _('Allowed Over Receive Proportion') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0\d+$)[\d]{1,2}|(100)" required="required" title="'._('The input must between 0 and 100').'" name="X_OverReceiveProportion" size="4" maxlength="3" value="' . $_SESSION['OverReceiveProportion'] . '" /></td>
<td>' . _('If check quantity charged vs delivery quantity is set to yes then this proportion determines the percentage by which invoices can be overcharged with respect to delivery') . '</td></tr>';
// PO_AllowSameItemMultipleTimes
echo '<tr style="outline: 1px solid"><td>' . _('Purchase Order Allows Same Item Multiple Times') . ':</td>
<td><select name="X_PO_AllowSameItemMultipleTimes">
<option '.($_SESSION['PO_AllowSameItemMultipleTimes']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['PO_AllowSameItemMultipleTimes']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td><td>' . _('If a purchase order can have the same item on the order several times this parameter should be set to yes') . '</td></tr>';
// AutoAuthorisePO
echo '<tr style="outline: 1px solid"><td>' . _('Automatically authorise purchase orders if user has authority') . ':</td>
<td><select name="X_AutoAuthorisePO">
<option '.($_SESSION['AutoAuthorisePO'] ?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['AutoAuthorisePO'] ?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td><td>' . _('If the user changing an existing purchase order or adding a new puchase order is set up to authorise purchase orders and the order is within their limit, then the purchase order status is automatically set to authorised') . '</td></tr>';
echo '<tr><th colspan="3">' . _('General Settings') . '</th></tr>';
echo $TableHeader;
// YearEnd
$MonthNames = array( 1=>_('January'),
2=>_('February'),
3=>_('March'),
4=>_('April'),
5=>_('May'),
6=>_('June'),
7=>_('July'),
8=>_('August'),
9=>_('September'),
10=>_('October'),
11=>_('November'),
12=>_('December') );
echo '<tr style="outline: 1px solid"><td>' . _('Financial Year Ends On') . ':</td>
<td><select name="X_YearEnd">';
for ($i=1; $i <= sizeof($MonthNames); $i++ )
echo '<option '.($_SESSION['YearEnd'] == $i ? 'selected="selected" ' : '').'value="'.$i.'">' . $MonthNames[$i] . '</option>';
echo '</select></td>
<td>' . _('Defining the month in which the financial year ends enables the system to provide useful defaults for general ledger reports') . '</td></tr>';
//PageLength
echo '<tr style="outline: 1px solid"><td>' . _('Report Page Length') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0\d*$)[\d]{1,3}" title="'._('The input should be between 1 and 999').'" placeholder="'._('1 to 999').'" name="X_PageLength" size="4" maxlength="6" value="' . $_SESSION['PageLength'] . '" /></td><td> </td>
</tr>';
//DefaultDisplayRecordsMax
echo '<tr style="outline: 1px solid">
<td>' . _('Default Maximum Number of Records to Show') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0\d*$)[\d]{1,3}" required="required" title="'._('The records should be between 1 and 999').'" name="X_DefaultDisplayRecordsMax" size="4" maxlength="3" value="' . $_SESSION['DefaultDisplayRecordsMax'] . '" /></td>
<td>' . _('When pages have code to limit the number of returned records - such as select customer, select supplier and select item, then this will be the default number of records to show for a user who has not changed this for themselves in user settings.') . '</td>
</tr>';
// ShowStockidOnImage
echo '<tr style="outline: 1px solid">
<td>' . _('Show Stockid on images') . ':</td>
<td><select name="X_ShowStockidOnImages">
<option '.($_SESSION['ShowStockidOnImages'] ?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['ShowStockidOnImages'] ?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('Show the code inside the thumbnail image of the items') . '</td>
</tr>';
//MaxImageSize
echo '<tr style="outline: 1px solid">
<td>' . _('Maximum Size in KB of uploaded images') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0\d*$)[\d]{1,3}" required="required" title="'._('The input should be between 1 and 999').'" placeholder="'._('1 to 999').'" name="X_MaxImageSize" size="4" maxlength="3" value="' . $_SESSION['MaxImageSize'] . '" /></td>
<td>' . _('Picture files of items can be uploaded to the server. The system will check that files uploaded are less than this size (in KB) before they will be allowed to be uploaded. Large pictures will make the system slow and will be difficult to view in the stock maintenance screen.') . '</td>
</tr>';
//NumberOfMonthMustBeShown
$sql = "SELECT confvalue
FROM `config`
WHERE confname ='numberOfMonthMustBeShown'";
$ErrMsg = _('Could not load the Number Of Month Must be Shown');
$result = DB_query($sql,$ErrMsg);
$row = DB_fetch_array($result);
$_SESSION['NumberOfMonthMustBeShown'] = $row['confvalue'];
echo '<tr style="outline: 1px solid"><td>' . _('Number Of Month Must Be Shown') . ':</td>
<td><input type="text" class="integer" pattern="(?!^0\d*$)[\d]+" required="required" title="'._('input must be positive integer').'" placeholder="'._('positive integer').'" name="X_NumberOfMonthMustBeShown" size="4" maxlength="3" value="' . $_SESSION['NumberOfMonthMustBeShown'] . '" /></td>
<td>' . _('Number of month must be shown on report can be changed with this parameters ex: in CustomerInquiry.php ') . '</td>
</tr>';
//$part_pics_dir
echo '<tr style="outline: 1px solid"><td>' . _('The directory where images are stored') . ':</td>
<td><select name="X_part_pics_dir">';
$CompanyDirectory = 'companies/' . $_SESSION['DatabaseName'] . '/';
$DirHandle = dir($CompanyDirectory);
while ($DirEntry = $DirHandle->read() ){
if (is_dir($CompanyDirectory . $DirEntry)
AND $DirEntry != '..'
AND $DirEntry!='.'
AND $DirEntry!='.svn'
AND $DirEntry != 'CVS'
AND $DirEntry != 'reports'
AND $DirEntry != 'locale'
AND $DirEntry != 'fonts' ){
if ($_SESSION['part_pics_dir'] == $CompanyDirectory . $DirEntry){
echo '<option selected="selected" value="' . $DirEntry . '">' . $DirEntry . '</option>';
} else {
echo '<option value="' . $DirEntry . '">' . $DirEntry . '</option>';
}
}
}
echo '</select></td>
<td>' . _('The directory under which all image files should be stored. Image files take the format of ItemCode.jpg - they must all be .jpg files and the part code will be the name of the image file. This is named automatically on upload. The system will check to ensure that the image is a .jpg file') . '</td>
</tr>';
//$reports_dir
echo '<tr style="outline: 1px solid"><td>' . _('The directory where reports are stored') . ':</td>
<td><select name="X_reports_dir">';
$DirHandle = dir($CompanyDirectory);
while (false != ($DirEntry = $DirHandle->read())){
if (is_dir($CompanyDirectory . $DirEntry)
AND $DirEntry != '..'
AND $DirEntry != 'includes'
AND $DirEntry!='.'
AND $DirEntry!='.svn'
AND $DirEntry != 'doc'
AND $DirEntry != 'css'
AND $DirEntry != 'CVS'
AND $DirEntry != 'sql'
AND $DirEntry != 'part_pics'
AND $DirEntry != 'locale'
AND $DirEntry != 'fonts' ){
if ($_SESSION['reports_dir'] == $CompanyDirectory . $DirEntry){
echo '<option selected="selected" value="' . $DirEntry . '">' . $DirEntry . '</option>';
} else {
echo '<option value="' . $DirEntry . '">' . $DirEntry . '</option>';
}
}
}
echo '</select></td>
<td>' . _('The directory under which all report pdf files should be created in. A separate directory is recommended') . '</td>
</tr>';
// HTTPS_Only
echo '<tr style="outline: 1px solid"><td>' . _('Only allow secure socket connections') . ':</td>
<td><select name="X_HTTPS_Only">
<option '.($_SESSION['HTTPS_Only']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
<option '.(!$_SESSION['HTTPS_Only']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
</select></td>
<td>' . _('Force connections to be only over secure sockets - ie encrypted data only') . '</td>
</tr>';
/*Perform Database maintenance DB_Maintenance*/
echo '<tr style="outline: 1px solid"><td>' . _('Perform Database Maintenance At Logon') . ':</td>
<td><select name="X_DB_Maintenance">';
if ($_SESSION['DB_Maintenance']=='1'){
echo '<option selected="selected" value="1">' . _('Daily') . '</option>';
} else {
echo '<option value="1">' . _('Daily') . '</option>';
}
if ($_SESSION['DB_Maintenance']=='7'){
echo '<option selected="selected" value="7">' . _('Weekly') . '</option>';
} else {
echo '<option value="7">' . _('Weekly') . '</option>';
}
if ($_SESSION['DB_Maintenance']=='30'){
echo '<option selected="selected" value="30">' . _('Monthly') . '</option>';
} else {
echo '<option value="30">' . _('Monthly') . '</option>';
}
if ($_SESSION['DB_Maintenance']=='0'){
echo '<option selected="selected" value="0">' . _('Never') . '</option>';
} else {
echo '<option value="0">' . _('Never') . '</option>';
}
if ($_SESSION['DB_Maintenance']=='-1'){
echo '<option selected="selected" value="-1">' . _('Allow SysAdmin Access Only') . '</option>';
} else {
echo '<option value="-1">' . _('Allow SysAdmin Access Only') . '</option>';
}
echo '</select></td>
<td>' . _('Uses the function DB_Maintenance defined in ConnectDB_XXXX.inc to perform database maintenance tasks, to run at regular intervals - checked at each and every user login') . '</td>
</tr>';