'conference_sessions' => $sessions,
'credit_card_number' => CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $participantParams)),
'credit_card_exp_date' => CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format(CRM_Utils_Array::value('credit_card_exp_date', $participantParams))),
+ 'selfcancelxfer_time' => abs($values['event']['selfcancelxfer_time']),
+ 'selfservice_preposition' => $values['event']['selfcancelxfer_time'] < 0 ? 'after' : 'before',
]);
// CRM-13890 : NOTE wait list condition need to be given so that
* Evaluate whether a participant record is eligible for self-service transfer/cancellation. If so,
* return additional participant/event details.
*
- * TODO: This function fails when the "hours until self-service" is less than zero.
* @param int $participantId
* @param string $url
* @param bool $isBackOffice
$cancelDeadline = (new Datetime($start_date))->sub($cancelInterval);
if ($timenow > $cancelDeadline) {
$details['eligible'] = FALSE;
- $details['ineligible_message'] = ts("Registration for this event cannot be cancelled or transferred less than %1 hours prior to the event's start time. Contact the event organizer if you have questions.", [1 => $time_limit]);
+ // Change the language of the status message based on whether the waitlist time limit is positive or negative.
+ $afterOrPrior = $time_limit < 0 ? 'after' : 'prior';
+ $moreOrLess = $time_limit < 0 ? 'more' : 'less';
+ $details['ineligible_message'] = ts("Registration for this event cannot be cancelled or transferred %1 than %2 hours %3 to the event's start time. Contact the event organizer if you have questions.",
+ [1 => $moreOrLess, 2 => $cancelHours, 3 => $afterOrPrior]);
+
}
}
return $details;
['name' => 'contribution_invoice_receipt', 'type' => 'html'],
],
],
+ [
+ 'version' => '5.30.alpha1',
+ 'upgrade_descriptor' => ts('Support negative hours for cancellation/transfer'),
+ 'templates' => [
+ ['name' => 'participant_confirm', 'type' => 'html'],
+ ['name' => 'participant_confirm', 'type' => 'text'],
+ ['name' => 'event_online_receipt', 'type' => 'html'],
+ ['name' => 'event_online_receipt', 'type' => 'text'],
+ ],
+ ],
];
}
{* file to handle db changes in 5.30.alpha1 during upgrade *}
+-- Allow self-service/transfer to have a negative time.
+ALTER TABLE civicrm_event MODIFY COLUMN selfcancelxfer_time INT;
+
{ts}Cancellation or Transfer Time Limit{/ts}
{/htxt}
{htxt id="id-selfcancelxfer_time"}
- {ts}Number of hours prior to event start date to allow self-service cancellation or transfer. Enter 0 (or leave empty) to allow cancellation or transfer up until the event has started.{/ts}
+ {ts}Number of hours prior to event start date to allow self-service cancellation or transfer. Enter a negative number of hours to allow cancellation after the event starts. Enter 0 (or leave empty) to allow cancellation or transfer up until the event has started.{/ts}
{/htxt}
'isBackOffice' => FALSE,
'successExpected' => FALSE,
];
+ // Cancellation deadline is < 0 hours
+ $scenarios[] = [
+ 'selfSvcEnabled' => 1,
+ 'selfSvcHours' => -12,
+ 'hoursToEvent' => 4,
+ 'participantStatusId' => 1,
+ 'isBackOffice' => FALSE,
+ 'successExpected' => TRUE,
+ ];
return $scenarios;
}
</field>
<field>
<name>selfcancelxfer_time</name>
- <type>int unsigned</type>
+ <type>int</type>
<default>0</default>
<title>Self-service Cancellation or Transfer Time</title>
<comment>Number of hours prior to event start date to allow self-service cancellation or transfer.</comment>
{if $event.allow_selfcancelxfer }
<tr>
<td colspan="2" {$valueStyle}>
- {ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}<br />
+ {ts 1=$selfcancelxfer_time 2=$selfservice_preposition}You may transfer your registration to another participant or cancel your registration up to %1 hours %2 the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}<br />
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
<a href="{$selfService}">{ts}Click here to transfer or cancel your registration.{/ts}</a>
</td>
{/if}
{if $event.allow_selfcancelxfer }
-{ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
+{ts 1=$selfcancelxfer_time 2=$selfservice_preposition}You may transfer your registration to another participant or cancel your registration up to %1 hours %2 the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
{ts}Transfer or cancel your registration:{/ts} {$selfService}
{/if}
{if $event.allow_selfcancelxfer }
<tr>
<td colspan="2" {$valueStyle}>
- {ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}<br />
+ {ts 1=$selfcancelxfer_time 2=$selfservice_preposition}You may transfer your registration to another participant or cancel your registration up to %1 hours %2 the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}<br />
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
<a href="{$selfService}">{ts}Click here to transfer or cancel your registration.{/ts}</a>
</td>
{$confirmUrl}
{/if}
{if $event.allow_selfcancelxfer }
-{ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
+{ts 1=$selfcancelxfer_time 2=$selfservice_preposition}You may transfer your registration to another participant or cancel your registration up to %1 hours %2 the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
{ts}Transfer or cancel your registration:{/ts} {$selfService}
{/if}