Skip to content

Commit

Permalink
COMCL-706: Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Shahrukh committed Aug 9, 2024
1 parent 44e9918 commit 6e3a562
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ jobs:
run: |
FILE_PATH="$GITHUB_WORKSPACE/site/web/sites/default/civicrm.settings.php"
INSERT_LINE="\$GLOBALS['_CV']['TEST_DB_DSN'] = 'mysql://root:root@mysql:3306/civicrm_test?new_link=true';"
INSERT_LINE_SECOND="\define('CIVICRM_TEMPLATE_COMPILE_CHECK', TRUE);"
TMP_FILE=$(mktemp)
while IFS= read -r line
do
echo "$line" >> "$TMP_FILE"
if [ "$line" = "<?php" ]; then
echo "$INSERT_LINE" >> "$TMP_FILE"
fi
if [ "$line" = "define('CIVICRM_TEMPLATE_COMPILE_CHECK', false);" ]; then
echo "$INSERT_LINE_SECOND" >> "$TMP_FILE"
fi
done < "$FILE_PATH"
mv "$TMP_FILE" "$FILE_PATH"
echo "File modified successfully."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Class CRM_Civicase_Hook_BuildForm_EnableCaseCategoryIconField.
* Shows the icon field for case category option value.
*/
class CRM_Civicase_Hook_BuildForm_EnableCaseCategoryIconField {

Expand Down
4 changes: 1 addition & 3 deletions CRM/Civicase/Hook/CaseCategoryFormHookBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ class CRM_Civicase_Hook_CaseCategoryFormHookBase {
* True if the form is right.
*/
protected function isCaseTypeCategoriesForm(CRM_Core_Form $form, $formName) {
$optionGroupName = $form->getVar('_gName');

return $formName == CRM_Admin_Form_Options::class
&& $optionGroupName == 'case_type_categories';
&& $form->getVar('_gName') == 'case_type_categories';
}

/**
Expand Down
3 changes: 1 addition & 2 deletions CRM/Civicase/Hook/PostProcess/CaseCategoryPostProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public function run($formName, CRM_Core_Form &$form) {
* returns TRUE or FALSE.
*/
private function shouldRun(CRM_Core_Form $form, $formName) {
$optionGroupName = $form->getVar('_gName');
return $formName == 'CRM_Admin_Form_Options' && $optionGroupName == 'case_type_categories';
return $formName == 'CRM_Admin_Form_Options' && $form->getVar('_gName') == 'case_type_categories';
}

}
7 changes: 7 additions & 0 deletions CRM/Civicase/Hook/ValidateForm/SendBulkEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ private function sendEmailForCase(CRM_Case_Form_Task_Email $form, int $caseId, a

$data['values']['Email']['to'] = implode(',', $toContactEmails);

$allEmails = explode(',', $data['values']['Email']['to']);
foreach ($allEmails as $value) {
$values = explode('::', $value);
print_r($values);
}
print_r($form->exportValues());

$form->submit($form->exportValues());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ private function runHook(string $subject, string $body, array $cases, array $con
$this->form->_contactDetails = [];
foreach ($contacts as $k => $contact) {
$this->form->_contactIds[] = $contact['id'];
$this->form->_toContactEmails[] = $k . '::' . $contact['email'];
$this->form->_toContactEmails[] = $contact['email'];
$this->form->_contactDetails[$contact['id']] = [
'email' => $contact['email'],
'contact_id' => $contact['id'],
'preferred_mail_format' => 'HTML',
];
$formValues['to'][$contact['id']] = $contact['id'] . '::' . $contact['email'];
$formValues['to'][$contact['id'] ?? $k] = ($contact['id'] ?? $k) . '::' . $contact['email'];
}
$formValues['to'] = implode(',', $formValues['to']);

Expand Down

0 comments on commit 6e3a562

Please sign in to comment.