function price_for(Attendee $attendee)
 {
     if (is_null($attendee->override_price) || $attendee->override_price == 0) {
         // NULL or 0
         return $this->price();
     } else {
         $lvl = RegistrationLevel::find_by_db_name($attendee->admission_level);
         $price_diff = $lvl->price - $attendee->override_price;
         return $this->price() + $price_diff;
     }
 }
Example #2
0
 public function validate()
 {
     $this->error_if_empty("legal_name");
     $this->error_if_empty("birthdate");
     if (!$this->error_on("birthdate")) {
         $this->error_if_invalid_date("birthdate");
     }
     $this->error_if_empty("address1");
     $this->error_if_empty("city");
     $this->error_if_empty("state_prov");
     $this->error_if_empty("postal_code");
     $this->error_if_empty("phone_number");
     // $this->error_if_empty("email");
     // if(!$this->error_on("email")){
     //   $this->error_unless_regex_match("email", "/@/");
     // }
     if (!empty($this->params["email"])) {
         $this->error_unless_regex_match("email", "/@/");
     }
     $age = age_from_birthdate(@$this->params["birthdate"]);
     if ($age && $age < MINOR_AGE) {
         $this->error_if_empty("adult_legal_name");
         $this->error_if_empty("adult_relationship");
         $this->error_if_empty("adult_phone_number");
     }
     $this->error_if_empty("badge_name");
     $this->error_if_empty("admission_level");
     if (!$this->error_on("admission_level")) {
         $lvl = RegistrationLevel::find_by_db_name(@$this->params["admission_level"]);
         if ($lvl && $lvl->includes_tshirt) {
             $this->error_if_empty("tshirt_size", "{$lvl->name} includes a T-Shirt.");
         } else {
             $this->error_unless_empty("tshirt_size", "Level doesn't include T-Shirt.");
         }
     }
     $this->error_if_empty("payment_method", "Select a payment method.");
 }
Example #3
0
<?php

include_once '../../../_includes/framework.php';
require_login();
if (!isset($form)) {
    $id = @$_GET['id'];
    $id or die("<p>Error, no attendee id.</p>");
    $form = new UpgradeForm(["id" => $id]);
}
$current_level = RegistrationLevel::find_by_db_name($form->attendee->admission_level);
$upgrades = RegistrationUpgrade::from_with_prices($form->attendee->admission_level);
?>
<input type="hidden" name="id" value="<?php 
echo $id;
?>
">

<div class="text-center">
<h2><?php 
echo $form->attendee->display_name();
?>
</h2>
<?php 
if ($form->attendee->vendor()) {
    ?>
  <h4 class="text-muted"><?php 
    echo $form->attendee->vendor()->display_name();
    ?>
</h4>
<?php 
}