forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 0
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 civicrm#27496 from eileenmcnaughton/activity_view
Fix activity view bug where an activity type id in the url overrides …
- Loading branch information
Showing
9 changed files
with
135 additions
and
61 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
use Civi\API\EntityLookupTrait; | ||
|
||
/** | ||
* Trait implements functions to retrieve activity related values. | ||
*/ | ||
trait CRM_Activity_Form_ActivityFormTrait { | ||
|
||
use EntityLookupTrait; | ||
|
||
/** | ||
* Get the value for a field relating to the activity. | ||
* | ||
* All values returned in apiv4 format. Escaping may be required. | ||
* | ||
* @api This function will not change in a minor release and is supported for | ||
* use outside of core. This annotation / external support for properties | ||
* is only given where there is specific test cover. | ||
* | ||
* @param string $fieldName | ||
* | ||
* @return mixed | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
public function getActivityValue(string $fieldName) { | ||
if ($this->isDefined('Activity')) { | ||
return $this->lookup('Activity', $fieldName); | ||
} | ||
$id = $this->getActivityID(); | ||
if ($id) { | ||
$this->define('Activity', 'Activity', ['id' => $id]); | ||
return $this->lookup('Activity', $fieldName); | ||
} | ||
return NULL; | ||
} | ||
|
||
/** | ||
* Get the selected Activity ID. | ||
* | ||
* @api This function will not change in a minor release and is supported for | ||
* use outside of core. This annotation / external support for properties | ||
* is only given where there is specific test cover. | ||
* | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
public function getActivityID(): ?int { | ||
throw new CRM_Core_Exception('`getActivityID` must be implemented'); | ||
} | ||
|
||
} |
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
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
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
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