Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ public function ingestExternalTicketData($summit_id)
path: '/api/v1/summits/{id}/tickets/csv/template',
operationId: 'getTicketImportTemplate',
summary: 'Get ticket import template',
description: 'Returns a CSV template for importing ticket data',
description: 'Returns a CSV template for importing ticket data. Includes one column per summit badge feature name plus one extra_question:{question name} column per summit order extra question (Ticket/Both usage).',
security: [['summit_tickets_oauth2' => [
SummitScopes::WriteSummitData,
SummitScopes::WriteRegistrationData,
Expand Down Expand Up @@ -788,7 +788,8 @@ public function getImportTicketDataTemplate($summit_id)
* ticket_promo_code (optional)
* badge_type_id (optional)
* badge_type_name (optional)
* badge_features (optional)
* badge_features (optional, one col per badge feature name)
* extra_question:{question name} (optional, one col per order extra question - Ticket/Both usage)
*/

$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id);
Expand Down Expand Up @@ -816,6 +817,11 @@ public function getImportTicketDataTemplate($summit_id)
$row[$featuresType->getName()] = '';
}

// order extra questions for summit ( ticket / attendee scoped ones )
foreach ($summit->getOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage) as $question) {
$row[sprintf('%s%s', ISummitOrderService::ExtraQuestionColumnPrefix, $question->getName())] = '';
}

$template = [
$row
];
Expand All @@ -835,7 +841,7 @@ public function getImportTicketDataTemplate($summit_id)
path: '/api/v1/summits/{id}/tickets/csv',
operationId: 'importTicketData',
summary: 'Import ticket data from CSV',
description: 'Imports ticket data from a CSV file',
description: 'Imports ticket data from a CSV file. Supported columns: id, number, attendee_email, attendee_first_name, attendee_last_name, attendee_tags, attendee_company, attendee_company_id, ticket_type_name, ticket_type_id, promo_code_id, promo_code, ticket_promo_code, badge_type_id, badge_type_name, one column per badge feature name (1/0) and one extra_question:{question name} column per order extra question (Ticket/Both usage; for list type questions use the value name/label, "|" separated for multi value).',
security: [['summit_tickets_oauth2' => [
SummitScopes::WriteSummitData,
SummitScopes::WriteRegistrationData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,22 @@ public function getAllowedBadgeFeatures(bool $exclude_deactivated_tickets = true
return $native_query->enableResultCache(600 , sprintf("ATTENDEES_%s_BADGE_FEATURES",$this->id))->getResult();
}

/**
* Drops the getAllowedBadgeFeatures result cache entry for this attendee, so permission
* checks that depend on badge features ( isAllowedQuestion ) re-evaluate against current
* state after the attendee's badge/features change mid-request.
*/
public function evictAllowedBadgeFeaturesCache(): void
{
try {
$result_cache = $this->getEM()->getConfiguration()->getResultCache();
if (!is_null($result_cache))
$result_cache->deleteItem(sprintf("ATTENDEES_%s_BADGE_FEATURES", $this->id));
} catch (\Exception $ex) {
Log::warning($ex);
}
}

public function buildExtraQuestionAnswer(): ExtraQuestionAnswer
{
return new SummitOrderExtraQuestionAnswer();
Expand Down
3 changes: 3 additions & 0 deletions app/Services/Model/ISummitOrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
*/
interface ISummitOrderService extends IProcessPaymentService
{
// ticket data import csv column naming convention for order extra question answers
const ExtraQuestionColumnPrefix = 'extra_question:';
Comment thread
smarcet marked this conversation as resolved.

/**
* @param Member|null $owner
* @param Summit $summit
Expand Down
Loading
Loading