Skip to content

Commit

Permalink
squash to previous
Browse files Browse the repository at this point in the history
  • Loading branch information
ammopt committed Nov 12, 2024
1 parent de4fc9c commit 828c174
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions code/web/sys/Community/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once ROOT_DIR . '/sys/Community/CampaignMilestone.php';
require_once ROOT_DIR . '/sys/Community/UserCampaign.php';
require_once ROOT_DIR . '/sys/Community/Reward.php';
require_once ROOT_DIR . '/sys/Community/CampaignAccess.php';
require_once ROOT_DIR . '/sys/Community/CampaignPatronTypeAccess.php';
require_once ROOT_DIR . '/sys/Account/User.php';


Expand Down Expand Up @@ -105,7 +105,7 @@ public static function getObjectStructure($context = ''): array {
public function getPatronTypeAccess() {
if (!isset($this->_allowPatronTypeAccess) && $this->id) {
$this->_allowPatronTypeAccess = [];
$patronTypeLink = new CampaignAccess();
$patronTypeLink = new CampaignPatronTypeAccess();
$patronTypeLink->campaignId = $this->id;
$patronTypeLink->find();
while ($patronTypeLink->fetch()) {
Expand All @@ -120,7 +120,7 @@ public function savePatronTypeAccess() {
$this->clearPatronTypeAccess();

foreach ($this->_allowPatronTypeAccess as $patronTypeId) {
$link = new CampaignAccess();
$link = new CampaignPatronTypeAccess();
$link->campaignId = $this->id;
$link->patronTypeId = $patronTypeId;
$link->insert();
Expand All @@ -131,7 +131,7 @@ public function savePatronTypeAccess() {

private function clearPatronTypeAccess() {
//Delete links to the patron types
$link = new CampaignAccess();
$link = new CampaignPatronTypeAccess();
$link->campaignId = $this->id;
return $link->delete(true);
}
Expand Down Expand Up @@ -296,7 +296,7 @@ public function find($fetchFirst = false, $requireOneMatchToReturn = true): bool
if (!UserAccount::isLoggedIn() || UserAccount::getActiveUserObj()->isAspenAdminUser())
return parent::find($fetchFirst, $requireOneMatchToReturn);

$this->joinAdd(new CampaignAccess(), 'INNER', 'ce_campaign_patron_type_access', 'id', 'campaignId');
$this->joinAdd(new CampaignPatronTypeAccess(), 'INNER', 'ce_campaign_patron_type_access', 'id', 'campaignId');
$this->whereAdd("ce_campaign_patron_type_access.patronTypeId = '" . UserAccount::getActiveUserObj()->getPTypeObj()->id . "'");
return parent::find($fetchFirst, $requireOneMatchToReturn);
}
Expand Down
2 changes: 1 addition & 1 deletion code/web/sys/Community/CampaignAccess.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


class CampaignAccess extends DataObject {
class CampaignPatronTypeAccess extends DataObject {
public $__table = 'ce_campaign_patron_type_access';
public $id;
public $campaignId;
Expand Down

0 comments on commit 828c174

Please sign in to comment.