Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • extensions/dataprocessor
  • sarvesh21/dataprocessor
  • mattwire/dataprocessor
  • VangelisP/dataprocessor
  • artfulrobot/dataprocessor
  • kainuk/dataprocessor
  • michaelmcandrew/dataprocessor
  • ufundo/dataprocessor
  • ayduns/dataprocessor
  • FoadYousefi/dataprocessor
  • erikbrouwer/dataprocessor
  • dave/dataprocessor
  • ananelson/dataprocessor
  • seamuslee/dataprocessor
  • chamilwijesooriya/dataprocessor
  • marcusm/dataprocessor
  • homotechsual/dataprocessor
  • justinfreeman/dataprocessor
  • JonGold/dataprocessor
  • totten/dataprocessor
  • TheSmammy/dataprocessor
  • kcristiano/dataprocessor
  • DaveD/dataprocessor
  • sebalis/dataprocessor
  • simon.hermann/dataprocessor
  • davej/dataprocessor
  • colemanw/dataprocessor
  • gngn/dataprocessor
  • david124136468769/dataprocessor
29 results
Show changes
Commits on Source (1168)
Showing
with 2345 additions and 573 deletions
# Master version (in development)
# Version 1.121 (not yet released)
* Respect selected permissions for outputs
* Moved the Smart Group functionality to its own extension (shipped with data processor). So we can set the requirement for legacy searches extension.
# Version 1.120
* Show only one date when both dates are the same day. See !129
* Fix for combining data processor and the donrec extension.
# Version 1.119
* Added Is Exposed to Field Output Handlers.
* Added Fallback Field Output Handler.
* Added Rewrite with Tokens Field Output Handler.
# Version 1.118
* Fixed issues with Aggregated Contribution data source
* Added extra filtes to data sources, such as a filter for event on the participant data source.
* Fixed issue with CSV export file name.
# Version 1.117
* Fixed issue with clicking export button
# Version 1.116
* Fixed issue with certain multi value fields on the filter configuration of a data source.
* Fixed issue with navigation menu.
* Make the 'Display the groups of a contact' output format resilient against empty inputs.
# Version 1.115
* Fixed issue with export and temporary storage.
# Version 1.114
* Minor refactor of generate PDF function. So that child classes could override the actual behaviour.
# Version 1.113
* Fixed issue with search output where all records are selected by default
* Fixed issue with exporting records not filtering before export.
# Version 1.112
* Fixed issue with API permissions.
# Version 1.111
* Fix for issue #143 error during CiviCRM upgrade. Make sure you update data processor extension before you upgrade CiviCRM.
# Version 1.110
* Added configuration for search outputs to limit and sort the task list.
* Fixed issue with Edit Participant link in participant searches. See !128 and thanks to @david124136468769
* Added two new Field output handlers for date ranges. See !127 and thanks to @gngn
# Version 1.109
* Fixed issue with running a search query twice after pressing Search
* Fixed issue with redirect after a search task.
# Version 1.108
* Fixed issue with API permissions and performance improvement.
# Version 1.107
* Fixed issue with API permissions and performance improvement.
# Version 1.106
* Fixed issue with API output and getsingle action.
# Version 1.105
* Fixed issue with in memory data flows. Such as the duplicate contacts.
# Version 1.104
* Fixed issue with in memory data flows. Such as the duplicate contacts.
* Added field for bounded calculations. Bounded calculations are calculations where you specify a minimum bound and maximum bound. If the value is outside the bounds the minimum value or maximum value is shown.
# Version 1.103
* Added contact types to contact tab output.
# Version 1.102
* Fixed issue with export output and php 8.
* Fix for deprecated function calls. See #142
* A data processor output now works in Drupal 10 after saving (without clearing the caches).
# Version 1.101
* Performance improvement.
# Version 1.100
* Fixed issue with in memory data flows. Such as the duplicate contacts.
# Version 1.99
* Fixed issue with in memory data flows. Such as the duplicate contacts.
# Version 1.98
* Fixed issue with in memory data flows. Such as the duplicate contacts.
* Fixed permission issue with Contact: Count number of cases.
# Version 1.97
* Fixed issue when a non-sql data source is used in the data processor and adding filters.
* Added a datasource for Country: Now you can sort on the country name.
# Version 1.96
* Prevent fatal PHP 8.1 error with CompareFieldFilter.
* Added output handler: Contact: Count number of cases.
# Version 1.95
* Added mixin for smarty templates. So it works with CiviCRM 5.69 and newer.
* Added error handling for the contact summary tab output. Prevent a hard failure.
* Added field for event availability information.
* Added campaign filter
# Version 1.94
* Added new field output handler for Show active memberships of a contact.
# Version 1.93
* Fixed issue with download spreadsheet export and selection of all records.
# Version 1.92
* Fixed issue #136: getSort also NULL as return
* Fixed issue with aggregated contribution data source.
# Version 1.91
* Fixed issue with aggregated contribution data source.
# Version 1.90
* Fixed issue with download spreadsheet export and selection of all records.
# Version 1.89
* Fixed TypeError in PDF Output
* Fixed issue with Timestamp fields in where clause.
# Version 1.88
* Removed PHP 8.2 warnings
* Fixed issue with exporting selected records.
# Version 1.87
* Added aggregation by receive date and id to the contribution aggrated data source.
# Version 1.86
* Added aggregation by receive date and id to the contribution aggrated data source.
# Version 1.85
* added output handlers to count and sum recurring contributions
* Fix issue for the participant role field that prevented showing multiple values.
* Added Data Processor Source for Entity FinancialTrxn.
# Version 1.84
* Reverted back the upgrader class so that it still works on Civi 5.37
# Version 1.83
* Reverted back the upgrader class so that it still works on Civi 5.37
# Version 1.82
* Fixed issue with date filter with operator not between and null values in the field.
# Version 1.81
* Fixed regression issue from !120 on CiviCRM version 5.37
# Version 1.80
* Fixed regression issue from !120 on CiviCRM version 5.37
# Version 1.79
* Fixed issue with contact search output and select all and following tasks.
# Version 1.78
* Fix for issue when filters are not set correctly.
* Fix Type Error when a filter has an empty description.
* Add option for the Custom Link with two fields to open in the same tab.
# Version 1.77
* Fix issue with Contact Data Sources in a join.
* PHP 8 and Drupal 10 compatibility. See !119 and !120
# Version 1.76
* Fix for #103: contribution search redirect.
* Added permission 'access dataprocessor definitions' that facilitates reading the DataProcessor Output Definitions without granting access CiviCRM. Created for the [Drupal CMRF Reference module](https://www.drupal.org/project/cmrf_reference).
* Fix for aggregate on case for activities.
# Version 1.75
* Added output handler: Sanitize string.
* Added output handler: Conditionally map strings.
* Fixed issue with PDF export and repeating headers.
* Fixed an error with settings the defaults in ConditionallyMapStrings. See !117
# Version 1.74
* Fixed issue with downloading the export file again after pressing the back button in the browser.
# Version 1.73
* Fixed bug with empty filter in search and then applying the defaults instead.
* Added filter: Contact has number of activities in period
* Added filter: Most recent event date
# Version 1.72
* Fixed regression bug during import.
# Version 1.71
* Possible to have certain output types multiple times at a data processor.
# Version 1.70
* Regression fix dashlets not working anymore #122
* Fixed contact Summary tab not loading due to fatal error. See !115 and #122
* Performance improvements.
* Fixed issue with Contact Search and Hard limit and paging.
# Version 1.69
* Fixed issue with expanded search form when hard limit is enabled.
* Export of selection is first stored in a temporary table. Performance improvement and fixes issue with export not containing all records.
# Version 1.68
* Fix for issue with get count api calls.
# Version 1.67
* Added filter Total Contribution Amount in Period.
* Fixed regression bug in contact search.
* Fixed regression bug with adding filters.
* Added aggregated contribution source
* Added date filter to data sources.
* Fixed issue in In- and Exclude filter contact has contributions.
* Fix for permission view contact filter.
* Added field output handler: Arthmetic Operations.
* Added field output handler for date range segments based on months.
* Fixed issue with permission to view contact. Also works now without a user record
* Added functionality to have a hard limit on a selection
* Added age filter
* Added possibility to provide index hints in a sql table data flow.
# Version 1.66
* Regression fix for issue #125.
# Version 1.65
* Regression fix for issue #125 after refactoring for filter collections.
* Added In- and Exclude to filter contact has contributions for the campaign field.
* Added multiplier to aggregate function field.
* Added found to nearest whole number to aggregate function field.
# Version 1.64
* Fixed issue with loading all records when opening a search screen or when doing an export.
* PHP 8 Compatibility: Don't pass NULL to functions that take string inputs by !114
* Added filter for contact has active recurring contributions.
* Added filter for contact has activity in period.
* PHP 8 Compatibility: Declarations of functions must be the same.
* Notices: Preventing several notices from calculated fields.
* Refactored filters (removed duplicate code)
* Added Filter Collections to group filter into a collection. Which could lead to an OR statement in the query.
# Version 1.63
* Fix for regression issue #123
* Preparation for PHP 8 compatibility
* Improved count query by removing group by and functions (such as AVG and SUM).
# Version 1.62
* Optimization of the contact data source and contact type filter.
* Added SQL Query Data Flow
* Added passing of extra data from the api or url to the filter.
# Version 1.61
* Improved on !98 filter parameter for SQL Table sources.
* Added data source Contribution (withouth Soft Contribution)
# Version 1.60.2
* Fixed regression bugs.
# Version 1.60.1
* Fixed regression bugs.
# Version 1.60
* Major refactor to search functionality. Simplified the code base and made it possible to have follow-up screens when exporting data.
* Add filter_sql parameter to sql tables. (See !98)
* Add filter for contact has contribution in period (See #120 and !112)
* Addedf filter for contact has relationship (See #121 and !113)
# Version 1.59
* Added week day filter.
# Version 1.58
* Fix error in Case Reports caused by removal of print permissions (by another extension).
* Fixed issue in Case Search. The hidden fields configuration was not respected.
* !110 PHP 8.1 compatibility - don't pull NULL to stripos
* !11 Update hook_civicrm_tabset for forward-compat with 5.57
* Make stripAlternavites (Removing the ALTERNATE text from activity detail field) also work for the API.
# Version 1.57
* When a DAO field does not have a title use the name instead.
* Fix for Legacy Custom Searches on CiviCRM older than 5.41, see #114
# Version 1.56
* Fixed regression with issue with joins.
# Version 1.55
* Fixed regression with issue with joins.
# Version 1.54
* Add stripAlternatives to MarkupFieldOutputHandler to hide the email ALTERNATE notation
* Fixed issue with Joins
# Version 1.53
* Fix for #109 sticky headers and dashlet.
# Version 1.52
* Fixed issue with event participant count field (do not count deleted contacts).
# Version 1.51
* Fixed regression with sticky row header.
# Version 1.50
* When using a search output the row header will stick upon scroll.
* Fixed when using the CSV export, the web browser can cache the downloaded CSV file with MR !103
* Provides ability to set the file name for the CSV export download, instead of using randomly generated file name with MR !104
# Version 1.49
* Added filter for Contact Has Event of Type
* Added filter for contact has contributions with status
* Added field output handler for listing event registrations of a contact
# Version 1.48
* Fixed permission issue with Contact Type Filter
* Fixed export from Smart Groups, by manage groups --> contacts --> export CSV
# Version 1.47
* Added Field Output Handler for Text from Template.
# Version 1.46
* The TotalFieldOutputHandler now sorts numeric instead of alphabetic (so first 9 and then 10)
* Added Field Outputhandler for Custom Link with three fields by !74
* Don't emit a PHP warning on a null string with 'use label as value' by !99
* Fix CiviCRM Case, adding Case as source, the default values cause an Error, see #102
# Version 1.45
* Fixed error with Aggregated Fields (#105)
* Fixed error with CalculationFields
# Version 1.44
* Introduce AbstractFormattedNumberOutputHandler with !95
# Version 1.43
* Enable upgrade to CiviCRM 5.43 and beyond without legacycustomsearches module enabled !94.
* Prevent non-numeric value warning in the TotalFieldOutputHandler.
* DateFieldOutput DateTime Option by !93
# Version 1.42
* !101 Fix upgrade crash when upgrading to CiviCRM 5.41.0
* Documented adding dataprocessors to your extension.
* Ability to return multi-valued field as an array.
# Version 1.41
* Fixed regression bug with joins and filters on a data source.
# Version 1.40
* Fixed issue with joins and filters on a data source.
# Version 1.39
* Improvement of the layout of the relationship output handler.
* Add link from the participant count field.
* Layout of date filter.
# Version 1.38
* Fixed #96: use INNER JOIN on custom fields when a filter is set.
* Fixes issue with Relationship output field handler.
# Version 1.37.1
* Fixed regression bug with operator options in the filter.
# Version 1.37
* Added filter to compare two fields.
* Fixed #94. Renamed the calculation Percentage to Percentage change (to avoid confusion).
* Make the totals (calculations that add up) and percentages sortable.
* Fixed #91. Duplicate column name 'participant_payment_participant_id' when a Data Processor is configured to use two or more Pariticipant Sources by !85
* Fixed issue with Participant and Contribution Searches by !87
* Fixed issue with sorting and limit. #95.
# Version 1.36
* Inconsistent use of "e-mail" and "email", use the CiviCRM standard "email" by !79
* Default delimiter for CSV export is semi-colon, not comma by !81
* Fixed issue with participant payment
* Ability to return contact as array in relashionship type by !84
# Version 1.35
* Fixed #87 Dataprocessors with required contact id filters throws "One of parameters (value: ) is not of the type Int" error for anonymous users by !77
* Compatibility fix for Symfony 2.8, 3.4 and 4.0
* Fixed issue with non required join and filtering on case type.
# Version 1.34
* Fixed issue with filtering on state/province custom fields.
* Fixed issue with filtering on multi value fields (fields which holds multiple values separated by the VALUE SEPARATOR symbol).
* Fix for #85 DB Error: no such field when using "Tab on contact summary" with contributions
# Version 1.33
* Added weight to search/reports outputs.
* Fix for #71 deprecation warnings.
* Compatibility fix for Symfony ^3.4 ^4.0.
# Version 1.32
* Added Field Output Handler for clean file names. E.g. change `Expense/2/receipt_802fd5cd009e0a39cf2202f4bfb9c0b4.pdf`
into `receipt.pdf`.
* Fixed #77 Contribution dataprocessor with current user contact filter shows no results by !75
# Version 1.31
* Fixed backwards compatibility with joins on the edit screen.
* Add custom link handler referencing two fields. (!73 & #79)
* Fixed issue with CSV and PDF Download output on wordpress.
# Version 1.30
* Fixed issue with relative date and required filters.
* Compatibility with php 7.0
* Activity search with empty id.
* Fixed issue with aggregation on date fields #78
* Fixed issue with CSV and PDF Download output.
# Version 1.29
* Fixed issue when same field existed twice but with different names.
# Version 1.28
* Fixed #73: Aggregation on SQL Source does not always work
* Fixed #40: SQL Table data source error and #45: Allow MySQL Views as Sources. See !71
* Fixed regression bug with custom fields on activity data sources.
# Version 1.27
* Added Contribution Count Field Output Handler.
* Fixed issue with importing/exporting of data processor.
* Fixed issue with participant data source.
* Fixed issue with loading menu items.
# Version 1.26
* Fixed issue with formatting of money fields and 0 value in the formatted number field output handler.
# Version 1.25
* Fix for #68: contact search actions did not work after upgrading to 5.32.2
* Fix for #67: error when a custom field or custom groups contains an @ or % sign in the help texts.
* Fixed issue with join on contribution data source.
* Added better error handling.
* Fixed issue with aggregation fields and a subquery data flow.
* Fixed issue with backwards compatibility and field drop down.
* Fixed issue with date filter and civicrm version before 5.25
* Join when aggregation is enabled on a data source should be of type LEFT and not INNER.
* Fix for regression bug #69: Multiple Field Filter
# Version 1.24.1
* Fixed regression bug when only one activity data source is present.
# Version 1.24
* Fixed issue with sorting the data processor and case insenstivity.
# Version 1.23.8
* Fixed regression bug in Checksum filter.
# Version 1.23.7
* Fixed another regression bug with filter on certain fields which are secondary to the data source. Such as the activity record type id.
# Version 1.23.6
* Fixed regression issue with file data source and with contribution source.
* Fixed #64 aggregation on a custom field of a contribution data source works.
# Version 1.23.5
* Fixed regression bug with filter on certain fields which are secondary to the data source. Such as the activity record type id.
* Fixed regression bug #66: Dataprocessor breaks API3 explorer actions list
# Version 1.23.4
* Fixed regression bug with case role filter (and other filters).
# Version 1.23.3
* Fixed issue with data sources for file, contributions and cases.
# Version 1.23.2
* Made smart group implementation compatible with civicrm version 5.14.1
# Version 1.23.1
* Fixed issue with config.
# Version 1.23
* Refactor of how the navigation menu is build/stored. It now makes use of hook_civicrm_navigationMenu instead of storing the items in the database directly.
* Refactor of config classes.
* Fixed regression bug in getting where statements and join statements.
# Version 1.22.1
* Fixed regression bug with API output.
# Version 1.22
* Fix issue filtering for multiple tags !66
* Added aggregation for membership data source so you can aggregate on the most recent, the least recent memberships.
* Added aggregation for activity data source so you can aggregate on the most recent, the least recent activity.
* Fixed issue with Field filter and operator is not one of on a multi value field.
* Contact Search Output is now also able to create smart groups and send bulk mails (with a hidden smarty group). See #32.
* Fixed issue with Field Filter on relationship type and also made relationship type a non required filter on the data source.
* Improved performance by caching the API entities and actions configured by a data processor output. (Previously during an api call all actions and entities where retrieved from the database)
* Fixed issue when a filter is required and no default value is set and you want to set the default value.
# Version 1.21
* Added contribution ID to the participant data source so that you can link a contribution and an event registration.
* Added a field for contact tags.
* Added a data source for entity tag and tag.
# Version 1.20
* ContactInGroup filter only supports IN/NOT IN so map =/!= !65
* Fixed issue with multiple Custom Group as data source and additional filters.
# Version 1.19.1
* Fixed issue with install sql and innodb.
# Version 1.19
* Added File Data Source
# Version 1.18
* Fix broken CSV (etc) download buttons (!62)
* Fix unable to select relative date value in filter #56
* Fix issue with tasks after an Participant Search.
# Version 1.17
* Added participant count field
* Fixed custom link field so that the raw value also contains the html link (#55).
* Fix for Field filter. It did not work on a custom field that has the type country.
* Added image field output handler (!61)
* Fixed issue with View and Edit an activity in Activity Search.
# Version 1.16
* Fixed blank worldregion in CVS output #52
* Fixed issue with not empty case role filter.
# Version 1.15.1
* Fixed backwards compatibility issue.
# Version 1.15
* Added percentage calculation field to calculate the difference in percentage between two fields.
* Fixed issue with saving default filter values.
* Fixed issue with filter for multiple select fields.
* Added filter for month.
# Version 1.14.2
* Fixed issue with broken filter #51
* Added all contact types customf fields to contact data source.
# Version 1.14.1
* Fixed issue with shoreditch theme #49
* Fixed issue with custom fields with the same name as an entity field.
# Version 1.14.0
* Fixed filter options for money fields. See issue #50
* Added Field Output handler for Custom Links. !57
* Fixed issue with shoreditch theme #49
# Version 1.13.0
* Added Checksum filter.
# Version 1.12.0
* Allow to specify defaults for a search through the URL.(!46)
* Fixed several notices (!47, !48, !49, !53)
* Fixed URL of dashlet on non drupal installations (!50)
* Show title of data processor when asking for a confirmation upon deleting.
* Add support for filter defaults to be set using the URL.
* Added Filter for World Region
* Added Output for World Region
* Fixed integration with search action designer extension for the Search/Report output.
* Fixed bug with aggregation fields (#44)
* Added option to expose the hide fields setting to the user at Search/Report output (#34)
# Version 1.11.0
* Added Field Output Handler for outputting a text when a contact has a certain relationship.
* Refactored Field Output Handlers and simplified duplicate code for initializing a field.
* Date filter now also works with Date/Time fields.
* Added Is not empty as an operator to the contact filter.
* Added field to edit activity.
* Renamed Case Role filter to Contact has role on case and added option to search for case without a role set and to search for current user has the role.
# Version 1.10.0
* Added option to return URL to File Download Link Field.
# Version 1.9.1
* Fixed regression issue with MySQL function such as Year on the Date Field.
# Version 1.9.0
* Fixed issue with filtering on contact subtype.
* Fixed issue with returning after a participant task.
* Added data source for membership payments.
* Added Contact Checksum Field.
* Added header fields to the PDF export output
* Fixed bug in File Download Link Field.
# Version 1.8.0
* Added Manage Case Link field.
* Added checkbox to show Manage Case on the Case Search output.
* Fixed issue with dashlet opening in full screen.
# Version 1.7.1
* Fixed issue with cloning data processors.
# Version 1.7.0
* Fixed #35: Custom Fields on a tab are also available as field now.
* Changed Age field so aggeragation is working correctly.
* Changed Field Specification to allow more advanced mysql functions.
* Added Event Filter.
* Added Formatted Address field.
* Added data source for note
* Refactored API Output to an Abstract Class so that it is easy for extension developers to develop their own implementation.
* Added Markup/Html Field Value output field handler.
* Improved In Memory Dataflow so that joins and filters would work.
* Improved Contact Summary Tab output so it includes a count.
* Fixed caching issues on the contact data source #31.
* Fixed bugs with ContactInGroup filter #33
# Version 1.6.0
* Update to avoid using a system function that is being deprecated. (See !37)
* Fixed issue with case role field.
# Version 1.5.0
* Added relationship type order by Relationship Field Type.
* Added smart group contact data source.
# Version 1.4.0
* Search tasks (eg. Export) work with Member,Contribute,Participant,Case...
* Added source to retrieve the owner membership, when owner membership is not set (meaning it is already the primary) then it will return itself.
* Added date filter to filter date with the PHP Date Format.
* Added filtering on Contact (sub) type on the contact filter.
* Added PDF Export Output
* Added Union Query Data Flow.
* Added a field specification for a fixed value
* Fixed #24
* Improved export/import functionality.
* Added documentation generator to the API output.
* Added default sort configuration for a data processor (#26).
* Added Age field.
* Added current user to contact filter.
* Added data source for permissioned contact (#25).
* Fixed issue with configuration contact source sub type filter.
* Added a no result text to the outputs.
# Version 1.3.0
* Fixed the dashlets.
* Fixed caching issues.
* Add Recurring Contribution as datasource
* Added Field Output Handler for Is Active fields based on dates (start date and end date).
* Refactored the factory (the factory is used by developers to add data source, field outputs, outputs, filters etc.).
* Added data sources for custom groups which are a multiple data set.
# Version 1.2.0
* Made CSV Export download available for anonymous users.
* Change Group Filter so that it also works with smart groups
* Fixed bug with date filter
* Added date group by function to date output field handler.
* Added exposure of Aggregation on the Search/Report output.
**Remark for extension developers**
If you have an extension which implements an `OutputHandlerAggregate` in your _Field Output Handlers_ then you
have to implement to additional methods: `enableAggregation` and `disableAggregation`.
# Version 1.1.0
* Respect selected permissions for outputs
* Allow to specify "Is Empty" for various filters.
* Allow to limit ContactFilter to only show contacts from specific groups.
* Output a data processor as a dashboard.
......@@ -13,6 +787,7 @@
* Added filter to search text in multiple fields.
* Added filter for searching contacts with a certain tag.
* Added filter for searching contacts with a certain type.
* Added filter for contact has membership.
* Added filter to respect the ACL. So that a user only sees the contacts he is allowed to see.
* Removed the title attribute from the outputs as those don't make sense.
* Refactored aggregation functionality and added aggregation function field.
......@@ -23,6 +798,10 @@
* Added Case ID field on the activity source.
* Added field to display relationships.
* Added is not empty as a filter operator.
* Added hidden fields option to search outputs, dashboard output and contact summary tab output.
* Added formatted number output field handler
* Added SQL Table Data Source
* Export from a search only exports the selected rows.
# Version 1.0.7
......
......@@ -14,77 +14,48 @@
*
* The second form is used to process search results with the associated actions.
*/
class CRM_Contact_Controller_DataProcessorContactSearch extends CRM_Core_Controller {
protected $dataProcessor;
/**
* Setter function to set the data porcessor
*
* @param $dataProcessorName
* @param $dataProcessor
*/
public function setDataProcessor($dataProcessorName, $dataProcessor) {
$this->dataProcessor = $dataProcessor;
}
class CRM_Contact_Controller_DataProcessorContactSearch extends CRM_DataprocessorSearch_Controller_Search {
/**
* Class constructor.
*
* @param string $title
* @param string|null $title
* @param bool $modal
* @param int|mixed|null $action
* @param int|mixed $action
*/
public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
parent::__construct($title, $modal);
$this->_stateMachine = new CRM_Contact_StateMachine_DataProcessorContactSearch($this, $action);
// create and instantiate the pages
$this->addPages($this->_stateMachine, $action);
// add all the actions
$this->addActions();
parent::__construct($title, $modal, $action);
$this->set('entity', 'Contact');
}
/**
* Process the request, overrides the default QFC run method
* This routine actually checks if the QFC is modal and if it
* is the first invalid page, if so it call the requested action
* if not, it calls the display action on the first invalid page
* avoids the issue of users hitting the back button and getting
* a broken page
*
* This run is basically a composition of the original run and the
* jump action
*
* @return mixed
*/
public function run() {
public function selectorName() {
return 'CRM_Contact_Selector_DataProcessorContactSearch';
}
$actionName = $this->getActionName();
list($pageName, $action) = $actionName;
// Hack to replace to userContext for redirecting after a Task has been completed.
// We want the redirect
if (!$this->_pages[$pageName] instanceof CRM_DataprocessorSearch_Form_ContactSearch) {
$session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlPath = CRM_Utils_System::getUrlPath();
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey=$qfKey";
}
$this->setDestination(CRM_Utils_System::url($urlPath, $urlParams));
}
public function getUrlForSearchRedirectReplacement():? string {
return '/civicrm/contact/search';
}
public function getSearchName(): string {
return 'Basic';
}
return parent::run();
public function getSearchClass(): string {
return 'CRM_Contact_Form_DataProcessorContactSearch';
}
/**
* @return mixed
* @param string $selectedTask
*
* @return string|array|null
*/
public function selectorName() {
return 'CRM_Contact_Selector_DataProcessorContactSearch';
public function getTaskClass(string $selectedTask) {
[$task] = CRM_Contact_Task::getTask($selectedTask);
if ($task) {
return $task;
}
return null;
}
}
......@@ -4,10 +4,10 @@
* @license AGPL-3.0
*/
use Civi\DataProcessor\Output\UIOutputInterface;
use Civi\DataProcessor\Output\UIFormOutputInterface;
use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
class CRM_Contact_DataProcessorContactSearch implements UIFormOutputInterface {
/**
* Returns true when this filter has additional configuration
......@@ -26,6 +26,7 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
* @param array $filter
*/
public function buildConfigurationForm(\CRM_Core_Form $form, $output=array()) {
\Civi\DataProcessor\Output\UIOutputHelper::fixBackwardsCompatibility($output);
$navigation = CRM_Dataprocessor_Utils_Navigation::singleton();
$dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $output['data_processor_id']));
$dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataProcessor);
......@@ -46,17 +47,33 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show Contact ID field'), array(0=>'Contact ID is Visible', 1=> 'Contact ID is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
$form->add('text', 'no_result_text', E::ts('No result text'), array('class' => 'huge'), false);
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially?'));
$form->add('checkbox', 'enable_hard_limit', E::ts('Enable Hard Limit?'));
$form->add('text', 'default_hard_limit', E::ts('Default Hard Limit'), array('class' => 'huge'), false);
$form->addYesNo('link_to_view_contact', E::ts('Add link to view contact?'));
// navigation field
$navigationOptions = $navigation->getNavigationOptions();
if (isset($output['configuration']['navigation_id'])) {
$navigationPath = $navigation->getNavigationPathById($output['configuration']['navigation_id']);
unset($navigationOptions[$navigationPath]);
}
$form->add('select', 'navigation_parent_path', ts('Parent Menu'), array('' => ts('- select -')) + $navigationOptions, true);
$form->add('text', 'navigation_weight', E::ts('Weight'), array('class' => 'huge'), false);
$taskParams['deletedContacts'] = FALSE;
$taskParams['ssID'] = $this->_ssID ?? NULL;
$allTasks = CRM_Contact_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission(), $taskParams);
CRM_DataprocessorSearch_Utils_Tasks::buildConfigurationForm($allTasks, $form, $output);
$defaults = array();
if ($output) {
......@@ -68,18 +85,41 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
if (isset($output['configuration']['contact_id_field'])) {
$defaults['contact_id_field'] = $output['configuration']['contact_id_field'];
}
if (isset($output['configuration']['navigation_id'])) {
$defaults['navigation_parent_path'] = $navigation->getNavigationParentPathById($output['configuration']['navigation_id']);
if (isset($output['configuration']['no_result_text'])) {
$defaults['no_result_text'] = $output['configuration']['no_result_text'];
} else {
$defaults['no_result_text'] = E::ts('No results');
}
if (isset($output['configuration']['navigation_parent_path'])) {
$defaults['navigation_parent_path'] = $output['configuration']['navigation_parent_path'];
}
if (isset($output['configuration']['navigation_weight'])) {
$defaults['navigation_weight'] = $output['configuration']['navigation_weight'];
}
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
if (isset($output['configuration']['expanded_search'])) {
$defaults['expanded_search'] = $output['configuration']['expanded_search'];
}
if (isset($output['configuration']['link_to_view_contact'])) {
$defaults['link_to_view_contact'] = $output['configuration']['link_to_view_contact'];
}
else {
$defaults['link_to_view_contact'] = TRUE;
}
if (isset($output['configuration']['enable_hard_limit'])) {
$defaults['enable_hard_limit'] = $output['configuration']['enable_hard_limit'];
}
if (isset($output['configuration']['default_hard_limit'])) {
$defaults['default_hard_limit'] = $output['configuration']['default_hard_limit'];
}
}
}
if (!isset($defaults['permission'])) {
......@@ -110,11 +150,17 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
public function processConfiguration($submittedValues, &$output) {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['navigation_weight'] = $submittedValues['navigation_weight'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
$configuration['link_to_view_contact'] = $submittedValues['link_to_view_contact'];
$configuration['enable_hard_limit'] = isset($submittedValues['enable_hard_limit']) ? $submittedValues['enable_hard_limit'] : false;
$configuration['default_hard_limit'] = $submittedValues['default_hard_limit'];
return CRM_DataprocessorSearch_Utils_Tasks::processConfiguration($submittedValues, $configuration);
}
/**
......@@ -138,6 +184,28 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
return "civicrm/dataprocessor_contact_search/{$dataProcessor['name']}";
}
/**
* Returns the data processor name from a url.
*
* @param $url
*
* @return string
*/
public function getDataProcessorNameFromUrl($url) {
$dataProcessorName = str_replace('civicrm/dataprocessor_contact_search/', '', $url);
return $dataProcessorName;
}
/**
* Returns the name of the contact id field.
*
* @param $config
* @return string
*/
public function getContactIdFieldNameFromConfig($config) {
return $config['contact_id_field'];
}
/**
* Returns the url for the page/form this output will show to the user
*
......
......@@ -4,10 +4,17 @@
* @license AGPL-3.0
*/
use Civi\DataProcessor\DataFlow\CombinedDataFlow\CombinedSqlDataFlow;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use CRM_Dataprocessor_ExtensionUtil as E;
use Civi\DataProcessor\Output\UIOutputInterface;
use Civi\DataProcessor\Output\UIFormOutputInterface;
use Civi\DataProcessor\ProcessorType\AbstractProcessorType;
use Civi\DataProcessor\DataFlow\InMemoryDataFlow\SimpleFilter;
use Civi\DataProcessor\DataFlow\InMemoryDataFlow;
use Civi\DataProcessor\DataFlow\SqlDataFlow;
use Civi\DataProcessor\DataFlow\SqlDataFlow\SimpleWhereClause;
class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
class CRM_Contact_DataProcessorContactSummaryTab implements UIFormOutputInterface {
/**
* Implements hook_civicrm_tabset().
......@@ -24,6 +31,7 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
if ($tabsetName != 'civicrm/contact/view') {
return;
}
$contactId = $context['contact_id'];
$factory = dataprocessor_get_factory();
// Check whether the factory exists. Usually just after
......@@ -42,13 +50,13 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
$maxWeight++;
$sql = "SELECT o.*, d.name as data_processor_name
FROM civicrm_data_processor d
FROM civicrm_data_processor d
INNER JOIN civicrm_data_processor_output o ON d.id = o.data_processor_id
WHERE d.is_active = 1 AND o.type = 'contact_summary_tab'";
$dao = CRM_Core_DAO::executeQuery($sql);
while($dao->fetch()) {
$outputClass = $factory->getOutputByName($dao->type);
if (!$outputClass instanceof \Civi\DataProcessor\Output\UIOutputInterface) {
if (!$outputClass instanceof CRM_Contact_DataProcessorContactSummaryTab) {
continue;
}
$output = civicrm_api3('DataProcessorOutput', 'getsingle', ['id' => $dao->id]);
......@@ -56,12 +64,50 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
if (!$outputClass->checkUIPermission($output, $dataprocessor)) {
continue;
}
$contactTypeIsValid = true;
$contactTypes = [];
if (isset($output['configuration']['contact_types']) && is_array($output['configuration']['contact_types'])) {
$contactTypes = $output['configuration']['contact_types'];
}
if (count($contactTypes)) {
try {
$contact = \Civi\Api4\Contact::get(FALSE)
->addWhere('id', '=', $contactId)
->execute()
->single();
}
catch (CRM_Core_Exception $e) {
$contactTypeIsValid = FALSE;
}
if (!in_array($contact['contact_type'], $contactTypes)) {
$contactTypeIsValid = false;
foreach($contact['contact_sub_type'] as $contactSubType) {
if (in_array($contactSubType, $contactTypes)) {
$contactTypeIsValid = true;
break;
}
}
}
}
if (!$contactTypeIsValid) {
continue;
}
$count = 0;
if ($contactId) {
try {
$count = $outputClass->getCount($contactId, $output, $dataprocessor);
} catch (\Exception $e) {
// Do nothing
}
}
$tab = [
'id' => 'dataprocessor_' . $dataprocessor['name'],
'title' => $outputClass->getTitleForUiLink($output, $dataprocessor),
'icon' => $outputClass->getIconForUiLink($output, $dataprocessor),
'url' => CRM_Utils_System::url('civicrm/dataprocessor/page/contactsummary', array('contact_id' => $context['contact_id'], 'data_processor' => $dataprocessor['name'], 'reset' => 1, 'force' => 1)),
'count' => $count,
'url' => CRM_Utils_System::url('civicrm/dataprocessor/page/contactsummary', array('contact_id' => $contactId, 'data_processor' => $dataprocessor['name'], 'reset' => 1, 'force' => 1)),
'class' => '',
];
if (isset($output['configuration']['weight']) && strlen($output['configuration']['weight']) && is_numeric($output['configuration']['weight'])) {
......@@ -96,6 +142,13 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
*/
public function buildConfigurationForm(\CRM_Core_Form $form, $output = []) {
$fieldSelect = \CRM_Dataprocessor_Utils_DataSourceFields::getAvailableFilterFieldsInDataSources($output['data_processor_id']);
$dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $output['data_processor_id']));
$dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataProcessor);
$fields = array();
foreach($dataProcessorClass->getDataFlow()->getOutputFieldHandlers() as $outputFieldHandler) {
$field = $outputFieldHandler->getOutputFieldSpecification();
$fields[$field->alias] = $field->title;
}
$form->add('select','permission', E::ts('Permission'), \CRM_Core_Permission::basicPermissions(), true, array(
'style' => 'min-width:250px',
......@@ -109,11 +162,32 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
'placeholder' => E::ts('- select -'),
));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this tab'), array('rows' => 6, 'cols' => 80));
$form->add('wysiwyg', 'no_result_text', E::ts('No Result Text'), array('rows' => 2, 'class' => 'huge'), false);
$form->add('text', 'weight', E::ts('Weight'));
$form->add('text', 'default_limit', E::ts('Default Limit'));
$contactTypes = [];
$contactTypesApi = \Civi\Api4\ContactType::get(FALSE)
->setLimit(0)
->execute();
foreach($contactTypesApi as $contactType) {
$contactTypes[$contactType['name']] = $contactType['label'];
}
$form->add('select', 'contact_types', E::ts('Contact Types'), $contactTypes, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$defaults = array();
if ($output) {
......@@ -130,6 +204,12 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
if (isset($output['configuration']['contact_id_field'])) {
$defaults['contact_id_field'] = $output['configuration']['contact_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['contact_types'])) {
$defaults['contact_types'] = $output['configuration']['contact_types'];
}
if (isset($output['configuration']['default_limit'])) {
$defaults['default_limit'] = $output['configuration']['default_limit'];
}
......@@ -172,6 +252,8 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
public function processConfiguration($submittedValues, &$output) {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['contact_types'] = $submittedValues['contact_types'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['weight'] = $submittedValues['weight'];
......@@ -201,6 +283,29 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
return "civicrm/dataprocessor_contact_summary/{$dataProcessor['name']}";
}
/**
* Returns the data processor name from a url.
*
* @param $url
*
* @return string
*/
public function getDataProcessorNameFromUrl($url) {
return str_replace('civicrm/dataprocessor_contact_summary/', '', $url);
}
/**
* Returns the name of the contact id field.
*
* @param $config
*
* @return string|false
*/
public function getContactIdFieldNameFromConfig($config) {
return false;
}
/**
* Returns the url for the page/form this output will show to the user
*
......@@ -245,5 +350,80 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
));
}
public function getCount($contact_id, $output, $dataProcessor) {
if (!$contact_id) {
return 0;
}
$dataProcessorClass = $this->loadDataProcessor($contact_id, $output, $dataProcessor);
return $dataProcessorClass->getDataFlow()->recordCount();
}
/**
* @param $contact_id
* @param $dataProcessor
*
* @return \Civi\DataProcessor\ProcessorType\AbstractProcessorType
* @throws \Exception
*/
protected function loadDataProcessor($contact_id, $output, $dataProcessor) {
$dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataProcessor);
return self::alterDataProcessor($contact_id, $output, $dataProcessorClass);
}
/**
* @param $contact_id
* @param $output
* @param AbstractProcessorType $dataProcessorClass
*
* @return AbstractProcessorType
* @throws \Civi\DataProcessor\Exception\DataSourceNotFoundException
* @throws \Civi\DataProcessor\Exception\FieldNotFoundException
*/
public static function alterDataProcessor($contact_id, $output, AbstractProcessorType $dataProcessorClass) {
[$datasource_name, $field_name] = explode('::', $output['configuration']['contact_id_field'], 2);
$dataSource = $dataProcessorClass->getDataSourceByName($datasource_name);
if (!$dataSource) {
throw new \Civi\DataProcessor\Exception\DataSourceNotFoundException(E::ts("Requires data source '%1' which could not be found. Did you rename or delete the data source?", array(1=>$datasource_name)));
}
$fieldSpecification = $dataSource->getAvailableFilterFields()->getFieldSpecificationByAlias($field_name);
if (!$fieldSpecification) {
$fieldSpecification = $dataSource->getAvailableFilterFields()->getFieldSpecificationByName($field_name);
}
if (!$fieldSpecification) {
throw new \Civi\DataProcessor\Exception\FieldNotFoundException(E::ts("Requires a field with the name '%1' in the data source '%2'. Did you change the data source type?", array(
1 => $field_name,
2 => $datasource_name
)));
}
$fieldSpecification = clone $fieldSpecification;
$fieldSpecification->alias = 'contact_summary_tab_contact_id';
$dataFlow = $dataSource->ensureField($fieldSpecification);
if ($dataFlow && $dataFlow instanceof SqlDataFlow && $dataProcessorClass->isAllSql()) {
$tableAlias = self::getTableAlias($dataFlow);
$whereClause = new SimpleWhereClause($tableAlias, $fieldSpecification->name, '=', $contact_id, $fieldSpecification->type);
$dataFlow->addWhereClause($whereClause);
} elseif ($dataFlow && $dataFlow instanceof InMemoryDataFlow) {
$filterClass = new SimpleFilter($fieldSpecification->name, '=', $contact_id);
$dataFlow->addFilter($filterClass);
}
return $dataProcessorClass;
}
/**
* Returns the table alias of a sql data flow.
*
* @param \Civi\DataProcessor\DataFlow\SqlDataFlow $dataFlow
* @return string|null
*/
protected static function getTableAlias(SqlDataFlow $dataFlow) {
$tableAlias = $dataFlow->getName();
if ($dataFlow instanceof SqlTableDataFlow) {
$tableAlias = $dataFlow->getTableAlias();
} elseif ($dataFlow instanceof CombinedSqlDataFlow) {
$tableAlias = $dataFlow->getPrimaryTableAlias();
}
return $tableAlias;
}
}
......@@ -14,19 +14,34 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return string
*/
public function getDefaultEntity() {
public function getDefaultEntity(): string {
return 'Contact';
}
/**
* This function could be overridden in child classes to change default configuration.
*
* @param $output
*
* @return array
*/
protected function alterDataProcessorOutput($output): array {
// link_to_view_contact option was added in 0.12. So we default to TRUE to match previous behaviour
if (!isset($output['configuration']['link_to_view_contact'])) {
$output['configuration']['link_to_view_contact'] = TRUE;
}
return $output;
}
/**
* Returns the url for view of the record action
*
* @param $row
* @param array $row
*
* @return false|string
* @return string
*/
protected function link($row) {
return CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid='.$row['id']);
protected function link($row): string {
return CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['id']);
}
/**
......@@ -36,7 +51,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return false|string
*/
protected function linkText($row) {
protected function linkText($row):? string {
return E::ts('View contact');
}
......@@ -45,7 +60,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return bool
*/
protected function isConfigurationValid() {
protected function isConfigurationValid(): bool {
if (!isset($this->dataProcessorOutput['configuration']['contact_id_field'])) {
return false;
}
......@@ -57,9 +72,8 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return String
*/
protected function getDataProcessorName() {
$dataProcessorName = str_replace('civicrm/dataprocessor_contact_search/', '', CRM_Utils_System::getUrlPath());
return $dataProcessorName;
protected function getDataProcessorName(): string {
return str_replace('civicrm/dataprocessor_contact_search/', '', CRM_Utils_System::currentPath());
}
......@@ -68,7 +82,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return string
*/
protected function getOutputName() {
protected function getOutputName(): string {
return 'contact_search';
}
......@@ -77,7 +91,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return string
*/
protected function getIdFieldName() {
public function getIdFieldName(): string {
return $this->dataProcessorOutput['configuration']['contact_id_field'];
}
......@@ -85,7 +99,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
* @return string
*/
protected function getEntityTable() {
protected function getEntityTable(): string {
return 'civicrm_contact';
}
......@@ -93,7 +107,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
* Returns whether we want to use the prevnext cache.
* @return bool
*/
protected function usePrevNextCache() {
protected function usePrevNextCache(): bool {
return true;
}
......@@ -104,7 +118,7 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
* @param array $ids
*
*/
protected function alterRows(&$rows, $ids) {
protected function alterRows(array &$rows, array $ids) {
$contactImages = array();
// Add the contact type image
if (count($ids)) {
......@@ -114,9 +128,14 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
foreach($rows as $idx => $row) {
if ($row['id'] == $contactDao->id) {
if (!isset($contactImages[$contactDao->id])) {
$contactImages[$contactDao->id] = CRM_Contact_BAO_Contact_Utils::getImage($contactDao->contact_sub_type ? $contactDao->contact_sub_type : $contactDao->contact_type, FALSE, $contactDao->id);
try {
$contactImages[$contactDao->id] = CRM_Contact_BAO_Contact_Utils::getImage($contactDao->contact_sub_type ?: $contactDao->contact_type, FALSE, $contactDao->id);
} catch (CRM_Core_Exception $e) {
}
}
if (isset($contactImages[$contactDao->id])) {
$rows[$idx]['contact_type'] = $contactImages[$contactDao->id];
}
$rows[$idx]['contact_type'] = $contactImages[$contactDao->id];
}
}
}
......@@ -128,12 +147,15 @@ class CRM_Contact_Form_DataProcessorContactSearch extends CRM_DataprocessorSearc
*
* @return array
*/
public function buildTaskList() {
public function buildTaskList(): array {
if (!$this->_taskList) {
$taskParams['deletedContacts'] = FALSE;
$taskParams['ssID'] = $this->_ssID ?? NULL;
$this->_taskList = CRM_Contact_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission(), $taskParams);
$this->filterTaskList();
}
return $this->_taskList;
}
}
\ No newline at end of file
}
......@@ -4,12 +4,9 @@
* @license AGPL-3.0
*/
use Civi\DataProcessor\DataFlow\SqlDataFlow;
use Civi\DataProcessor\DataFlow\SqlDataFlow\SimpleWhereClause;
use Civi\DataProcessor\Exception\DataSourceNotFoundException;
use Civi\DataProcessor\Exception\FieldNotFoundException;
use Civi\DataProcessor\ProcessorType\AbstractProcessorType;
use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorSearch_Form_AbstractSearch {
public function buildQuickform() {
......@@ -24,10 +21,10 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return int
*/
protected function getDefaultLimit() {
protected static function getDefaultLimit(array $output = null): int {
$defaultLimit = 25;
if (!empty($this->dataProcessorOutput['configuration']['default_limit'])) {
$defaultLimit = $this->dataProcessorOutput['configuration']['default_limit'];
if (!empty($output['configuration']['default_limit'])) {
$defaultLimit = $output['configuration']['default_limit'];
}
return $defaultLimit;
}
......@@ -38,14 +35,14 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return string
*/
protected function getIdFieldName() {
public function getIdFieldName(): string {
return false;
}
/**
* @return false|string
*/
protected function getEntityTable() {
protected function getEntityTable():? string {
return false;
}
......@@ -56,7 +53,7 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return false|string
*/
protected function link($row) {
protected function link($row):? string {
return false;
}
......@@ -67,7 +64,7 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return false|string
*/
protected function linkText($row) {
protected function linkText($row):? string {
return false;
}
......@@ -76,9 +73,8 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return String
*/
protected function getDataProcessorName() {
$dataProcessorName = str_replace('civicrm/dataprocessor_contact_summary/', '', CRM_Utils_System::getUrlPath());
return $dataProcessorName;
protected function getDataProcessorName(): string {
return str_replace('civicrm/dataprocessor_contact_summary/', '', CRM_Utils_System::currentPath());
}
/**
......@@ -86,7 +82,7 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return string
*/
protected function getOutputName() {
protected function getOutputName(): string {
return 'contact_summary_tab';
}
......@@ -95,7 +91,7 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
*
* @return bool
*/
protected function isConfigurationValid() {
protected function isConfigurationValid(): bool {
return TRUE;
}
......@@ -117,31 +113,10 @@ class CRM_Contact_Form_DataProcessorContactSummaryTab extends CRM_DataprocessorS
* @param \Civi\DataProcessor\ProcessorType\AbstractProcessorType $dataProcessorClass
*/
protected function alterDataProcessor(AbstractProcessorType $dataProcessorClass) {
$cid = CRM_Utils_Request::retrieve('contact_id', 'Integer', $this, true);
list($datasource_name, $field_name) = explode('::', $this->dataProcessorOutput['configuration']['contact_id_field'], 2);
$dataSource = $dataProcessorClass->getDataSourceByName($datasource_name);
if (!$dataSource) {
throw new DataSourceNotFoundException(E::ts("Requires data source '%1' which could not be found. Did you rename or deleted the data source?", array(1=>$datasource_name)));
}
if (!$dataSource->getAvailableFilterFields()->getFieldSpecificationByName($field_name)) {
throw new FieldNotFoundException(E::ts("Requires a field with the name '%1' in the data source '%2'. Did you change the data source type?", array(
1 => $field_name,
2 => $datasource_name
)));
}
$fieldSpecification = clone $dataSource->getAvailableFilterFields()->getFieldSpecificationByName($field_name);
if (!$fieldSpecification) {
throw new FieldNotFoundException(E::ts("Requires a field with the name '%1' in the data source '%2'. Did you change the data source type?", array(
1 => $field_name,
2 => $datasource_name
)));
}
$fieldSpecification->alias = 'contact_summary_tab_contact_id';
$dataFlow = $dataSource->ensureField($fieldSpecification);
if ($dataFlow && $dataFlow instanceof SqlDataFlow) {
$whereClause = new SimpleWhereClause($dataFlow->getName(), $fieldSpecification->name, '=', $cid, $fieldSpecification->type);
$dataFlow->addWhereClause($whereClause);
try {
$cid = CRM_Utils_Request::retrieveValue('contact_id', 'Integer', NULL, TRUE);
CRM_Contact_DataProcessorContactSummaryTab::alterDataProcessor($cid, $this->dataProcessorOutput, $dataProcessorClass);
} catch (CRM_Core_Exception|DataSourceNotFoundException|FieldNotFoundException $e) {
}
}
}
......@@ -33,14 +33,14 @@ class CRM_Contact_Page_DataProcessorContactSummaryTab extends CRM_Core_Page {
*/
protected function preProcess() {
$this->dataProcessorName = CRM_Utils_Request::retrieve('data_processor', 'String', $this, true);
$contact_id = CRM_Utils_Request::retrieve('contact_id', 'Integer', $this, true);
$this->dataProcessorName = CRM_Utils_Request::retrieveValue('data_processor', 'String', NULL, TRUE);
$contact_id = CRM_Utils_Request::retrieveValue('contact_id', 'Integer', NULL, TRUE);
$this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('name' => $this->dataProcessorName));
$this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor);
$this->assign('dataProcessorName', $this->dataProcessorName);
$this->assign('contact_id', $contact_id);
$this->assign('url', CRM_Utils_System::url("civicrm/dataprocessor_contact_summary/{$this->dataProcessorName}", array('contact_id' => $contact_id, 'reset' => '1', 'snippet' => 'json')));
$this->assign('url', CRM_Utils_System::url("civicrm/dataprocessor_contact_summary/{$this->dataProcessorName}", array('contact_id' => $contact_id, 'reset' => '1', 'snippet' => 'json'), FALSE , NULL , FALSE ));
}
/**
......
......@@ -5,6 +5,7 @@
*/
class CRM_Contact_Selector_DataProcessorContactSearch {
/**
* @var \Civi\DataProcessor\ProcessorType\AbstractProcessorType;
*/
......@@ -21,7 +22,7 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
protected $dataProcessor;
/**
* @var \CRM_Dataprocessor_BAO_Output
* @var \CRM_Dataprocessor_BAO_DataProcessorOutput
*/
protected $dataProcessorOutput;
......@@ -43,6 +44,7 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
}
$this->dataProcessorClass->getDataFlow()->addSort($sortField['name'], $sortDirection);
}
CRM_Dataprocessor_Form_Output_AbstractUIOutputForm::applyLimit($this->dataProcessorClass, $formValues, $this->dataProcessorOutput);
}
/**
......@@ -85,6 +87,8 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
* @return Object
*/
public function contactIDQuery($params, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND') {
$this->dataProcessorClass->getDataFlow()->setOffset(false);
$this->dataProcessorClass->getDataFlow()->setLimit(false);
$dataFlow = $this->dataProcessorClass->getDataFlow();
$cids = array();
$contactIdFieldName = $this->dataProcessorOutput['configuration']['contact_id_field'];
......@@ -104,7 +108,7 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
* @return String
*/
protected function getDataProcessorName() {
$dataProcessorName = str_replace('civicrm/dataprocessor_contact_search/', '', CRM_Utils_System::getUrlPath());
$dataProcessorName = str_replace('civicrm/dataprocessor_contact_search/', '', CRM_Utils_System::currentPath());
return $dataProcessorName;
}
......@@ -115,10 +119,12 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
*/
protected function loadDataProcessor() {
if (!$this->dataProcessorId) {
$doNotUseCache = CRM_Utils_Request::retrieveValue('debug', 'Boolean', FALSE);
$dataProcessorName = $this->getDataProcessorName();
$sql = "
SELECT civicrm_data_processor.id as data_processor_id, civicrm_data_processor_output.id AS output_id
FROM civicrm_data_processor
FROM civicrm_data_processor
INNER JOIN civicrm_data_processor_output ON civicrm_data_processor.id = civicrm_data_processor_output.data_processor_id
WHERE is_active = 1 AND civicrm_data_processor.name = %1 AND civicrm_data_processor_output.type = %2
";
......@@ -130,7 +136,7 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
}
$this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $dao->data_processor_id));
$this->dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor, true);
$this->dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor, $doNotUseCache);
$this->dataProcessorId = $dao->data_processor_id;
$this->dataProcessorOutput = civicrm_api3('DataProcessorOutput', 'getsingle', array('id' => $dao->output_id));
......@@ -182,10 +188,10 @@ class CRM_Contact_Selector_DataProcessorContactSearch {
protected function getHiddenFields() {
$hiddenFields = array();
if (!$this->isIdFieldVisible()) {
$hiddenFields[] = $this->getIdFieldName();
$hiddenFields[] = $this->dataProcessorOutput['configuration']['contact_id_field'];
}
return $hiddenFields;
}
}
\ No newline at end of file
}
<?php
/**
* @author Jaap Jansma <jaap.jansma@civicoop.org>
* @license AGPL-3.0
*/
class CRM_Contact_StateMachine_DataProcessorContactSearch extends CRM_Core_StateMachine {
/**
* The task that the wizard is currently processing
*
* @var string
*/
protected $_task;
/**
* Class constructor.
*
* @param object $controller
* @param \const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array();
$this->_pages['Basic'] = array(
'className' => 'CRM_Contact_Form_DataProcessorContactSearch',
);
list($task, $result) = $this->taskName($controller);
$this->_task = $task;
if (is_array($task)) {
foreach ($task as $t) {
$this->_pages[$t] = NULL;
}
}
else {
$this->_pages[$task] = NULL;
}
if ($result) {
$this->_pages['CRM_Contact_Form_Task_Result'] = NULL;
}
$this->addSequentialPages($this->_pages, $action);
}
/**
* Determine the form name based on the action. This allows us
* to avoid using conditional state machine, much more efficient
* and simpler
*
* @param CRM_Core_Controller $controller
* The controller object.
*
* @return array
* the name of the form that will handle the task
*/
public function taskName($controller) {
// total hack, check POST vars and then session to determine stuff
$value = CRM_Utils_Array::value('task', $_POST);
if (!isset($value)) {
$value = $controller->get('task');
}
$this->_controller->set('task', $value);
return CRM_Contact_Task::getTask($value);
}
/**
* Return the form name of the task.
*
* @return string
*/
public function getTaskFormName() {
if (is_array($this->_task)) {
// return first page
return CRM_Utils_String::getClassName($this->_task[0]);
}
else {
return CRM_Utils_String::getClassName($this->_task);
}
}
/**
* Since this is a state machine for search and we want to come back to the same state
* we dont want to issue a reset of the state session when we are done processing a task
*/
public function shouldReset() {
return FALSE;
}
}
<?php
use Civi\DataProcessor\FieldOutputHandler\OutputHandlerAggregate;
use Civi\DataProcessor\FilterCollection\FilterCollection;
use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_Dataprocessor_BAO_DataProcessor extends CRM_Dataprocessor_DAO_DataProcessor {
......@@ -54,15 +54,17 @@ class CRM_Dataprocessor_BAO_DataProcessor extends CRM_Dataprocessor_DAO_DataProc
* Returns a configured data processor instance.
*
* @param array $dataProcessor
* @param bool $force
* If set reload the data processor in the cache.
* @return \Civi\DataProcessor\ProcessorType\AbstractProcessorType
* @throws \Exception
*/
public static function dataProcessorToClass($dataProcessor) {
public static function dataProcessorToClass($dataProcessor, $force=false) {
$cache_key = 'dataprocessor_'.$dataProcessor['id'];
$cache = CRM_Dataprocessor_Utils_Cache::singleton();
if ($dataProcessorClass = $cache->get($cache_key)) {
if (!$force && $dataProcessorClass = $cache->get($cache_key)) {
// Reset the default filter values as they might have been changed.
$dataProcessorClass->setDefaultFilterValues();
$dataProcessorClass->loadedFromCache();
return $dataProcessorClass;
}
$factory = dataprocessor_get_factory();
......@@ -75,15 +77,31 @@ class CRM_Dataprocessor_BAO_DataProcessor extends CRM_Dataprocessor_DAO_DataProc
CRM_Core_Session::setStatus($e->getMessage(), E::ts("Could not add data source"), 'error');
}
}
$filterCollections = civicrm_api3('DataProcessorFilterCollection', 'get', array('data_processor_id' => $dataProcessor['id'], 'options' => array('limit' => 0)));
$filterCollectionIdToNr = [];
$i =1;
foreach($filterCollections['values'] as $filterCollection) {
$filterCollectionIdToNr[$filterCollection['id']] = $i;
$objFilterCollection = new FilterCollection($i, $filterCollection['link_condition'], $filterCollection['condition'], $filterCollection['title'], $filterCollection['description'], $filterCollection['show_collapsed']);
$objFilterCollection->setDataProcessor($dataProcessorClass);
$dataProcessorClass->addFilterCollection($objFilterCollection);
$i++;
}
$filters = civicrm_api3('DataProcessorFilter', 'get', array('data_processor_id' => $dataProcessor['id'], 'options' => array('limit' => 0)));
foreach($filters['values'] as $filter) {
$filterCollectionNr = 0;
if (isset($filter['collection_id']) && isset($filterCollectionIdToNr[$filter['collection_id']])) {
$filterCollectionNr = $filterCollectionIdToNr[$filter['collection_id']];
}
$filterCollection = $dataProcessorClass->getFilterCollectionByNumber($filterCollectionNr);
$filterHandler = $factory->getFilterByName($filter['type']);
if ($filterHandler) {
$filterHandler->setDataProcessor($dataProcessorClass);
$filterHandler->setFilterCollection($filterCollection);
try {
$filterHandler->initialize($filter);
$dataProcessorClass->addFilterHandler($filterHandler);
$filterCollection->addFilterHandler($filterHandler);
} catch (\Exception $e) {
CRM_Core_Session::setStatus($e->getMessage(), E::ts("Invalid filter"), 'error');
}
......@@ -95,17 +113,28 @@ class CRM_Dataprocessor_BAO_DataProcessor extends CRM_Dataprocessor_DAO_DataProc
$outputHandler = $factory->getOutputHandlerByName($field['type']);
if ($outputHandler) {
$outputHandler->setDataProcessor($dataProcessorClass);
$outputHandler->setIsExposed($field['is_exposed']);
try {
$outputHandler->initialize($field['name'], $field['title'], $field['configuration']);
$dataProcessorClass->addOutputFieldHandlers($outputHandler);
if ($outputHandler instanceof OutputHandlerAggregate && $outputHandler->isAggregateField()) {
$dataProcessorClass->getDataFlow()->addAggregateOutputHandler($outputHandler);
}
} catch (\Exception $e) {
CRM_Core_Session::setStatus($e->getMessage(), E::ts("Invalid field"), 'error');
}
}
}
if (isset($dataProcessor['configuration']['default_sort'])) {
foreach($dataProcessor['configuration']['default_sort'] as $sort) {
if (stripos($sort, 'asc_by_') === 0) {
$field = substr($sort, 7);
$dataProcessorClass->getDataFlow()->addSort($field, 'ASC');
} elseif (stripos($sort, 'desc_by_') === 0) {
$field = substr($sort, 8);
$dataProcessorClass->getDataFlow()->addSort($field, 'DESC');
}
}
}
$cache->set($cache_key, $dataProcessorClass);
return $dataProcessorClass;
}
......
<?php
use Civi\DataProcessor\FilterCollection\FilterCollection;
use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_Dataprocessor_BAO_DataProcessorFilterCollection extends CRM_Dataprocessor_DAO_DataProcessorFilterCollection {
/**
* Returns the filter colelction number from its ID.
*
* @param $data_processor_id
* @param $id
*
* @return int
*/
public static function getFilterFilloctionNumberById($data_processor_id, $id): int {
static $filterCollectionIdToNr = [];
if (empty($filterCollectionIdToNr)) {
try {
$filterCollections = civicrm_api3('DataProcessorFilterCollection', 'get', [
'data_processor_id' => $data_processor_id,
'options' => ['limit' => 0],
]);
$i = 1;
foreach ($filterCollections['values'] as $filterCollection) {
$filterCollectionIdToNr[$filterCollection['id']] = $i;
$i++;
}
} catch (CRM_Core_Exception $e) {
}
}
if ($id && isset($filterCollectionIdToNr[$id])) {
$filterCollectionIdToNr[$id];
}
return 0;
}
public static function checkName($title, $data_processor_id, $id=null,$name=null) {
if (!$name) {
$name = preg_replace('@[^a-z0-9_]+@','_',strtolower($title));
}
$name = preg_replace('@[^a-z0-9_]+@','_',strtolower($name));
$name_part = $name;
$sql = "SELECT COUNT(*) FROM `civicrm_data_processor_filter_collection` WHERE `name` = %1 AND `data_processor_id` = %2";
$sqlParams[1] = array($name, 'String');
$sqlParams[2] = array($data_processor_id, 'String');
if ($id) {
$sql .= " AND `id` != %3";
$sqlParams[3] = array($id, 'Integer');
}
$i = 1;
while(CRM_Core_DAO::singleValueQuery($sql, $sqlParams) > 0) {
$i++;
$name = $name_part .'_'.$i;
$sqlParams[1] = array($name, 'String');
}
return $name;
}
/**
* Delete function so that the hook for deleting an output gets invoked.
*
* @param $id
*/
public static function del($id) {
CRM_Utils_Hook::pre('delete', 'DataProcessorFilterCollection', $id, CRM_Core_DAO::$_nullArray);
$dao = new CRM_Dataprocessor_BAO_DataProcessorFilterCollection();
$dao->id = $id;
if ($dao->find(true)) {
$dao->delete();
}
CRM_Utils_Hook::post('delete', 'DataProcessorFilterCollection', $id, CRM_Core_DAO::$_nullArray);
}
/**
* Function to delete a Data Processor Filter with id
*
* @param int $id
* @throws Exception when $id is empty
* @access public
* @static
*/
public static function deleteWithDataProcessorId($id) {
if (empty($id)) {
throw new Exception('id can not be empty when attempting to delete a data processor filter');
}
$field = new CRM_Dataprocessor_DAO_DataProcessorFilterCollection();
$field->data_processor_id = $id;
$field->find(FALSE);
while ($field->fetch()) {
civicrm_api3('DataProcessorFilterCollection', 'delete', array('id' => $field->id));
}
}
}
......@@ -2,17 +2,20 @@
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessor.xml
* Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessor.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:d6907bd0c85e77ce033cc7aef3d0aa3a)
* (GenCodeChecksum:408f563ffe49f973ca26a24c8e17b40e)
*/
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Database access object for the DataProcessor entity.
*/
class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/**
* Static instance to hold the table name.
......@@ -21,6 +24,13 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
*/
public static $_tableName = 'civicrm_data_processor';
/**
* Field to show when displaying a record.
*
* @var string
*/
public static $_labelField = 'title';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
......@@ -31,57 +41,79 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
/**
* Unique DataProcessor ID
*
* @var int
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $name;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $title;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $type;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $configuration;
/**
* @var bool
* @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
public $is_active;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $description;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $storage_type;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $storage_configuration;
/**
* @var int
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $status;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $source_file;
......@@ -93,6 +125,16 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
parent::__construct();
}
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Data Processors') : E::ts('Data Processor');
}
/**
* Returns all the column names of this table
*
......@@ -104,136 +146,215 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessor ID'),
'title' => E::ts('ID'),
'description' => E::ts('Unique DataProcessor ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.id',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'name' => [
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Name'),
'title' => E::ts('Name'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.name',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'title' => [
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Title'),
'title' => E::ts('Title'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.title',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'type' => [
'name' => 'type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Type'),
'title' => E::ts('Type'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.type',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'configuration' => [
'name' => 'configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
'title' => E::ts('Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.configuration',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'is_active' => [
'name' => 'is_active',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Is active'),
'title' => E::ts('Is active'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.is_active',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'description' => [
'name' => 'description',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Description'),
'title' => E::ts('Description'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.description',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'storage_type' => [
'name' => 'storage_type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Storage Type'),
'title' => E::ts('Storage Type'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.storage_type',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'storage_configuration' => [
'name' => 'storage_configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Storage Configuration'),
'title' => E::ts('Storage Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.storage_configuration',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'status' => [
'name' => 'status',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Status'),
'title' => E::ts('Status'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.status',
'default' => '0',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
'source_file' => [
'name' => 'source_file',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Source File'),
'title' => E::ts('Source File'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor.source_file',
'table_name' => 'civicrm_data_processor',
'entity' => 'DataProcessor',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
'localizable' => 0,
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
......@@ -241,37 +362,6 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Return a mapping from field-name to the corresponding key (as used in fields()).
*
* @return array
* Array(string $name => string $uniqueName).
*/
public static function &fieldKeys() {
if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
}
return Civi::$statics[__CLASS__]['fieldKeys'];
}
/**
* Returns the names of this table
*
* @return string
*/
public static function getTableName() {
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return bool
*/
public function getLog() {
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
......
......@@ -2,17 +2,20 @@
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorField.xml
* Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:d274dcffe6113de94c614b35f32dc06b)
* (GenCodeChecksum:9513d8dff12fff19074757207c0dfb73)
*/
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Database access object for the DataProcessorField entity.
*/
class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/**
* Static instance to hold the table name.
......@@ -21,6 +24,13 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
*/
public static $_tableName = 'civicrm_data_processor_field';
/**
* Field to show when displaying a record.
*
* @var string
*/
public static $_labelField = 'title';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
......@@ -31,42 +41,63 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
/**
* Unique DataProcessorField ID
*
* @var int
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* FK to Data Processor
*
* @var int
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $data_processor_id;
/**
* @var int
* @var int|string
* (SQL type: int)
* Note that values will be retrieved from the database as a string.
*/
public $weight;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $name;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $title;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $type;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $configuration;
/**
* @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
public $is_exposed;
/**
* Class constructor.
*/
......@@ -76,18 +107,13 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
}
/**
* Returns foreign keys and entity references.
* Returns localized title of this entity.
*
* @return array
* [CRM_Core_Reference_Interface]
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
return Civi::$statics[__CLASS__]['links'];
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Data Processor Fields') : E::ts('Data Processor Field');
}
/**
......@@ -101,87 +127,158 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorField ID'),
'title' => E::ts('ID'),
'description' => E::ts('Unique DataProcessorField ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.id',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'data_processor_id' => [
'name' => 'data_processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
'title' => E::ts('Data Processor ID'),
'description' => E::ts('FK to Data Processor'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.data_processor_id',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'FKClassName' => 'CRM_Dataprocessor_DAO_DataProcessor',
'add' => NULL,
],
'weight' => [
'name' => 'weight',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Weight'),
'title' => E::ts('Weight'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.weight',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'add' => NULL,
],
'name' => [
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Name'),
'title' => E::ts('Name'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.name',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'add' => NULL,
],
'title' => [
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Title'),
'title' => E::ts('Title'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.title',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'add' => NULL,
],
'type' => [
'name' => 'type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Type'),
'title' => E::ts('Type'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.type',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'add' => NULL,
],
'configuration' => [
'name' => 'configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
'title' => E::ts('Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.configuration',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'is_exposed' => [
'name' => 'is_exposed',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => E::ts('Is exposed'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_field.is_exposed',
'default' => '1',
'table_name' => 'civicrm_data_processor_field',
'entity' => 'DataProcessorField',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
'localizable' => 0,
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
......@@ -189,37 +286,6 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Return a mapping from field-name to the corresponding key (as used in fields()).
*
* @return array
* Array(string $name => string $uniqueName).
*/
public static function &fieldKeys() {
if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
}
return Civi::$statics[__CLASS__]['fieldKeys'];
}
/**
* Returns the names of this table
*
* @return string
*/
public static function getTableName() {
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return bool
*/
public function getLog() {
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
......
......@@ -2,17 +2,20 @@
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorFilter.xml
* Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorFilterHandler.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:24f21f0d15aa13b3b28792ad454e68e8)
* (GenCodeChecksum:0bec9ca27a1543c58fa6e52cdd3ff528)
*/
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Database access object for the DataProcessorFilter entity.
*/
class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/**
* Static instance to hold the table name.
......@@ -21,6 +24,13 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
*/
public static $_tableName = 'civicrm_data_processor_filter';
/**
* Field to show when displaying a record.
*
* @var string
*/
public static $_labelField = 'title';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
......@@ -31,57 +41,84 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
/**
* Unique DataProcessorFilter ID
*
* @var int
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* FK to Data Processor
*
* @var int
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $data_processor_id;
/**
* @var int
* @var int|string
* (SQL type: int)
* Note that values will be retrieved from the database as a string.
*/
public $weight;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $name;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $title;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $type;
/**
* @var bool
* @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
public $is_required;
/**
* @var bool
* @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
public $is_exposed;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $configuration;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $filter_value;
/**
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $collection_id;
/**
* Class constructor.
*/
......@@ -91,18 +128,13 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
}
/**
* Returns foreign keys and entity references.
* Returns localized title of this entity.
*
* @return array
* [CRM_Core_Reference_Interface]
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
return Civi::$statics[__CLASS__]['links'];
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Data Processor Filters') : E::ts('Data Processor Filter');
}
/**
......@@ -116,122 +148,213 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorFilter ID'),
'title' => E::ts('ID'),
'description' => E::ts('Unique DataProcessorFilter ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.id',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'data_processor_id' => [
'name' => 'data_processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
'title' => E::ts('Data Processor ID'),
'description' => E::ts('FK to Data Processor'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.data_processor_id',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'FKClassName' => 'CRM_Dataprocessor_DAO_DataProcessor',
'add' => NULL,
],
'weight' => [
'name' => 'weight',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Weight'),
'title' => E::ts('Weight'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.weight',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'add' => NULL,
],
'name' => [
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Name'),
'title' => E::ts('Name'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.name',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'add' => NULL,
],
'title' => [
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Title'),
'title' => E::ts('Title'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.title',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'add' => NULL,
],
'type' => [
'name' => 'type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Type'),
'title' => E::ts('Type'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.type',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'add' => NULL,
],
'is_required' => [
'name' => 'is_required',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Is required'),
'title' => E::ts('Is required'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.is_required',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'add' => NULL,
],
'is_exposed' => [
'name' => 'is_exposed',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Is exposed'),
'title' => E::ts('Is exposed'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.is_exposed',
'default' => '1',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'add' => NULL,
],
'configuration' => [
'name' => 'configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
'title' => E::ts('Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.configuration',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'filter_value' => [
'name' => 'filter_value',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Default Filter Value'),
'title' => E::ts('Default Filter Value'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.filter_value',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'collection_id' => [
'name' => 'collection_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Filter Collection Id'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter.collection_id',
'table_name' => 'civicrm_data_processor_filter',
'entity' => 'DataProcessorFilter',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
'localizable' => 0,
'FKClassName' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
......@@ -239,37 +362,6 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Return a mapping from field-name to the corresponding key (as used in fields()).
*
* @return array
* Array(string $name => string $uniqueName).
*/
public static function &fieldKeys() {
if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
}
return Civi::$statics[__CLASS__]['fieldKeys'];
}
/**
* Returns the names of this table
*
* @return string
*/
public static function getTableName() {
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return bool
*/
public function getLog() {
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
......
<?php
/**
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorFilterCollection.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:3c4c74e46acd9b9dffd549d17293d118)
*/
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Database access object for the DataProcessorFilterCollection entity.
*/
class CRM_Dataprocessor_DAO_DataProcessorFilterCollection extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/**
* Static instance to hold the table name.
*
* @var string
*/
public static $_tableName = 'civicrm_data_processor_filter_collection';
/**
* Field to show when displaying a record.
*
* @var string
*/
public static $_labelField = 'title';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
* @var bool
*/
public static $_log = FALSE;
/**
* Unique DataProcessorFilterCollection ID
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* FK to Data Processor
*
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $data_processor_id;
/**
* @var int|string
* (SQL type: int)
* Note that values will be retrieved from the database as a string.
*/
public $weight;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $name;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $title;
/**
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $description;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $condition;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $link_condition;
/**
* @var bool|string
* (SQL type: tinyint)
* Note that values will be retrieved from the database as a string.
*/
public $show_collapsed;
/**
* Class constructor.
*/
public function __construct() {
$this->__table = 'civicrm_data_processor_filter_collection';
parent::__construct();
}
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Data Processor Filter Collections') : E::ts('Data Processor Filter Collection');
}
/**
* Returns all the column names of this table
*
* @return array
*/
public static function &fields() {
if (!isset(Civi::$statics[__CLASS__]['fields'])) {
Civi::$statics[__CLASS__]['fields'] = [
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('ID'),
'description' => E::ts('Unique DataProcessorFilterCollection ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.id',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'data_processor_id' => [
'name' => 'data_processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Data Processor ID'),
'description' => E::ts('FK to Data Processor'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.data_processor_id',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'FKClassName' => 'CRM_Dataprocessor_DAO_DataProcessor',
'add' => NULL,
],
'weight' => [
'name' => 'weight',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Weight'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.weight',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
'name' => [
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Name'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.name',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
'title' => [
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Title'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.title',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
'description' => [
'name' => 'description',
'type' => CRM_Utils_Type::T_TEXT,
'title' => E::ts('Description'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.description',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
'condition' => [
'name' => 'condition',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Condition'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.condition',
'default' => 'AND',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
'link_condition' => [
'name' => 'link_condition',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Condition for linking this collection to the previous collection'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.link_condition',
'default' => 'AND',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
'show_collapsed' => [
'name' => 'show_collapsed',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => E::ts('Show Collapsed'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_filter_collection.show_collapsed',
'table_name' => 'civicrm_data_processor_filter_collection',
'entity' => 'DataProcessorFilterCollection',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection',
'localizable' => 0,
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Returns the list of fields that can be imported
*
* @param bool $prefix
*
* @return array
*/
public static function &import($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'data_processor_filter_collection', $prefix, []);
return $r;
}
/**
* Returns the list of fields that can be exported
*
* @param bool $prefix
*
* @return array
*/
public static function &export($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'data_processor_filter_collection', $prefix, []);
return $r;
}
/**
* Returns the list of indices
*
* @param bool $localize
*
* @return array
*/
public static function indices($localize = TRUE) {
$indices = [];
return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
}
}
......@@ -2,17 +2,20 @@
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorOutput.xml
* Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorOutput.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:b084899f5823b297a409b16cc41bdf7a)
* (GenCodeChecksum:e9f8b631a630c9b50d2eef236d5dc7a0)
*/
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Database access object for the DataProcessorOutput entity.
*/
class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/**
* Static instance to hold the table name.
......@@ -31,44 +34,60 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
/**
* Unique DataProcessorOutput ID
*
* @var int
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* FK to Data Processor
*
* @var int
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $data_processor_id;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $type;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $configuration;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $permission;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $api_entity;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $api_action;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $api_count_action;
......@@ -81,18 +100,13 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
}
/**
* Returns foreign keys and entity references.
* Returns localized title of this entity.
*
* @return array
* [CRM_Core_Reference_Interface]
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
return Civi::$statics[__CLASS__]['links'];
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Data Processor Outputs') : E::ts('Data Processor Output');
}
/**
......@@ -106,102 +120,161 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorOutput ID'),
'title' => E::ts('ID'),
'description' => E::ts('Unique DataProcessorOutput ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.id',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'data_processor_id' => [
'name' => 'data_processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
'title' => E::ts('Data Processor ID'),
'description' => E::ts('FK to Data Processor'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.data_processor_id',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'FKClassName' => 'CRM_Dataprocessor_DAO_DataProcessor',
'add' => NULL,
],
'type' => [
'name' => 'type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Type'),
'title' => E::ts('Type'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.type',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'add' => NULL,
],
'configuration' => [
'name' => 'configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
'title' => E::ts('Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.configuration',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'permission' => [
'name' => 'permission',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Permission'),
'title' => E::ts('Permission'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.permission',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'add' => NULL,
],
'api_entity' => [
'name' => 'api_entity',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('API Entity'),
'title' => E::ts('API Entity'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.api_entity',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'add' => NULL,
],
'api_action' => [
'name' => 'api_action',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('API Action'),
'title' => E::ts('API Action'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.api_action',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'add' => NULL,
],
'api_count_action' => [
'name' => 'api_count_action',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('API Getcount action'),
'title' => E::ts('API Getcount action'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_output.api_count_action',
'table_name' => 'civicrm_data_processor_output',
'entity' => 'DataProcessorOutput',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
'localizable' => 0,
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
......@@ -209,37 +282,6 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Return a mapping from field-name to the corresponding key (as used in fields()).
*
* @return array
* Array(string $name => string $uniqueName).
*/
public static function &fieldKeys() {
if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
}
return Civi::$statics[__CLASS__]['fieldKeys'];
}
/**
* Returns the names of this table
*
* @return string
*/
public static function getTableName() {
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return bool
*/
public function getLog() {
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
......
......@@ -2,17 +2,20 @@
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorSource.xml
* Generated from dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorSource.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:8b610b28b2023badbccde15e8fa1010d)
* (GenCodeChecksum:e91b055f903a8a154900634aa039e331)
*/
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Database access object for the DataProcessorSource entity.
*/
class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/**
* Static instance to hold the table name.
......@@ -21,6 +24,13 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
*/
public static $_tableName = 'civicrm_data_processor_source';
/**
* Field to show when displaying a record.
*
* @var string
*/
public static $_labelField = 'title';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
......@@ -31,49 +41,67 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
/**
* Unique DataProcessorSource ID
*
* @var int
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* FK to Data Processor
*
* @var int
* @var int|string
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $data_processor_id;
/**
* @var int
* @var int|string
* (SQL type: int)
* Note that values will be retrieved from the database as a string.
*/
public $weight;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $name;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $title;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $type;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $configuration;
/**
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $join_type;
/**
* @var text
* @var string
* (SQL type: text)
* Note that values will be retrieved from the database as a string.
*/
public $join_configuration;
......@@ -86,18 +114,13 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
}
/**
* Returns foreign keys and entity references.
* Returns localized title of this entity.
*
* @return array
* [CRM_Core_Reference_Interface]
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getReferenceColumns() {
if (!isset(Civi::$statics[__CLASS__]['links'])) {
Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
return Civi::$statics[__CLASS__]['links'];
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Data Processor Sources') : E::ts('Data Processor Source');
}
/**
......@@ -111,112 +134,178 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorSource ID'),
'title' => E::ts('ID'),
'description' => E::ts('Unique DataProcessorSource ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.id',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'data_processor_id' => [
'name' => 'data_processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
'title' => E::ts('Data Processor ID'),
'description' => E::ts('FK to Data Processor'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.data_processor_id',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'FKClassName' => 'CRM_Dataprocessor_DAO_DataProcessor',
'add' => NULL,
],
'weight' => [
'name' => 'weight',
'type' => CRM_Utils_Type::T_INT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Weight'),
'title' => E::ts('Weight'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.weight',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'add' => NULL,
],
'name' => [
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Name'),
'title' => E::ts('Name'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.name',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'add' => NULL,
],
'title' => [
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Title'),
'title' => E::ts('Title'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.title',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'add' => NULL,
],
'type' => [
'name' => 'type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Type'),
'title' => E::ts('Type'),
'required' => TRUE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.type',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'add' => NULL,
],
'configuration' => [
'name' => 'configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
'title' => E::ts('Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.configuration',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
'join_type' => [
'name' => 'join_type',
'type' => CRM_Utils_Type::T_STRING,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Join Type'),
'title' => E::ts('Join Type'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.join_type',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'add' => NULL,
],
'join_configuration' => [
'name' => 'join_configuration',
'type' => CRM_Utils_Type::T_TEXT,
'title' => CRM_Dataprocessor_ExtensionUtil::ts('Join Configuration'),
'title' => E::ts('Join Configuration'),
'required' => FALSE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_data_processor_source.join_configuration',
'table_name' => 'civicrm_data_processor_source',
'entity' => 'DataProcessorSource',
'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
......@@ -224,37 +313,6 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Return a mapping from field-name to the corresponding key (as used in fields()).
*
* @return array
* Array(string $name => string $uniqueName).
*/
public static function &fieldKeys() {
if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
}
return Civi::$statics[__CLASS__]['fieldKeys'];
}
/**
* Returns the names of this table
*
* @return string
*/
public static function getTableName() {
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return bool
*/
public function getLog() {
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
......
......@@ -26,7 +26,7 @@ class CRM_Dataprocessor_Form_CloneDataProcessor extends CRM_Core_Form {
* @access public
*/
function preProcess() {
$this->dataProcessorId = CRM_Utils_Request::retrieve('id', 'Integer', $this, true);
$this->dataProcessorId = CRM_Utils_Request::retrieveValue('id', 'Integer', NULL, TRUE);
$this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', ['id' => $this->dataProcessorId]);
$this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor, true);
$this->currentUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
......@@ -75,48 +75,13 @@ class CRM_Dataprocessor_Form_CloneDataProcessor extends CRM_Core_Form {
public function postProcess() {
$session = CRM_Core_Session::singleton();
$values = $this->exportValues();
$params['name'] = $values['name'];
$params['title'] = $values['title'];
$params['description'] = $values['description'];
$params['is_active'] = !empty($values['is_active']) ? 1 : 0;
$result = civicrm_api3('DataProcessor', 'create', $params);
$newId = $result['id'];
$sources = civicrm_api3('DataProcessorSource', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$dataProcessor['data_sources'] = array();
foreach($sources['values'] as $i => $datasource) {
unset($datasource['id']);
unset($datasource['data_processor_id']);
$datasource['data_processor_id'] = $newId;
civicrm_api3('DataProcessorSource', 'create', $datasource);
}
$filters = civicrm_api3('DataProcessorFilter', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$dataProcessor['filters'] = array();
foreach($filters['values'] as $i => $filter) {
unset($filter['id']);
unset($filter['data_processor_id']);
$filter['data_processor_id'] = $newId;
civicrm_api3('DataProcessorFilter', 'create', $filter);
}
$fields = civicrm_api3('DataProcessorField', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$dataProcessor['fields'] = array();
foreach($fields['values'] as $i => $field) {
unset($field['id']);
unset($field['data_processor_id']);
$field['data_processor_id'] = $newId;
civicrm_api3('DataProcessorField', 'create', $field);
}
$outputs = $outputs = civicrm_api3('DataProcessorOutput', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$dataProcessor['outputs'] = array();
foreach($outputs['values'] as $i => $output) {
unset($output['id']);
unset($output['data_processor_id']);
$output['data_processor_id'] = $newId;
civicrm_api3('DataProcessorOutput', 'create', $output);
}
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $result['id']));
$dataProcessor = CRM_Dataprocessor_Utils_Importer::export($this->dataProcessorId);
$dataProcessor['name'] = $values['name'];
$dataProcessor['title'] = $values['title'];
$dataProcessor['description'] = $values['description'];
$dataProcessor['is_active'] = !empty($values['is_active']) ? 1 : 0;
$newId = CRM_Dataprocessor_Utils_Importer::importDataProcessor($dataProcessor, null, null, CRM_Dataprocessor_Status::STATUS_IN_DATABASE);
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $newId));
CRM_Utils_System::redirect($redirectUrl);
}
......
......@@ -73,15 +73,18 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
$this->assign('dataProcessor', $this->dataProcessor);
$this->addSources();
$this->addFields();
$this->addFilterCollections();
$this->addFilters();
$this->addOutputs();
$dataSourceAddUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/source', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
$addFieldUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/field', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
$addFilterUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/filter', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
$addFilterCollectionUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/filtercollection', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
$outputAddUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/output', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
$this->assign('addDataSourceUrl', $dataSourceAddUrl);
$this->assign('addFieldUrl', $addFieldUrl);
$this->assign('addFilterUrl', $addFilterUrl);
$this->assign('addFilterCollectionUrl', $addFilterCollectionUrl);
$this->assign('addOutputUrl', $outputAddUrl);
}
}
......@@ -103,17 +106,56 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
}
protected function addFields() {
$factory = dataprocessor_get_factory();
$fields = civicrm_api3('DataProcessorField', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$fields = $fields['values'];
CRM_Utils_Weight::addOrder($fields, 'CRM_Dataprocessor_DAO_DataProcessorField', 'id', $this->currentUrl, 'data_processor_id='.$this->dataProcessorId);
$this->assign('fields', $fields);
$sortFields = [];
foreach($fields as $idx => $field) {
$fieldClass = $factory->getOutputHandlerByName($field['type']);
if ($fieldClass instanceof \Civi\DataProcessor\FieldOutputHandler\OutputHandlerSortable) {
$sortFields['asc_by_'.$field['name']] = E::ts('%1 Ascending', [1=>$field['title']]);
$sortFields['desc_by_'.$field['name']] = E::ts('%1 Descending', [1=>$field['title']]);
}
}
if (isset($this->dataProcessor['configuration']['default_sort']) && is_array($this->dataProcessor['configuration']['default_sort'])) {
foreach(array_reverse($this->dataProcessor['configuration']['default_sort']) as $sort) {
$label = $sortFields[$sort];
unset($sortFields[$sort]);
$sortFields = array_merge([$sort=>$label], $sortFields);
}
}
$sortOptions = array_flip($sortFields);
$this->addCheckBox('defaultSort', E::ts('Default sort'), $sortOptions);
$this->assign('sortFields', $sortFields);
$this->add('hidden', 'default_sort_weight', null, ['id' => 'default_sort_weight']);
}
protected function addFilterCollections() {
$filterCollections = civicrm_api3('DataProcessorFilterCollection', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$filterCollections = $filterCollections['values'];
foreach($filterCollections as $index => $filterCollection) {
$filterCollections[$index]['filters'] = $this->getFilters($filterCollection['id']);
}
CRM_Utils_Weight::addOrder($filterCollections, 'CRM_Dataprocessor_DAO_DataProcessorFilterCollection', 'id', $this->currentUrl, 'data_processor_id='.$this->dataProcessorId);
$this->assign('filterCollections', $filterCollections);
}
protected function addFilters() {
$filters = civicrm_api3('DataProcessorFilter', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
protected function addFilters(int $groupId = null) {
$this->assign('filters', $this->getFilters($groupId));
}
protected function getFilters(int $groupId = null): array {
if ($groupId) {
$groupIdParameter = $groupId;
} else {
$groupIdParameter = ['IS NULL' => 1];
}
$filters = civicrm_api3('DataProcessorFilter', 'get', array('data_processor_id' => $this->dataProcessorId, 'collection_id' => $groupIdParameter, 'options' => array('limit' => 0)));
$filters = $filters['values'];
CRM_Utils_Weight::addOrder($filters, 'CRM_Dataprocessor_DAO_DataProcessorFilter', 'id', $this->currentUrl, 'data_processor_id='.$this->dataProcessorId);
$this->assign('filters', $filters);
return $filters;
}
protected function addOutputs() {
......@@ -123,8 +165,10 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
$outputs = CRM_Utils_Array::value('values', $outputs);
foreach($outputs as $idx => $output) {
$outputClass = $factory->getOutputByName($output['type']);
if ($outputClass instanceof \Civi\DataProcessor\Output\UIOutputInterface) {
if ($outputClass instanceof \Civi\DataProcessor\Output\UIFormOutputInterface) {
$outputs[$idx]['navigation_url'] = CRM_Utils_System::url($outputClass->getUrlToUi($output, $this->dataProcessor), array('reset' => '1'));
} elseif ($outputClass instanceof \Civi\DataProcessor\Output\UrlOutputInterface && $outputClass->checkPermission($output, $this->dataProcessor)) {
$outputs[$idx]['navigation_url'] = $outputClass->getUrl($output, $this->dataProcessor);
}
if (isset($types[$output['type']])) {
......@@ -142,7 +186,7 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
if ($this->_action != CRM_Core_Action::DELETE) {
$this->add('text', 'name', E::ts('Name'), array('size' => CRM_Utils_Type::HUGE), FALSE);
$this->add('text', 'title', E::ts('Title'), array('size' => CRM_Utils_Type::HUGE), TRUE);
$this->add('text', 'description', E::ts('Description'), array('size' => 100, 'maxlength' => 256));
$this->add('text', 'description', E::ts('Description'), array('size' => 100, 'maxlength' => 256, 'style' => 'width: 600px;'));
$this->add('checkbox', 'is_active', E::ts('Enabled'));
}
if ($this->_action == CRM_Core_Action::ADD) {
......@@ -213,6 +257,17 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
if ($this->dataProcessorId) {
$params['id'] = $this->dataProcessorId;
}
if (!empty($values['default_sort_weight'])) {
$defaultSortWeight = explode(',', $values['default_sort_weight']);
$params['configuration']['default_sort'] = [];
foreach ($defaultSortWeight as $key => $val) {
if ($val && isset($values['defaultSort'][$val])) {
$params['configuration']['default_sort'][] = $val;
}
}
} elseif (isset($values['defaultSort'])) {
$params['configuration']['default_sort'] = array_keys($values['defaultSort']);
}
$result = civicrm_api3('DataProcessor', 'create', $params);
......@@ -262,6 +317,12 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
$defaults['description'] = '';
}
$defaults['is_active'] = $this->dataProcessor['is_active'];
if (isset($this->dataProcessor['configuration']['default_sort'])) {
$defaults['defaultSort'] = [];
foreach($this->dataProcessor['configuration']['default_sort'] as $sort) {
$defaults['defaultSort'][$sort] = 1;
}
}
}
}
......
......@@ -88,6 +88,7 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
if ($this->_action != CRM_Core_Action::DELETE) {
$this->add('text', 'name', E::ts('Name'), array('size' => CRM_Utils_Type::HUGE), FALSE);
$this->add('text', 'title', E::ts('Title'), array('size' => CRM_Utils_Type::HUGE), TRUE);
$this->add('checkbox', 'is_exposed', E::ts('Field is exposed to the user'));
$this->add('select', 'type', E::ts('Select Field'), $this->outputHandlers, true, array(
'style' => 'min-width:250px',
......@@ -127,6 +128,11 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
$defaults['name'] = $this->field['name'];
}
}
if ($this->_action == CRM_Core_Action::ADD) {
$defaults['is_exposed'] = 1;
} elseif (isset($this->field['is_exposed'])) {
$defaults['is_exposed'] = $this->field['is_exposed'];
}
return $defaults;
}
......@@ -156,6 +162,7 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
$params['title'] = $values['title'];
$params['type'] = $values['type'];
$params['data_processor_id'] = $this->dataProcessorId;
$params['is_exposed'] = isset($values['is_exposed']) && $values['is_exposed'] ? 1 : 0;
if ($this->id) {
$params['id'] = $this->id;
}
......@@ -170,4 +177,4 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
parent::postProcess();
}
}
\ No newline at end of file
}