implement TwingleShop integration
This commit is contained in:
parent
ea46e6a747
commit
8cfa270dff
60 changed files with 5200 additions and 106 deletions
|
@ -251,6 +251,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
|
||||
// Assign template variables.
|
||||
$this->assign('op', $this->_op);
|
||||
$this->assign('twingle_use_shop', (int) Civi::settings()->get('twingle_use_shop'));
|
||||
$this->assign('profile_name', $profile_name);
|
||||
$this->assign('is_default', $is_default);
|
||||
|
||||
|
@ -354,6 +355,10 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
static::getPrefixOptions()
|
||||
);
|
||||
|
||||
// Add script and css for Twingle Shop integration
|
||||
Civi::resources()->addScriptUrl(E::url('js/twingle_shop.js'));
|
||||
Civi::resources()->addStyleFile(E::LONG_NAME, 'css/twingle_shop.css');
|
||||
|
||||
$payment_instruments = CRM_Twingle_Profile::paymentInstruments();
|
||||
$this->assign('payment_instruments', $payment_instruments);
|
||||
foreach ($payment_instruments as $pi_name => $pi_label) {
|
||||
|
@ -523,6 +528,42 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
['class' => 'crm-select2 huge', 'multiple' => 'multiple']
|
||||
);
|
||||
|
||||
if (Civi::settings()->get('twingle_use_shop')) {
|
||||
$this->add(
|
||||
'checkbox', // field type
|
||||
'enable_shop_integration', // field name
|
||||
E::ts('Enable Shop Integration'), // field label
|
||||
FALSE,
|
||||
[]
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select', // field type
|
||||
'shop_financial_type', // field name
|
||||
E::ts('Default Financial Type'), // field label
|
||||
static::getFinancialTypes(), // list of options
|
||||
TRUE,
|
||||
['class' => 'crm-select2 huge']
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select', // field type
|
||||
'shop_donation_financial_type', // field name
|
||||
E::ts('Financial Type for top up donations'), // field label
|
||||
static::getFinancialTypes(), // list of options
|
||||
TRUE,
|
||||
['class' => 'crm-select2 huge']
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'checkbox', // field type
|
||||
'shop_map_products', // field name
|
||||
E::ts('Map Products as Price Fields'), // field label
|
||||
FALSE, // is not required
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
$this->addButtons([
|
||||
[
|
||||
'type' => 'submit',
|
||||
|
@ -566,9 +607,6 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
CRM_Core_Session::setStatus($e->getMessage(), E::ts('Warning'));
|
||||
}
|
||||
}
|
||||
catch (ProfileValidationError $e) {
|
||||
$this->setElementError($e->getAffectedFieldName(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return parent::validate();
|
||||
|
@ -993,5 +1031,4 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
|||
}
|
||||
return static::$_campaigns;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue