Commit 26327066 authored by jaapjansma's avatar jaapjansma

refactor

parent ee2872ab
......@@ -73,11 +73,19 @@ class SimpleWhereClause implements WhereClauseInterface {
* @return string
*/
public function getWhereClause() {
if ($this->operator == 'NOT IN') {
// If the operator is NOT IN also include NULL values.
return "(`{$this->table_alias}`.`{$this->field}` {$this->operator} {$this->value} OR `{$this->table_alias}`.`{$this->field}` IS NULL)";
if ($this->isJoinClause()) {
return "`{$this->table_alias}`.`{$this->field}` {$this->operator} {$this->value}";
}
switch ($this->operator) {
case 'NOT IN':
case 'NOT LIKE':
case '!=':
return "(`{$this->table_alias}`.`{$this->field}` {$this->operator} {$this->value} OR `{$this->table_alias}`.`{$this->field}` IS NULL)";
break;
default:
return "`{$this->table_alias}`.`{$this->field}` {$this->operator} {$this->value}";
break;
}
return "`{$this->table_alias}`.`{$this->field}` {$this->operator} {$this->value}";
}
}
\ No newline at end of file
......@@ -95,23 +95,23 @@ class Factory {
$this->dispatcher = \Civi::dispatcher();
$this->addDataProcessorType('default', 'Civi\DataProcessor\ProcessorType\DefaultProcessorType', E::ts('Default'));
$this->addDataSource('contact', 'Civi\DataProcessor\Source\ContactSource', E::ts('Contact'));
$this->addDataSource('group', 'Civi\DataProcessor\Source\GroupSource', E::ts('Group'));
$this->addDataSource('group_contact', 'Civi\DataProcessor\Source\GroupContactSource', E::ts('Contacts in a group'));
$this->addDataSource('email', 'Civi\DataProcessor\Source\EmailSource', E::ts('E-mail'));
$this->addDataSource('address', 'Civi\DataProcessor\Source\AddressSource', E::ts('Address'));
$this->addDataSource('phone', 'Civi\DataProcessor\Source\PhoneSource', E::ts('Phone'));
$this->addDataSource('contribution', 'Civi\DataProcessor\Source\ContributionSource', E::ts('Contribution'));
$this->addDataSource('relationship', 'Civi\DataProcessor\Source\RelationshipSource', E::ts('Relationship'));
$this->addDataSource('relationship_type', 'Civi\DataProcessor\Source\RelationshipTypeSource', E::ts('Relationship Type'));
$this->addDataSource('event', 'Civi\DataProcessor\Source\EventSource', E::ts('Event'));
$this->addDataSource('participant', 'Civi\DataProcessor\Source\ParticipantSource', E::ts('Participant'));
$this->addDataSource('mailing', 'Civi\DataProcessor\Source\MailingSource', E::ts('Mailing'));
$this->addDataSource('mailing_job', 'Civi\DataProcessor\Source\MailingJobSource', E::ts('Mailing Job'));
$this->addDataSource('mailing_group', 'Civi\DataProcessor\Source\MailingGroupSource', E::ts('Mailing Group'));
$this->addDataSource('membership', 'Civi\DataProcessor\Source\MembershipSource', E::ts('Membership'));
$this->addDataSource('membership_type', 'Civi\DataProcessor\Source\MembershipTypeSource', E::ts('Membership Type'));
$this->addDataSource('membership_status', 'Civi\DataProcessor\Source\MembershipStatusSource', E::ts('Membership Status'));
$this->addDataSource('contact', 'Civi\DataProcessor\Source\Contact\ContactSource', E::ts('Contact'));
$this->addDataSource('group', 'Civi\DataProcessor\Source\Group\GroupSource', E::ts('Group'));
$this->addDataSource('group_contact', 'Civi\DataProcessor\Source\Group\GroupContactSource', E::ts('Contacts in a group'));
$this->addDataSource('email', 'Civi\DataProcessor\Source\Contact\EmailSource', E::ts('E-mail'));
$this->addDataSource('address', 'Civi\DataProcessor\Source\Contact\AddressSource', E::ts('Address'));
$this->addDataSource('phone', 'Civi\DataProcessor\Source\Contact\PhoneSource', E::ts('Phone'));
$this->addDataSource('contribution', 'Civi\DataProcessor\Source\Contribution\ContributionSource', E::ts('Contribution'));
$this->addDataSource('relationship', 'Civi\DataProcessor\Source\Contact\RelationshipSource', E::ts('Relationship'));
$this->addDataSource('relationship_type', 'Civi\DataProcessor\Source\Contact\RelationshipTypeSource', E::ts('Relationship Type'));
$this->addDataSource('event', 'Civi\DataProcessor\Source\Event\EventSource', E::ts('Event'));
$this->addDataSource('participant', 'Civi\DataProcessor\Source\Event\ParticipantSource', E::ts('Participant'));
$this->addDataSource('mailing', 'Civi\DataProcessor\Source\Mailing\MailingSource', E::ts('Mailing'));
$this->addDataSource('mailing_job', 'Civi\DataProcessor\Source\Mailing\MailingJobSource', E::ts('Mailing Job'));
$this->addDataSource('mailing_group', 'Civi\DataProcessor\Source\Mailing\MailingGroupSource', E::ts('Mailing Group'));
$this->addDataSource('membership', 'Civi\DataProcessor\Source\Member\MembershipSource', E::ts('Membership'));
$this->addDataSource('membership_type', 'Civi\DataProcessor\Source\Member\MembershipTypeSource', E::ts('Membership Type'));
$this->addDataSource('membership_status', 'Civi\DataProcessor\Source\Member\MembershipStatusSource', E::ts('Membership Status'));
$this->addDataSource('csv', 'Civi\DataProcessor\Source\CSV', E::ts('CSV File'));
$this->addOutput('api', 'Civi\DataProcessor\Output\Api', E::ts('API'));
$this->addOutput('search', 'CRM_DataprocessorSearch_Search', E::ts('Search'));
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contact;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,10 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contact;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contact;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contact;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,10 +4,10 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contact;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use Civi\DataProcessor\DataFlow\SqlDataFlow\SimpleWhereClause;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\CustomFieldSpecification;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
......
......@@ -4,12 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contact;
use Civi\DataProcessor\DataFlow\SqlDataFlow\SimpleWhereClause;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Contribution;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Event;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Event;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Group;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Group;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Mailing;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Mailing;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Mailing;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Member;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Member;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
......@@ -4,11 +4,9 @@
* @license AGPL-3.0
*/
namespace Civi\DataProcessor\Source;
namespace Civi\DataProcessor\Source\Member;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\DataSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\AbstractCivicrmEntitySource;
use CRM_Dataprocessor_ExtensionUtil as E;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment