private function select_badge_type() { $age = age_from_birthdate(@$this->params["birthdate"]); if ($age && $age < MINOR_AGE) { $badge_type = BadgeType::default_minor(); } else { $badge_type = BadgeType::default_adult(); } $this->params["badge_type"] = $badge_type->db_name; }
public function validate() { $age = age_from_birthdate(@$this->params["birthdate"]); $minor = $age && $age < MINOR_AGE; $this->error_if_empty("legal_name"); $this->error_if_empty("badge_name"); if (!$this->error_on("birthdate")) { $this->error_if_invalid_date("birthdate"); } $this->error_if_empty("admission_level"); }
public function validate() { $age = age_from_birthdate(@$this->params["birthdate"]); $minor = $age && $age < MINOR_AGE; $this->error_if_empty("legal_name"); $this->error_if_empty("birthdate"); if (!$this->error_on("birthdate")) { $this->error_if_invalid_date("birthdate"); } // if($minor){ // $this->error_if_empty("adult_legal_name"); // $this->error_if_empty("adult_phone_number"); // } if (@$this->params["checked_in"]) { $this->error_if_empty("badge_number", "Already checked in, field required."); } if (!empty(@$this->params["badge_number"])) { if (!Attendee::is_unique_badge_number(@$this->params["badge_number"], $this->attendee)) { $this->add_error("badge_number", "Number is already assigned."); } } $this->error_if_empty("badge_name"); $this->error_if_empty("admission_level"); #$this->error_if_empty("payment_method", "Select a payment method."); $this->error_if_empty("badge_type"); if (!$this->error_on("badge_type")) { $badge_type = BadgeType::find_by_db_name(@$this->params["badge_type"]); if (!$badge_type->minor && $minor) { $this->add_error("badge_type", "Attendee is a minor."); } elseif ($badge_type->minor && !$minor) { $this->add_error("badge_type", "Attendee is not a minor."); } if ($badge_type->vendor && !$this->params["vendor_id"]) { $this->add_error("vendor_id", "Vendor Required."); } } if (@$this->params["blacklisted"]) { $this->error_if_empty("blacklist_type", "Blacklisted, type required."); $this->error_if_empty("blacklist_message", "Blacklisted, message required."); } }
public function validate() { $age = age_from_birthdate(@$this->params["birthdate"]); $minor = $age && $age < MINOR_AGE; $this->error_if_empty("badge_name"); $this->error_if_empty("badge_number"); if (!$this->error_on("badge_number")) { if (!Attendee::is_unique_badge_number(@$this->params["badge_number"], $this->attendee)) { $this->add_error("badge_number", "Number is already assigned."); } } $this->error_if_empty("badge_type"); if (!$this->error_on("badge_type")) { $badge_type = BadgeType::find_by_db_name(@$this->params["badge_type"]); if (!$badge_type->minor && $minor) { $this->add_error("badge_type", "Attendee is a minor."); } elseif ($badge_type->minor && !$minor) { $this->add_error("badge_type", "Attendee is not a minor."); } if ($badge_type->vendor && !$this->params["vendor_id"]) { $this->add_error("vendor_id", "Vendor Required."); } } $this->error_if_empty("legal_name"); $this->error_if_empty("birthdate"); if (!$this->error_on("birthdate")) { $this->error_if_invalid_date("birthdate"); } if (!$this->attendee->paid) { $this->error_if_empty("admission_level"); $this->error_if_empty("payment_method"); } if ($minor) { $this->error_if_empty("adult_relationship"); if ($this->params["adult_relationship"] != AdultRelationship::EMANCIPATED) { $this->error_if_empty("adult_legal_name"); $this->error_if_empty("adult_phone_number"); } } }
<?php echo input_tag($form, "legal_name", ["placeholder" => "John Doe"]); ?> <?php echo error_display($form, "legal_name"); ?> </div> <div class="form-group col-md-3 <?php echo $form->error_on("birthdate") ? "has-error" : ""; ?> "> <?php echo label_tag("birthdate", "Birthdate"); ?> <?php echo input_tag($form, "birthdate"); ?> <?php echo error_display($form, "birthdate"); ?> </div> <div class="form-group col-md-2"> <label>Age</label> <input class="form-control" id="age" type="text" value="<?php echo age_from_birthdate(@$form->params["birthdate"]); ?> " readonly> </div> </div>
function age() { return age_from_birthdate($this->birthdate); }