Skip to content

Commit

Permalink
remove case creation from profile settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcMichalsky committed Nov 6, 2023
1 parent abde699 commit afea6f1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 123 deletions.
88 changes: 0 additions & 88 deletions CRM/Twingle/Form/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,6 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
*/
protected static $_sepaCreditors = NULL;

/**
* @var array
*
* A static cache of retrieved case types found within
* static::getCaseTypes().
*/
protected static $_caseTypes = NULL;

/**
* @var array
*
* A static cache of retrieved case status found within
* static::getCaseStatus().
*/
protected static $_caseStatus = NULL;

/**
* Builds the form structure.
*/
Expand Down Expand Up @@ -521,31 +505,6 @@ public function buildQuickForm() {
FALSE, // is not required
[]
);

$this->add(
'select', // field type
'shop_open_case', // field name
E::ts('Open Case for each order'), // field label
['' => E::ts('- none -')] + static::getCaseTypes(), // list of options
FALSE, // is not required
['class' => 'crm-select2 huge']
);

$this->add(
'text', // field type
'shop_case_subject', // field name
E::ts('Case Subject'), // field label
[]
);

$this->add(
'select', // field type
'shop_case_status', // field name
E::ts('Case Status'), // field label
['' => E::ts('- none -')] + static::getCaseStatus(), // list of options
FALSE, // is not required
['class' => 'crm-select2 huge']
);
}

$this->addButtons([
Expand Down Expand Up @@ -990,51 +949,4 @@ public static function getCampaigns() {
}
return static::$_campaigns;
}

/**
* Retrieves case types present within the system as options for select
* form elements.
*
* @return array
*
* @throws \CiviCRM_API3_Exception
*/
public static function getCaseTypes() {
if (!isset(static::$_caseTypes)) {
static::$_caseTypes = array();
$query = civicrm_api3('CaseType', 'get', array(
'option.limit' => 0,
'is_active' => 1,
'return' => 'id,title'
));
foreach ($query['values'] as $type) {
static::$_caseTypes[$type['id']] = $type['title'];
}
}
return static::$_caseTypes;
}

/**
* Retrieves case types present within the system as options for select
* form elements.
*
* @return array
*
* @throws \CiviCRM_API3_Exception
*/
public static function getCaseStatus() {
if (!isset(static::$_caseStatus)) {
static::$_caseStatus = array();
$query = civicrm_api3('OptionValue', 'get', array(
'option.limit' => 0,
'is_active' => 1,
'option_group_id' => 'case_status',
'return' => 'value,label'
));
foreach ($query['values'] as $type) {
static::$_caseStatus[$type['value']] = $type['label'];
}
}
return static::$_caseStatus;
}
}
6 changes: 0 additions & 6 deletions CRM/Twingle/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,6 @@ public static function allowedAttributes() {
'shop_financial_type',
'shop_donation_financial_type',
'shop_map_products',
'shop_open_case',
'shop_case_subject',
'shop_case_status',
],
// Add payment methods.
array_keys(static::paymentInstruments()),
Expand Down Expand Up @@ -591,9 +588,6 @@ public static function createDefaultProfile($name = 'default') {
'shop_financial_type' => 1,
'shop_donation_financial_type' => 1,
'shop_map_products' => FALSE,
'shop_open_case' => NULL,
'shop_case_subject' => NULL,
'shop_case_status' => NULL,
]
// Add contribution status for all payment methods.
+ array_fill_keys(array_map(function($attribute) {
Expand Down
14 changes: 0 additions & 14 deletions api/v3/TwingleDonation/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,20 +886,6 @@ function civicrm_api3_twingle_donation_Submit($params) {
}
}

// CASE CREATION
if (
!empty($params['products']) &&
$profile->isShopEnabled() &&
!empty($profile->getAttribute('shop_open_case'))
) {
$case = CRM_Twingle_Submission::openCase($result_values['contribution'], $profile);
$result_values['case'] = array_pop($case);

// Add contribution activity to case
$activity = CRM_Twingle_Submission::addActivityToCase($result_values['contribution'], $result_values['case']);
$result_values['activity'] = array_pop($activity);
}

$result = civicrm_api3_create_success($result_values);
}
catch (Exception $exception) {
Expand Down
15 changes: 0 additions & 15 deletions templates/CRM/Twingle/Form/Profile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,6 @@
</div>
</td>
</tr>
<tr class="crm-section twingle-shop-element">
<td class="label">{$form.shop_open_case.label}</td>
<td class="content">{$form.shop_open_case.html}</td>
</tr>
<tr class="crm-section twingle-shop-element">
<td class="label">{$form.shop_case_subject.label}</td>
<td class="content">{$form.shop_case_subject.html}</td>
</tr>
<tr class="crm-section twingle-shop-element">
<td class="label">{$form.shop_case_status.label}</td>
<td class="content">{$form.shop_case_status.html}</td>
</tr>
</table>
{/if}
Expand Down

0 comments on commit afea6f1

Please sign in to comment.