Skip to content

Commit 3bf3469

Browse files
committed
Merge pull request civicrm#25 from dpradeep/VAT-389-New
VAT-389 Resubmit the changes with some modifications.
2 parents 2a31b08 + 1be9403 commit 3bf3469

File tree

3 files changed

+64
-26
lines changed

3 files changed

+64
-26
lines changed

CRM/Admin/Form/Preferences/Contribute.php

+49-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
*
66
*/
77
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+
*/
815
function preProcess() {
916
CRM_Utils_System::setTitle(ts('CiviContribute Component Settings'));
1017
$this->_varNames = array(
@@ -31,17 +38,22 @@ function preProcess() {
3138
'html_type' => 'select',
3239
'weight' => 4,
3340
'description' => ts('Select the interval for due date.'),
34-
),
35-
'tax_display_settings'=> array(
36-
'html_type' => 'select',
37-
'weight' => 6,
38-
),
41+
),
3942
'notes' => array(
4043
'html_type' => 'textarea',
4144
'title' => ts('Notes or Standard Terms'),
4245
'weight' => 5,
4346
'description' => ts('Enter note or message to be display on PDF invoice or credit notes '),
4447
),
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+
),
4557
),
4658
);
4759
parent::preProcess();
@@ -54,23 +66,50 @@ function preProcess() {
5466
* @access public
5567
*/
5668
function buildQuickForm() {
69+
$config = CRM_Core_Config::singleton();
5770
$this->add('select', 'due_date_period', ts('For transmission'),
5871
array(
5972
'select' => ts('- select -'),
6073
'days' => ts('Days'),
61-
'months' => ts('months'),
62-
'years' => ts('years')
74+
'months' => ts('Months'),
75+
'years' => ts('Years')
6376
)
6477
);
6578
$this->add('select','tax_display_settings', ts('Tax Display Settings'),
6679
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]')
7083
)
7184
);
7285
parent::buildQuickForm();
7386
}
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+
}
74113
}
75114

76115

CRM/Contribute/BAO/Contribution.php

-15
Original file line numberDiff line numberDiff line change
@@ -3389,19 +3389,4 @@ static function getPaymentInfo($id, $component, $getTrxnInfo = FALSE, $usingLine
33893389
}
33903390
return $info;
33913391
}
3392-
3393-
/**
3394-
* Function to retreive the admin page data for contribution
3395-
*
3396-
*/
3397-
static function getContributionSettings() {
3398-
$fields = array('invoice_prefix','due_date','due_date_period','notes','credit_notes_prefix','tax_display_settings');
3399-
foreach ($fields as $values) {
3400-
$fieldName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Setting',$values, 'value','name');
3401-
if (preg_match('/"([^"]+)"/', $fieldName, $fieldData)) {
3402-
$fieldValue[$values] = $fieldData[1];
3403-
}
3404-
}
3405-
return $fieldValue;
3406-
}
34073392
}

CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl

+15-1
Original file line numberDiff line numberDiff line change
@@ -530,4 +530,18 @@ VALUES
530530

531531
-- Add new column tax_amount in contribution and lineitem table
532532
ALTER TABLE `civicrm_contribution` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'Total tax amount of this contribution.';
533-
ALTER TABLE `civicrm_line_item` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'tax of each item';
533+
ALTER TABLE `civicrm_line_item` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'tax of each item';
534+
535+
-- Insert menu item at Administer > CiviContribute, below the Payment Processors.
536+
SELECT @parent_id := id from `civicrm_navigation` where name = 'CiviContribute' AND domain_id = {$domainID};
537+
SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Payment Processors' and `parent_id` = @parent_id;
538+
539+
UPDATE `civicrm_navigation`
540+
SET `weight` = `weight`+1
541+
WHERE `parent_id` = @parent_id
542+
AND `weight` > @add_weight_id;
543+
544+
INSERT INTO `civicrm_navigation`
545+
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
546+
VALUES
547+
( {$domainID}, 'civicrm/admin/setting/preferences/contribute', '{ts escape="sql" skip="true"}CiviContribute Component Settings{/ts}', 'CiviContribute Component Settings', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight_id + 1 );

0 commit comments

Comments
 (0)