Skip to content

Commit

Permalink
Fix missing Pay now link
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Nov 21, 2018
1 parent 97724d9 commit 68d5841
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/SettingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected function addFieldsDefinedInSettingsMetadata() {
$this->$add($setting, ts($props['title']), $options);
}
// Migrate to using an array as easier in smart...
$descriptions[$setting] = ts($props['description']);
$descriptions[$setting] = CRM_Utils_Array::value('description', $props);
$this->assign("{$setting}_description", ts($props['description']));
if ($setting == 'max_attachments') {
//temp hack @todo fix to get from metadata
Expand Down
4 changes: 1 addition & 3 deletions CRM/Contribute/Page/UserDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ public function listContribution() {
* loads, it decides the which action has to be taken for the page.
*/
public function run() {
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
$defaultInvoicePage = CRM_Utils_Array::value('default_invoice_page', $invoiceSettings);
$this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled());
$this->assign('defaultInvoicePage', $defaultInvoicePage);
$this->assign('defaultInvoicePage', CRM_Invoicing_Utils::getDefaultPaymentPage());
parent::preProcess();
$this->listContribution();
}
Expand Down
19 changes: 18 additions & 1 deletion CRM/Invoicing/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function onToggle($oldValue, $newValue, $metadata) {
* set within contribution_invoice_settings (which stores multiple settings
* as an array in a non-standard way).
*
* We check both here.
* We check both here. But will deprecate the latter in time.
*/
public static function isInvoicingEnabled() {
if (Civi::settings()->get('invoicing')) {
Expand All @@ -76,4 +76,21 @@ public static function isInvoicingEnabled() {
return CRM_Utils_Array::value('invoicing', $invoiceSettings);
}

/**
* Function to call to determine default invoice page.
*
* Historically the invoicing was declared as a setting but actually
* set within contribution_invoice_settings (which stores multiple settings
* as an array in a non-standard way).
*
* We check both here. But will deprecate the latter in time.
*/
public static function getDefaultPaymentPage() {
if (($value = Civi::settings()->get('default_invoice_page') !== FALSE)) {
return $value;
}
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
return CRM_Utils_Array::value('default_invoice_page', $invoiceSettings);
}

}

0 comments on commit 68d5841

Please sign in to comment.