Comments (3)
Or - maybe another option is to only verify the availableTo against the availableFrom and de-couple them from the event endDate. This way users/admins have flexibility to set ticket dates that work for their use case.
from events.
Yii rules are a little difficult to "unset", but it certainly is possible! You'll want to loop through any of the rules configured for the element and remove it, adding your own.
use craft\events\DefineRulesEvent;
use verbb\events\elements\Ticket;
use yii\base\Event;
Event::on(Ticket::class, Ticket::EVENT_DEFINE_RULES, function(DefineRulesEvent $event) {
foreach ($event->rules as $key => $rule) {
[$attribute, $validator] = $rule;
if ($attribute === ['availableFrom', 'availableTo']) {
unset($event->rules[$key]);
}
if ($attribute === ['availableFrom']) {
unset($event->rules[$key]);
}
}
});
But you'll need to get on the latest craft-4
branch for that as well.
And yeah, I'll consider that. I was just thinking that there's no point in offering tickets for sale once the end date of the event is over, but this is purely a validation step.
from events.
Hi, thanks for that. We've started the upgrade to craft-v4, so I'll get that finished and hook into unsetting these rules. Thanks.
from events.
Related Issues (20)
- Deleting tickets sets the 'Total Capacity' to 0 HOT 3
- No error validation for ticket type HOT 2
- Bulk refund event tickets
- QR generation error HOT 2
- Array to string conversion HOT 1
- Possible to Query purchased tickets with User data on Craft 4? HOT 2
- Uncaught error when saving an event with a ticket with empty fields HOT 1
- Setting unknown property: craft\commerce\events\PdfEvent::order HOT 2
- Feedme importing into Events element and error HOT 3
- Event Types Disappearing HOT 1
- Title field appears in every tab for event types HOT 1
- Tickets only available in the control panel HOT 3
- Attach ticket(s) to E-Mail HOT 2
- Translatable ticket fields do not work correctly HOT 3
- Overbooking is possible HOT 4
- Event capacity and ticket capacity HOT 6
- Insufficient validation of the ticket PDF download parameters HOT 3
- Ticket only available to purchase if enabled on primary site HOT 1
- duplicate event but not tickets HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from events.