forked from civicrm/org.civicrm.civicase
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1002 from compucorp/BTHAB-158-invoice-fixes
BTHAB-158 Invoice list Fixes
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
CRM/Civicase/Hook/BuildForm/RefreshInvoiceListOnUpdate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/** | ||
* Refresh the invoice list upon updating an invoice. | ||
*/ | ||
class CRM_Civicase_Hook_BuildForm_RefreshInvoiceListOnUpdate { | ||
|
||
/** | ||
* Refresh the invoice list upon updating an invoice. | ||
* | ||
* @param CRM_Core_Form $form | ||
* Form Class object. | ||
* @param string $formName | ||
* Form Name. | ||
*/ | ||
public function run(CRM_Core_Form &$form, $formName) { | ||
if (!$this->shouldRun($form, $formName)) { | ||
return; | ||
} | ||
|
||
CRM_Core_Resources::singleton()->addScript( | ||
"CRM.$(function($) { | ||
$(\"a[target='crm-popup']\").on('crmPopupFormSuccess', function (e) { | ||
CRM.refreshParent(e); | ||
}); | ||
}); | ||
"); | ||
} | ||
|
||
/** | ||
* Determines if the hook will run. | ||
* | ||
* @param CRM_Core_Form $form | ||
* Form Class object. | ||
* @param string $formName | ||
* Form Name. | ||
* | ||
* @return bool | ||
* TRUE if the hook should run, FALSE otherwise. | ||
*/ | ||
private function shouldRun($form, $formName) { | ||
if ($formName !== 'CRM_Contribute_Form_Contribution' || $form->getAction() !== CRM_Core_Action::UPDATE || !isset($_GET['snippet'])) { | ||
return FALSE; | ||
} | ||
|
||
return TRUE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters