Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function () {
'badge_prints_count' => ['==', '>=', '<=', '>', '<'],
'has_owner_company' => ['=='],
'exclude_is_printable_free_unassigned' => ['=='],
'has_promo_code' => ['=='],
];
},
function () {
Expand Down Expand Up @@ -189,6 +190,7 @@ function () {
'badge_prints_count' => 'sometimes|integer',
'has_owner_company' => ['sometimes', new Boolean()],
'exclude_is_printable_free_unassigned' => ['sometimes', new Boolean()],
'has_promo_code' => ['sometimes', new Boolean()],
];
},
function () {
Expand Down Expand Up @@ -330,6 +332,7 @@ function () {
'badge_prints_count' => ['==', '>=', '<=', '>', '<'],
'has_owner_company' => ['=='],
'exclude_is_printable_free_unassigned' => ['=='],
'has_promo_code' => ['=='],
];
},
function () {
Expand Down Expand Up @@ -368,6 +371,7 @@ function () {
'badge_prints_count' => 'sometimes|integer',
'has_owner_company' => ['sometimes', new Boolean()],
'exclude_is_printable_free_unassigned' => ['sometimes', new Boolean()],
'has_promo_code' => ['sometimes', new Boolean()],
];
},
function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function requiredAliases(?Filter $filter, ?Order $order): array
$need['m'] = true;
} // usa m.id y a.email

if ($has('promo_code') || $has('promo_code_id') || $has('promo_code_description')) {
if ($has('promo_code') || $has('promo_code_id') || $has('promo_code_description') || $has('has_promo_code')) {
$need['pc'] = true;
}
if ($has('promo_code_tag') || $has('promo_code_tag_id')) {
Expand Down Expand Up @@ -437,6 +437,17 @@ protected function getFilterMappings()
),
]
),
'has_promo_code' => new DoctrineSwitchFilterMapping([
'1' => new DoctrineCaseFilterMapping(
'true',
"pc is not null"
),
'0' => new DoctrineCaseFilterMapping(
'false',
"pc is null"
),
]
),
];
}

Expand Down
36 changes: 35 additions & 1 deletion tests/OAuth2SummitTicketsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -950,4 +950,38 @@ public function testGetAllTicketsByPromoCodeTag()
$this->assertTrue(!is_null($tickets));
return $tickets;
}
}

public function testGetAllTicketsWithoutPromoCode()
{
$params = [
'id' => self::$summit->getId(),
'page' => 1,
'per_page' => 10,
'filter' => [
'has_promo_code==0',
],
'order' => '+id'
];

$headers = [
"HTTP_Authorization" => " Bearer " . $this->access_token,
"CONTENT_TYPE" => "application/json"
];

$response = $this->action(
"GET",
"OAuth2SummitTicketApiController@getAllBySummit",
$params,
[],
[],
[],
$headers
);

$content = $response->getContent();
$this->assertResponseStatus(200);
$tickets = json_decode($content);
$this->assertTrue(!is_null($tickets));
return $tickets;
}
}