5
5
*
6
6
*/
7
7
class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
8
+ /**
9
+ * Function to process the form
10
+ *
11
+ * @access public
12
+ *
13
+ * @return void
14
+ */
8
15
function preProcess () {
9
16
CRM_Utils_System::setTitle (ts ('CiviContribute Component Settings ' ));
10
17
$ this ->_varNames = array (
@@ -31,17 +38,22 @@ function preProcess() {
31
38
'html_type ' => 'select ' ,
32
39
'weight ' => 4 ,
33
40
'description ' => ts ('Select the interval for due date. ' ),
34
- ),
35
- 'tax_display_settings ' => array (
36
- 'html_type ' => 'select ' ,
37
- 'weight ' => 6 ,
38
- ),
41
+ ),
39
42
'notes ' => array (
40
43
'html_type ' => 'textarea ' ,
41
44
'title ' => ts ('Notes or Standard Terms ' ),
42
45
'weight ' => 5 ,
43
46
'description ' => ts ('Enter note or message to be display on PDF invoice or credit notes ' ),
44
47
),
48
+ 'tax_term ' => array (
49
+ 'html_type ' => 'text ' ,
50
+ 'title ' => ts ('Tax Term ' ),
51
+ 'weight ' => 6 ,
52
+ ),
53
+ 'tax_display_settings ' => array (
54
+ 'html_type ' => 'select ' ,
55
+ 'weight ' => 7 ,
56
+ ),
45
57
),
46
58
);
47
59
parent ::preProcess ();
@@ -54,23 +66,50 @@ function preProcess() {
54
66
* @access public
55
67
*/
56
68
function buildQuickForm () {
69
+ $ config = CRM_Core_Config::singleton ();
57
70
$ this ->add ('select ' , 'due_date_period ' , ts ('For transmission ' ),
58
71
array (
59
72
'select ' => ts ('- select - ' ),
60
73
'days ' => ts ('Days ' ),
61
- 'months ' => ts ('months ' ),
62
- 'years ' => ts ('years ' )
74
+ 'months ' => ts ('Months ' ),
75
+ 'years ' => ts ('Years ' )
63
76
)
64
77
);
65
78
$ this ->add ('select ' ,'tax_display_settings ' , ts ('Tax Display Settings ' ),
66
79
array (
67
- 'Do_not_show ' => ts ('Do not show brakedown, only show total -i.e $ 120.00 ' ),
68
- 'Inclusive ' => ts ('Show VAT inclusive price - i.e. $ 120.00(include TAX LABLE -$20 ) ' ),
69
- 'Exclusive ' => ts ('Show VAT exclusive price - i.e. $ 100 + TAX LABLE -$20) ' )
80
+ 'Do_not_show ' => ts ('Do not show brakedown, only show total -i.e ' . $ config -> defaultCurrencySymbol . ' 120.00 ' ),
81
+ 'Inclusive ' => ts ('Show [tax term] inclusive price - i.e. ' . $ config -> defaultCurrencySymbol . ' 120.00 (includes [tax term] of ' . $ config -> defaultCurrencySymbol . ' 20.00 ) ' ),
82
+ 'Exclusive ' => ts ('Show [tax term] exclusive price - i.e. ' . $ config -> defaultCurrencySymbol . ' 100.00 + ' . $ config -> defaultCurrencySymbol . ' 20.00 [tax term] ' )
70
83
)
71
84
);
72
85
parent ::buildQuickForm ();
73
86
}
87
+
88
+ /**
89
+ * This function sets the default values for the form.
90
+ * default values are retrieved from the database
91
+ *
92
+ * @access public
93
+ *
94
+ * @return void
95
+ */
96
+ function setDefaultValues () {
97
+ $ defaults = CRM_Core_BAO_Setting::getItem (CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME ,'contribution_invoice_settings ' );
98
+ return $ defaults ;
99
+ }
100
+
101
+ /**
102
+ * process the form after the input has been submitted and validated
103
+ *
104
+ * @access public
105
+ *
106
+ * @return void
107
+ */
108
+ public function postProcess () {
109
+ // store the submitted values in an array
110
+ $ params = $ this ->controller ->exportValues ($ this ->_name );
111
+ $ setInvoiceSettings = CRM_Core_BAO_Setting::setItem ($ params , CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME , 'contribution_invoice_settings ' );
112
+ }
74
113
}
75
114
76
115
0 commit comments