Skip to content

Commit

Permalink
Merge pull request civicrm#5 from rohankatkar/VAT-389
Browse files Browse the repository at this point in the history
VAT-389 Added form for CiviContribute Component Settings
  • Loading branch information
kurund committed May 22, 2014
2 parents 042cbb6 + 9d4da08 commit dbe4bf6
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 1 deletion.
77 changes: 77 additions & 0 deletions CRM/Admin/Form/Preferences/Contribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

/**
* This class generates form components for the display preferences
*
*/
class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviContribute Component Settings'));
$this->_varNames = array(
CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME =>
array(
'invoice_prefix' => array(
'html_type' => 'text',
'title' => ts('Invoice Prefix'),
'weight' => 1,
'description' => ts('Enter prefix to be display on PDF for invoice'),
),
'credit_notes_prefix' => array(
'html_type' => 'text',
'title' => ts('Credit Notes Prefix'),
'weight' => 2,
'description' => ts('Enter prefix to be display on PDF for credit notes.'),
),
'due_date' => array(
'html_type' => 'text',
'title' => ts('Due Date'),
'weight' => 3,
),
'due_date_period' => array(
'html_type' => 'select',
'weight' => 4,
'description' => ts('Select the interval for due date.'),
),
'tax_display_settings'=> array(
'html_type' => 'select',
'weight' => 6,
),
'notes' => array(
'html_type' => 'textarea',
'title' => ts('Notes or Standard Terms'),
'weight' => 5,
'description' => ts('Enter note or message to be display on PDF invoice or credit notes '),
),
),
);
parent::preProcess();
}

/**
* Function to build the form
*
* @return void
* @access public
*/
function buildQuickForm() {
$this->add('select', 'due_date_period', ts('For transmission'),
array(
'select' => ts('- select -'),
'days' => ts('Days'),
'months' => ts('months'),
'years' => ts('years')
)
);
$this->add('select','tax_display_settings', ts('Tax Display Settings'),
array(
'Do_not_show' => ts('Do not show brakedown, only show total -i.e $120.00'),
'Inclusive' => ts('Show VAT inclusive price - i.e. $120.00(include TAX LABLE -$20)'),
'Exclusive' => ts('Show VAT exclusive price - i.e. $100 + TAX LABLE -$20)')
)
);
parent::buildQuickForm();
}
}



15 changes: 15 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3368,4 +3368,19 @@ static function getPaymentInfo($id, $component, $getTrxnInfo = FALSE, $usingLine
}
return $info;
}

/**
* Function to retreive the admin page data for contribution
*
*/
static function getContributionSettings() {
$fields = array('invoice_prefix','due_date','due_date_period','notes','credit_notes_prefix','tax_display_settings');
foreach ($fields as $values) {
$fieldName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Setting',$values, 'value','name');
if (preg_match('/"([^"]+)"/', $fieldName, $fieldData)) {
$fieldValue[$values] = $fieldData[1];
}
}
return $fieldValue;
}
}
8 changes: 8 additions & 0 deletions CRM/Contribute/xml/Menu/Contribute.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,12 @@
<page_type>1</page_type>
<component>CiviContribute</component>
</item>
<item>
<path>civicrm/admin/setting/preferences/contribute</path>
<title>CiviContribute Component Settings</title>
<page_callback>CRM_Admin_Form_Preferences_Contribute</page_callback>
<desc>Configure global CiviContribute behaviors.</desc>
<access_arguments>access CiviContribute,administer CiviCRM</access_arguments>
<adminGroup>CiviContribute</adminGroup>
</item>
</menu>
26 changes: 26 additions & 0 deletions templates/CRM/Admin/Form/Preferences/Contribute.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.5 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{include file="CRM/Form/basicForm.tpl"}
3 changes: 2 additions & 1 deletion xml/templates/civicrm_navigation.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ VALUES
( @domainID, 'civicrm/admin/options/soft_credit_type?reset=1', '{ts escape="sql" skip="true"}Soft Credit Types{/ts}', 'Soft Credit Types', 'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', 1, 14 ),
( @domainID, 'civicrm/admin/price?reset=1&action=add', '{ts escape="sql" skip="true"}New Price Set{/ts}', 'New Price Set', 'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 15 ),
( @domainID, 'civicrm/admin/price?reset=1', '{ts escape="sql" skip="true"}Manage Price Sets{/ts}', 'Manage Price Sets', 'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 16 ),
( @domainID, 'civicrm/admin/paymentProcessor?reset=1', '{ts escape="sql" skip="true"}Payment Processors{/ts}', 'Payment Processors', 'administer CiviCRM', '', @adminContributelastID, '1', NULL, 17 );
( @domainID, 'civicrm/admin/paymentProcessor?reset=1', '{ts escape="sql" skip="true"}Payment Processors{/ts}', 'Payment Processors', 'administer CiviCRM', '', @adminContributelastID, '1', NULL, 17 ),
( @domainID, 'civicrm/admin/setting/preferences/contribute', '{ts escape="sql" skip="true"}CiviContribute Component Settings{/ts}', 'CiviContribute Component Settings', 'administer CiviCRM', '', @adminContributelastID, '1', NULL, 18 ) ;

INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
Expand Down

0 comments on commit dbe4bf6

Please sign in to comment.