+ The Security # is the three or four digit number on the signature side of your credit card.
+ American Express cards may have this number on the front of the card.
+
+
+
+
+
+
+
+
+
+
+
Contact Information
+
+
+
+
First Name
+
Last Name
+
Address
+
+
City
+
+
State
+
+
+
+
+
+
Country
+
+
+
+
+
ZIP/Postal code
+
Phone
+
E-Mail
+
Verify E-Mail
+
+
OK to Sent E-Mail?
+
Please send information on activities and offers.
+
+
+
+
+
+
+
+
+
Venue #2 Name
+
+
+
+
(venue description text goes here)
+
+
+
+
+
+
+
+
+
+
Event #1 Name
+
+
(venue description text goes here)
+
+
+
+
+
+
Quant
+
Section
+
Ticket
+
Price Each
+
Total
+
+
+
5
+
Section 1
+
Type 1
+
$25.00/each
+
$125.00
+
+
+
2
+
Section 2
+
Type 2
+
$25.00
+
$50.00
+
+
+
7
+
$175.00
+
+
+
+
+
+
+
+
+
Event #2 Name
+
+
(venue description text goes here)
+
+
+
+
+
+
Quant
+
Section
+
Ticket
+
Price Each
+
Total
+
+
+
5
+
Section 1
+
Type 1
+
$25.00/each
+
$125.00
+
+
+
2
+
Section 2
+
Type 2
+
$25.00
+
$50.00
+
+
+
7
+
$175.00
+
+
+
+
+
+
+
+
+
+
+
Tickets
+
Venue Total
+
+
+
19
+
$250.00
+
+
+
+
+
+
+
+
+
+
+
Payment for Venue #2 Name
+
+
+
+
+
Card Type
+
+
+
+
+
Name on Card
+
Card #
+
+
Expiration
+
+ Month
+ Year
+
+
+
+
Security #
+
+
+ The Security # is the three or four digit number on the signature side of your credit card.
+ American Express cards may have this number on the front of the card.
+
Selects display of Housing summary information only in the report.
+ When this option is selected, only the summary is displayed without all of the property and inventory detail.
Selects display of Reservations summary information only in the report.
+ When this option is selected, only the summary is displayed without all of the reservation detail.
Display on Screen - Display the report in your browser below the report request form.
+
Printable Report - Display the report in a separate browser window for output to a printer.
+
Export as Spreadsheet - Sends the report to your computer as a ".CSV" type file for import into a spreadsheet program.
+
+
If the Printable Report does not show, check to make sure you have permitted browser pop-ups for this Web site.
+ '
+ )
+ )
+
+
+
+ );
+ }
+
+ /**
+ * Create Report Controls Data
+ *
+ * @return array
+ */
+ function newControls()
+ {
+
+ $r = $this->newEntry();
+
+ // Get event, state, team matrix and merge that with result
+ $eventStateTeamData = $this->getEventStateTeamMatrix();
+ $r['eventStateTeam'] = $eventStateTeamData;
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $event = isset($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $r['eventStateTeam'][$event]['default'] = true;
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * getStateTeamMatrix
+ *
+ */
+ function getEventStateTeamMatrix()
+ {
+
+ // Get property/accommodation matrix
+ $sql = "
+ SELECT C.id AS event_id,
+ C.name AS event_name,
+ C.event_code AS event_code,
+ S.id AS state_id,
+ S.code AS state_code,
+ S.event AS event,
+ T.id AS team_id,
+ T.team_code AS team_code,
+ T.name AS team_name
+ FROM eventmgt.event C
+ LEFT OUTER JOIN state_rep S ON (S.event = C.id)
+ LEFT OUTER JOIN team T ON (T.state = S.id)
+ ORDER BY C.name, S.code, T.team_code
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventStateTeamData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($eventStateTeamData) == 0) {
+ $reason[] = "No State Reps listed in the system.";
+ }
+ // *** LOOK FOR DEFAULTS ***
+ // Build array of Members with their accommodations
+ $eventStateTeam = array();
+ foreach ($eventStateTeamData as $d) {
+
+ // If event hasn't been added yet, do that.
+ if (!isset($eventStateTeam[$d['event_id']])) {
+ $eventStateTeam[$d['event_id']] = array(
+ 'eventID' => $d['event_id'],
+ 'eventName' => $d['event_name'],
+ 'eventCode' => $d['event_code'],
+ 'default' => false,
+ 'state' => array()
+ );
+ }
+
+ // If state hasn't been added yet, do that.
+ if ($d['state_id']) {
+ if (!isset($eventStateTeam[$d['event_id']]['state'][$d['state_id']])) {
+ $eventStateTeam[$d['event_id']]['state'][$d['state_id']] = array(
+ 'stateID' => $d['state_id'],
+ 'stateCode' => $d['state_code'],
+ 'team' => array()
+ );
+ }
+ }
+
+ // Add team
+ if ($d['team_id']) {
+ $eventStateTeam[$d['event_id']]['state'][$d['state_id']]['team'][$d['team_id']] = array(
+ 'teamID' => $d['team_id'],
+ 'teamName' => $d['team_name']
+ );
+ }
+ }
+
+ return $eventStateTeam;
+ }
+
+
+ /**
+ * Try to process controls input
+ *
+ * @return array
+ */
+ function processControls()
+ {
+
+ $r = $this->processInputData();
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $event = isset($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $r['fieldData']['event_name']['pick_list'][$event]['default'] = true;
+ }
+
+ return $r;
+
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAccoms.php b/classes/data/dataAccoms.php
new file mode 100644
index 0000000..9fa360f
--- /dev/null
+++ b/classes/data/dataAccoms.php
@@ -0,0 +1,468 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAccoms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAccoms class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAccoms,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataAccoms extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.accommodation';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Member name
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => 'property',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ 'p_where' => 'member_id in
+ (
+ SELECT DISTINCT member_id
+ FROM members.member_category
+ WHERE category_id IN
+ (SELECT category_id FROM members.category WHERE accommodations)
+ )',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'ni'
+ ),
+
+ // Member name
+ 'member_2' => array(
+ 'field' => 'member',
+ 'as' => 'property',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'view_only' => true,
+ 'use' => 'gleudc'
+ ),
+
+ // Accommodation Name (internal use)
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Accommodation Title (for display to users)
+ 'title' => array(
+ 'field' => 'title',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Category - Needs to be moved to a separate admin table
+ 'category' => array(
+ 'field' => 'category',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->room_category->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gnieud'
+ ),
+
+ // Quantity - Number of these accommodations at property
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgnieud'
+ ),
+
+ // Standard # of occupants
+ 'occupants' => array(
+ 'field' => 'occupants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gnieud'
+ ),
+
+ // Max # of occupants
+ 'maxoccupants' => array(
+ 'field' => 'maxoccupants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gnieud'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Get Accommadations list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAccomsList($member = false)
+ {
+
+ // Get any specified member listing option - default to event
+ $option = 'event';
+ if (($membersListOption = filter_input(INPUT_GET, 'AccomsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $membersListOption;
+ }
+
+ // Get event Member from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ if ($member) {
+ $memberID = $member;
+ $option = 'member';
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'member':
+ if ($memberID) {
+ $where = "T.member = $memberID";
+ } else {
+ $where .= "false";
+ }
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of all available Events
+ $accomsList = $this->getList($where, 'sort, name');
+
+
+ if (count($accomsList) == 0) {
+ return false;
+ }
+
+
+ return $accomsList;
+ }
+
+
+ /**
+ * Get Accommodation Detail
+ *
+ * @return array
+ */
+ function getAccomDetail()
+ {
+
+ // Is there a new accom ID selected?
+ if (($accomID = filter_input(INPUT_GET, 'AccomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $accomID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+
+ // Otherwise, get the event ID from the session
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $accomDetail = $this->getEntry($accomID);
+
+ return $accomDetail;
+
+ }
+
+
+ /**
+ * Edit Accommodation
+ *
+ * @return array
+ */
+ function editAccom()
+ {
+
+ // Is there a new accommodaton code selected?
+ if (($accomID = filter_input(INPUT_GET, 'AccomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $accomID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+
+ // Otherwise, get the accommodation ID from the session
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ } else {
+
+ // Otherwise, we don't have a accommodation id
+ return false;
+
+ }
+
+ $accomDetail = $this->editEntry($accomID);
+
+ // echo "
".print_r($accomDetail,1)."
";
+ return $accomDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Accommodation
+ *
+ * @return array
+ */
+ function updateAccom()
+ {
+
+ // Is there a new event code selected?
+ if (($accomID = filter_input(INPUT_GET, 'AccomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $accomID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Accom'])) {
+
+ // Otherwise, get the accommodation ID from the session
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ } else {
+
+ // Otherwise, we don't have a accommodation id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($accomID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add Accommodation
+ *
+ * @return array
+ */
+ function newAccom()
+ {
+
+ $r = $this->newEntry();
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member']) && $_SESSION[GLM_EVENT_SESSION]['Member'] != false) {
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ $r['fieldData']['property']['pick_list'][$accomID]['default'] = true;
+ $r['fieldData']['property']['name'] = $r['fieldData']['property']['pick_list'][$accomID]['name'];
+ $r['fieldData']['property']['value'] = $accomID;
+ }
+
+ // If succesful then set current accommodation to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $r['insertedID'];
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Accommodation
+ *
+ * @return array
+ */
+ function insertAccom()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current accommodation to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = $r['insertedID'];
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAddonSold.php b/classes/data/dataAddonSold.php
new file mode 100644
index 0000000..5af00aa
--- /dev/null
+++ b/classes/data/dataAddonSold.php
@@ -0,0 +1,290 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddonSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAddonSold class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddonSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+class EventManagementDataAddonSold extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.add_on_sold';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Ticket Order
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Ticket Sold
+ 'ticket_sold' => array(
+ 'field' => 'ticket_sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Add-on Name
+ 'add_on_name' => array(
+ 'field' => 'add_on_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on type
+ 'add_on_type' => array(
+ 'field' => 'add_on_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_add_on_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on type name
+ 'add_on_type_name' => array(
+ 'field' => 'add_on_type_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Unit name
+ 'unit_name' => array(
+ 'field' => 'unit_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Unit cost number
+ 'unit_price_numb' => array(
+ 'field' => 'unit_price',
+ 'as' => 'unit_price_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Unit price (money)
+ 'unit_price' => array(
+ 'field' => 'unit_price',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ ),
+
+ // Quantity selected
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Total Price Paid - Number
+ 'price_paid_numb' => array(
+ 'field' => 'price_paid',
+ 'as' => 'price_paid_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Price paid (money)
+ 'price_paid' => array(
+ 'field' => 'price_paid',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ )
+
+ );
+
+ }
+
+ /**
+ * Get Ticket Sold Add-Ons list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAddonsSoldList($ticketSoldID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied, use the $TicketSoldID - Otherwise $where
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a ticket sold ID, then filter by that
+ $ticketSoldID = ($ticketSoldID - 0); // Make sure it's number
+ if ($ticketSoldID > 0) {
+ $where .= " AND T.ticket_sold = $ticketSoldID";
+ }
+
+ }
+
+ $addonsSoldList = $this->getList($where, 'id');
+
+ return $addonsSoldList;
+ }
+
+ /**
+ * Get Add-On Sold Detail
+ *
+ * @return array
+ */
+ function getAddonSoldDetail($addonSoldID = false)
+ {
+
+ if ($addonSoldID == false) {
+
+ // Otherwise, we don't have an add-on id
+ return false;
+
+ }
+
+ // If the add-on sold ID is valid, get the detail
+ $addonSoldID = filter_input(INPUT_GET, 'AddonSoldID', FILTER_SANITIZE_NUMBER_INT);
+ if ($addonSoldID) {
+ $addonSoldDetail = $this->getEntry($addonSoldID);
+
+ // Otherwise fail
+ } else {
+ return false;
+ }
+
+ return $addonSoldDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAddons.php b/classes/data/dataAddons.php
new file mode 100644
index 0000000..bdf6e26
--- /dev/null
+++ b/classes/data/dataAddons.php
@@ -0,0 +1,416 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAddons class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAddons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+class EventManagementDataAddons extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_add_on';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Ticket
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Ticket'],
+ 'use' => 'niegdl'
+ ),
+
+ // Add-on Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on type
+ 'add_on_type' => array(
+ 'field' => 'add_on_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_add_on_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Maximum quant (0 is unlimited)
+ 'max_quant' => array(
+ 'field' => 'max_quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Unit name
+ 'unit_name' => array(
+ 'field' => 'unit_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Unit cost
+ 'unit_cost_numb' => array(
+ 'field' => 'unit_cost',
+ 'as' => 'unit_cost_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Unit cost (money)
+ 'unit_cost' => array(
+ 'field' => 'unit_cost',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ )
+
+ );
+
+ }
+
+ /**
+ * Get Add-Ons list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAddonsList($ticketID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a ticket ID and filter by that ticket if there is
+ $ticketID = ($ticketID - 0); // Make sure it's number
+ if ($ticketID > 0) {
+ $where .= " AND T.ticket = $ticketID";
+ } elseif ($_SESSION[GLM_EVENT_MGT_ADMIN]['Ticket'] > 0) {
+ $where .= " AND T.ticket = ".$_SESSION[GLM_EVENT_MGT_ADMIN]['Ticket'];
+ }
+
+ }
+
+ // Get list of Add-Ons
+ $addonsList = $this->getList($where, 'name');
+
+ return $addonsList;
+ }
+
+ /**
+ * Get Add-On Detail
+ *
+ * @return array
+ */
+ function getAddonDetail($addonID = false)
+ {
+
+ // If a Add-On ID has been supplied
+ if ($addonID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise if there a new add-on ID supplied via the request
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have an add-on id
+ return false;
+
+ }
+
+ $addonDetail = $this->getEntry($addonID);
+
+ return $addonDetail;
+
+ }
+
+
+ /**
+ * Edit Add-On
+ *
+ * @return array
+ */
+ function editAddon()
+ {
+
+ if (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have a add-on id
+ return false;
+
+ }
+
+ $addonDetail = $this->editEntry($addonID);
+
+ return $addonDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Add-On
+ *
+ * @return array
+ */
+ function updateAddon()
+ {
+
+ if (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($addonID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Add-On
+ *
+ * @return array
+ */
+ function newAddon()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert add-on
+ *
+ * @return array
+ */
+ function insertAddon()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current add-on to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete add-on
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function addonDelete($confirm = false)
+ {
+
+ // Is there a new add-on code selected?
+ if (($addonID = filter_input(INPUT_GET, 'AddonID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Addon'] = $addonID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Addon'])) {
+
+ // Otherwise, get the add-on ID from the session
+ $addonID = $_SESSION[GLM_EVENT_SESSION]['Addon'];
+
+ } else {
+
+ // Otherwise, we don't have an add-on id
+ return false;
+
+ }
+
+ $addonDetail = $this->deleteEntry($addonID, $confirm);
+
+ return $addonDetail;
+
+ }
+
+ /**
+ * Get Add-Ons Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAddonsStats($where = 'true')
+ {
+
+ $addonsStats = $this->getStats($where);
+
+ return $addonsStats;
+ }
+
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataAmenities.php b/classes/data/dataAmenities.php
new file mode 100644
index 0000000..3f50b0f
--- /dev/null
+++ b/classes/data/dataAmenities.php
@@ -0,0 +1,486 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAmenities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataAmenities class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataAmenities.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataAmenities extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.amenities';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Affiliation (insert) - what type of entities is this Amenity for
+ 'affiliation_type' => array(
+ 'field' => 'affiliation_type',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Affiliation (view)
+ 'affiliation_type_2' => array(
+ 'field' => 'affiliation_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->reference_type_numb->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gled'
+ ),
+
+ // Amenity affiliation (non-standard pointer)
+ // Points to various tables depending on the "Affiliation type" value
+ 'owner' => array(
+ 'field' => 'owner',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Amenity affiliation (non-standard pointer)
+ // Points to various tables depending on the "Affiliation To" value
+ 'owner_2' => array(
+ 'field' => 'owner',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gled'
+ ),
+
+ // Amenity Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Quantity / Size
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Amenity Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get an array of Amenities for a particular affiliated entity
+ *
+ * $listOption Optional Type of affiliation - see config.ini 'reference_type'
+ * If not supplied will check for AmenitiesListOption GET value
+ * $whereRequest If supplied, use as WHERE clause instead
+ *
+ * @return object containing array as sub-objects
+ */
+ function getAmenities($listOption = false, $whereRequest = false)
+ {
+
+ $where = '';
+
+ // If there's a specific whereRequest, use that only
+ if ($whereRequest) {
+ $where = $whereRequest;
+ } else {
+
+ // Get Event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get Member ID from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ // Get any specified listing option
+ if ($listOption != '') {
+ $option = $listOption;
+
+ // Otheriwse check for list options provided in request
+ } elseif (($AmenitiesListOption = filter_input(INPUT_GET, 'AmenitiesListOption', FILTER_SANITIZE_STRING))) {
+ $option = $AmenitiesListOption;
+ }
+
+ // Include selection of proper affiliation type
+ switch ($option) {
+ case 'member':
+ if ($memberID) {
+ $where .= "T.affiliation_type = ".$this->config->reference_type->property
+ ."AND owner = $memberID\n";
+ } else {
+ $where .= "false";
+ }
+ break;
+ }
+ }
+
+ // Get the Amenities - return false if none found
+ $amenitiesList = $this->getList($where, 'name');
+ if (!is_array($amenitiesList) || count($amenitiesList) == 0) {
+ return false;
+ }
+
+ // Get affiliation type for each Amenity
+ reset($amenitiesList);
+ while( list($key, $val) = each( $amenitiesList ) ) {
+
+ $aData = $this->getAffiliate(
+ $val['affiliation_type']['value'],
+ $val['owner']
+ );
+
+ if ($aData) {
+ $amenitiesList[$key]['affiliation_type_name'] = $aData['applied_to_name'];
+ $amenitiesList[$key]['owner_name'] = $aData['owner_name'];
+ }
+
+ } // Get Amenities affiliation
+
+ return $amenitiesList;
+ }
+
+ /**
+ * Get Amenity Detail
+ *
+ * @return array
+ */
+ function getAmenityDetail()
+ {
+
+ // Is there a new Amenity ID supplied?
+ if (!($amenityID = filter_input(INPUT_GET, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ // We don't have an amenity id
+ return false;
+
+ }
+
+ $amenityDetail = $this->getEntry($amenityID);
+
+ // Get owner data
+ $aData = $this->getAffiliate(
+ $amenityDetail['affiliation_type']['value'],
+ $amenityDetail['owner']
+ );
+
+
+ if ($aData) {
+ $amenityDetail = array_merge($amenityDetail, $aData);
+ }
+
+ return $amenityDetail;
+
+ }
+
+ /**
+ * Edit Amenity
+ *
+ * @return array
+ */
+ function editAmenity()
+ {
+
+ // Is there a new amenity ID supplied?
+ if (!($amenityID = filter_input(INPUT_GET, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ // We don't have an amenity id
+ return false;
+
+ }
+
+ $amenityDetail = $this->editEntry($amenityID);
+
+ // Get owner data
+ $aData = $this->getAffiliate(
+ $amenityDetail['affiliation_type']['value'],
+ $amenityDetail['owner']
+ );
+
+ if ($aData) {
+ $amenityDetail = array_merge($amenityDetail, $aData);
+ }
+
+ return $amenityDetail;
+
+ }
+
+ /**
+ * Update Amenity
+ *
+ * @return array
+ */
+ function updateAmenity()
+ {
+
+ // Is there a new amenity ID supplied?
+ if (!($amenityID = filter_input(INPUT_GET, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ if (!($amenityID = filter_input(INPUT_POST, 'AmenityID', FILTER_SANITIZE_NUMBER_INT))) {
+ echo "::::::";
+ // We don't have an Amenity id
+ return false;
+ }
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($amenityID);
+
+ // Get owner data
+ $aData = $this->getAffiliate(
+ $amenityDetail['affiliation_type']['value'],
+ $amenityDetail['owner']
+ );
+
+ if ($aData) {
+ $amenityDetail = array_merge($amenityDetail, $aData);
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * New Amenity Affiliation
+ *
+ * @return array
+ */
+ function newAmenityAffiliation($r)
+ {
+
+ // Check for specified Amenity type
+ // We need to check for name rather than number because that's what the js is sending us
+ if (!isset($_REQUEST['amenity_type_code']) || $_REQUEST['amenity_type_code'] == '') {
+ return false;
+ }
+
+ // Get type and affiliation
+ $amenityType = trim($_REQUEST['amenity_type_code']);
+ $affiliateID = false;
+
+ switch ($amenityType) {
+ case 'property':
+ $amenityTypeNumber = $this->config->reference_type->property;
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+ $affiliateID = ($_SESSION[GLM_EVENT_SESSION]['Member'] - 0);
+ $amenityTypeName = 'Property';
+ $aTable = 'eventmgt.member';
+ $aField = 'name';
+ $aFieldShort = $aField;
+ }
+ break;
+ }
+
+ // If no match on Amenity type, then fail
+ if ($affiliateID == false) {
+ return false;
+ }
+
+ // Get affiliate data
+ $sql = "SELECT $aField AS name,
+ $aFieldShort AS short_name
+ FROM $aTable
+ WHERE id = $affiliateID
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $aData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // if no valid affiliate data - fail
+ if (!$aData) {
+ return false;
+ }
+
+ $r['fieldData']['amenity_type_name'] = $amenityTypeName;
+ $r['fieldData']['amenity_type_code'] = $amenityType;
+ $r['fieldData']['amenity_type'] = $amenityTypeNumber;
+ $r['fieldData']['affiliation_name'] = $aData['name'];
+ $r['fieldData']['affiliation'] = $affiliateID;
+ $r['fieldData']['affiliation_short'] = $aData['short_name'];
+
+ return $r;
+
+ }
+
+ function newAmenity()
+ {
+
+ $r = $this->newEntry();
+
+ $r = $this->newAmenityAffiliation($r);
+
+ // echo "
";
+ return $r;
+
+ }
+
+ /**
+ * Get Affiliate table and name
+ *
+ */
+ function getAffiliate($type, $affiliation)
+ {
+
+ // Deterimine Affliate table
+ $aTable = '';
+ $aField = '';
+ switch ($type) {
+ case $this->config->reference_type->event:
+ $aType = 'Event';
+ $aTable = 'event';
+ $aField = 'name';
+ $aFieldShort = 'event_code';
+ break;
+ case $this->config->reference_type->property:
+ $aType = 'Property';
+ $aTable = 'eventmgt.member';
+ $aField = 'name';
+ $aFieldShort = $aField;
+ break;
+ }
+
+ $r = false;
+
+ // If we have a good affiliate relationship
+ if ($aField != '') {
+
+ $sql = "SELECT $aField AS name,
+ $aFieldShort AS short_name
+ FROM $aTable
+ WHERE id = $affiliation
+ ;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $aData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if ($aData) {
+ $r = array(
+ 'fee_type_name' => $aType,
+ 'affiliation_name' => $aData['name'],
+ 'affiliation_short' => $aData['short_name']
+ );
+ }
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Fee
+ *
+ * @return array
+ */
+ function feeDelete($confirm = false)
+ {
+ // Is there a new fee code selected?
+ if (($feeID = filter_input(INPUT_GET, 'FeeID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Fee'] = $feeID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Fee'])) {
+
+ // Otherwise, get the fee ID from the session
+ $feeID = $_SESSION[GLM_EVENT_SESSION]['Fee'];
+
+ } else {
+
+ // Otherwise, we don't have a fee id
+ return false;
+
+ }
+
+ $feeDetail = $this->deleteEntry($feeID, $confirm);
+ return $feeDetail;
+
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/classes/data/dataInventory.php b/classes/data/dataInventory.php
new file mode 100644
index 0000000..0d5015d
--- /dev/null
+++ b/classes/data/dataInventory.php
@@ -0,0 +1,1141 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementAdminInventory class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataInventory extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.inventory';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event selection
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lgud'
+ ),
+
+ // Event ID
+ 'event_id' => array(
+ 'field' => 'event',
+ 'as' => 'event_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgud'
+ ),
+
+ // Property selection
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lgud'
+ ),
+
+ // Member Street Address - From main member db
+ 'member_street' => array(
+ 'field' => 'member', // ID in member table is same as in eventmgt.member
+ 'as' => 'street',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'street',
+ 'p_id' => 'member_id',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member City - From main member db
+ 'member_city' => array(
+ 'field' => 'member', // ID in member table is same as in eventmgt.member
+ 'as' => 'city',
+ 'type' => 'pointer',
+ 'p_table' => 'members.city',
+ 'p_field' => 'city_name',
+ 'p_id' => 'city_id',
+ 'p_where' => 'M.member_id = T.member AND city.city_id = M.city_id',
+ 'p_from' => 'members.member M',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // member ID
+ 'memb_id' => array(
+ 'field' => 'member',
+ 'as' => 'member_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgdu'
+ ),
+
+ // Accommodation ID
+ 'accommodation_id' => array(
+ 'field' => 'accommodation',
+ 'as' => 'accommodation_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'au'
+ ),
+
+ // Accommodation
+ 'accommodation' => array(
+ 'field' => 'accommodation',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.accommodation',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'ni'
+ ),
+
+ // Accommodation name
+ 'accommodation_name' => array(
+ 'field' => 'accommodation',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.accommodation',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lged'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'ni'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niu'
+ ),
+
+ // Date
+ 'date' => array(
+ 'field' => 'date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => date('m/d/Y'),
+ 'use' => 'lgeud'
+ ),
+
+ // Assigned to Event
+ 'assigned' => array(
+ 'field' => 'assigned',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'minValue' => 1,
+ 'use' => 'a'
+ ),
+
+ // Available to reserve
+ 'available' => array(
+ 'field' => 'available',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'lgeud'
+ ),
+
+ // On Hold
+ 'on_hold' => array(
+ 'field' => 'id',
+ 'as' => 'on_hold',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.inven_hold',
+ 'p_field' => 'quant',
+ 'p_id' => 'inventory',
+ 'p_where' => "expire_time > '".date('r')."' AND inventory = T.id",
+ 'p_sum' => true,
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lg'
+ ),
+
+/* not using now
+ // Minimum Nights Requred
+ 'min_nights' => array(
+ 'field' => 'min_nights',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 1,
+ 'minValue' => 1,
+ 'use' => 'a'
+ ),
+*/
+ // Event Room Rate - For standard number of occupants
+ 'rate' => array(
+ 'field' => 'rate',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0.0,
+ 'minValue' => 1,
+ 'use' => 'a'
+ )
+/* not using now
+ // Additional Person Rate
+ 'add_person' => array(
+ 'field' => 'add_person',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.0,
+ 'minValue' => 0,
+ 'use' => 'a'
+ )
+*/
+
+/* not using policies at this level for now
+ // Request Policy
+ 'res_policy' => array(
+ 'field' => 'res_policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Cancel Policy
+ 'can_policy' => array(
+ 'field' => 'can_policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+*/
+ );
+ }
+
+ /**
+ * Get Inventory list
+ *
+ * @param string type of events list
+ *
+ * @return object containing array
+ * timestamp of first date of inventory
+ * array of inventory items
+ */
+ function getInvenList($setType = false, $setId = false)
+ {
+
+ // Get any specified member listing option - default to event
+ if ($setType) {
+
+ $option = $setType;
+
+ } else {
+
+ $option = 'accom';
+ if (($invenListOption = filter_input(INPUT_GET, 'InvenListOption', FILTER_SANITIZE_STRING))) {
+ $option = $invenListOption;
+ }
+
+ }
+
+ // Check for setId passed in URL
+ $setIdRequest = ($_REQUEST['setId'] - 0);
+ if ($setIdRequest > 0) {
+ $setId = $setIdRequest;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ $type = 'Summary';
+ break;
+ case 'event':
+ // Get event ID from session - if available
+ $eventID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Event'] );
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.event = $eventID";
+ $type = 'Summary';
+ break;
+ case 'member':
+ $memberID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Member'] );
+ if (!$memberID) {
+ return false;
+ }
+ $where = "T.member = $memberID";
+ $type = 'Calendar';
+ break;
+ case 'accom':
+ // Get event ID from session - if available
+ $accomID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Accom'] );
+ if (!$accomID) {
+ return false;
+ }
+ $where = "T.accommodation = $accomID";
+ $type = 'Calendar';
+ break;
+ case 'team':
+ $teamID = ( $setId ? $setId : $_SESSION[GLM_EVENT_SESSION]['Team'] );
+ if (!$teamID) {
+ return false;
+ }
+ $where = "
+ T.member in (
+ SELECT property
+ FROM eventmgt.team_property
+ WHERE team = $teamID
+ )";
+ $type = 'Calendar';
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Only look for inventory from now forward.
+ $where .= " AND T.date > 'now'";
+
+ // Get list of all available Events
+ $inventoryList = $this->getList($where);
+
+ // Clean up and fix specific fields and find first date of inventory
+ if ($inventoryList != false) {
+
+ $firstDate = strtotime('+5 years'); // Start with something far out in time
+ reset($inventoryList);
+ while( list($key, $val) = each( $inventoryList ) ) {
+
+ $thisDate = strtotime($val['date']['date']);
+
+ // Is this date earlier than any others?
+ if ($thisDate < $firstDate) {
+ $firstDate = $thisDate;
+ }
+
+ // Convert dates to format required for fullcalendar
+ $inventoryList[$key]['cal_date'] = date('Y-m-d', $thisDate);
+
+ // Make member_name copy safe for inclusion in JAVAscript code
+ $inventoryList[$key]['member_name_h'] = addslashes($val['property']);
+
+ }
+ }
+
+ // Create a summary for certain list options
+ $sum = array();
+ $dates = array();
+ $have_summary = false;
+ $total_properties = 0;
+ $total_assigned = array();
+ $total_available = array();
+ $total_sold = array();
+ if ($type == 'Summary' && is_array($inventoryList) && count($inventoryList) > 0) {
+
+ // Start by building list of all inventory dates
+ // *** should be able to do this from the event dates data ***
+ foreach ($inventoryList as $inv) {
+ // Add to dates list
+ $t = strtotime($inv['date']['date']);
+ $dates[$t] = date('m/d/Y', $t);
+ $total_assigned[$t] = 0;
+ $total_available[$t] = 0;
+ $total_sold[$t] = 0;
+ }
+ ksort($dates);
+
+ // Now go through it again and build all the data
+ foreach ($inventoryList as $inv) {
+ // If event has not been set yet
+ $event_id = $inv['event_id'];
+ if (!isset($sum[$event_id])) {
+ $sum[$event_id] = array(
+ 'id' => $event_id,
+ 'name' => $inv['event'],
+ 'memb' => array()
+ );
+ }
+
+ // If member has not been set yet
+ $memb_id = $inv['member_id'];
+ if (!isset($sum[$event_id]['memb'][$memb_id])) {
+
+ // Get Member credit card types
+ $sql = "
+ SELECT CT.ccard_type_name AS ccardName
+ FROM members.ccard_type CT, members.member_ccard_type MCT
+ WHERE MCT.member_id = $memb_id
+ AND CT.ccard_type_id = MCT.ccard_type_id
+ ORDER BY CT.ccard_type_name
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $cc_types = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($cc_types) == 0) {
+ $cc_types = false;
+ }
+
+ $sum[$event_id]['memb'][$memb_id] = array(
+ 'id' => $memb_id,
+ 'name' => $inv['member'],
+ 'street' => $inv['street'],
+ 'city' => $inv['city'],
+ 'accom' => array(),
+ 'cc_types' => $cc_types
+ );
+
+ $total_properties++;
+ }
+
+ // If accommodation has not been set yet
+ $accom_id = $inv['accommodation_id'];
+ if (!isset($sum[$event_id]['memb'][$memb_id]['accom'][$accom_id])) {
+ $sum[$event_id]['memb'][$memb_id]['accom'][$accom_id] = array(
+ 'id' => $memb_id,
+ 'name' => $inv['accommodation'],
+ 'date' => array()
+ );
+
+ // Also build all the dates as empty entries
+ reset($dates);
+ while( list($k, $v) = each($dates) ) {
+ $sum[$event_id]['memb'][$memb_id]['accom'][$accom_id]['date'][$k] = false;
+ }
+
+ }
+
+ // Add this inventory item
+ $inven_id = $inv['id'];
+ $t = strtotime($inv['date']['date']);
+ $sum[$event_id]['memb'][$memb_id]['accom'][$accom_id]['date'][$t] = array(
+ 'id' => $inven_id,
+ 'date' => $inv['date']['date'],
+ 'assigned' => $inv['assigned'],
+ 'avail' => $inv['available'],
+ 'sold' => $inv['assigned'] - $inv['available'],
+ 'rate' => $inv['rate']
+ );
+ ksort($sum[$event_id]['memb'][$memb_id]['accom'][$accom_id]['date']);
+
+ $total_assigned[$t] += $inv['assigned'];
+ $total_available[$t] += $inv['available'];
+ $total_sold[$t] += ($inv['assigned'] - $inv['available']);
+
+ }
+
+ $sum[$event_id]['total_properties'] = $total_properties;
+ $sum[$event_id]['total_assigned'] = $total_assigned;
+ $sum[$event_id]['total_available'] = $total_available;
+ $sum[$event_id]['total_sold'] = $total_sold;
+
+ // Calculate overall uptake rate per day
+ $ta = 0;
+ $ts = 0;
+ $daily_uptake = array();
+ while (list($k, $v) = each($total_assigned)) {
+ $ta += $v;
+ $ts += $total_sold[$k];
+
+ // Calculate uptake rate for this day
+ $sum[$event_id]['daily_uptake'][$k] = sprintf('%.2f', (($total_sold[$k] / $v) * 100) )."%";
+ }
+ $sum[$event_id]['overall_uptake'] = sprintf('%.2f', (($ts / $ta) * 100) )."%";
+
+ $have_summary = true;
+
+ }
+
+ $r = array(
+ 'inventory' => $inventoryList,
+ 'firstDate' => $firstDate,
+ 'type' => $type,
+ 'dates' => $dates,
+ 'sum' => $sum,
+ 'have_sum' => $have_summary
+ );
+
+ return $r;
+
+ }
+
+
+ /**
+ * Get Inventory Detail
+ *
+ * @return array
+ */
+ function getInvenDetail($invID = false)
+ {
+
+ // If an inventory ID is supplied
+ if ($invID) {
+ $inventoryID = $invID;
+
+ // Otherwise is there a new inventory item selected selected?
+ } elseif (($inventoryID = filter_input(INPUT_GET, 'InvenID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Inven'] = $inventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Inven'])) {
+
+ // Otherwise, get the inventory ID from the session
+ $inventoryID = $_SESSION[GLM_EVENT_SESSION]['Inven'];
+
+ } else {
+
+ // Otherwise, we don't have an inventory id
+ return false;
+
+ }
+
+ $inventoryDetail = $this->getEntry($inventoryID);
+
+ return $inventoryDetail;
+
+ }
+
+
+ /**
+ * Edit Inventory
+ *
+ * @return array
+ */
+ function editInven()
+ {
+
+ if (($invenID = filter_input(INPUT_GET, 'InvenID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Inven'] = $invenID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Inven'])) {
+
+ // Otherwise, get the inventory ID from the session
+ $invenID = $_SESSION[GLM_EVENT_SESSION]['Inven'];
+
+ } else {
+
+ // Otherwise, we don't have an inventory id
+ return false;
+
+ }
+
+ $invenDetail = $this->editEntry($invenID);
+
+ return $invenDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Inventory
+ *
+ * @return array
+ */
+ function updateInven()
+ {
+
+ if (($invenID = filter_input(INPUT_GET, 'InvenID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Inven'] = $invenID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Inven'])) {
+
+ // Otherwise, get the inventory ID from the session
+ $invenID = $_SESSION[GLM_EVENT_SESSION]['Inven'];
+
+ } else {
+
+ // Otherwise, we don't have a inventory id
+ return false;
+
+ }
+
+ // Assume no delete and no delete failure
+ $delete = false;
+ $deleteFail = false;
+ $reason = array();
+
+ // Check if we have valid data
+ $r = $this->updateEntry($invenID, 'id', false);
+ if ($r['status']) {
+
+ // check if this is a Delete request
+ if (isset($_REQUEST['submitType']) && $_REQUEST['submitType'] == 'Delete Selected Inventory') {
+
+ // Check if there are room block associated with this inventory
+ $sql = "
+ SELECT COUNT(id)
+ FROM eventmgt.room_block_seg
+ WHERE event = ".$r['fieldData']['event_id']."
+ AND accommodation = ".$r['fieldData']['accommodation_id'].";
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $blockData = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($blockData['count'] > 0) {
+ // Can't delete because room blocks associated with this inventory exist
+ $r['status'] = false;
+ $reason[] = 'The selected inventory is in use in a room block.';
+ $reason[] = 'Delete the room block first if you want to delete this inventory.';
+ $delete = false;
+ $deleteFail = true;
+ } else {
+ // No room blocks so inventory may be deleted.
+ $delete = true;
+ }
+ }
+
+ // Check if this is only the original date
+ if ($r['fieldStore']['date'] == $r['fieldStore']['end_date'] &&
+ $r['fieldData']['date']['date'] == $_REQUEST['original_date']) {
+
+ $fields = $this->fields;
+ unset($fields['end_date']);
+ $this->fields = $fields;
+
+ // It's only the original date, so do again but store it this time or delete it
+ if ($delete) {
+
+ // Delete requested
+ $sql = "DELETE FROM eventmgt.inventory
+ WHERE id = ".$r['fieldData']['id'].";";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ $r['fieldData']['date']['date'] .= " *** DELETED *** ";
+
+ } else {
+
+ $r = $this->updateEntry($invenID);
+
+ }
+
+ } else { // This is either not the original date or it's a date range
+
+ // Check for sane dates
+ if ($r['fieldData']['date']['timestamp'] > $r['fieldData']['end_date']['timestamp']) {
+
+ $r['status'] = false;
+ $r['fieldFail']['end_date'] = "Must be equal to or later than From Date.";
+
+ } else {
+
+ $accom_id = ($_REQUEST['accom_id'] - 0);
+ $event_id = ($_REQUEST['event_id'] - 0);
+ $memb_id = ($_REQUEST['member_id'] - 0);
+
+ // Delete any inventory for this accommodation and event
+ $sql = "DELETE FROM eventmgt.inventory
+ WHERE event = ".$event_id."
+ AND accommodation = ".$accom_id."
+ AND date >= '".$r['fieldData']['date']['date']."'
+ AND date <= '".$r['fieldData']['end_date']['date']."';";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+
+ // Check if this is a request to delete the inventory
+ if (isset($_REQUEST['submitType']) && $_REQUEST['submitType'] == 'Delete Selected Inventory') {
+ $r['fieldData']['date']['date'] .= " through ".$r['fieldData']['end_date']['date'].' *** DELETED ***';
+ } else {
+
+ // Insert updated inventory for date range (note incriment is a bit more to accommodate leap seconds)
+ $sql = "INSERT INTO eventmgt.inventory
+ (date, member, accommodation, event, assigned, available, rate)
+ VALUES
+ ('{date}', $memb_id, $accom_id, $event_id, ".$r['fieldStore']['assigned'].",
+ ".$r['fieldStore']['available'].", ".$r['fieldStore']['rate']."
+ );
+ ";
+
+ // For each date, create new inventory.
+ for ($d = $r['fieldData']['date']['timestamp'] ;
+ $d <= $r['fieldData']['end_date']['timestamp'] ;
+ $d = strtotime(date('m/d/Y', $d+86500))) {
+
+ $date = date('m/d/Y', $d);
+ $s = str_replace('{date}', $date, $sql);
+ $stmt = $this->dbh->prepare($s);
+ $stmt->execute();
+
+ }
+
+ // Change date on detail display to show range
+ $r['fieldData']['date']['date'] .= " through ".$r['fieldData']['end_date']['date'];
+ }
+ }
+ }
+
+ }
+
+ // Check if there was a delete failure
+ if ($deleteFail) {
+ $r['status'] = false;
+ if (is_array($r['reason'])) {
+ $reason = array_merge($r['reason'], $reason);
+ }
+ $r['reason'] = $reason;
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add Inventory
+ *
+ * @return array
+ */
+ function addInven()
+ {
+ $reason = array();
+
+ // Make sure an Event has been selected.
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ $reason[] = "No event has been selected. Please select an Event and Property before adding inventory.";
+ }
+
+ // Get selected event and property data
+ $eventData = $this->getEventMemberData($eventID);
+
+ // Set dates to default to event dates
+ $this->fields['start_date']['default'] = strtotime($eventData['event_start_date']);
+ $this->fields['end_date']['default'] = strtotime($eventData['event_end_date']);
+ $this->fields['min_nights']['default'] = $eventData['event_days'];
+
+ // Get new entry fields
+ $r = $this->newEntry();
+
+ // Check for available properties/accommodations
+ if (count($r['fieldData']['accommodation']['pick_list']) == 0) {
+ $r['status'] = false;
+ $r['reason'][] = 'No property accommodations in system to select from. Please add accommodations to a property.';
+ }
+
+ // Add in static Event and Property data
+ $r['fieldData'] = array_merge($r['fieldData'], $eventData);
+
+ // Add in member/accommodation data
+ $membAccom = $this->getMembAccomMatrix();
+ $r['membAccom'] = $membAccom;
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Inventory
+ *
+ * @return array
+ */
+ function insertInven()
+ {
+
+ // Get selected event and property data using ID's passed from form
+ $eventID = ($_REQUEST['event'] - 0);
+ $memberID = ($_REQUEST['member'] - 0);
+ $eventData = $this->getEventMemberData($eventID);
+
+ // Process input, but don't store any result
+ $r = $this->insertEntry(false);
+
+ // Add in static Event and Property data
+ $r['fieldData'] = array_merge($r['fieldData'], $eventData);
+
+ // Check for sane dates
+ if ($r['fieldData']['start_date']['timestamp'] > $r['fieldData']['end_date']['timestamp']) {
+ $r['status'] = false;
+ $r['fieldFail']['start_date'] = 'First date may not be later than last date when creating inventory.';
+ }
+
+ if ($memberID > 0 && $r['status'] ) {
+
+ // Check for existing inventory conflicting with this new inventory
+ $sql = "SELECT count(id)
+ FROM eventmgt.inventory
+ WHERE event = $eventID
+ AND member = $memberID
+ AND accommodation = ".$r['fieldStore']['accommodation']."
+ AND date BETWEEN ".$r['fieldStore']['start_date']." AND ".$r['fieldStore']['end_date']."
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if ($eventData['count'] > 0) {
+ $r['status'] = false;
+ $r['fieldFail']['start_date'] = 'Inventory already exists for at least one of the dates requested.';
+ }
+ }
+
+ if ($memberID == 0) {
+ $r['fieldFail']['member'] = 'Member is required.';
+ }
+
+ // If it's OK to create the inventory
+ if ($r['status']) {
+
+ // Add each night as separate inventory item
+ $s = $r['fieldData']['start_date']['timestamp'];
+ $e = $r['fieldData']['end_date']['timestamp'];
+ $sql = array();
+ for ($date=$s ; $date<=$e ; $date=strtotime(date('m/d/Y',$date)." +1 day")) {
+ $sql[] = "INSERT INTO eventmgt.inventory
+ (event, member, accommodation, date, assigned, available, rate)
+ VALUES
+ (
+ $eventID, $memberID, ".$r['fieldStore']['accommodation'].",
+ '".date('m/d/Y',$date)."', ".$r['fieldStore']['assigned'].",
+ ".$r['fieldStore']['assigned'].", ".$r['fieldStore']['rate']."
+ );
+ \n";
+ }
+/* Not using event_prop table anymore
+ // Check for existing event/property table entry
+ $sql2 = "SELECT count(id)
+ FROM eventmgt.event_prop
+ WHERE event = $eventID
+ AND property = $memberID
+ ;";
+ $stmt = $this->dbh->prepare($sql2);
+ $stmt->execute();
+ $eventpropData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // If there's not an entry, add one
+ if ($eventpropData['count'] == 0) {
+ $sql[] = "INSERT INTO eventmgt.event_prop
+ (event, property)
+ VALUES
+ ($eventID, $memberID)
+ ;";
+
+ }
+*/
+ // Try to add this inventory
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ $r['status'] = false;
+ $r['reason'][] = 'Unable to store new inventory for unknown reason. ';
+ // var_dump($e);
+ }
+
+ // Add to event-property table
+ }
+
+ // Add in member/accommodation data
+ $membAccom = $this->getMembAccomMatrix();
+ if ($memberID > 0) {
+ $r['membSelected'] = $membAccom[$memberID];
+ $membAccom[$memberID]['selected'] = true;
+ }
+ $r['membAccom'] = $membAccom;
+
+ // Check for selected accommodation
+ $a = ($r['fieldData']['accommodation']['in'] - 0);
+ if ($a > 0) {
+ $r['membSelected']['accoms'][$a]['selected'] = true;
+ }
+
+
+ // If succesful then set current inventory to the one just inserted.
+ if ($r['status']) {
+
+ $sql = "select currval('inventory_id_seq');";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $last = $stmt->fetch(PDO::FETCH_ASSOC);
+ $r['insertedID'] = $last['currval'] ;
+
+ }
+
+ return $r;
+
+ }
+
+
+
+ /**
+ * getMembAccomMatrix
+ *
+ * @param integer $memberID
+ */
+ function getMembAccomMatrix()
+ {
+
+ // Get property/accommodation matrix
+ if (count($reason) == 0) {
+ $sql = "SELECT M.id AS memb_id,
+ M.name AS memb_name,
+ A.id AS accom_id,
+ A.name AS accom_name
+ FROM eventmgt.member M, eventmgt.accommodation A
+ WHERE A.member = M.id
+ ORDER BY M.name, A.sort
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $membAccomData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($membAccomData) == 0) {
+ $reason[] = "No properties with accommodations are currently listed in the system.";
+ }
+ }
+
+ // Build array of Members with their accommodations
+ $membAccom = array();
+ foreach ($membAccomData as $d) {
+
+ // If member hasn't been added to array yet
+ if (!isset($membAccom[$d['memb_id']])) {
+ $membAccom[$d['memb_id']] = array(
+ 'membID' => $d['memb_id'],
+ 'membName' => $d['memb_name'],
+ 'accoms' => array()
+ );
+ }
+
+ // Add this accommodation
+ $membAccom[$d['memb_id']]['accoms'][$d['accom_id']] = array(
+ 'accomID' => $d['accom_id'],
+ 'accomName' => $d['accom_name']
+ );
+ }
+
+ return $membAccom;
+ }
+
+ /**
+ * Get Event and Member information for specified event and member ID
+ *
+ * @param integer $eventID
+ * @param integer $memberID
+ */
+ function getEventMemberData($eventID)
+ {
+ // Get event Data
+ $sql = "SELECT name, event_code, start_date, end_date, days
+ FROM eventmgt.event
+ WHERE id = $eventID;
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Add event information to returned array
+ $r['event'] = $eventData['name'];
+ $r['event_code'] = $eventData['event_code'];
+ $r['event_id'] = $eventID;
+ $r['event_days'] = $eventData['days'];
+ $r['event_start_date'] = $eventData['start_date'];
+ $r['event_end_date'] = $eventData['end_date'];
+
+/*
+ // Get property Data
+ $sql = "SELECT name
+ FROM eventmgt.member
+ WHERE id = $memberID;
+ ";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $memberData = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Add event information to returned array
+ $r['member'] = $memberData['name'];
+ $r['member_id'] = $memberID;
+*/
+ return $r;
+
+ }
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataMemberScansFor.php b/classes/data/dataMemberScansFor.php
new file mode 100644
index 0000000..79d6da1
--- /dev/null
+++ b/classes/data/dataMemberScansFor.php
@@ -0,0 +1,234 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMemberScansFor.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataMemberScansFor class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMemberScansFor,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataMemberScansFor extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.member_scans_for';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Pointer to a member who does the scanning
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Name of member who does the scanning
+ 'member_name' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Pointer to a member who the scanning is for
+ 'scans_for' => array(
+ 'field' => 'scans_for',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Name of member who does the scanning
+ 'scans_for_name' => array(
+ 'field' => 'scans_for',
+ 'as' => 'scans_for_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ )
+
+ );
+ }
+
+ /**
+ * Get List
+ *
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getMemberScansForList($memberID = false)
+ {
+
+ // if member ID is not supplied, try to find it
+ if ($memberID == false) {
+
+ // Check submit input
+ $memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT);
+
+ // If we still don't have it
+ if ($memberID == false || $memberID < 1) {
+
+ // Try the session
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ }
+
+ }
+
+ }
+
+ // If we still don't have a valid member ID
+ if ($memberID == false || ($memberID - 0) <= 0) {
+ return false;
+ }
+
+ $where = "T.member = $memberID";
+
+ // Get the list of members a member scans for
+ $memberScansFor = $this->getList($where);
+ if (count($memberScansFor) == 0) {
+ return false;
+ }
+
+ return $memberScansFor;
+
+ }
+
+ /**
+ * Update member scans for list
+ *
+ * Expects request input "selectedMember[id]" array.
+ */
+
+ public function updateMemberScansForList($memberID = false)
+ {
+
+ if ($memberID == false) {
+ return false;
+ }
+
+ // Query to delete current Member Scans For list
+ $sql = "
+ BEGIN;
+ DELETE FROM eventmgt.member_scans_for
+ WHERE member = $memberID;
+ ";
+
+ // Now add in any members who this member will be scanning for
+ $newMembers = $_REQUEST['selectedMember'];
+ if ($newMembers) {
+ foreach ($newMembers as $m) {
+ $sql .= "
+ INSERT INTO eventmgt.member_scans_for
+ ( member, scans_for )
+ VALUES ( $memberID, $m )
+ ;";
+ }
+ }
+ $sql .= "COMMIT;";
+ $this->dbh->exec($sql);
+
+ return $this->getMemberScansForList($memberID);
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php
new file mode 100644
index 0000000..9871c92
--- /dev/null
+++ b/classes/data/dataMembers.php
@@ -0,0 +1,1219 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataMembers class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+class EventManagementDataMembers extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.member';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Member Type
+ 'member_type' => array(
+ 'field' => 'member_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->member_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // E-Mail
+ 'email' => array(
+ 'field' => 'email',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Processing E-Mail
+ 'proc_email' => array(
+ 'field' => 'proc_email',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Processing E-Mail #2
+ 'proc_email2' => array(
+ 'field' => 'proc_email2',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notify member of each checkout
+ 'checkout_notify' => array(
+ 'field' => 'checkout_notify',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => true,
+ 'use' => 'a'
+ ),
+
+ // Check In Time
+ 'check_in' => array(
+ 'field' => 'check_in',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Check Out Time
+ 'check_out' => array(
+ 'field' => 'check_out',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Defalut Ticket Policy
+ 'def_ticket_pol' => array(
+ 'field' => 'def_ticket_pol',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+
+ /*
+ * Fields used whether or not we're using an integrated member database
+ */
+
+/* not using policies at this level for now
+ // Defalut Reservation Policy
+ 'def_res_pol' => array(
+ 'field' => 'def_res_pol',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+
+ // Defalut Cancel Policy
+ 'def_can_pol' => array(
+ 'field' => 'def_can_pol',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+*/
+ // Member amenity #1
+ 'amen_1' => array(
+ 'field' => 'amen_1',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #2
+ 'amen_2' => array(
+ 'field' => 'amen_2',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #3
+ 'amen_3' => array(
+ 'field' => 'amen_3',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #4
+ 'amen_4' => array(
+ 'field' => 'amen_4',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #5
+ 'amen_5' => array(
+ 'field' => 'amen_5',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #6
+ 'amen_6' => array(
+ 'field' => 'amen_6',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #7
+ 'amen_7' => array(
+ 'field' => 'amen_7',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #8
+ 'amen_8' => array(
+ 'field' => 'amen_8',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #9
+ 'amen_9' => array(
+ 'field' => 'amen_9',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member amenity #10
+ 'amen_10' => array(
+ 'field' => 'amen_10',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Intro Text for front-end
+ 'intro_text' => array(
+ 'field' => 'intro_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Checkout E-Mail
+ 'checkout_email' => array(
+ 'field' => 'checkout_email',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+
+ /*
+ * Fields used if we're using an integrated member database
+ */
+ if ($this->config->option->member_db_integrated) {
+
+ $integratedDb = array(
+
+ // Member name - From main member db - Used only if db is Integrated
+ 'member_name' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ // Only permit members set at providing accommodations
+ 'p_where' => 'member_id in
+ (
+ SELECT DISTINCT member_id
+ FROM members.member_category
+ WHERE category_id IN
+ (SELECT category_id FROM members.category WHERE accommodations)
+ )',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Member name - From main member db - Used only if db is Integrated
+ 'member_name_view' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_name',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member login - From main member db - Used only if db is Integrated
+ 'member_login_view' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_login',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_login',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member password - From main member db - Used only if db is Integrated
+ 'member_passwd_view' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'member_passwd',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'member_passwd',
+ 'p_id' => 'member_id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Street Address - From main member db
+ 'member_street' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'street',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'street',
+ 'p_id' => 'member_id',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member City - From main member db
+ 'member_city' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'city',
+ 'type' => 'pointer',
+ 'p_table' => 'members.city',
+ 'p_field' => 'city_name',
+ 'p_id' => 'city_id',
+ 'p_where' => 'M.member_id = T.id AND city.city_id = M.city_id',
+ 'p_from' => 'members.member M',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member phone - From main member db
+ 'member_phone' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'phone',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'phone',
+ 'p_id' => 'member_id',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Lat - From main member db
+ 'member_lat' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'lat',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'lat',
+ 'p_id' => 'member_id',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Lon - From main member db
+ 'member_lon' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'lon',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member',
+ 'p_field' => 'lon',
+ 'p_id' => 'member_id',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member number of rooms at property
+ 'prop_rooms' => array(
+ 'field' => 'id', // ID in member table is same as in eventmgt.member
+ 'as' => 'prop_rooms',
+ 'type' => 'pointer',
+ 'p_table' => 'members.member_accommodations',
+ 'p_field' => 'num_rooms',
+ 'p_id' => 'member_id',
+ 'required' => false,
+ 'unique' => true,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ )
+
+ );
+
+ $this->fields = array_merge($this->fields, $integratedDb);
+
+ }
+
+
+ /*
+ * Fields used if we're not using an integrated database
+ */
+ if (!$this->config->option->member_db_integrated) {
+
+ $nonIntegratedDb = array(
+
+ // Member Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 1
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // City
+ 'city' => array(
+ 'field' => 'city',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->states->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 'MI',
+ 'use' => 'a'
+ ),
+
+ // Country
+ 'country' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->countries->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // ZIP
+ 'zip' => array(
+ 'field' => 'zip',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Latitude
+ 'lat' => array(
+ 'field' => 'lat',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 45,
+ 'use' => 'a'
+ ),
+
+ // Longitude
+ 'lon' => array(
+ 'field' => 'lon',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => -84,
+ 'use' => 'a'
+ ),
+
+ // Member phone - From main member db
+ 'phone' => array(
+ 'field' => 'phone', // ID in member table is same as in eventmgt.member
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Cards Accepted - multi-pick
+ 'cards_accepted' => array(
+ 'field' => 'cards_accepted',
+ 'as' => false,
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config->ccard->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0, // Note that this is a bitmap of card indexes
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway
+ 'payment_gateway' => array(
+ 'field' => 'payment_gateway',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ccard_processor->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => '99',
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 1 (Authorize.net: login, Merchant Solutions: acctid)
+ 'gateway_par1' => array(
+ 'field' => 'gateway_par1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 2 (Authorize.net: key, Merchant Solutions: merchantpin)
+ 'gateway_par2' => array(
+ 'field' => 'gateway_par2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 3 (Authorize.net: test, Merchant Solutions: n/a)
+ // test: LOCAL_TEST, LOCAL_FAIL, TRUE, FALSE (Must be FALSE for production)
+ 'gateway_par3' => array(
+ 'field' => 'gateway_par3',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->cc_mode->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 4 (Authorize.net: Send Conf Flag, Merchant Solutions: n/a)
+ 'gateway_par4' => array(
+ 'field' => 'gateway_par4',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment Gateway Parameter 5 (Authorize.net: Merchant Email, Merchant Solutions: n/a)
+ 'gateway_par5' => array(
+ 'field' => 'gateway_par5',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal enabled flag
+ 'paypal' => array(
+ 'field' => 'paypal',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal Client ID
+ 'paypal_client_id' => array(
+ 'field' => 'paypal_client_id',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal Secret
+ 'paypal_secret' => array(
+ 'field' => 'paypal_secret',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // PayPal payment mode
+ // test:
+ 'paypal_mode' => array(
+ 'field' => 'paypal_mode',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->paypal_mode->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Parking Map
+ 'parking_map' => array(
+ 'field' => 'parking_map',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Sector Map
+ 'ticket_sec_map' => array(
+ 'field' => 'ticket_sec_map',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Policy
+ 'ticket_policy' => array(
+ 'field' => 'ticket_policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Special Request Accepted
+ 'ticket_spec_req' => array(
+ 'field' => 'ticket_spec_req',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Sort order
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ ),
+
+ // Member account active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+ );
+
+ $this->fields = array_merge($this->fields, $nonIntegratedDb);
+
+ }
+
+ }
+
+ /**
+ * Get Members list
+ *
+ * @param string type of events list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getMembersList($option = 'event', $where = 'TRUE', $sort = 'name')
+ {
+
+ // Check if a member ID was submitted
+ $locationID = filter_input(INPUT_GET, 'locationID', FILTER_SANITIZE_NUMBER_INT);
+ if ($locationID) {
+ $option = 'member';
+ }
+
+ if ($option == 'all') {
+ $_SESSION[GLM_EVENT_SESSION]['Event'] = false;
+ }
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get any specified member listing option - default to event
+ if (($membersListOption = filter_input(INPUT_GET, 'MembersListOption', FILTER_SANITIZE_STRING))) {
+ $option = $membersListOption;
+ }
+
+ // Select type of list
+ $sortByDist = false;
+ switch ($option) {
+
+ case 'all':
+ break;
+
+ case 'active':
+ $where .= ' AND active';
+ break;
+
+ case 'accom':
+ $where .= " AND id in
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.accommodation
+ )
+ ";
+ break;
+
+ case 'member':
+ $where .= " AND active AND id = ".($locationID - 0);
+ break;
+
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where .= "AND id IN
+ (
+ SELECT DISTINCT member
+ FROM eventmgt.inventory
+ WHERE conv = $eventID
+ )
+ ";
+ /* Not using event_prop anymore
+ SELECT DISTINCT property
+ FROM eventmgt.event_prop
+ WHERE event = $eventID
+ */
+ $sortByDist = true;
+ break;
+
+ case 'type1':
+ $where .= " AND member_type = 1 AND active";
+ break;
+
+ case 'type2':
+ $where .= " AND member_type = 2 AND active";
+ break;
+
+ case 'type3':
+ $where .= " AND member_type = 3 AND active";
+ break;
+
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get Members List
+ $membersList = $this->getList($where, $sort);
+
+ // Add distances to the member data and sort by distance
+ if ($sortByDist) {
+ if (!class_exists('EventManagementGeoCalculations')) {
+ require COMMON_APP_BASE.APP_VERSION.'/classes/GeoCalculations.php';
+ }
+ $Geo = new EventManagementGeoCalculations($this->dbh);
+ $membersList = $Geo->getMemberEventDistance( $eventID, $membersList, 'lat', 'lon', 'distance', 'duration', 'id', true);
+ }
+
+ // echo "
".print_r($membersList,1)."
";
+ return $membersList;
+ }
+
+
+ /**
+ * Get Member Detail
+ *
+ * @return array
+ */
+ function getMemberDetail($memberID = false)
+ {
+ $this->optionIncludeSelectListData = false;
+
+ // If a member ID has been supplied
+ if ($memberID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise if there a new member ID supplied via the request
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the event ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $memberDetail = $this->getEntry($memberID);
+
+ // echo "
".print_r($memberDetail,1)."
";
+ return $memberDetail;
+
+ }
+
+
+ /**
+ * Edit Member
+ *
+ * @return array
+ */
+ function editMember()
+ {
+ // Is there a new member code selected?
+ if (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the member ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have a member id
+ return false;
+
+ }
+
+ $memberDetail = $this->editEntry($memberID);
+
+ return $memberDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Member
+ *
+ * @return array
+ */
+ function updateMember()
+ {
+
+ // Is there a new event code selected?
+ if (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the member ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have a member id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($memberID);
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Member
+ *
+ * @return array
+ */
+ function insertMember()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current member to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete Member
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function memberDelete($confirm = false)
+ {
+
+ // Is there a new member code selected?
+ if (($memberID = filter_input(INPUT_GET, 'MemberID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $memberID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Member'])) {
+
+ // Otherwise, get the member ID from the session
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ } else {
+
+ // Otherwise, we don't have a member id
+ return false;
+
+ }
+
+ /*
+ * Delete all supporting information
+ *
+ * Contacts
+ * Performance
+ * Sections
+ * Events
+ * Tickets
+ * Ticket inventory
+ * Orders
+ * Sold
+ *
+ *
+ * inven_hold gets cleaned out and does not need to be deleted
+ */
+/*
+ DELETE FROM eventmgt.ticket_order
+ WHERE member = $memberID;
+ DELETE FROM eventmgt.ticket_sold
+ WHERE member = $memberID;
+*/
+ $sql = "
+ DELETE FROM eventmgt.res_contact
+ WHERE contact_type = ".$this->config->reference_type->member."
+ AND affiliation = $memberID;
+ DELETE FROM eventmgt.section
+ WHERE member = $memberID;
+ DELETE FROM eventmgt.ticket_inventory
+ WHERE ticket in (
+ SELECT id
+ FROM eventmgt.ticket
+ WHERE member = $memberID
+ );
+ DELETE FROM eventmgt.ticket
+ WHERE member = $memberID;
+ DELETE FROM eventmgt.performance
+ WHERE member = $memberID;
+ ";
+ $this->dbh->exec($sql);
+
+ // Delete member and return their old data
+ $memberDetail = $this->deleteEntry($memberID, $confirm);
+
+ return $memberDetail;
+
+ }
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataMisc.php b/classes/data/dataMisc.php
new file mode 100644
index 0000000..ca124a7
--- /dev/null
+++ b/classes/data/dataMisc.php
@@ -0,0 +1,283 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMisc.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataMisc class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMisc,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataMisc extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.misc';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // ID - in this table there's only one entry and the ID is always 1
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for intro page
+ 'intro_text' => array(
+ 'field' => 'intro_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for section selection page
+ 'section_text' => array(
+ 'field' => 'section_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for ticket selection page
+ 'ticket_text' => array(
+ 'field' => 'ticket_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for ticket date, time, section, quantity, selection page
+ 'ticket_opt_text' => array(
+ 'field' => 'ticket_opt_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for cart page
+ 'cart_text' => array(
+ 'field' => 'cart_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for checkout page
+ 'checkout_text' => array(
+ 'field' => 'checkout_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Text for checkout success page
+ 'success_text' => array(
+ 'field' => 'success_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Google tracking script for checkout page
+ 'tracking' => array(
+ 'field' => 'tracking',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // No payment reasons for admin checkout
+ 'no_payment_reasons' => array(
+ 'field' => 'no_payment_reasons',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #1
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #2
+ 'opt_field_2_name' => array(
+ 'field' => 'opt_field_2_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #3
+ 'opt_field_3_name' => array(
+ 'field' => 'opt_field_3_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // SSL Certificate Seal Head Script
+ 'ssl_seal_head_script' => array(
+ 'field' => 'ssl_seal_head_script',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // SSL Certificate Seal Body Script
+ 'ssl_seal_body_script' => array(
+ 'field' => 'ssl_seal_body_script',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_UNSAFE_RAW,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Central Payment Location
+ 'central_payment' => array(
+ 'field' => 'central_payment',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Central Payment Location ID
+ 'central_payment_id' => array(
+ 'field' => 'central_payment',
+ 'as' => 'central_payment_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'g'
+ )
+
+ );
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/classes/data/dataOrders.php b/classes/data/dataOrders.php
new file mode 100644
index 0000000..2850a64
--- /dev/null
+++ b/classes/data/dataOrders.php
@@ -0,0 +1,714 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataOrders.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataOrders,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataOrders extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_order';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // user_trace_info
+ 'user_trace_info' => array(
+ 'field' => 'user_trace_info',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // First Name
+ 'fname' => array(
+ 'field' => 'fname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Last Name
+ 'lname' => array(
+ 'field' => 'lname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 1
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // First Name
+ 'city' => array(
+ 'field' => 'city',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Contact State
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->states->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 'MI',
+ 'use' => 'a'
+ ),
+
+ // Contact Country
+ 'country' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->countries->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Contact ZIP
+ 'zip' => array(
+ 'field' => 'zip',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Phone
+ 'phone' => array(
+ 'field' => 'phone',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // E-Mail
+ 'email' => array(
+ 'field' => 'email',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // E-Mail OK
+ 'email_ok' => array(
+ 'field' => 'email_ok',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Purchase Date
+ 'purchase_date' => array(
+ 'field' => 'purchase_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => time(),
+ 'use' => 'lged'
+ ),
+
+ // Member ID
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // CC Type
+ 'cctype' => array(
+ 'field' => 'cctype',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // CC Number
+ 'ccnumber' => array(
+ 'field' => 'ccnumber',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // CC Expiration$_SESSION[GLM_EVENT_SESSION]['Ticket']
+ 'expire' => array(
+ 'field' => 'expire',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // Name on Card
+ 'ccname' => array(
+ 'field' => 'ccname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // CC Confirmation #
+ 'ccconf' => array(
+ 'field' => 'ccconf',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // Charge Number
+ 'charge_numb' => array(
+ 'field' => 'charge_total',
+ 'as' => 'charge_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Charge Total Money
+ 'charge_total' => array(
+ 'field' => 'charge_total',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lge'
+ ),
+
+ // Special Needs
+ 'special_needs' => array(
+ 'field' => 'special_needs',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Optional Checkout Field Name #1
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field #1
+ 'opt_field_1' => array(
+ 'field' => 'opt_field_1',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field Name #2
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field #2
+ 'opt_field_2' => array(
+ 'field' => 'opt_field_2',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field Name #3
+ 'opt_field_1_name' => array(
+ 'field' => 'opt_field_1_name',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Optional Checkout Field #3
+ 'opt_field_3' => array(
+ 'field' => 'opt_field_3',
+ 'as' => false,
+ 'type' => text,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+
+ /**
+ * Get Orders list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getOrdersList($memberID = false, $performanceID = false, $sectionID = false, $listType = false)
+ {
+
+ // Get member ID
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+
+ // Get performance ID
+ if ($performanceID == false) {
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+ }
+
+ // Get section ID
+ if ($sectionID == false) {
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+ }
+
+ // Get URI search type
+ if (!$listType && isset($_REQUEST['listType'])) {
+ $listType = $_REQUEST['listType'];
+ }
+
+ // Build query Where clause
+ $where = 'true';
+
+ switch ($listType) {
+
+ case 'norm':
+ default:
+ if ($memberID) {
+ $where .= " AND T.member = $memberID";
+ }
+ if ($performanceID) {
+ $where .= " AND T.performance = $performanceID";
+ }
+ if ($sectionID) {
+ $where .= " AND T.section = $sectionID";
+ }
+ break;
+
+ case 'all':
+ break;
+
+ }
+
+ // Get list of Orders
+ $ordersList = $this->getList($where, 'purchase_date');
+
+ return $ordersList;
+ }
+
+ /**
+ * Get Order Detail
+ *
+ * @return array
+ */
+ function getOrderDetail($orderID = false, $memberID = false)
+ {
+
+ // If a order has been specified
+ if ($orderID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ // Otherwise if there's a order ID in the request
+ } elseif (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ $where = '';
+ if ($memberID) {
+ $where = "AND T.member = $memberID";
+ }
+
+ $orderDetail = $this->getEntry($orderID, 'id', $where);
+
+ // If we have a member ID then make sure the sold ticket is for that member
+ if ($memberID && $orderDetail['member'] != $memberID) {
+ return false;
+ }
+
+ return $orderDetail;
+
+ }
+
+
+ /**
+ * Edit Order
+ *
+ * @return array
+ */
+ function editOrder()
+ {
+
+ if (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ // Otherwise, get the order ID from the session
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ $orderDetail = $this->editEntry($orderID);
+
+ return $orderDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Order
+ *
+ * @return array
+ */
+ function updateOrder()
+ {
+
+ if (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ // Otherwise, get the order ID from the session
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($orderID);
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Order
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ * @param $orderID int If supplied, use for order ID, otherwise check for orderID REQUEST param.
+ *
+ * @return int Deleted order ID or false if fail
+ */
+ function orderDelete($confirm = false, $orderID = false)
+ {
+
+ $orderID = $orderID - 0;
+
+ // If an order wasn't supplied in the function call or it's not a positive integer
+ if ($orderID <= 0) {
+
+ $orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT);
+ $orderID = $orderID - 0;
+
+ // Is there isn't a new order ID provided on the URL
+ if ($orderID <= 0) {
+ echo "
No valid order ID supplied.
";
+ return false;
+ }
+
+ }
+
+ // Get order to validate order ID
+ $orderDetail = $this->getEntry($orderID);
+ if (!$orderDetail) {
+ echo "
Order ID $orderID not found.
";
+ return false;
+ }
+
+ $sql = "BEGIN;\n";
+
+ // Build query to delete add_on_sold data
+ $sql .= "DELETE FROM eventmgt.add_on_sold WHERE ticket_order = $orderID;\n";
+
+ // Build query to delete promo_sold data
+ $sql .= "DELETE FROM eventmgt.promo_sold WHERE ticket_order = $orderID;\n";
+
+ // Get list of tickets sold in this order
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSold.php';
+ $Sold = new EventManagementDataSold($this->dbh, $this->config);
+ $sold = $Sold->getSoldList($orderID);
+ if (!$sold) {
+ echo "
No tickets found for order ID $orderID.
";
+ return false;
+ }
+
+ // Build query to update inventory for each ticket sold and to delete the ticket sold
+ foreach ($sold as $s) {
+
+ // If this is not a package sold item, adjust inventory - Only the tickets in a package get processed
+ if (!$s['ticket_package']) {
+
+ // Note that we don't check to see if the ticket is marked as having unlimited quantity. If it's unlimited, decrementing the inventory has no effect.
+
+ // If this is a date specific ticket, specify the inventory for that date
+ $dateWhere = '';
+ if ($s['date_specific']['value']) {
+ $dateWhere = " AND ticket_date = '".$s['ticket_date']['date']."'";
+ }
+
+ // If this is a time specific ticket, specify the inventory for that time
+ $timeWhere = '';
+ if ($s['time_specific']['value']) {
+ $timeWhere = " AND ticket_time = '".$s['ticket_time']['time']."'";
+ }
+
+ // Build the query for this ticket sold to adjust the inventory levels
+ $sql .= "UPDATE eventmgt.ticket_inventory SET available = available + 1, sold = sold - 1 WHERE ticket = ".$s['ticket']."$dateWhere$timeWhere;\n";
+
+ }
+
+ }
+
+ // Build the query to delete the ticket_sold records
+ $sql .= "DELETE FROM eventmgt.ticket_sold WHERE ticket_order = $orderID;\n";
+
+ // Build the query to delete the ticket_claim_tracking records
+ $sql .= "DELETE FROM eventmgt.ticket_claim_tracking WHERE ticket_order = $orderID;\n";
+
+ // Lastly, build the query to delete the ticket_order record
+ $sql .= "DELETE FROM eventmgt.ticket_order WHERE id = $orderID;\n";
+
+ $sql .= "COMMIT\n";
+
+// echo "
$sql
";
+
+ $res = $this->dbh->exec($sql);
+
+ return $res;
+ }
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataPerformances.php b/classes/data/dataPerformances.php
new file mode 100644
index 0000000..66989e0
--- /dev/null
+++ b/classes/data/dataPerformances.php
@@ -0,0 +1,956 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPerformances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPerformances class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPerformances.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataPerformances extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.performance';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Member ID for adding performances
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'nid'
+ ),
+
+ // Member ID for adding performances
+ 'member_id' => array(
+ 'field' => 'member',
+ 'as' => member_id,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gle'
+ ),
+
+ // Performance Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Admin Only Flag
+ 'admin_only' => array(
+ 'field' => 'admin_only',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Short Description
+ 'short_descr' => array(
+ 'field' => 'short_descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Purchase lead-time in hours
+ 'purch_leadtime' => array(
+ 'field' => 'purch_leadtime',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 24,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Policy
+ 'policy' => array(
+ 'field' => 'policy',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher Text
+ 'voucher_text' => array(
+ 'field' => 'voucher_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Confirmation E-Mail Text
+ 'conf_text' => array(
+ 'field' => 'conf_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promote in Cart
+ 'promote_in_cart' => array(
+ 'field' => 'promote_in_cart',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Sort order
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ /* Also get some member information in case we need it */
+
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Address line 1
+ 'member_addr1' => array(
+ 'field' => 'member',
+ 'as' => 'member_addr1',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'addr1',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Address line 2
+ 'member_addr2' => array(
+ 'field' => 'member',
+ 'as' => 'member_addr2',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'addr2',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member City
+ 'member_city' => array(
+ 'field' => 'member',
+ 'as' => 'member_city',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'city',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member State
+ 'member_state' => array(
+ 'field' => 'member',
+ 'as' => 'member_state',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'state',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member ZIP
+ 'member_zip' => array(
+ 'field' => 'member',
+ 'as' => 'member_zip',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'zip',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Country
+ 'member_country' => array(
+ 'field' => 'member',
+ 'as' => 'member_country',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'country',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member LAT
+ 'member_lat' => array(
+ 'field' => 'member',
+ 'as' => 'member_lat',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'lat',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member LON
+ 'member_lon' => array(
+ 'field' => 'member',
+ 'as' => 'member_lon',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'lon',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member phone
+ 'member_phone' => array(
+ 'field' => 'member',
+ 'as' => 'member_phone',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'phone',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member payment gateways
+ 'member_payment_gateway' => array(
+ 'field' => 'member',
+ 'as' => 'member_payment_gateway',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'payment_gateway',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member credit cards accepted
+ 'member_cards_accepted' => array(
+ 'field' => 'member',
+ 'as' => 'member_cards_accepted',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'cards_accepted',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member credit cards accepted
+ 'member_cards_accepted' => array(
+ 'field' => 'member',
+ 'as' => 'member_cards_accepted',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'cards_accepted',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member payment gateway parameter 1
+ 'member_gateway_par1' => array(
+ 'field' => 'member',
+ 'as' => 'member_gateway_par1',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'gateway_par1',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member payment gateway parameter 2
+ 'member_gateway_par2' => array(
+ 'field' => 'member',
+ 'as' => 'member_gateway_par2',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'gateway_par2',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+
+
+ );
+ }
+
+ /**
+ * Get Performances list
+ *
+ * @param $listType String A particular list type ('all', 'member', 'cart_promotions', ...)
+ * @return object containing array as sub-objects
+ */
+ function getPerformancesList($listType = false, $memberID = false, $includeAdminOnly = false)
+ {
+
+ $where = '';
+ $and = '';
+
+ // Determine if there's a list type request (otherwise default to call parameter $listType)
+ if (!$listType && isset($_REQUEST['listType'])) {
+ $listType = $_REQUEST['listType'];
+ $and = ' AND ';
+ }
+
+ // Check if adminUser
+ if (!$includeAdminOnly) {
+ $where .= $and.' NOT T.admin_only';
+ $and = ' AND ';
+ }
+
+ switch ($listType) {
+
+ case 'member':
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+ $where .= $and."member = $memberID";
+ break;
+
+ case 'member_and_active':
+ if ($memberID == false) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+ $where .= $and."member = $memberID AND T.active";
+ break;
+
+ case 'cart_promotions':
+ $where .= $and."T.promote_in_cart AND T.active AND (SELECT active FROM eventmgt.member WHERE active = true AND member.id = T.member)";
+ break;
+
+ case 'all':
+ default:
+ break;
+
+ }
+
+ $performancesList = $this->getList($where, 'sort, name');
+
+ return $performancesList;
+ }
+
+ /**
+ * Get Performance Detail
+ *
+ * @return array
+ */
+ function getPerformanceDetail($performanceID = false)
+ {
+
+ $where = '';
+
+ // If a performance has been specified
+ if ($performanceID != false) {
+
+ // Don't do anything here
+
+ // Is there a new Performance code selected?
+ } elseif (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the performance ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a performance specified
+ return false;
+
+ }
+
+
+ $performanceDetail = $this->getEntry($performanceID, 'id', $where);
+
+ return $performanceDetail;
+
+ }
+
+
+ /**
+ * Edit Performance
+ *
+ * @return array
+ */
+ function editPerformance()
+ {
+
+ if (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $performanceDetail = $this->editEntry($performanceID);
+
+ return $performanceDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Performance
+ *
+ * @return array
+ */
+ function updatePerformance()
+ {
+
+ if (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($performanceID);
+
+ // If the update was successful and we ahve start and end dates, Set inventory outside of the dates set for this performance to inactive
+ $start = $r['fieldData']['start_date']['date'];
+ $end = $r['fieldData']['end_date']['date'];
+ if ($r['status'] && $r['fieldData']['start_date']['date'] != '' && $r['fieldData']['end_date']['date'] != '') {
+ $sql = "
+ UPDATE eventmgt.ticket_inventory
+ SET active = false
+ WHERE id in (
+ SELECT I.id
+ FROM eventmgt.ticket T, eventmgt.ticket_inventory I
+ WHERE T.performance = $performanceID
+ AND T.id = I.ticket
+ AND ( I.ticket_date < '$start' OR I.ticket_date > '$end')
+ )
+ ;";
+ $this->dbh->exec($sql);
+
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Performance
+ *
+ * @return array
+ */
+ function newPerformance()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Performance
+ *
+ * @return array
+ */
+ function insertPerformance()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current performance to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete Performance
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function performanceDelete($confirm = false)
+ {
+
+ // Is there a new performance code selected?
+ if (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $performanceID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the performance ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have an performance id
+ return false;
+
+ }
+
+ $performanceDetail = $this->deleteEntry($performanceID, $confirm);
+
+ return $performanceDetail;
+
+ }
+
+ /**
+ * Get Performance Inventory Summary
+ *
+ * @return array
+ */
+ function getPerformanceInventorySummary($performanceID = false, $year = false)
+ {
+
+ // If a performance has been specified
+ if ($performanceID != false) {
+
+ // Don't do anything here
+
+ // Is there a new Performance code selected?
+ } elseif (($performanceID = filter_input(INPUT_GET, 'PerformanceID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Don't do anything here
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Performance'])) {
+
+ // Otherwise, get the performance ID from the session
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $yearWhere = '';
+ if ($year) {
+ $yearWhere = "AND I.ticket_date BETWEEN '01/01/$year' AND '12/31/$year'";
+ }
+ // Get detail on the performance
+ $performanceDetail = $this->getPerformanceDetail($performanceID);
+
+ // Get inventory summary data for the performance
+ $sql = "
+ SELECT I.active, I.ticket_date AS date, I.ticket_time AS time, I.id AS invenID, I.quant, I.available, I.sold,
+ S.id AS sectionID, S.name AS sectionName, COALESCE(sum(H.quant),0) AS quantHeld,
+ T.name AS ticketname, T.price, t.unlimited_quant
+ FROM eventmgt.ticket T, eventmgt.ticket_inventory I LEFT OUTER JOIN eventmgt.inven_hold H ON (H.inventory = I.id),
+ eventmgt.section S
+ WHERE T.performance = $performanceID
+ AND I.ticket = T.id
+ AND S.id = T.section
+ $yearWhere
+ GROUP BY I.active, I.ticket_date, I.ticket_time, I.id, I.quant, I.available, I.sold, S.id, S.name, T.name, T.price, T.unlimited_quant
+ ORDER BY date, time, sectionID, ticketname
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $invData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Build inventory summary array organized by date, time, section, ticket
+ $sum = array();
+ $date = false;
+ $time = false;
+ $section = false;
+ foreach ($invData as $i) {
+
+ $dow = date('D', strtotime($i['date']));
+
+ $t = explode(':', $i['time']);
+ $ampm = 'AM';
+ $hour = ($t[0] - 0);
+ if ($hour > 11) {
+ $ampm = 'PM';
+ } else {
+ }
+ if ($hour > 12) {
+ $hour -= 12;
+ }
+ $timeString = sprintf('%2d:%02d %s', $hour, $min, $ampm);
+
+ // Insert ticket with inventory
+ $s = array(
+ 'id' => $i['invenid'],
+ 'active' => $i['active'],
+ 'date' => $dow." ".$i['date'],
+ 'time' => $timeString,
+ 'section' => $i['sectionname'],
+ 'name' => $i['ticketname'],
+ 'unlimited_quant' => $i['unlimited_quant'],
+ 'quant' => $i['quant'],
+ 'avail' => $i['available'],
+ 'sold' => $i['sold'],
+ 'held' => $i['quantheld'],
+ 'netAvail' => $i['available'] - $i['held'],
+ 'price' => $this->money($i['price'])
+ );
+
+ // Clear redundant values
+ if ($i['date'] == $date) {
+ $s['date'] = '';
+ } else {
+ $date = $i['date'];
+ $time = false;
+ $section = false;
+ }
+
+ if ($i['time'] == $time) {
+ $s['time'] = '';
+ } else {
+ $time = $i['time'];
+ $section = false;
+ }
+
+ if ($i['sectionname'] == $section) {
+ $s['section'] = '';
+ } else {
+ $section = $i['sectionname'];
+ }
+
+
+ $sum[] = $s;
+ }
+
+ return $sum;
+
+ }
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataPromoSold.php b/classes/data/dataPromoSold.php
new file mode 100644
index 0000000..9ad7ab4
--- /dev/null
+++ b/classes/data/dataPromoSold.php
@@ -0,0 +1,268 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPromoSold class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+class EventManagementDataPromoSold extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.promo_sold';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Ticket Order
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Ticket Sold
+ 'ticket_sold' => array(
+ 'field' => 'ticket_sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Promo
+ 'promo' => array(
+ 'field' => 'promo',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'niegdl'
+ ),
+
+ // Promo Name
+ 'promo_name' => array(
+ 'field' => 'promo_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promo type
+ 'promo_type' => array(
+ 'field' => 'promo_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->promo_ticket_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promo type name
+ 'promo_type_name' => array(
+ 'field' => 'promo_type_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Amount
+ 'amount' => array(
+ 'field' => 'amount',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'a'
+ ),
+
+ // Amount (money)
+ 'amount_money' => array(
+ 'field' => 'amount',
+ 'as' => 'amount_money',
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0.00,
+ 'use' => 'lgd'
+ ),
+
+ // Session ID
+ 'session_id' => array(
+ 'field' => 'session_id',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+ }
+
+ /**
+ * Get Ticket Sold promos list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromosSoldList($ticketSoldID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied, use the $TicketSoldID - Otherwise $where
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a ticket sold ID, then filter by that
+ $ticketSoldID = ($ticketSoldID - 0); // Make sure it's number
+ if ($ticketSoldID > 0) {
+ $where .= " AND T.ticket_sold = $ticketSoldID";
+ }
+
+ }
+
+ $promosSoldList = $this->getList($where, 'id');
+
+ return $promosSoldList;
+ }
+
+ /**
+ * Get Promo Sold Detail
+ *
+ * @return array
+ */
+ function getPromoSoldDetail($promoSoldID = false)
+ {
+
+ if ($promoSoldID == false) {
+
+ // Otherwise, we don't have an promo sold id
+ return false;
+
+ }
+
+ // If the promo sold ID is valid, get the detail
+ $promoSoldID = filter_input(INPUT_GET, 'PromoSoldID', FILTER_SANITIZE_NUMBER_INT);
+ if ($promoSoldID) {
+ $promoSoldDetail = $this->getEntry($promoSoldID);
+
+ // Otherwise fail
+ } else {
+ return false;
+ }
+
+ return $promoSoldDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataPromoTickets.php b/classes/data/dataPromoTickets.php
new file mode 100644
index 0000000..183b38d
--- /dev/null
+++ b/classes/data/dataPromoTickets.php
@@ -0,0 +1,505 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoTickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPromoTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromoTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataPromoTickets extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.promo_ticket';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Promo Code
+ 'promo' => array(
+ 'field' => 'promo',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion Name
+ 'promo_name' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion Description
+ 'promo_descr' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_descr',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'descr',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion Start Date
+ 'promo_start_date' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_start_date',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'start_date',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promomotion end Date
+ 'promo_end_date' => array(
+ 'field' => 'promo',
+ 'as' => 'promo_end_date',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.promo_code',
+ 'p_field' => 'end_date',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket ID
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Name
+ 'ticket_name' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'title',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Promo type
+ 'promo_type' => array(
+ 'field' => 'promo_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->promo_ticket_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Amount
+ 'amount' => array(
+ 'field' => 'amount',
+ 'as' => false,
+ 'type' => 'float',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ return $r;
+ }
+
+ /**
+ * Get Promo Ticket list
+ *
+ * If $promoID is supplied also returns sales counts for this promo for each ticket.
+ * Front-end shop selection of
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromoTicketsList($promoID = false, $promoCode = false, $where = 'true')
+ {
+
+ // If promoID is supplied, get only tickets listed for that promo
+ if ($promoID) {
+ $where .= " AND T.promo = $promoID";
+ }
+
+ // If promoCode is supplied, get only tickets listed for that promo
+ if ($promoCode) {
+ $where .= " AND T.promo = (SELECT id FROM eventmgt.promo_code WHERE name = '$promoCode')";
+ }
+
+ // Get list of Promo Tickets
+ $promoTicketsList = $this->getList($where);
+
+ // If a Promo ID was supplied, also get the promo code use counts per ticket
+ If ($promoID && is_array($promoTicketsList)) {
+
+ // If promoID is supplied, get only tickets listed for that promo
+ if ($promoID) {
+ $where = " AND P.promo = $promoID";
+ }
+
+ // Also get total Promo counts for each ticket
+ reset($promoTicketsList);
+ while (list($key, $val) = each($promoTicketsList)) {
+
+ // Get number sold and value sold for this ticket type and promo code
+ $sql = "
+ SELECT count(P.id) as numb_sold, sum(P.amount) as value_sold
+ FROM eventmgt.promo_sold P, eventmgt.ticket_sold T
+ WHERE T.id = P.ticket_sold
+ AND T.ticket = ".$val['ticket']."
+ $where;
+ ";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $sales = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // Add it to the results
+ $promoTicketsList[$key]['numberSold'] = $sales['numb_sold'];
+ $promoTicketsList[$key]['valueSold'] = $sales['value_sold'];
+ $promoTicketsList[$key]['dollarsSold'] = $this->money($sales['value_sold']);
+
+ }
+
+ }
+
+ return $promoTicketsList;
+ }
+
+ /**
+ * Get Promo Ticket Detail
+ *
+ * @return array
+ */
+ function getPromoTicketDetail($promoTicketID = false)
+ {
+
+ // If a promo ticket has been specified
+ if ($promoTicketID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ // Otherwise if there's a promo ticket ID in the request
+ } elseif (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a Promo Ticket submitted, so save that
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoTicketID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have a promo ticket id
+ return false;
+
+ }
+
+ $promoTicketDetail = $this->getEntry($promoTicketID);
+
+ return $promoTicketDetail;
+
+ }
+
+ /**
+ * Edit Promo Ticket
+ *
+ * @return array
+ */
+ function editPromoTicket()
+ {
+
+ if (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo ticket ID from the session
+ $promoTicketID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have a promo ticket id
+ return false;
+
+ }
+
+ $promoTicketDetail = $this->editEntry($promoTicketID);
+
+ return $promoTicketDetail;
+
+ }
+
+ /**
+ * Update Promo Ticket
+ *
+ * @return array
+ */
+ function updatePromoTicket()
+ {
+
+ if (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo ticket ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have a promo ticket id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($promoTicketID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Promo Ticket
+ *
+ * @return array
+ */
+ function newPromoTicket()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Promo Ticket
+ *
+ * @return array
+ */
+ function insertPromoTicket()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current promo ticket to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Promo Ticket
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function promoTicketDelete($confirm = false)
+ {
+
+ // Is there a new promo ticket code selected?
+ if (($promoTicketID = filter_input(INPUT_GET, 'PromoTicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['PromoTicket'] = $promoTicketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['PromoTicket'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoTicketID = $_SESSION[GLM_EVENT_SESSION]['PromoTicket'];
+
+ } else {
+
+ // Otherwise, we don't have an promo ticket id
+ return false;
+
+ }
+
+ $promoTicketDetail = $this->deleteEntry($promoTicketID, $confirm);
+
+ return $promoTicketDetail;
+
+ }
+
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataPromos.php b/classes/data/dataPromos.php
new file mode 100644
index 0000000..6773d78
--- /dev/null
+++ b/classes/data/dataPromos.php
@@ -0,0 +1,376 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromos.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataPromos class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataPromos,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataPromos extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.promo_code';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Promo Code Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Promo Code Long Name
+ 'long_name' => array(
+ 'field' => 'long_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ // Check that Sticky is not used with date-specific inventory
+ if ($r['fieldData']['date_specific']['value'] && $r['fieldData']['cart_sticky']['value']) {
+ $r['status'] = false;
+ $r['fieldFail']['cart_sticky'] = 'Sticky may not be used when "Specified Dates" is checked.';
+ $r['fieldFail']['date_specific'] = 'Specified dates may not be used when "Sticky" is checked.';
+ }
+
+ return $r;
+ }
+
+ /**
+ * Get Promo Code list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getPromosList()
+ {
+
+ // Build query Where clause
+ $where = 'true';
+
+ // Get list of Promo Codes
+ $promosList = $this->getList($where, 'start_date, name');
+
+ return $promosList;
+ }
+
+ /**
+ * Get Promo Code Detail
+ *
+ * @return array
+ */
+ function getPromoDetail($promoID = false)
+ {
+
+ // If a promo code has been specified
+ if ($promoID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ // Otherwise if there's a promo code ID in the request
+ } elseif (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a Promo Code submitted, so save that
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have a promo code id
+ return false;
+
+ }
+
+ $promoDetail = $this->getEntry($promoID);
+
+ return $promoDetail;
+
+ }
+
+ /**
+ * Edit Promo Code
+ *
+ * @return array
+ */
+ function editPromo()
+ {
+
+ if (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $promoDetail = $this->editEntry($promoID);
+
+ return $promoDetail;
+
+ }
+
+ /**
+ * Update Promo Code
+ *
+ * @return array
+ */
+ function updatePromo()
+ {
+
+ if (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have a promo code id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($promoID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Promo Code
+ *
+ * @return array
+ */
+ function newPromo()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Promo Code
+ *
+ * @return array
+ */
+ function insertPromo()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current promo code to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Promo Code
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function promoDelete($confirm = false)
+ {
+
+echo "dataPromos.php - promoDelete() - need to also delete from promo_ticket table";
+
+ // Is there a new promo code code selected?
+ if (($promoID = filter_input(INPUT_GET, 'PromoID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Promo'] = $promoID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Promo'])) {
+
+ // Otherwise, get the promo code ID from the session
+ $promoID = $_SESSION[GLM_EVENT_SESSION]['Promo'];
+
+ } else {
+
+ // Otherwise, we don't have an promo code id
+ return false;
+
+ }
+
+ $promoDetail = $this->deleteEntry($promoID, $confirm);
+
+ return $promoDetail;
+
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataReservations.php b/classes/data/dataReservations.php
new file mode 100644
index 0000000..482382b
--- /dev/null
+++ b/classes/data/dataReservations.php
@@ -0,0 +1,830 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataReservations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataReservations class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataReservations.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataReservations extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.reservation';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // User Trace Info
+ 'user_trace_info' => array(
+ 'field' => 'user_trace_info',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // First Name
+ 'fname' => array(
+ 'field' => 'fname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Last Name
+ 'lname' => array(
+ 'field' => 'lname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Team name (stored as "org") - need to clean up field name
+ 'org' => array(
+ 'field' => 'org',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Event
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Event name
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'event_code',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Team
+ 'team' => array(
+ 'field' => 'team',
+ 'as' => 'team_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.team',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State Rep
+ 'state_rep' => array(
+ 'field' => 'state_rep',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State Rep Code
+ 'state_rep_code' => array(
+ 'field' => 'state_rep',
+ 'as' => 'state_rep_code',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.state_rep',
+ 'p_field' => 'code',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member (property)
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Member (property) ID
+ 'member_id' => array(
+ 'field' => 'member',
+ 'as' => 'member_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Address Line 1
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Address Line 2
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // City
+ 'city' => array(
+ 'field' => 'city',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // State
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Country
+ 'country' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lnieudc'
+ ),
+
+ // Country Full - Get Detail only
+ 'countryFull' => array(
+ 'field' => 'country',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->countries->toArray(),
+ 'list_keytype' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'g'
+ ),
+
+ // ZIP
+ 'zip' => array(
+ 'field' => 'zip',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Phone
+ 'phone' => array(
+ 'field' => 'phone',
+ 'as' => false,
+ 'type' => 'phone',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+
+ // Contact E-Mail
+ 'email' => array(
+ 'field' => 'email',
+ 'as' => false,
+ 'type' => 'email',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // OK to sent email
+ 'email_ok' => array(
+ 'field' => 'email_ok',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Date reservation was entered.
+ 'date_entered' => array(
+ 'field' => 'date_entered',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Arrive Date
+ 'arrive_date' => array(
+ 'field' => 'arrive_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Nights
+ 'nights' => array(
+ 'field' => 'nights',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Number of Rooms
+ 'rooms' => array(
+ 'field' => 'rooms',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Occupants (adults)
+ 'adults' => array(
+ 'field' => 'adults',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Payment method
+ 'payby' => array(
+ 'field' => 'payby',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->pay_types->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card Type
+ 'cctype' => array(
+ 'field' => 'cctype',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card Number
+ 'ccnumber' => array(
+ 'field' => 'ccnumber',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card Expiration
+ 'expire' => array(
+ 'field' => 'expire',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Name on Credit Card
+ 'ccname' => array(
+ 'field' => 'ccname',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Credit Card CCV
+ 'cccode' => array(
+ 'field' => 'cccode',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Total Room Rate for stay (formatted)
+ 'hotel_price' => array(
+ 'field' => 'hotel_price',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Total Room Rate for stay (number)
+ 'hotel_price_numb' => array(
+ 'field' => 'hotel_price',
+ 'as' => 'hotel_price_numb',
+ 'type' => 'float',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'l'
+ ),
+
+ // Total Taxes (formatted)
+ 'taxes' => array(
+ 'field' => 'taxes',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Total Taxes (number)
+ 'taxes_numb' => array(
+ 'field' => 'taxes',
+ 'as' => 'taxes_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'l'
+ ),
+
+ // Grand Total (formatted)
+ 'grand_total' => array(
+ 'field' => 'grand_total',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Grand Total (number)
+ 'grand_total_numb' => array(
+ 'field' => 'grand_total',
+ 'as' => 'grand_total_numb',
+ 'type' => 'float',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'l'
+ ),
+
+ // Confirmed
+ 'confirmed' => array(
+ 'field' => 'confirmed',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Declined
+ 'declined' => array(
+ 'field' => 'declined',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // date_confirmed
+ 'date_confirmed' => array(
+ 'field' => 'date_confirmed',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Confirmed By
+ 'conf_by' => array(
+ 'field' => 'conf_by',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Confirmation Message
+ 'conf_message' => array(
+ 'field' => 'conf_message',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Reservation Detail (serialized array)
+ 'res_detail' => array(
+ 'field' => 'res_detail',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'no_stripslashes' => true,
+ 'use' => 'a'
+ ),
+
+ // HTML Summary of Reservation
+ 'summary' => array(
+ 'field' => 'summary',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get Reservations list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getReservationsList()
+ {
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get member ID from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ // Get accommodation ID from session - if available
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ // Get team ID from session - if available
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ // Get any specified reservation listing option - default to event
+ $option = 'event';
+ if (($resListOption = filter_input(INPUT_GET, 'ReservationsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $resListOption;
+ }
+ $status = 'all';
+ if (($resListStatus = filter_input(INPUT_GET, 'ReservationsListStatus', FILTER_SANITIZE_STRING))) {
+ $status = $resListStatus;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.event = $eventID";
+ break;
+ case 'member':
+ if (!$memberID) {
+ return false;
+ }
+ $where = "T.member = $memberID";
+ break;
+ case 'accom':
+ if (!$accomID) {
+ return false;
+ }
+ $where = "T.accommodation = $accomID";
+ break;
+ case 'team':
+ if (!$teamID) {
+ return false;
+ }
+ $where = "T.team_id = $memberID";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Select by status
+ switch ($status) {
+ case 'pending':
+ $where .= ($where!=''?' AND ':'')." NOT T.confirmed AND NOT T.declined";
+ break;
+ case 'confirmed':
+ $where .= ($where!=''?' AND ':'')." T.confirmed AND NOT T.declined";
+ break;
+ case 'declined':
+ $where .= ($where!=''?' AND ':'')." T.declined";
+ break;
+ case 'all':
+ default:
+ break;
+ }
+
+ // Get list of Reservations
+ $resList = $this->getList($where);
+ return $resList;
+ }
+
+ /**
+ * Get Reservation Detail
+ *
+ * @return array
+ */
+ function getReservationDetail()
+ {
+
+ // Is there a new reservation code selected?
+ if (($resID = filter_input(INPUT_GET, 'ReservationID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = $resID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Reservation'])) {
+
+ // Otherwise, get the team ID from the session
+ $resID = $_SESSION[GLM_EVENT_SESSION]['Reservation'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $resDetail = $this->getEntry($resID);
+
+ // NEED TO PUT THIS CAPABILITY INTO ABSTRACT AS AN OPTION
+ $resDetail['summary'] = html_entity_decode($resDetail['summary']);
+
+ // echo "
".print_r($resDetail,1)."
";
+ return $resDetail;
+
+ }
+
+
+ /**
+ * Edit Reservation
+ *
+ * @return array
+ */
+ function editReservation()
+ {
+
+ if (($resID = filter_input(INPUT_GET, 'ReservationID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = $resID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Reservation'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Reservation'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $resDetail = $this->editEntry($resID);
+
+ return $resDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ // Nothing here for now
+
+ return $r;
+ }
+
+ /**
+ * Update Reservation
+ *
+ * @return array
+ */
+ function updateReservation()
+ {
+
+ if (($resID = filter_input(INPUT_GET, 'ReservationID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = $resID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Reservation'])) {
+
+ // Otherwise, get the reservation ID from the session
+ $resID = $_SESSION[GLM_EVENT_SESSION]['Reservation'];
+
+ } else {
+
+ // Otherwise, we don't have a reservation id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($resID);
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Reservation
+ *
+ * @return array
+ */
+ function insertReservation()
+ {
+
+ echo "INSERT NOT SUPPORTED FOR RESERVATIONS IN EVENT MANAGEMENT ADMIN AREA!";
+ exit;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataRooms.php b/classes/data/dataRooms.php
new file mode 100644
index 0000000..650e8ac
--- /dev/null
+++ b/classes/data/dataRooms.php
@@ -0,0 +1,457 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataRooms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataRooms class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataRooms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataRooms extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.room_detail';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Member
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Accommodation
+ 'accommodation' => array(
+ 'field' => 'accommodation',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'i'
+ ),
+
+ // Occupants
+ 'occupants' => array(
+ 'field' => 'occupants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Room Type - Needs to be moved to a separate admin table
+ 'room_type' => array(
+ 'field' => 'room_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->room_types->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Bath Type - Needs to be moved to a separate admin table
+ 'bath_type' => array(
+ 'field' => 'bath_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->bath_types->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Pull-out Beds
+ 'pullout_beds' => array(
+ 'field' => 'pullout_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Single Beds
+ 'single_beds' => array(
+ 'field' => 'single_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Double Beds
+ 'double_beds' => array(
+ 'field' => 'double_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Queen Beds
+ 'queen_beds' => array(
+ 'field' => 'queen_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // King Beds
+ 'king_beds' => array(
+ 'field' => 'king_beds',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // TV
+ 'tv' => array(
+ 'field' => 'tv',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Fridge
+ 'fridge' => array(
+ 'field' => 'fridge',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Safe
+ 'safe' => array(
+ 'field' => 'safe',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get Rooms list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getRoomsList()
+ {
+
+ // Get accommodation ID from session - if available
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ if (!$accomID) {
+ return false;
+ }
+
+ // Select type of list
+ $where = "T.accommodation = $accomID";
+
+ // Get list of States
+ $roomsList = $this->getList($where, 'sort');
+
+ // Build Beds summary
+ if ($roomsList && count($roomsList) > 0) {
+ reset($roomsList);
+ while( list($key, $val) = each( $roomsList ) ) {
+ $beds_summary = '';
+ $sep = '';
+ if ($val['pullout_beds'] > 0) {
+ $beds_summary .= $val['pullout_beds']." Pullout";
+ $sep = ', ';
+ }
+ if ($val['single_beds'] > 0) {
+ $beds_summary .= $sep.$val['single_beds']." Single";
+ $sep = ', ';
+ }
+ if ($val['double_beds'] > 0) {
+ $beds_summary .= $sep.$val['double_beds']." Double";
+ $sep = ', ';
+ }
+ if ($val['queen_beds'] > 0) {
+ $beds_summary .= $val['queen_beds']." Queen";
+ $sep = ', ';
+ }
+ if ($val['king_beds'] > 0) {
+ $beds_summary .= $val['king_beds']." King";
+ $sep = ', ';
+ }
+ $roomsList[$key]['beds_summary'] = $beds_summary;
+ }
+ }
+
+ return $roomsList;
+ }
+
+ /**
+ * Get Room Detail
+ *
+ * @return array
+ */
+ function getRoomDetail()
+ {
+
+ // Is there a new State Rep code selected?
+ if (!($roomID = filter_input(INPUT_GET, 'RoomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ return false;
+
+ }
+
+ $roomDetail = $this->getEntry($roomID);
+
+ return $roomDetail;
+
+ }
+
+
+ /**
+ * Edit Room
+ *
+ * @return array
+ */
+ function editRoom()
+ {
+ if (!($roomID = filter_input(INPUT_GET, 'RoomID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $roomDetail = $this->editEntry($roomID);
+
+ $roomDetail['RoomID'] = $roomID;
+
+ // echo "
".print_r($roomDetail,1)."
";
+ return $roomDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Room
+ *
+ * @return array
+ */
+ function updateRoom()
+ {
+
+ if (!($roomID = filter_input(INPUT_POST, 'RoomID', FILTER_SANITIZE_NUMBER_INT))) {
+ return false;
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($roomID);
+
+ $r['fieldData']['RoomID'] = $roomID;
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Room
+ *
+ * @return array
+ */
+ function newRoom()
+ {
+ // Get member and accommodation ID from session - if available
+ $membID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ $accomID = $_SESSION[GLM_EVENT_SESSION]['Accom'];
+
+ if (!$accomID) {
+ return false;
+ }
+
+ $r = $this->newEntry();
+
+ $r['fieldData']['member'] = $membID;
+ $r['fieldData']['accommodation'] = $accomID;
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Room
+ *
+ * @return array
+ */
+ function insertRoom()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current state rep to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataSections.php b/classes/data/dataSections.php
new file mode 100644
index 0000000..ae768c4
--- /dev/null
+++ b/classes/data/dataSections.php
@@ -0,0 +1,450 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSections.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataSections class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSections.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataSections extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.section';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Member ID for adding sections
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'nid'
+ ),
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Section Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Entrance
+ 'entrance' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.entrance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_where' => 'member = '.$_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nideu'
+ ),
+
+ // Entrance_view
+ 'entrance_view' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.entrance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Entrance_id
+ 'entrance_id' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Sort order
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Get Sections list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSectionsList($memberID = false, $where = false)
+ {
+
+ // If a where clause has not been supplied
+ if (!$where) {
+
+ $where = 'true';
+
+ // Check if there's a member ID and filter by that member if there is
+ $memberID = ($memberID - 0); // Make sure it's number
+ if ($memberID > 0) {
+ $where .= " AND T.member = $memberID";
+ } elseif ($_SESSION[GLM_EVENT_MGT_ADMIN]['Member'] > 0) {
+ $where .= " AND T.member = ".$_SESSION[GLM_EVENT_MGT_ADMIN]['Member'];
+ }
+
+ }
+
+ // Get list of Sections
+ $sectionsList = $this->getList($where, 'sort, name');
+
+ return $sectionsList;
+ }
+
+ /**
+ * Get Section Detail
+ *
+ * @return array
+ */
+ function getSectionDetail($sectionID = false)
+ {
+
+ // If a section ID has been supplied
+ if ($sectionID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // Otherwise if there a new section ID supplied via the request
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the event ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have an event id
+ return false;
+
+ }
+
+ $sectionDetail = $this->getEntry($sectionID);
+
+ return $sectionDetail;
+
+ }
+
+
+ /**
+ * Edit Section
+ *
+ * @return array
+ */
+ function editSection()
+ {
+
+ if (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the section ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have a section id
+ return false;
+
+ }
+
+ $sectionDetail = $this->editEntry($sectionID);
+
+ return $sectionDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Section
+ *
+ * @return array
+ */
+ function updateSection()
+ {
+
+ if (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the section ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have a section id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($sectionID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Section
+ *
+ * @return array
+ */
+ function newSection()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Section
+ *
+ * @return array
+ */
+ function insertSection()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current section to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+
+ /**
+ * Delete Section
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function sectionDelete($confirm = false)
+ {
+
+ // Is there a new section code selected?
+ if (($sectionID = filter_input(INPUT_GET, 'SectionID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = $sectionID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Section'])) {
+
+ // Otherwise, get the section ID from the session
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+
+ } else {
+
+ // Otherwise, we don't have an section id
+ return false;
+
+ }
+
+ $sectionDetail = $this->deleteEntry($sectionID, $confirm);
+
+ return $sectionDetail;
+
+ }
+
+ /**
+ * Get Sections Stats
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSectionsStats($where = 'true')
+ {
+
+ $sectionsStats = $this->getStats($where);
+
+ return $sectionsStats;
+ }
+
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataSold.php b/classes/data/dataSold.php
new file mode 100644
index 0000000..ebad123
--- /dev/null
+++ b/classes/data/dataSold.php
@@ -0,0 +1,804 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSold.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataSold class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataSold,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataSold extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_sold';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Ticket Sold (Voucher) ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Order ID
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Member ID
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Member Name
+ 'member_name' => array(
+ 'field' => 'member_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Left End Text
+ 'real_member_name' => array(
+ 'field' => 'member',
+ 'as' => 'real_member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Assigned (consignment to another venue)
+ 'assigned' => array(
+ 'field' => 'assigned',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Assigned From ID
+ 'assigned_from' => array(
+ 'field' => 'assigned_from',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Assigned from name
+ 'assigned_from_name' => array(
+ 'field' => 'assigned_from_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Performance ID
+ 'performance' => array(
+ 'field' => 'performance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Performance Name
+ 'performance_name' => array(
+ 'field' => 'performance_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Entrance ID
+ 'entrance' => array(
+ 'field' => 'entrance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Entrance Name
+ 'entrance_name' => array(
+ 'field' => 'entrance_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Entrance Color
+ 'entrance_color' => array(
+ 'field' => 'entrance_color',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Section ID
+ 'section' => array(
+ 'field' => 'section',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Section Name
+ 'section_name' => array(
+ 'field' => 'section_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket ID
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Name
+ 'ticket_name' => array(
+ 'field' => 'ticket_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Is Package
+ 'is_package' => array(
+ 'field' => 'is_package',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Ticket Package - points to ticket that is a package that includes this ticket - 0 if not part of a package
+ 'ticket_package' => array(
+ 'field' => 'ticket_package',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Package Sold ID
+ 'package_sold_id' => array(
+ 'field' => 'package_sold_id',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Package Name
+ 'package_name' => array(
+ 'field' => 'package_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Text
+ 'ticket_voucher_text' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_voucher_text',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'voucher_text',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Type
+ 'ticket_voucher_type' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_voucher_type',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'voucher_type',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Voucher Left End Text
+ 'ticket_voucher_leftend_text' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_voucher_leftend_text',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'voucher_leftend_text',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Date Specific flag
+ 'date_specific' => array(
+ 'field' => 'date_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Ticket Date
+ 'ticket_date' => array(
+ 'field' => 'ticket_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Time Specific flag
+ 'time_specific' => array(
+ 'field' => 'time_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Ticket Time
+ 'ticket_time' => array(
+ 'field' => 'ticket_time',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Start Date for non-date-specific tickets
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // End Date for non-date-specific tickets
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Date customer will likely use this ticket
+ 'likely_date' => array(
+ 'field' => 'likely_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Price Paid
+ 'price_paid' => array(
+ 'field' => 'price_paid',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Policies at time of order
+ 'policies' => array(
+ 'field' => 'policies',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Unlimited Use flag
+ 'unlimited_use' => array(
+ 'field' => 'unlimited_use',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Number of uses
+ 'numb_uses' => array(
+ 'field' => 'numb_uses',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Number of times claimed
+ 'numb_claimed' => array(
+ 'field' => 'numb_claimed',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgd'
+ ),
+
+ // Time Claimed
+ 'time_claimed' => array(
+ 'field' => 'time_claimed',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y h:i:s A',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lged'
+ )
+
+ );
+ }
+
+
+ /**
+ * Get Orders list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSoldList($orderID = false, $memberID = false)
+ {
+
+ // If a order has been specified
+ if ($orderID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ // Otherwise if there's a order ID in the request
+ } elseif (($orderID = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = $orderID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Order'])) {
+
+ $orderID = $_SESSION[GLM_EVENT_SESSION]['Order'];
+
+ } else {
+
+ // Otherwise, we don't have an order id
+ return false;
+
+ }
+
+ $where = '';
+ if ($memberID) {
+ $where = "AND T.member = $memberID";
+ }
+
+ // Get list of Tickets Sold
+ $soldList = $this->getList("T.ticket_order = $orderID $where", 'T.ticket_order, T.package_sold_id, T.id');
+
+ // Load addonsSold class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/addonsSold.php';
+ $addonsSold = new EventManagementAdminAddonsSold($this->dbh, $this->config);
+
+ // For each ticket, check for any add-ons that have been sold with it
+ if ($soldList != false) {
+ reset($soldList);
+ while (list($key, $val) = each($soldList)) {
+ // Get any add-ons included with this ticket
+ $addonsSoldList = $addonsSold->getAddonsSoldList($val['id']);
+ if ($addonsSoldList) {
+ $soldList[$key]['addons_sold'] = $addonsSoldList;
+ }
+ }
+ }
+
+ return $soldList;
+ }
+
+ /**
+ * Get Ticket Sold Detail
+ *
+ * @return array
+ */
+ function getSoldDetail($soldID = false, $memberID = false)
+ {
+ // Test Check character
+ $testCheck = false;
+
+ // If a order has been specified
+ if ($soldID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Sold'] = $soldID;
+
+ // Otherwise if there's a sold ID in the request
+ } elseif (($soldID = filter_input(INPUT_GET, 'SoldID', FILTER_SANITIZE_STRING))) {
+
+ // Do a check character test if input from form.
+ $testCheck = true;
+
+ $_SESSION[GLM_EVENT_SESSION]['Sold'] = $soldID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Sold'])) {
+
+ $soldID = $_SESSION[GLM_EVENT_SESSION]['Sold'];
+
+ } else {
+
+ // Otherwise, we don't have an ticket sold id
+ return false;
+
+ }
+
+ $checkBypass = filter_input(INPUT_GET, 'checkBypass', FILTER_SANITIZE_STRING);
+ if ( $checkBypass == 'true') {
+ $testCheck = false;
+ }
+
+
+ $where = '';
+ if ($memberID) {
+ $where = "AND T.member = $memberID";
+ }
+
+ // If input came from form, then test the check char
+ $voucherNumb = $soldID;
+ if ($testCheck) {
+ // Separate check character from voucher number
+ $voucherNumb = substr($soldID, 0, -2);
+ $checkChar = substr($soldID, -2);
+
+ // Check if check character
+ $c = $this->getCheckCode($voucherNumb);
+ if ($c != strtoupper($checkChar)) {
+
+ return false;
+ }
+ }
+
+ // If number has
+ $soldDetail = $this->getEntry($voucherNumb, 'id', $where);
+
+ // If we have a member ID then make sure the sold ticket is for that member
+ if ($memberID && $soldDetail['member'] != $memberID) {
+ return false;
+ }
+
+ return $soldDetail;
+
+ }
+
+
+ /**
+ * Edit Sold
+ *
+ * @return array
+ */
+ function editSold()
+ {
+echo "editSold() not competed";
+/*
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->editEntry($ticketID);
+
+ return $ticketDetail;
+*/
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Ticket Sold
+ *
+ * @return array
+ */
+ function updateSold()
+ {
+
+echo "updateSold() not competed";
+/*
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($ticketID);
+
+ return $r;
+*/
+ }
+
+ /**
+ * Delete Ticket Sold
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function soldDelete($confirm = false)
+ {
+echo "soldDelete() not competed";
+/*
+
+ // Is there a new ticket code selected?
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have an ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->deleteEntry($ticketID, $confirm);
+
+ return $ticketDetail;
+*/
+ }
+
+
+ /*
+ * Function to add check character to end of voucher number
+ *
+ * Uses config->voucher_check_secret and voucher # to create MD5 string
+ * then takes last hex character off of that string and shifts it up to
+ * always be a character (adds 16 to numbers and 10 to the upper-case
+ * version of the character).
+ * i.e. 0 = A, 9 = J, A = K, F =
+ *
+ */
+ public function getCheckCode($voucherNumb)
+ {
+
+ // Create MD5 string using voucher number and secret
+ $md5 = md5($voucherNumb.$this->config->voucher_check_secret);
+
+ // Get last character code of the last character in the MD5
+ $cc = strtoupper(substr($md5, -2));
+ $cc[0] = $this->shiftCheckCodeCharacter($cc[0]);
+ $cc[1] = $this->shiftCheckCodeCharacter($cc[1]);
+
+ // Return check code
+ return $cc;
+
+ }
+
+ private function shiftCheckCodeCharacter($c) {
+
+ $x = ord($c);
+
+ // If it's a digit, add 16
+ if ($x < 65) {
+ $x += 17;
+ // otherwise, add 10
+ } else {
+ $x += 10;
+ }
+
+ // Also skip the letter O
+ if (x >= ord('O')) {
+ $x += 1;
+ }
+
+ return chr($x);
+ }
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataStates.php b/classes/data/dataStates.php
new file mode 100644
index 0000000..7fe8857
--- /dev/null
+++ b/classes/data/dataStates.php
@@ -0,0 +1,363 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataStates.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataStates class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataStates.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataStates extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.state_rep';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Event selection
+ 'conv' => array(
+ 'field' => 'conv',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Event Name display
+ 'conv_view' => array(
+ 'field' => 'conv',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // State Rep Code
+ 'code' => array(
+ 'field' => 'code',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Password
+ 'password' => array(
+ 'field' => 'password',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get States list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getStatesList()
+ {
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get any specified state rep listing option - default to event
+ $option = 'event';
+ if (($statesListOption = filter_input(INPUT_GET, 'StatesListOption', FILTER_SANITIZE_STRING))) {
+ $option = $statesListOption;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.conv = $eventID";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of States
+ $statesList = $this->getList($where, 'code');
+
+ return $statesList;
+ }
+
+ /**
+ * Get State Rep Detail
+ *
+ * @return array
+ */
+ function getStateDetail()
+ {
+
+ // Is there a new State Rep code selected?
+ if (($stateID = filter_input(INPUT_GET, 'StateID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $stateID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['State'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $stateDetail = $this->getEntry($stateID);
+
+ return $stateDetail;
+
+ }
+
+
+ /**
+ * Edit State Rep
+ *
+ * @return array
+ */
+ function editState()
+ {
+
+ if (($stateID = filter_input(INPUT_GET, 'StateID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $stateID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['State'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ $stateDetail = $this->editEntry($stateID);
+
+ return $stateDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update State Rep
+ *
+ * @return array
+ */
+ function updateState()
+ {
+
+ if (($stateID = filter_input(INPUT_GET, 'StateID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $stateID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['State'])) {
+
+ // Otherwise, get the state rep ID from the session
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+
+ } else {
+
+ // Otherwise, we don't have a state rep id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($stateID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New State Rep
+ *
+ * @return array
+ */
+ function newState()
+ {
+
+ $r = $this->newEntry();
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $event = isset($_SESSION[GLM_EVENT_SESSION]['Event']);
+ $r['fieldData']['event_name']['pick_list'][$event]['default'] = true;
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Insert State Rep
+ *
+ * @return array
+ */
+ function insertState()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current state rep to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['State'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataTeams.php b/classes/data/dataTeams.php
new file mode 100644
index 0000000..73e8e51
--- /dev/null
+++ b/classes/data/dataTeams.php
@@ -0,0 +1,735 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTeams.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com/
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTeams class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTeams.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+class EventManagementDataTeams extends DataAbstract
+{
+ /**
+ * Field definitions
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.team';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Event selection
+ 'event' => array(
+ 'field' => 'event',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Event Name display
+ 'event_view' => array(
+ 'field' => 'event',
+ 'as' => 'event_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.event',
+ 'p_field' => 'event_code',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // State (rep) selection
+ 'state' => array(
+ 'field' => 'state',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.state_rep',
+ 'p_field' => 'code',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'ni'
+ ),
+
+ // State (rep) Name display
+ 'state_view' => array(
+ 'field' => 'state',
+ 'as' => 'state_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.state_rep',
+ 'p_field' => 'code',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Division selection
+ 'division' => array(
+ 'field' => 'division',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.division',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nid'
+ ),
+
+ // Division Name display
+ 'division_view' => array(
+ 'field' => 'division',
+ 'as' => 'division_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.division',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Team name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Team Code
+ 'team_code' => array(
+ 'field' => 'team_code',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Participants
+ 'participants' => array(
+ 'field' => 'participants',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Notes
+ 'notes' => array(
+ 'field' => 'notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Get Teams list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTeamsList()
+ {
+
+ // Get event ID from session - if available
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+
+ // Get member ID from session - if available
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+
+ // Clear Session Team Selection
+// $_SESSION[GLM_EVENT_SESSION]['Team'] = false;
+
+ // Get any specified team listing option - default to event
+ $option = 'event';
+ if (($teamsListOption = filter_input(INPUT_GET, 'TeamsListOption', FILTER_SANITIZE_STRING))) {
+ $option = $teamsListOption;
+ }
+
+ // Select type of list
+ $where = '';
+ switch ($option) {
+ case 'all':
+ $where = 'TRUE';
+ break;
+ case 'member':
+ if (!$memberID) {
+ return false;
+ }
+ $where = "
+ T.id in (
+ SELECT team
+ FROM team_property
+ WHERE property = $memberID
+ )
+ ";
+ break;
+ case 'event':
+ if (!$eventID) {
+ return false;
+ }
+ $where = "T.event = $eventID";
+ break;
+ default:
+ echo "Option not set";
+ break;
+ }
+
+ // Get list of Teams
+ $teamsList = $this->getList($where, 'event_name,state_name,division_name,name');
+
+ return $teamsList;
+ }
+
+ /**
+ * Get Team Detail
+ *
+ * @return array
+ */
+ function getTeamDetail()
+ {
+
+ // Is there a new team code selected?
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $teamDetail = $this->getEntry($teamID);
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ $r = array(
+ 'teamDetail' => $teamDetail,
+ 'teamRoster' => $teamRoster
+ );
+
+ return $r;
+
+ }
+
+ /**
+ * Get Team Roster
+ *
+ * @return array
+ */
+ function getTeamRoster($teamID, $participants)
+ {
+ // Try to get team roster
+ $sql = "SELECT *
+ FROM team_roster
+ WHERE team = $teamID
+ ORDER BY
+ CASE lname WHEN '' THEN 'ZZZZZZZ' ELSE lname END,
+ CASE fname WHEN '' THEN 'ZZZZZZZ' ELSE fname END;";
+
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamRoster = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Did we get less entries than team members listed?
+ if (count($teamRoster) < $participants) {
+ // Add number of additional participant slots to roster
+ $sql2 = array();
+ for ($i=count($teamRoster) ; $i<$participants ; $i++ ) {
+ $sql2[] = "INSERT INTO eventmgt.team_roster (team) values ($teamID);";
+ }
+
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql2 as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ }
+
+ // Get the team roster again
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamRoster = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ }
+
+ // Convert to array that has the roster ids as the index
+ $tr = array();
+ foreach($teamRoster as $r) {
+ $tr[$r['id']] = $r;
+ }
+
+ return $tr;
+ }
+
+
+ /**
+ * Edit Team
+ *
+ * @return array
+ */
+ function editTeam()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ $teamDetail = $this->editEntry($teamID);
+
+ // echo "
".print_r($teamDetail,1)."
";
+ return $teamDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+/*
+ $fd = $r['fieldData'];
+
+ // Is Start date is later than End date
+ if (strtotime($fd['start_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['start_date'] = 'Start date is later than end date.';
+ $r['status'] = false;
+ }
+
+ // Is cutoff date is later than end date
+ if (strtotime($fd['cutoff_date']) > strtotime($fd['end_date'])) {
+ $r['fieldFail']['cutoff_date'] = 'Cutoff date is later than end date.';
+ $r['status'] = false;
+ }
+*/
+ return $r;
+ }
+
+ /**
+ * Update Team
+ *
+ * @return array
+ */
+ function updateTeam()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($teamID);
+
+ return $r;
+
+ }
+
+
+ /**
+ * Add New Team
+ *
+ * @return array
+ */
+ function newTeam()
+ {
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Don't have a selected Event, so can't add a team.
+ return false;
+ }
+
+ // Set the p_where values for State Rep and Division picklists to only display ones associated
+ // with the selected event.
+ $this->fields['state']['p_where'] = "event = $eventID";
+ $this->fields['division']['p_where'] = "event = $eventID";
+
+ $r = $this->newEntry();
+
+ // Add selected event id and name for display in new team form
+ $r['fieldData']['event']['value'] = $eventID;
+ $r['fieldData']['event']['name'] = $r['fieldData']['event']['pick_list'][$eventID]['name'];
+
+ // Set selected event - Note that the template should actally not be using the event pick_list
+ // for new team entry unless we get the page to reload with the correct State Rep and Division lists.
+ $r['fieldData']['event']['pick_list'][$eventID]['default'] = true;
+
+ // If there's a currently selected State, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['State']) && $_SESSION[GLM_EVENT_SESSION]['State'] != false) {
+ $stateID = isset($_SESSION[GLM_EVENT_SESSION]['State']);
+ $r['fieldData']['state']['pick_list'][$stateID]['default'] = true;
+ }
+
+ // If there's a currently selected Division, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Division']) && $_SESSION[GLM_EVENT_SESSION]['Division'] != false) {
+ $divisionID = isset($_SESSION[GLM_EVENT_SESSION]['Division']);
+ $r['fieldData']['division']['pick_list'][$divisionID]['default'] = true;
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Insert Team
+ *
+ * @return array
+ */
+ function insertTeam()
+ {
+
+ // If there's a currently selected Event, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Event']) && $_SESSION[GLM_EVENT_SESSION]['Event'] != false) {
+ $eventID = $_SESSION[GLM_EVENT_SESSION]['Event'];
+ } else {
+ // Don't have a selected Event, so can't add a team.
+ return false;
+ }
+
+ // Set the p_where values for State Rep and Division picklists to only display ones associated
+ // with the selected event.
+ $this->fields['state']['p_where'] = "event = $eventID";
+ $this->fields['division']['p_where'] = "event = $eventID";
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current team to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $r['insertedID'];
+ }
+
+ // Add selected event name and value for display in new team form
+ $r['fieldData']['event']['name'] = $r['fieldData']['event']['pick_list'][$eventID]['name'];
+ $r['fieldData']['event']['value'] = $eventID;
+
+ // Set selected event - Note that the template should actally not be using the event pick_list
+ // for new team entry unless we get the page to reload with the correct State Rep and Division lists.
+ $r['fieldData']['event']['pick_list'][$eventID]['default'] = true;
+
+ // If there's a currently selected State, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['State']) && $_SESSION[GLM_EVENT_SESSION]['State'] != false) {
+ $stateID = $_SESSION[GLM_EVENT_SESSION]['State'];
+ $r['fieldData']['state']['pick_list'][$stateID]['default'] = true;
+ }
+
+ // If there's a currently selected Division, set that as default
+ if (isset($_SESSION[GLM_EVENT_SESSION]['Division']) && $_SESSION[GLM_EVENT_SESSION]['Division'] != false) {
+ $divisionID = $_SESSION[GLM_EVENT_SESSION]['Division'];
+ $r['fieldData']['division']['pick_list'][$divisionID]['default'] = true;
+ }
+
+ // echo "
".print_r($r,1)."
";
+ return $r;
+
+ }
+
+ /**
+ * Edit Team Roster
+ *
+ * @return array
+ */
+ function editTeamRoster()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ // Get team detail for reference
+ $teamDetail = $this->getEntry($teamID);
+
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ $r = array(
+ 'teamDetail' => $teamDetail,
+ 'teamRoster' => $teamRoster
+ );
+
+ return $r;
+
+ }
+
+ /**
+ * Update Team Roster
+ *
+ * @return array
+ */
+ function updateTeamRoster()
+ {
+
+ if (($teamID = filter_input(INPUT_GET, 'TeamID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = $teamID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Team'])) {
+
+ // Otherwise, get the team ID from the session
+ $teamID = $_SESSION[GLM_EVENT_SESSION]['Team'];
+
+ } else {
+
+ // Otherwise, we don't have a team id
+ return false;
+
+ }
+
+ // Get team detail for reference
+ $teamDetail = $this->getEntry($teamID);
+
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ $fieldFail = array();
+ $status = true;
+
+ // Filter and sanitize all input arrays
+ $lname_in = filter_input(INPUT_POST, "lname", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+ $fname_in = filter_input(INPUT_POST, "fname", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+ $pos_in = filter_input(INPUT_POST, "pos", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+ $notes_in = filter_input(INPUT_POST, "notes", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES|FILTER_REQUIRE_ARRAY);
+
+ // For each participant
+ while (list($key, $val) = each($lname_in)) {
+
+ // Last Name
+ if ($lname_in[$key] || $lname_in[$key] == '') {
+ $teamRoster[$key]['lname'] = $lname_in[$key];
+ $fieldFail[$key]['lname'] = false;
+ } else {
+ $fieldFail[$key]['lname'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+
+ // First Name
+ if ($fname_in[$key] || $fname_in[$key] == '') {
+ $teamRoster[$key]['fname'] = $fname_in[$key];
+ $fieldFail[$key]['fname'] = false;
+ } else {
+ $fieldFail[$key]['fname'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+
+ // Position
+ if ($pos_in[$key] || $pos_in[$key] == '') {
+ $teamRoster[$key]['pos'] = $pos_in[$key];
+ $fieldFail[$key]['pos'] = false;
+ } else {
+ $fieldFail[$key]['pos'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+
+ // Notes
+ if ($notes_in[$key] || $notes_in[$key] == '') {
+ $teamRoster[$key]['notes'] = $notes_in[$key];
+ $fieldFail[$key]['notes'] = false;
+ } else {
+ $fieldFail[$key]['notes'] = 'Provided input was not a valid string.';
+ $status = false;
+ }
+ }
+
+ // If submission is safe, then update the roster table
+ if ($status) {
+ $sql = array();
+ foreach ($teamRoster as $r) {
+ $sql[] = "UPDATE team_roster
+ SET lname = '".addslashes($r['lname'])."',
+ fname = '".addslashes($r['fname'])."',
+ pos = '".addslashes($r['pos'])."',
+ notes = '".addslashes($r['notes'])."'
+ WHERE id = ".$r['id'].";";
+ }
+
+ try {
+ $this->dbh->beginTransaction();
+ foreach ($sql as $s) {
+ $this->dbh->exec($s);
+ }
+ $this->dbh->commit();
+ } catch (Exception $e) {
+ $this->dbh->rollBack();
+ }
+
+ // Get team roster again so it's propety ordered
+ $teamRoster = $this->getTeamRoster($teamID, $teamDetail['participants']);
+
+ }
+
+ $r = array(
+ 'status' => $status,
+ 'teamDetail' => $teamDetail,
+ 'teamRoster' => $teamRoster,
+ 'fieldFail' => $fieldFail
+ );
+
+ return $r;
+
+ }
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataTicketClaimTracking.php b/classes/data/dataTicketClaimTracking.php
new file mode 100644
index 0000000..bbc8ed0
--- /dev/null
+++ b/classes/data/dataTicketClaimTracking.php
@@ -0,0 +1,216 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketClaimTtracking.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTicketClaimTracking class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketClaimTracking,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementDataTicketClaimTracking extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_claim_tracking';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket Order
+ 'ticket_order' => array(
+ 'field' => 'ticket_order',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Sold
+ 'ticket_sold' => array(
+ 'field' => 'ticket_sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Time of scan (timestamp)
+ 'time_of_action' => array(
+ 'field' => 'time_of_action',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Action Type
+ 'action_type' => array(
+ 'field' => 'action_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->member_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Quantity
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Scan User
+ 'scan_user' => array(
+ 'field' => 'scan_user',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Scan Name
+ 'scan_name' => array(
+ 'field' => 'scan_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Attendance Entry
+ 'attendance' => array(
+ 'field' => 'attendance',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Attendee Name
+ 'attendee_name' => array(
+ 'field' => 'attendee_name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Attendee Notes
+ 'attendee_notes' => array(
+ 'field' => 'attendee_notes',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ return $r;
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataTicketInventory.php b/classes/data/dataTicketInventory.php
new file mode 100644
index 0000000..65e0a02
--- /dev/null
+++ b/classes/data/dataTicketInventory.php
@@ -0,0 +1,683 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketInventory.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataTicketInventory extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_inventory';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Ticket ID
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Ticket'],
+ 'use' => 'nid'
+ ),
+
+ // Member ID
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'lged'
+ ),
+
+ // Member Name
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Name Display
+ 'ticket_view' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket ID
+ 'ticket_id' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Date
+ 'ticket_date' => array(
+ 'field' => 'ticket_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => time(),
+ 'use' => 'lgnid'
+ ),
+
+ // Ticket time
+ 'ticket_time' => array(
+ 'field' => 'ticket_time',
+ 'as' => false,
+ 'type' => 'time',
+// 'format' => 'm/d/Y',
+// 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+// 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lgnid'
+ ),
+
+ // Ticket Unlimited Quantity
+ 'unlimited_quant' => array(
+ 'field' => 'ticket',
+ 'as' => 'unlimited_quant',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'unlimited_quant',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket is Cart Sticky
+ 'cart_sticky' => array(
+ 'field' => 'ticket',
+ 'as' => 'cart_sticky',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'cart_sticky',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Quantity Allotted
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Available
+ 'available' => array(
+ 'field' => 'available',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Available
+ 'sold' => array(
+ 'field' => 'sold',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // On Hold
+ 'on_hold' => array(
+ 'field' => 'id',
+ 'as' => 'on_hold',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.inven_hold',
+ 'p_field' => 'quant',
+ 'p_id' => 'inventory',
+ 'p_where' => "
+ hold_type = ".$this->config->hold_types->ticket." AND
+ expire_time > '".date('r')."' AND
+ inventory = T.id",
+ 'p_sum' => true,
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'lg'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket sort order
+ 'ticket_sort' => array(
+ 'field' => 'ticket',
+ 'as' => 'ticket_sort',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'sort',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Section ID - retrieval only
+ 'section' => array(
+ 'field' => 'ticket',
+ 'as' => 'section',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'section',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'g'
+ )
+
+
+ );
+ }
+
+
+ /**
+ * Get Ticket Inventory
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketInventoryList($ticketID = false, $where = false, $dateKey = false)
+ {
+
+ // If ticket ID is -1, then don't use ticket ID in search.
+ if ($ticketID == -1) {
+
+ $ticketID = false;
+
+ // If a ticket ID is specified
+ } elseif ($ticketID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If there's a new ticket code submitted then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id - This should not be a problem
+
+ }
+
+ // If we have a ticket id, use that for inventory selection
+ $ticketWhere = 'true ';
+ if ($ticketID) {
+ $ticketWhere = "T.ticket = $ticketID ";
+ }
+
+ // Check for Where clause supplied
+ if ($where) {
+ $where = "AND $where ";
+ }
+
+ // Get list of Inventory
+ $invData = $this->getList($ticketWhere.$where, 'ticket_date');
+
+ // Convert to array with timestamp or ID as index
+ $inventoryData = array();
+ if ($invData != false) {
+ foreach ($invData as $i) {
+
+ // If the inventory item has a date and we're getting inventory for a specific ticketID
+ if (trim($i['ticket_date']['date']) != '' && $ticketID) {
+
+ // Use ticket timestamp for index
+ $inventoryData[$i['ticket_date']['timestamp']] = $i;
+
+ // Otherwise just use inventory ID (it's a non-date specific ticket)
+ } else {
+ $inventoryData[$i['id']] = $i;
+ }
+ }
+ }
+
+ return $inventoryData;
+ }
+
+ /**
+ * Get Ticket Inventory Calendar Data
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketInventoryCalendarData()
+ {
+
+ // Is there a new Ticket code selected?
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Get peformance ID from ticket
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/tickets.php';
+ $Tickets = new EventManagementAdminTickets($this->dbh, $this->config);
+ $ticketDetail = $Tickets->getTicketDetail();
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = $ticketDetail['performance_id'];
+
+ // Get performance data to get start and end date for the performance
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/performances.php';
+ $Performances = new EventManagementAdminPerformances($this->dbh, $this->config);
+ $performanceDetail = $Performances->getPerformanceDetail();
+
+ $invData = $this->getTicketInventoryList(false, "ticket_date is not null");
+
+ // If this ticket is date specific by inventory
+ // If not, there's only one inventory item, so we don't build a calendar
+ if ($ticketDetail['date_specific']['value']) {
+
+ $start = $ticketDetail['start_date']['timestamp'];
+ $end = $ticketDetail['end_date']['timestamp'];
+
+ /*
+ * Build output organized as calendar months
+ */
+
+ // Create calendars for the months covered by the performance
+ $calData = array();
+ $startMonth = strtotime(date('m/1/Y', $start));
+ $endMonth = strtotime(date('m/1/Y', $end));
+
+ // For each month of the performance
+ $newInventoryAdded = false;
+ for ($month = $startMonth; $month <= $endMonth; $month = strtotime(date('m/d/Y',$month).' +1 Month')) {
+
+ $offset = date('w', $month); // Number of days start of month is offset from Sunday
+ $monthDays = date('t', $month); // Number of days in the month
+
+ $calData[$month] = array(
+ 'month' => date('F', $month),
+ 'year' => date('Y', $month)
+ );
+
+ // For each week of the month
+ for ($week = 1; $week <= 6; $week++) {
+
+ $weekUsed = false;
+
+ // For each day of the week
+ for ($day = 1; $day <= 7; $day++) {
+
+ $cellNumb = ($week-1) * 7 + $day; // Calendar cell number - 6 week rows = 42 cells
+
+ // If this is a real date cell, then add the date info and any inventory data
+ $dateData = array('isDate' => false);
+ if ($cellNumb > $offset && ($cellNumb-$offset) <= $monthDays) {
+
+ $date = $cellNumb - $offset; // Day of the month
+ $dateTime = strtotime(date('m/d/Y', $month)." + ".($date-1)." Days"); // Timestamp for this date
+
+ $dow = date('w', $dateTime);
+
+ // Create base cell data
+ $dateData = array(
+ 'isDate' => true,
+ 'time' => $dateTime,
+ 'dom' => date('j', $dateTime),
+ 'date' => date('m/d/Y',$dateTime),
+ 'selectable' => ($dateTime >= $start && $dateTime <= $end && $ticketDetail['days_of_week']['bitmap'][$dow]['default']),
+ 'selected' => false
+ );
+
+
+ if ($ticketDetail['days_of_week']['bitmap'][$dow]['default']) {
+
+
+ $weekUsed = true;
+
+ // Check if there's no inventory for this date and there should be
+ if (($dateTime >= $start && $dateTime <= $end) && !isset($invData[$dateTime])) {
+
+ // Create a new inventory item
+ $quant = $ticketDetail['quant'];
+ $time = trim($ticketDetail['ticket_time']['time']);
+ $dateText = date('m/d/Y', $dateTime);
+
+ $sql = "
+ INSERT INTO eventmgt.ticket_inventory
+ (ticket, quant, available, ticket_date, ticket_time, sold, active)
+ VALUES
+ ($ticketID, $quant, $quant, '$dateText', '$time', 0, true)
+ ;";
+ $this->dbh->exec($sql);
+ $newInventoryAdded = true;
+
+ }
+
+ }
+
+ // If there's data for this date, add that to the cell data
+ if (isset($invData[$dateTime])) {
+
+ $dateData = array_merge($dateData, $invData[$dateTime]);
+ unset($dateData['ticket_date']); // Don't need this here
+ unset($dateData['ticket_name']); // Don't need this here
+
+ }
+
+ }
+ $calData[$month]['weeks'][$week]['weekUsed'] = $weekUsed;
+ $calData[$month]['weeks'][$week]['days'][$cellNumb] = $dateData;
+
+ }
+ }
+ }
+
+ // If new inventory was added, go back and reload all the data again
+ if ($newInventoryAdded) {
+ $calData = $this->getTicketInventoryCalendarData();
+ }
+
+ } else {
+
+ // If not date specific, we'll just pass on the current inventory data item
+ $calData = $invData;
+ }
+
+ return $calData;
+ }
+
+
+ /**
+ * Get Ticket Inventory Detail
+ *
+ * @return array
+ */
+ function getTicketInventoryDetail($ticketInventoryID = false, $extended = false)
+ {
+
+ // If an ID was supplied
+ if ($ticketInventoryID > 0) {
+
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ // Otherwise is there a new Ticket code submitted?
+ } elseif (($ticketInventoryID = filter_input(INPUT_GET, 'TicketInventoryID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['TicketInventory'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketInventoryID = $_SESSION[GLM_EVENT_SESSION]['TicketInventory'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $detail = $this->getEntry($ticketInventoryID);
+
+ // If $extended, then get detail on Section and Entrance
+ if ($extended) {
+
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataSections.php';
+ $Sections = new EventManagementDataSections($this->dbh, $this->config);
+ $Sections->optionIncludeSelectListData = false;
+ $sectionDetail = $Sections->getSectionDetail($detail['section']);
+
+ }
+
+ return $detail;
+
+ }
+
+
+ /**
+ * Edit Ticket Inventory
+ *
+ * @return array
+ */
+ function editTicketInventory()
+ {
+
+ if (($ticketInventoryID = filter_input(INPUT_GET, 'TicketInventoryID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['TicketInventory'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketInventoryID = $_SESSION[GLM_EVENT_SESSION]['TicketInventory'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->editEntry($ticketInventoryID);
+
+ return $ticketInventoryDetail;
+
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * This function must be here because it's called from a function
+ * in dataAbstract. Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+ return $r;
+ }
+
+ /**
+ * Update Ticket
+ *
+ * @return array
+ */
+ function updateTicketInventory()
+ {
+
+ // Removing "active" field to keep inventory update from messing with active flag
+ $saveActive = $this->fields['active'];
+ unset($this->fields['active']);
+
+ if (($ticketInventoryID = filter_input(INPUT_GET, 'TicketInventoryID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = $ticketInventoryID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['TicketInventory'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketInventoryID = $_SESSION[GLM_EVENT_SESSION]['TicketInventory'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Check if there's existing inventory data
+
+
+ // Try to update this data
+ $r = $this->updateEntry($ticketInventoryID);
+
+ // Restore "active" field
+ $this->fields['active'] = $saveActive;
+
+ return $r;
+
+ }
+
+
+
+
+}
+
+
+
+
+?>
diff --git a/classes/data/dataTicketPackages.php b/classes/data/dataTicketPackages.php
new file mode 100644
index 0000000..dfb3f44
--- /dev/null
+++ b/classes/data/dataTicketPackages.php
@@ -0,0 +1,347 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTicketPackage.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTicketPackage class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataTicketPackages extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket_package';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Pointer to ticket that is acting as a package container
+ 'ticket_package' => array(
+ 'field' => 'package',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Pointer to ticket that is contained in the package
+ 'ticket' => array(
+ 'field' => 'ticket',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Quantity
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Separate Voucher Flag
+ 'separate_voucher' => array(
+ 'field' => 'separate_voucher',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a'
+ ),
+
+ // Package Name
+ 'package_name' => array(
+ 'field' => 'package',
+ 'as' => 'package_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'title',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Member Name
+ 'member_name' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Performance Name
+ 'performance_name' => array(
+ 'field' => 'performance',
+ 'as' => 'performance_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.performance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Title
+ 'ticket_title' => array(
+ 'field' => 'ticket',
+ 'as' => 'title',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'title',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Active
+ 'active' => array(
+ 'field' => 'ticket',
+ 'as' => 'active',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.ticket',
+ 'p_field' => 'active',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Get Package Tickets list
+ *
+ *
+ * @return object containing array as sub-objects
+ */
+ public function getPackageList($where)
+ {
+
+ // Get the package contents
+ $packageData = $this->getList($where);
+ if (count($packageData) == 0) {
+ return false;
+ }
+
+ // Build output array with package ticket as key
+ $outData = array();
+ if ($packageData && count($packageData) > 0) {
+ foreach ($packageData as $p) {
+ $outData[$p['ticket']] = $p;
+ }
+ }
+ return $outData;
+
+ }
+
+ /**
+ * Update package tickets list
+ *
+ * Expects request input "selected_ticket_quant[id]" array.
+ */
+ public function updatePackageTicketsList($packageID = false)
+ {
+ // Check for good package ID
+ $pID = $packageID - 0;
+ if ($pID <= 0) {
+ return false;
+ }
+
+ // Try to retrieve package to make sure it exists and is a package
+ $sql = "
+ SELECT id
+ FROM eventmgt.ticket
+ WHERE id = $pID
+ AND ticket_type = 20
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $packageData = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($packageData) != 1) {
+ return false;
+ }
+
+ // Query to delete all for selected package
+ $sql = "
+ BEGIN;
+ DELETE FROM eventmgt.ticket_package
+ WHERE package = $packageID;
+ ";
+
+ // Now add in any tickets in request
+ require_once EVENT_MANAGEMENT_APP_BASE.'classes/data/dataTickets.php';
+ $Tickets = new EventManagementDataTickets($this->dbh, $this->config);
+ $newTickets = $_REQUEST['selected_ticket_quant'];
+
+ if ($newTickets) {
+
+ foreach ($newTickets as $k=>$v) {
+
+ // Get ticket data
+ $ticketData = $Tickets->getEntry($k);
+ if (is_array($ticketData)) {
+
+ // Check for separate vouchers
+ $separateVoucher = 'false';
+ if (isset($_REQUEST['selected_ticket_separatevoucher'][$k])) {
+ $separateVoucher = 'true';
+ }
+
+ $sql .= "
+ INSERT INTO eventmgt.ticket_package
+ (package, ticket, member, performance, quant, sort, separate_voucher)
+ VALUES ($packageID, $k, ".$ticketData['member'].", ".$ticketData['performance_id'].", $v, 99, $separateVoucher)
+ ;";
+ }
+
+ }
+ }
+ $sql .= "COMMIT;";
+ $this->dbh->exec($sql);
+
+ return $this->getPackageList("package = $packageID");
+
+ }
+
+ /**
+ * Clear package tickets list
+ */
+ public function clearPackageTicketsList($packageID = false)
+ {
+
+ // Check for good package ID
+ $pID = $packageID - 0;
+ if ($pID <= 0) {
+ return false;
+ }
+
+ $sql = "
+ DELETE FROM eventmgt.ticket_package
+ WHERE package = $packageID;
+ ";
+ $this->dbh->exec($sql);
+
+ return;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataTickets.php b/classes/data/dataTickets.php
new file mode 100644
index 0000000..1a5a3b8
--- /dev/null
+++ b/classes/data/dataTickets.php
@@ -0,0 +1,923 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link http://www.gaslightmedia.com
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataTickets class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataTickets,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ * @link <>
+ */
+class EventManagementDataTickets extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.ticket';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Admin Only Flag
+ 'admin_only' => array(
+ 'field' => 'admin_only',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Type
+ 'ticket_type' => array(
+ 'field' => 'ticket_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 10,
+ 'use' => 'a'
+ ),
+
+ // Member ID for adding tickets
+ 'member' => array(
+ 'field' => 'member',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'use' => 'a'
+ ),
+
+ // Member Name display
+ 'member_view' => array(
+ 'field' => 'member',
+ 'as' => 'member_name',
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.member',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_static' => true,
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'view_only' => true,
+ 'use' => 'gleu'
+ ),
+
+ // Ticket Name (internal use)
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Title (for display to users)
+ 'title' => array(
+ 'field' => 'title',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Performance
+ 'performance' => array(
+ 'field' => 'performance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.performance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_where' => 'member = '.$_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'required' => true,
+ 'unique' => false,
+ 'default' => $_SESSION[GLM_EVENT_SESSION]['Performance'],
+ 'use' => 'nideu'
+ ),
+
+ // Performance_view
+ 'performance_view' => array(
+ 'field' => 'performance',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.performance',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Performance ID
+ 'performance_id' => array(
+ 'field' => 'performance',
+ 'as' => 'performance_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Section
+ 'section' => array(
+ 'field' => 'section',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.section',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'p_where' => 'member = '.$_SESSION[GLM_EVENT_SESSION]['Member'],
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'nideu'
+ ),
+
+ // Section View
+ 'section_view' => array(
+ 'field' => 'section',
+ 'as' => false,
+ 'type' => 'pointer',
+ 'p_table' => 'eventmgt.section',
+ 'p_field' => 'name',
+ 'p_id' => 'id',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Section ID
+ 'section_id' => array(
+ 'field' => 'section',
+ 'as' => 'section_id',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Available for Sale Start Date
+ 'for_sale_start_date' => array(
+ 'field' => 'for_sale_start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y').' -1 year'), // Earliest is now less 1 year
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Available for Sale End Date
+ 'for_sale_end_date' => array(
+ 'field' => 'for_sale_end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y').' -1 year'), // Earliest is now less 1 year
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Date Specific - use single or multiple inventory
+ 'date_specific' => array(
+ 'field' => 'date_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Days of the week to create default inventory - multi-pick
+ 'days_of_week' => array(
+ 'field' => 'days_of_week',
+ 'as' => false,
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config->days->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 0, // Note that this is a bitmap of card indexes
+ 'use' => 'a'
+ ),
+
+ // Start Date
+ 'start_date' => array(
+ 'field' => 'start_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // End Date
+ 'end_date' => array(
+ 'field' => 'end_date',
+ 'as' => false,
+ 'type' => 'date',
+ 'format' => 'm/d/Y',
+ 'minValue' => strtotime('1/1/'.date('Y')), // Earliest is now
+ 'maxValue' => strtotime('12/31/'.date('Y').' +3 years'), // This year plus 3
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Time Specific
+ 'time_specific' => array(
+ 'field' => 'time_specific',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Ticket Time
+ 'ticket_time' => array(
+ 'field' => 'ticket_time',
+ 'as' => false,
+ 'type' => 'time',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => '12:00 PM',
+ 'use' => 'a'
+ ),
+
+ // Ticket Timestamp
+ 'ticket_timestamp' => array(
+ 'field' => 'ticket_time',
+ 'as' => 'ticket_timestamp',
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'gl'
+ ),
+
+ // Unlimited Use
+ 'unlimited_use' => array(
+ 'field' => 'unlimited_use',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Number of uses
+ 'uses' => array(
+ 'field' => 'uses',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Unlimited Quantity
+ 'unlimited_quant' => array(
+ 'field' => 'unlimited_quant',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => true,
+ 'use' => 'a'
+ ),
+
+ // Quantity - Number of these tickets in the section
+ 'quant' => array(
+ 'field' => 'quant',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'lgnieud'
+ ),
+
+ // Price
+ 'price' => array(
+ 'field' => 'price',
+ 'as' => false,
+ 'type' => 'money',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Consignment Type
+ 'consignment_type' => array(
+ 'field' => 'consignment_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_consignment_type->toArray(),
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Cart Sticky (Always displayed on cart - even with no quant)
+ 'cart_sticky' => array(
+ 'field' => 'cart_sticky',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a',
+ 'callback' => function ($r) {
+ $r['status'] = false;
+ return $r;
+ }
+ ),
+
+ // Show ticket on Start Page
+ 'show_on_start' => array(
+ 'field' => 'show_on_start',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Add-on Selection Required
+ 'addon_required' => array(
+ 'field' => 'addon_required',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Price
+ 'price_numb' => array(
+ 'field' => 'price',
+ 'as' => 'price_numb',
+ 'type' => 'float',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'lg'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => FILTER_SANITIZE_MAGIC_QUOTES,
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image
+ 'image' => array(
+ 'field' => 'image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher Text
+ 'voucher_text' => array(
+ 'field' => 'voucher_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher LeftEnd Text - overrides other text for that area if set
+ 'voucher_leftend_text' => array(
+ 'field' => 'voucher_leftend_text',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Voucher Type
+ 'voucher_type' => array(
+ 'field' => 'voucher_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->ticket_voucher_type->toArray(),
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 1,
+ 'use' => 'a'
+ ),
+
+ // Display Order (sort)
+ 'sort' => array(
+ 'field' => 'sort',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => 999,
+ 'use' => 'a'
+ )
+
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ // Check that Sticky is not used with date-specific inventory
+ if ($r['fieldData']['date_specific']['value'] && $r['fieldData']['cart_sticky']['value']) {
+ $r['status'] = false;
+ $r['fieldFail']['cart_sticky'] = 'Sticky may not be used when "Specified Dates" is checked.';
+ $r['fieldFail']['date_specific'] = 'Specified dates may not be used when "Sticky" is checked.';
+ }
+
+ return $r;
+ }
+
+ /**
+ * Get Tickets list
+ *
+ * @param integer $memberID Specifies tickets for a Member ID
+ * @param integer $performanceID Specifies tickets for a Performance ID
+ * @param integer $sectionID Specifies tickets for a Section ID
+ * @param string $listType Type of list to generate
+ * "norm" Standard list output with detail
+ * 'all' List all and ignore member, performance, section ID
+ * 'packageSelect' List package selection with only ID, Name, Member, Performance, Section, active
+ * Optional specify $notTicketID to not include the current ticket by ID
+ * Sorts by Member, Performance, Section, then Ticket
+ *
+ * @return object containing array as sub-objects
+ */
+ function getTicketsList($memberID = false, $performanceID = false, $sectionID = false, $listType = false, $activeOnly = false, $where = false, $includeAdminOnly = false, $notTicketID = false, $packages = true)
+ {
+ // Get member ID - But don't use it if performance or section IDs are supplied.
+ if ($memberID == false && !$performanceID && !$sectionID) {
+ $memberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ }
+
+ // Get performance ID
+ if ($performanceID == false) {
+ $performanceID = $_SESSION[GLM_EVENT_SESSION]['Performance'];
+ }
+
+ // Get section ID
+ if ($sectionID == false) {
+ $sectionID = $_SESSION[GLM_EVENT_SESSION]['Section'];
+ }
+
+ // Get URI search type
+ if (!$listType && isset($_REQUEST['listType'])) {
+ $listType = $_REQUEST['listType'];
+ }
+
+ // Build query Where clause
+ if ($where == false) {
+ $where = 'true';
+ }
+
+ // Check for active only request
+ if ($activeOnly) {
+ $where .= ' AND T.active';
+ }
+
+ // Check if adminUser
+ if (!$includeAdminOnly) {
+ $where .= ' AND NOT T.admin_only';
+ }
+
+ // Check if packages aren't enabled
+ if (!$packages) {
+ $where .= ' AND T.ticket_type != 20';
+ }
+
+ $fieldsSave = false;
+
+ switch ($listType) {
+
+ case 'packageSelect':
+
+ // Save current field list
+ $fieldsSave = $this->fields;
+ $this->fields = array(
+ 'id' => $this->fields['id'],
+ 'name' => $this->fields['name'],
+ 'title' => $this->fields['title'],
+ 'member_name' => $this->fields['member_view'],
+ 'performance_view' => $this->fields['performance_view'],
+ 'section_view' => $this->fields['section_view'],
+ 'active' => $this->fields['active']
+ );
+
+ $where = '
+ T.ticket_type != 20
+ AND T.addon_required = false
+ '.($notTicketID ? ' AND T.id != '.$notTicketID : '').'
+ ';
+ if ($memberID) {
+ $where .= " AND ( T.member = $memberID OR T.consignment_type > 1)";
+ } else {
+ $where .= 'AND T.consignment_type > 1';
+ }
+
+ $sort = '';
+
+ break;
+
+ case 'norm':
+ default:
+ if ($memberID) {
+ $where .= " AND T.member = $memberID";
+ }
+ if ($performanceID) {
+ $where .= " AND T.performance = $performanceID";
+ }
+ if ($sectionID) {
+ $where .= " AND T.section = $sectionID";
+ }
+ $sort = 'sort, name';
+ break;
+
+ case 'all':
+ $sort = 'sort, name';
+ break;
+
+ }
+
+ // Get list of Tickets
+ $ticketsList = $this->getList($where, 'sort, name');
+
+ if ($fieldsSave != false) {
+ $this->fields = $fieldsSave;
+ }
+
+ // If type packageSelect
+ if ($listType == 'packageSelect') {
+
+ // Sort by member, performance, section, ticket names.
+ function packageSelectSort($a, $b) {
+ if ($a['member_name'] == $b['member_name'] && $a['performance'] == $b['performance'] && $a['section'] == $b['section'] && $a['title'] == $b['title'] ) {
+ return 0;
+ }
+ if ($a['member_name'] < $b['member_name']) { return -1; }
+ if ($a['member_name'] > $b['member_name']) { return 1; }
+ if ($a['performance'] < $b['performance']) { return -1; }
+ if ($a['performance'] > $b['performance']) { return 1; }
+ if ($a['section'] < $b['section']) {return -1;}
+ if ($a['section'] > $b['section']) {return 1;}
+ if ($a['title'] < $b['title']) {return -1;}
+ return 1;
+ }
+ uasort($ticketsList, 'packageSelectSort');
+
+ // Save names, Remove subsequent member, performance, section until change
+ $memberName = '';
+ $performanceName = '';
+ $sectionName = '';
+ while (list($k, $v) = each($ticketsList)) {
+
+ // Also provide active as Yes/No
+ $ticketsList[$k]['active_name'] = ($v['active'] ? 'Yes' : 'No');
+
+ // Save names for adding to selected list
+ $ticketsList[$k]['member_save'] = $v['member_name'];
+ $ticketsList[$k]['performance_save'] = $v['performance'];
+ $ticketsList[$k]['section_save'] = $v['section'];
+
+ // Remove duplicate names for ordered picklist
+ if ($v['member_name'] != $memberName) {
+ $memberName = $v['member_name'];
+ $performanceName = '';
+ $sectionName = '';
+ } else {
+ $ticketsList[$k]['member_name'] = '';
+ }
+ if ($v['performance'] != $performanceName) {
+ $performanceName = $v['performance'];
+ $sectionName = '';
+ } else {
+ $ticketsList[$k]['performance'] = '';
+ }
+ if ($v['section'] != $sectionName) {
+ $sectionName = $v['section'];
+ } else {
+ $ticketsList[$k]['performance'] = '';
+ }
+
+ }
+
+ }
+
+ return $ticketsList;
+ }
+
+ /**
+ * Get Ticket Detail
+ *
+ * @return array
+ */
+ function getTicketDetail($ticketID = false)
+ {
+
+ // If a ticket has been specified
+ if ($ticketID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ // Otherwise if there's a ticket ID in the request
+ } elseif (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->getEntry($ticketID);
+
+ return $ticketDetail;
+
+ }
+
+ /**
+ * Edit Ticket
+ *
+ * @return array
+ */
+ function editTicket()
+ {
+
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->editEntry($ticketID);
+
+ return $ticketDetail;
+
+ }
+
+ /**
+ * Update Ticket
+ *
+ * @return array
+ */
+ function updateTicket()
+ {
+
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have a ticket id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($ticketID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Ticket
+ *
+ * @return array
+ */
+ function newTicket()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Ticket
+ *
+ * @return array
+ */
+ function insertTicket()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current ticket to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Ticket
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function ticketDelete($confirm = false)
+ {
+
+ // Is there a new ticket code selected?
+ if (($ticketID = filter_input(INPUT_GET, 'TicketID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = $ticketID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Ticket'])) {
+
+ // Otherwise, get the ticket ID from the session
+ $ticketID = $_SESSION[GLM_EVENT_SESSION]['Ticket'];
+
+ } else {
+
+ // Otherwise, we don't have an ticket id
+ return false;
+
+ }
+
+ $ticketDetail = $this->deleteEntry($ticketID, $confirm);
+
+ return $ticketDetail;
+
+ }
+
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataVoucherCoupons.php b/classes/data/dataVoucherCoupons.php
new file mode 100644
index 0000000..a4f0850
--- /dev/null
+++ b/classes/data/dataVoucherCoupons.php
@@ -0,0 +1,472 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataVoucherCoupons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+require_once DATA_ABSTRACT;
+
+/**
+ * EventManagementDataVoucherCoupons class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataVoucherCoupons,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementDataVoucherCoupons extends DataAbstract
+{
+ /**
+ * Tables
+ *
+ * @var $ini
+ * @access public
+ */
+ public $table = 'eventmgt.voucher_coupons';
+
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($dbh, $config)
+ {
+
+ parent::__construct($dbh, $config);
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'lged'
+ ),
+
+ // Voucher Coupon Name
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Active
+ 'active' => array(
+ 'field' => 'active',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => true,
+ 'use' => 'a'
+ ),
+
+ // Coupon Type
+ 'coupon_type' => array(
+ 'field' => 'coupon_type',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->coupon_type->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Coupon Position
+ 'coupon_position' => array(
+ 'field' => 'coupon_position',
+ 'as' => false,
+ 'type' => 'list',
+ 'list' => $this->config->coupon_position->toArray(),
+ 'list_keytype' => 'int',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Display From Date
+ 'display_from' => array(
+ 'field' => 'display_from',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => time(),
+ 'use' => 'a'
+ ),
+
+ // Display To Date
+ 'display_to' => array(
+ 'field' => 'display_to',
+ 'as' => false,
+ 'type' => 'date',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => strtotime('12/31/'.date('Y').' +4 years'),
+ 'use' => 'a'
+ ),
+
+ // Stretch to Fit
+ 'stretch_to_fit' => array(
+ 'field' => 'stretch_to_fit',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Image Padding
+ 'padding' => array(
+ 'field' => 'padding',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ ),
+
+ // Show Border
+ 'show_border' => array(
+ 'field' => 'show_border',
+ 'as' => false,
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Coupon Image
+ 'coupon_image' => array(
+ 'field' => 'coupon_image',
+ 'as' => false,
+ 'type' => 'image',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Maximum Display Count (-1 = unlimited)
+ 'max_display_count' => array(
+ 'field' => 'max_display_count',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => -1,
+ 'use' => 'a'
+ ),
+
+ // Display Count
+ 'display_count' => array(
+ 'field' => 'display_count',
+ 'as' => false,
+ 'type' => 'integer',
+ 'required' => true,
+ 'unique' => false,
+ 'default' => 0,
+ 'use' => 'a'
+ )
+
+ );
+ }
+
+ /**
+ * Check for other field related issues
+ *
+ * Simply return $r if there's nothing to check.
+ *
+ * @return array
+ */
+ function checkOther($r)
+ {
+ parent::checkOther($r);
+
+ return $r;
+ }
+
+
+ /**
+ * Get Voucher Coupon list
+ *
+ * @return object containing array as sub-objects
+ */
+ function getVoucherCouponList($where = '')
+ {
+
+ // Build query Where clause
+ if ($where == '') {
+ $where = 'true';
+ }
+
+ // Get list of Voucher Coupons
+ $voucherCouponsList = $this->getList($where, 'name');
+
+ return $voucherCouponsList;
+ }
+
+ /**
+ * Get Voucher Coupon Detail
+ *
+ * @return array
+ */
+ function getVoucherCouponDetail($voucherCouponID = false)
+ {
+
+ // If a voucher coupon has been specified
+ if ($voucherCouponID != false) {
+
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ // Otherwise if there's a voucher coupon ID in the request
+ } elseif (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // There's a Voucher Coupon submitted, so save that
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have a voucher coupon id
+ return false;
+
+ }
+
+ $voucherCouponDetail = $this->getEntry($voucherCouponID);
+
+ return $voucherCouponDetail;
+
+ }
+
+ /**
+ * Edit Voucher Coupon
+ *
+ * @return array
+ */
+ function editVoucherCoupon()
+ {
+
+ if (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have a voucher coupon id
+ return false;
+
+ }
+
+ $voucherCouponDetail = $this->editEntry($voucherCouponID);
+
+ return $voucherCouponDetail;
+
+ }
+
+ /**
+ * Update Voucher Coupon
+ *
+ * @return array
+ */
+ function updateVoucherCoupon()
+ {
+
+ if (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have a voucher coupon id
+ return false;
+
+ }
+
+ // Try to update this data
+ $r = $this->updateEntry($voucherCouponID);
+
+ return $r;
+
+ }
+
+ /**
+ * Add New Voucher Coupon
+ *
+ * @return array
+ */
+ function newVoucherCoupon()
+ {
+
+ $r = $this->newEntry();
+
+ return $r;
+
+ }
+
+ /**
+ * Insert Voucher Coupon
+ *
+ * @return array
+ */
+ function insertVoucherCoupon()
+ {
+
+ $r = $this->insertEntry();
+
+ // If succesful then set current voucher coupone to the one just inserted.
+ if ($r['status']) {
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $r['insertedID'];
+ }
+
+ return $r;
+
+ }
+
+ /**
+ * Delete Voucher Coupon
+ *
+ * @param $confirm bool False to ask if user wants to delete and true to actually delete
+ *
+ * @return array
+ */
+ function voucherCouponDelete($confirm = false)
+ {
+
+ // Is there a new voucher coupon code selected?
+ if (($voucherCouponID = filter_input(INPUT_GET, 'VoucherCouponID', FILTER_SANITIZE_NUMBER_INT))) {
+
+ // If so then add it to the session
+ $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'] = $voucherCouponID;
+
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'])) {
+
+ // Otherwise, get the voucher coupon ID from the session
+ $voucherCouponID = $_SESSION[GLM_EVENT_SESSION]['VoucherCoupon'];
+
+ } else {
+
+ // Otherwise, we don't have an voucher coupon id
+ return false;
+
+ }
+
+ $voucherCouponDetail = $this->deleteEntry($voucherCouponID, $confirm);
+
+ return $voucherCouponDetail;
+
+ }
+
+ /**
+ * Get Voucher Coupon List for Display
+ *
+ * @param $date string Date to use for selection (usually today unless testing)
+ *
+ * @return array
+ */
+ function getCouponsForDisplay($date = false)
+ {
+
+ $where = '';
+
+ // If no date (time) has been supplied
+ if (!$date) {
+ $date = date('m/d/Y', time());
+ }
+ $where = "T.active AND '$date' >= T.display_from AND '$date' <= T.display_to";
+
+ $coupons = $this->getVoucherCouponList($where);
+
+ if (!is_array($coupons) || count($coupons) == 0) {
+ return false;
+ }
+
+ // Convert to array organized by location
+ $cr = array();
+ foreach ($coupons as $c) {
+ $cr[$c['coupon_position']['value']][] = $c;
+ }
+
+ // Shuffle order of coupons in each location (randomize)
+ foreach ($cr as $k => $v) {
+ shuffle($cr[$k]);
+ }
+
+ return $cr;
+
+ }
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/configs/common.ini b/configs/common.ini
new file mode 100644
index 0000000..deb1b9b
--- /dev/null
+++ b/configs/common.ini
@@ -0,0 +1,807 @@
+; Configuration File for Event Management System - V3
+;
+; This file contains common configuration for all sites using this Event Management
+; System on this server. Each site also has local configuration for this application
+; in a config/applications/EventManagement.ini file in the site.
+;
+; Custom configurations for development and developer configuration at bottom of file.
+
+[common]
+
+applicationName = "Event Management"
+applicationVersion = "EventManagement/V3"
+dataAbstractLocation = "Database/V0"
+pdfAbstractLocation = "PDF/V0"
+paymentProcessorsLocation = "PaymentProcessors/V0"
+imageServerAbstractLocation = "ImageServer/V0"
+internalReportingAddress = "cscott@gaslightmedia.com"
+
+orderVerificationSecret = "GLMOrder2secreT"
+
+;
+; ********** NEED TO VERIFY EVERYTHING BELOW **************
+;
+
+; Base URL/paths for front-end of this application
+url.members = CURRENT_BASE_URL "members-only-area/?page_id=122"
+path.front_end = BASE_PATH ""
+path.admin = BASE_PATH "admin/Event_Housing/"
+path.common = "/var/www/server/CommonApps/"
+
+; Admin Interface Selection
+default_admin_interface = "tickets"
+admin_interface.selectable = false;
+admin_interface.tickets = "tickets"
+admin_interface_type.tickets = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+
+; Front End Interface Selection
+; default_front_interface (set in customer configuration)
+front_interface.selectable = false;
+
+; Front End Interfaces
+; "tickets"
+front_interface.tickets = "tickets"
+front_interface_type.tickets = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "TicketsFoundation"
+front_interface.TicketsFoundation = "TicketsFoundation"
+front_interface_type.TicketsFoundation = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "FoundationStandAlone" - Used for foundation with tickets when Foundation is not loaded for the site
+front_interface.FoundationStandAlone = "TicketsFoundation"
+front_interface_type.FoundationStandAlone = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "SaultSteMarie"
+front_interface.SaultSteMarie = "SaultSteMarie"
+front_interface_type.SaultSteMarie = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "Gaslight"
+front_interface.Gaslight = "Gaslight"
+front_interface_type.Gaslight = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "MMM"
+front_interface.MMM = "MMM"
+front_interface_type.MMM = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+; "PointerBoat"
+front_interface.PointerBoat = "PointerBoat"
+front_interface_type.PointerBoat = "flexy" ;Options are "flexy" and "smarty" (smarty not working yet)
+
+; Set Database Date Style - uncomment desired style
+;misc.datestyle = "SET DATESTYLE TO 'ISO';" ;ISO example: 1997-12-17 07:37:16-08';\n"
+misc.datestyle = "SET DATESTYLE TO 'SQL';" ;SQL example: 12/17/1997 07:37:16.00 PST';\n"
+;misc.datestyle = "SET DATESTYLE TO 'Postgres';" ;Postgres example: Wed Dec 17 07:37:16 1997 PST';\n"
+;misc.datestyle = "SET DATESTYLE TO 'European';" ;European example: 17/12/1997 15:37:16.00 MET';\n"
+;misc.datestyle = "SET DATESTYLE TO 'US';" ;US example: 12/17/1997 07:37:16.00 PST';\n"
+;misc.datestyle = "SET DATESTYLE TO 'German';" ;German example: 17.12.1997 07:37:16.00 PST';\n"
+
+; Standard arrays
+
+; Member Types
+member_type.1 = "Standard"
+member_type.2 = "Standard + Sells other's items"
+member_type.3 = "Vendor of items only sold through others"
+member_type.10 = "Other - neither vendor nor sales"
+
+; Ticket consignment types
+ticket_consignment_type.1 = "Not sold by other locations"
+ticket_consignment_type.2 = "Available for sale by other locations"
+ticket_consignment_type.3 = "Sold only by other locations"
+
+; Ticket voucher types - Note types < 80 are tickets, > 80 are things sold
+ticket_voucher_type.1 = "Standard Voucher/Ticket with Barcode"
+ticket_voucher_type.11 = "Voucher/Ticket for Pickup - no Barcode"
+ticket_voucher_type.12 = "Voucher/Ticket to be mailed Mailed - no Barcode"
+ticket_voucher_type.81 = "Object Sold (i.e. books) to be claimed - with Barcode"
+ticket_voucher_type.82 = "Object Sold (i.e. books) to be mailed - no Barcode"
+
+; Ticket Types
+ticket_type.10 = 'Standard'
+ticket_type.20 = 'Package'
+
+; Ticket Add-On Types
+ticket_add_on_type.1 = 'Checkbox'
+ticket_add_on_type.2 = 'Quantity'
+
+; Promo Ticket Types
+promo_ticket_type.1 = '$ Amount'
+promo_ticket_type.2 = 'Percentage'
+
+; Permissions
+permissions.10 = "Full Venue Access"
+permissions.20 = "Ticket Orders and Claims"
+permissions.30 = "Ticket Claims Only"
+permissions.99 = "No Access"
+
+; Permissions References
+permissions_numb.full = 10
+permissions_numb.orders_and_claims = 20
+permissions_numb.claims = 30
+permissions_numb.none = 99
+
+; Pending cart hold types
+hold_types.reservation = 1
+hold_types.ticket = 2
+
+; Claim Tracking Types by Name
+claim_tracking_types_numb.claim = 1
+claim_tracking_types_numb.clear = 2
+
+; Claim Tracking Types
+claim_tracking_types.1 = "Claimed"
+claim_tracking_types.2 = "Claim Cleared"
+
+; Processing Methods
+proc_method.1 = merchant ;Merchant processes cards
+proc_method.2 = processed ;Processed by a card processor
+
+; Card Processors by number
+ccard_processor.0 = "(none - select processor)"
+ccard_processor.3 = "No Payment Processing at Checkout"
+ccard_processor.99 = "Card Processing Test"
+ccard_processor.1 = "Authorize.net"
+ccard_processor.2 = "Merchant Solutions"
+
+; Card Processors by name
+ccard_processor_numb.none = 0
+ccard_processor_numb.authorize_net = 1
+ccard_processor_numb.merchant_solutions = 2
+ccard_processor_numb.no_payment = 3
+ccard_processor_numb.test = 99
+
+; Card processing mode options
+cc_mode.1 = "Local Transaction Approval Test"
+cc_mode.2 = "Local Transaction Decline Test"
+cc_mode.3 = "On-Line Transaction Test"
+cc_mode.0 = "Production Mode"
+
+; PayPal processing mode options
+paypal_mode.3 = "On-Line Transaction Test"
+paypal_mode.0 = "Production Mode"
+
+; Processing Status
+proc_status.new = 0
+proc_status.descr.0 = "New Registration Record"
+proc_status.unpaid = 1
+proc_status.descr.1 = "Not Paid"
+proc_status.cc_pend = 2
+proc_status.descr.2 = "Credit Card Pending"
+proc_status.cc_paid = 3
+proc_status.descr.3 = "Paid by Credit Card"
+proc_status.cc_decl = 4
+proc_status.descr.4 = "Credit Card Declined"
+proc_status.check_pend = 5
+proc_status.descr.5 = "Check Pending"
+proc_status.check_paid = 6
+proc_status.descr.6 = "Paid by Check"
+proc_status.comp = 7
+proc_status.descr.7 = "Complimentary"
+proc_status.failed = 98
+proc_status.descr.98 = "Submission Failed"
+proc_status.canceled = 99
+proc_status.descr.99 = "Canceled"
+
+; Payment Types
+pay_types.1 = "Credit Card"
+pay_types.2 = "Check"
+pay_types.3 = "Direct"
+pay_types.4 = "PayPal"
+
+; Credit Cards - numbers are an exponent of 2 that represent the bit position
+ccard.0 = "Visa"
+ccard.1 = "MasterCard"
+ccard.2 = "American Express"
+ccard.3 = "Discover"
+ccard.4 = "Diners Club"
+
+; Credit Card validation strings (regular expression)
+ccverify.0 = "^4.{15}$|^4.{12}$"
+ccverify.1 = "^5[1-5].{14}$"
+ccverify.2 = "^3[47].{13}$"
+ccverify.3 = "^6011.{12}$"
+ccverify.4 = "^30[0-5].{11}$|^3[68].{12}$"
+
+; Confirmation Methods
+conf_methods.1 = "US Mail"
+conf_methods.2 = "E-Mail"
+
+; Reference Types
+reference_type.misc = 0
+reference_type.event = 1
+reference_type.member = 2
+reference_type.state = 3
+reference_type.team = 4
+
+; Voucher Check Character Secret
+voucher_check_secret = "emVoucherCheck1"
+
+; Reference Type Numbers
+reference_type_numb.0 = "Misc"
+reference_type_numb.1 = "Event"
+reference_type_numb.2 = "Member/Venue"
+reference_type_numb.3 = "State Rep"
+reference_type_numb.4 = "Team"
+
+; Fee Method
+fee_method.fixed_stay = 1
+fee_method.fixed_accom = 2
+fee_method.fixed_accomnight = 3
+fee_method.percent_stay = 10
+
+; Fee Method Numbers
+fee_method_numb.1 = "Per Reservation"
+fee_method_numb.2 = "Per Room"
+fee_method_numb.3 = "Per Night"
+fee_method_numb.10 = "Percent of Room Rate"
+
+; Member/Venue Amenities
+; Static amenitities set system-wide
+; Only 10 fields in member records for these at this time
+; Needs to be replaced with managed amenities list
+memb_amen.1 = "Air-Conditioning"
+memb_amen.2 = "Barrier Free"
+memb_amen.3 = "Coffee Pot"
+memb_amen.4 = "Hair Dryer"
+memb_amen.5 = "Interior Corridor"
+memb_amen.6 = "Microwave"
+memb_amen.7 = "Refrigerator"
+;memb_amen.8 = "Shopping nearby"
+;memb_amen.9 = "Indoor pool"
+;memb_amen.10 = "Outdoor pool"
+;memb_amen.? = "Sauna"
+;memb_amen.? = "Whirlpool"
+;memb_amen.? = "Valet/Charge Parking"
+;memb_amen.? = "Self-operated coin laundry"
+;memb_amen.? = "Free parking"
+;memb_amen.? = "Fitness area"
+;memb_amen.? = "Room service"
+;memb_amen.? = "Conference/Meeting facilities"
+;memb_amen.? = "Restaurant nearby"
+;memb_amen.? = "Restaurant on site"
+;memb_amen.? = "Barrier free guest rooms available"
+;memb_amen.? = "Pets"
+;memb_amen.? = "Golf nearby"
+
+; Accommodatation Amenitities
+; NOT USED AT THIS TIME
+;accom_amen.1 = "Cable TV"
+;accom_amen.2 = "Movies in Room"
+;accom_amen.3 = "Barrier Free Access"
+;accom_amen.4 = "Smoke Free Room"
+;accom_amen.5 = "Jacuzzi in Room"
+;accom_amen.6 = "Iron and Ironing Board"
+;accom_amen.7 = "Coffee Pot in Room"
+;accom_amen.8 = "Refrigerator in Room"
+;accom_amen.9 = "Microwave in Room"
+;accom_amen.10 = "Safe"
+;accom_amen.11 = "Hair Dryer"
+
+; Accommodation Room Categories
+room_category.0 = "n/a"
+room_category.1 = "Bed"
+room_category.2 = "Room"
+room_category.3 = "Suite"
+
+; Accommodation Room Types
+room_types.0 = "n/a"
+room_types.1 = "Main"
+room_types.2 = "Bedroom"
+room_types.3 = "Kitchen"
+room_types.4 = "Living Room"
+
+; Accommodation Bath Types
+bath_types.0 = "None"
+bath_types.1 = "Full"
+bath_types.2 = "Half"
+bath_types.3 = "Sink"
+
+; Voucher Coupon Types
+coupon_type.0 = "Image"
+; coupon_type.1 = "PDF"
+; coupon_type.2 = "Text"
+
+; Days of the week - numbers are an exponent of 2 that represent the bit position
+days.0 = "Sunday"
+days.1 = "Monday"
+days.2 = "Tuesday"
+days.3 = "Wednesday"
+days.4 = "Thursday"
+days.5 = "Friday"
+days.6 = "Saturday"
+
+; States
+states.AL = "Alabama"
+states.AK = "Alaska"
+states.AB = "Alberta"
+states.AZ = "Arizona"
+states.AR = "Arkansas"
+states.BC = "British Columbia"
+states.CA = "California"
+states.CO = "Colorado"
+states.CT = "Connecticut"
+states.DE = "Delaware"
+states.DC = "District of Columbia"
+states.FL = "Florida"
+states.GA = "Georgia"
+states.GU = "Guam"
+states.HI = "Hawaii"
+states.ID = "Idaho"
+states.IL = "Illinois"
+states.IN = "Indiana"
+states.IA = "Iowa"
+states.KS = "Kansas"
+states.KY = "Kentucky"
+states.LA = "Louisiana"
+states.ME = "Maine"
+states.MB = "Manitoba"
+states.MD = "Maryland"
+states.MA = "Massachusetts"
+states.MI = "Michigan"
+states.MN = "Minnesota"
+states.MS = "Mississppi"
+states.MO = "Missouri"
+states.MT = "Montana"
+states.NE = "Nebraska"
+states.NV = "Nevada"
+states.NB = "New Brunswick"
+states.NF = "Newfoundland"
+states.NH = "New Hampshire"
+states.NJ = "New Jersey"
+states.NM = "New Mexico"
+states.NY = "New York"
+states.NC = "North Carolina"
+states.ND = "North Dakota"
+states.NT = "Northwest Territories"
+states.NS = "Nova Scotia"
+states.OH = "Ohio"
+states.OK = "Oklahoma"
+states.ON = "Ontario"
+states.OR = "Oregon"
+states.PA = "Pennsylvania"
+states.PE = "Prince Edward Island"
+states.PR = "Puerto Rico"
+states.QC = "Quebec"
+states.RI = "Rhode Island"
+states.SK = "Saskatchewan"
+states.SC = "South Carolina"
+states.SD = "South Dakota"
+states.TN = "Tennessee"
+states.TX = "Texas"
+states.UT = "Utah"
+states.VT = "Vermont"
+states.VI = "Virgin Islands"
+states.VA = "Virginia"
+states.WA = "Washington"
+states.WV = "West Virginia"
+states.WI = "Wisconsin"
+states.WY = "Wyoming"
+states.YT = "Yukon"
+
+; Countries
+countries.US = "United States"
+countries.CA = "Canada"
+countries.AF = "Afghanistan"
+countries.AX = "Land Islands"
+countries.AL = "Albania"
+countries.DZ = "Algeria"
+countries.AS = "American Samoa"
+countries.AD = "Andorra"
+countries.AO = "Angola"
+countries.AI = "Anguilla"
+countries.AQ = "Antarctica"
+countries.AG = "Antigua and Barbuda"
+countries.AR = "Argentina"
+countries.AM = "Armenia"
+countries.AW = "Aruba"
+countries.AU = "Australia"
+countries.AT = "Austria"
+countries.AZ = "Azerbaijan"
+countries.BS = "Bahamas"
+countries.BH = "Bahrain"
+countries.BD = "Bangladesh"
+countries.BB = "Barbados"
+countries.BY = "Belarus"
+countries.BE = "Belgium"
+countries.BZ = "Belize"
+countries.BJ = "Benin"
+countries.BM = "Bermuda"
+countries.BT = "Bhutan"
+countries.BO = "Bolivia"
+countries.BA = "Bosnia and Herzegovina"
+countries.BW = "Botswana"
+countries.BV = "Bouvet Island"
+countries.BR = "Brazil"
+countries.IO = "British Indian Ocean Territory"
+countries.BN = "Brunei Darussalam"
+countries.BG = "Bulgaria"
+countries.BF = "Burkina Faso"
+countries.BI = "Burundi"
+countries.KH = "Cambodia"
+countries.CM = "Cameroon"
+countries.CV = "Cape Verde"
+countries.KY = "Cayman Islands"
+countries.CF = "Central African Republic"
+countries.TD = "Chad"
+countries.CL = "Chile"
+countries.CN = "China"
+countries.CX = "Christmas Island"
+countries.CC = "Cocos (Keeling) Islands"
+countries.CO = "Colombia"
+countries.KM = "Comoros"
+countries.CG = "Congo"
+countries.CD = "Congo, the Democratic Rep. of"
+countries.CK = "Cook Islands"
+countries.CR = "Costa Rica"
+countries.CI = "Cote D'Ivoire"
+countries.HR = "Croatia"
+countries.CU = "Cuba"
+countries.CY = "Cyprus"
+countries.CZ = "Czech Republic"
+countries.DK = "Denmark"
+countries.DJ = "Djibouti"
+countries.DM = "Dominica"
+countries.DO = "Dominican Republic"
+countries.EC = "Ecuador"
+countries.EG = "Egypt"
+countries.SV = "El Salvador"
+countries.GQ = "Equatorial Guinea"
+countries.ER = "Eritrea"
+countries.EE = "Estonia"
+countries.ET = "Ethiopia"
+countries.FK = "Falkland Islands (Malvinas)"
+countries.FO = "Faroe Islands"
+countries.FJ = "Fiji"
+countries.FI = "Finland"
+countries.FR = "France"
+countries.GF = "French Guiana"
+countries.PF = "French Polynesia"
+countries.TF = "French Southern Territories"
+countries.GA = "Gabon"
+countries.GM = "Gambia"
+countries.GE = "Georgia"
+countries.DE = "Germany"
+countries.GH = "Ghana"
+countries.GI = "Gibraltar"
+countries.GR = "Greece"
+countries.GL = "Greenland"
+countries.GD = "Grenada"
+countries.GP = "Guadeloupe"
+countries.GU = "Guam"
+countries.GT = "Guatemala"
+countries.GN = "Guinea"
+countries.GW = "Guinea-Bissau"
+countries.GY = "Guyana"
+countries.HT = "Haiti"
+countries.HM = "Heard Island, McDonald Islands"
+countries.VA = "Holy see (Vatican City State)"
+countries.HN = "Honduras"
+countries.HK = "Hong Kong"
+countries.HU = "Hungary"
+countries.IS = "Iceland"
+countries.IN = "India"
+countries.ID = "Indonesia"
+countries.IR = "Iran, Islamic Republic of"
+countries.IQ = "Iraq"
+countries.IE = "Ireland"
+countries.IL = "Israel"
+countries.IT = "Italy"
+countries.JM = "Jamaica"
+countries.JP = "Japan"
+countries.JO = "Jordan"
+countries.KZ = "Kazakhstan"
+countries.KE = "Kenya"
+countries.KI = "Kiribati"
+countries.KP = "Korea, Democratic People's Rep. of"
+countries.KR = "Korea, Republic of"
+countries.KW = "Kuwait"
+countries.KG = "Kyrgyzstan"
+countries.LA = "Lao People's Democratic Republic"
+countries.LV = "Latvia"
+countries.LB = "Lebanon"
+countries.LS = "Lesotho"
+countries.LR = "Liberia"
+countries.LY = "Libyan Arab Jamahiriya"
+countries.LI = "Liechtenstein"
+countries.LT = "Lithuania"
+countries.LU = "Luxembourg"
+countries.MO = "Macao"
+countries.MK = "Macedonia, the Former Yugoslav Rep."
+countries.MG = "Madagascar"
+countries.MW = "Malawi"
+countries.MY = "Malaysia"
+countries.MV = "Maldives"
+countries.ML = "Mali"
+countries.MT = "Malta"
+countries.MH = "Marshall Islands"
+countries.MQ = "Martinique"
+countries.MR = "Mauritania"
+countries.MU = "Mauritius"
+countries.YT = "Mayotte"
+countries.MX = "Mexico"
+countries.FM = "Micronesia, Federated States of"
+countries.MD = "Moldova, Republic of"
+countries.MC = "Monaco"
+countries.MN = "Mongolia"
+countries.MS = "Montserrat"
+countries.MA = "Morocco"
+countries.MZ = "Mozambique"
+countries.MM = "Myanmar"
+countries.NA = "Namibia"
+countries.NR = "Nauru"
+countries.NP = "Nepal"
+countries.NL = "Netherlands"
+countries.AN = "Netherlands Antilles"
+countries.NC = "New Caledonia"
+countries.NZ = "New Zealand"
+countries.NI = "Nicaragua"
+countries.NE = "Niger"
+countries.NG = "Nigeria"
+countries.NU = "Niue"
+countries.NF = "Norfolk Island"
+countries.MP = "Northern Mariana Islands"
+countries.NO = "Norway"
+countries.OM = "Oman"
+countries.PK = "Pakistan"
+countries.PW = "Palau"
+countries.PS = "Palestinian Territory, Occupied"
+countries.PA = "Panama"
+countries.PG = "Papua New Guinea"
+countries.PY = "Paraguay"
+countries.PE = "Peru"
+countries.PH = "Philippines"
+countries.PN = "Pitcairn"
+countries.PL = "Poland"
+countries.PT = "Portugal"
+countries.PR = "Puerto Rico"
+countries.QA = "Qatar"
+countries.RE = "Reunion"
+countries.RO = "Romania"
+countries.RU = "Russian Federation"
+countries.RW = "Rwanda"
+countries.SH = "Saint Helena"
+countries.KN = "Saint Kitts and Nevis"
+countries.LC = "Saint Lucia"
+countries.PM = "Saint Pierre and Miquelon"
+countries.VC = "Saint Vincent and the Grenadines"
+countries.WS = "Samoa"
+countries.SM = "San Marino"
+countries.ST = "Sao Tome and Principe"
+countries.SA = "Saudi Arabia"
+countries.SN = "Senegal"
+countries.CS = "Serbia and Montenegro"
+countries.SC = "Seychelles"
+countries.SL = "Sierra Leone"
+countries.SG = "Singapore"
+countries.SK = "Slovakia"
+countries.SI = "Slovenia"
+countries.SB = "Solomon Islands"
+countries.SO = "Somalia"
+countries.ZA = "South Africa"
+countries.GS = "South Georgia, South Sandwich Islands"
+countries.ES = "Spain"
+countries.LK = "Sri Lanka"
+countries.SD = "Sudan"
+countries.SR = "Suriname"
+countries.SJ = "Svalbard and Jan Mayen"
+countries.SZ = "Swaziland"
+countries.SE = "Sweden"
+countries.CH = "Switzerland"
+countries.SY = "Syrian Arab Republic"
+countries.TW = "Taiwan, Province of China"
+countries.TJ = "Tajikistan"
+countries.TZ = "Tanzania, United Republic of"
+countries.TH = "Thailand"
+countries.TL = "Timor-Leste"
+countries.TG = "Togo"
+countries.TK = "Tokelau"
+countries.TO = "Tonga"
+countries.TT = "Trinidad and Tobago"
+countries.TN = "Tunisia"
+countries.TR = "Turkey"
+countries.TM = "Turkmenistan"
+countries.TC = "Turks and Caicos Islands"
+countries.TV = "Tuvalu"
+countries.UG = "Uganda"
+countries.UA = "Ukraine"
+countries.AE = "United Arab Emirates"
+countries.GB = "United Kingdom"
+countries.UM = "United States minor outlying islands"
+countries.UY = "Uruguay"
+countries.UZ = "Uzbekistan"
+countries.VU = "Vanuatu"
+countries.VE = "Venezuela"
+countries.VN = "Viet Nam"
+countries.VG = "Virgin Islands, British"
+countries.VI = "Virgin Islands, U.S."
+countries.WF = "Wallis and Futuna"
+countries.EH = "Western Sahara"
+countries.YE = "Yemen"
+countries.ZM = "Zambia"
+countries.ZW = "Zimbabwe"
+
+; Standard color names and codes
+color.800000 = 'maroon'
+color.8B0000 = 'darkred'
+color.FF0000 = 'red'
+color.FFB6C1 = 'lightpink'
+color.DC143C = 'crimson'
+color.DB7093 = 'palevioletred'
+color.FF69B4 = 'hotpink'
+color.FF1493 = 'deeppink'
+color.C71585 = 'mediumvioletred'
+color.800080 = 'purple'
+color.8B008B = 'darkmagenta'
+color.DA70D6 = 'orchid'
+color.D8BFD8 = 'thistle'
+color.DDA0DD = 'plum'
+color.EE82EE = 'violet'
+color.FF00FF = 'fuchsia'
+color.FF00FF = 'magenta'
+color.BA55D3 = 'mediumorchid'
+color.9400D3 = 'darkviolet'
+color.9932CC = 'darkorchid'
+color.8A2BE2 = 'blueviolet'
+color.4B0082 = 'indigo'
+color.9370DB = 'mediumpurple'
+color.6A5ACD = 'slateblue'
+color.7B68EE = 'mediumslateblue'
+color.00008B = 'darkblue'
+color.05367D = 'mackinawblue'
+color.0000CD = 'mediumblue'
+color.0000FF = 'blue'
+color.000080 = 'navy'
+color.191970 = 'midnightblue'
+color.483D8B = 'darkslateblue'
+color.4169E1 = 'royalblue'
+color.6495ED = 'cornflowerblue'
+color.B0C4DE = 'lightsteelblue'
+color.F0F8FF = 'aliceblue'
+color.F8F8FF = 'ghostwhite'
+color.E6E6FA = 'lavender'
+color.1E90FF = 'dodgerblue'
+color.4682B4 = 'steelblue'
+color.00BFFF = 'deepskyblue'
+color.708090 = 'slategray'
+color.778899 = 'lightslategray'
+color.87CEFA = 'lightskyblue'
+color.87CEEB = 'skyblue'
+color.ADD8E6 = 'lightblue'
+color.008080 = 'teal'
+color.008B8B = 'darkcyan'
+color.00CED1 = 'darkturquoise'
+color.00FFFF = 'aqua'
+color.48D1CC = 'mediumturquoise'
+color.5F9EA0 = 'cadetblue'
+color.AFEEEE = 'paleturquoise'
+color.E0FFFF = 'lightcyan'
+color.F0FFFF = 'azure'
+color.20B2AA = 'lightseagreen'
+color.40E0D0 = 'turquoise'
+color.B0E0E6 = 'powderblue'
+color.2F4F4F = 'darkslategray'
+color.7FFFD4 = 'aquamarine'
+color.00FA9A = 'mediumspringgreen'
+color.66CDAA = 'mediumaquamarine'
+color.00FF7F = 'springgreen'
+color.3CB371 = 'mediumseagreen'
+color.2E8B57 = 'seagreen'
+color.32CD32 = 'limegreen'
+color.006400 = 'darkgreen'
+color.008000 = 'green'
+color.00FF00 = 'lime'
+color.228B22 = 'forestgreen'
+color.8FBC8F = 'darkseagreen'
+color.90EE90 = 'lightgreen'
+color.98FB98 = 'palegreen'
+color.F5FFFA = 'mintcream'
+color.F0FFF0 = 'honeydew'
+color.7FFF00 = 'chartreuse'
+color.7CFC00 = 'lawngreen'
+color.6B8E23 = 'olivedrab'
+color.556B2F = 'darkolivegreen'
+color.9ACD32 = 'yellowgreen'
+color.ADFF2F = 'greenyellow'
+color.F5F5DC = 'beige'
+color.FAF0E6 = 'linen'
+color.FAFAD2 = 'lightgoldenrodyellow'
+color.808000 = 'olive'
+color.FFFF00 = 'yellow'
+color.FFFFE0 = 'lightyellow'
+color.FFFFF0 = 'ivory'
+color.BDB76B = 'darkkhaki'
+color.F0E68C = 'khaki'
+color.EEE8AA = 'palegoldenrod'
+color.F5DEB3 = 'wheat'
+color.FFD700 = 'gold'
+color.FFFACD = 'lemonchiffon'
+color.FFEFD5 = 'papayawhip'
+color.B8860B = 'darkgoldenrod'
+color.DAA520 = 'goldenrod'
+color.FAEBD7 = 'antiquewhite'
+color.FFF8DC = 'cornsilk'
+color.FDF5E6 = 'oldlace'
+color.FFE4B5 = 'moccasin'
+color.FFDEAD = 'navajowhite'
+color.FFA500 = 'orange'
+color.FFE4C4 = 'bisque'
+color.D2B48C = 'tan'
+color.FF8C00 = 'darkorange'
+color.DEB887 = 'burlywood'
+color.8B4513 = 'saddlebrown'
+color.F4A460 = 'sandybrown'
+color.FFEBCD = 'blanchedalmond'
+color.FFF0F5 = 'lavenderblush'
+color.FFF5EE = 'seashell'
+color.FFFAF0 = 'floralwhite'
+color.FFFAFA = 'snow'
+color.CD853F = 'peru'
+color.FFDAB9 = 'peachpuff'
+color.D2691E = 'chocolate'
+color.A0522D = 'sienna'
+color.FFA07A = 'lightsalmon'
+color.FF7F50 = 'coral'
+color.E9967A = 'darksalmon'
+color.FFE4E1 = 'mistyrose'
+color.FF4500 = 'orangered'
+color.FA8072 = 'salmon'
+color.FF6347 = 'tomato'
+color.BC8F8F = 'rosybrown'
+color.FFC0CB = 'pink'
+color.CD5C5C = 'indianred'
+color.F08080 = 'lightcoral'
+color.A52A2A = 'brown'
+color.B22222 = 'firebrick'
+color.000000 = 'black'
+color.696969 = 'dimgray'
+color.808080 = 'gray'
+color.A9A9A9 = 'darkgray'
+color.C0C0C0 = 'silver'
+color.D3D3D3 = 'lightgrey'
+color.DCDCDC = 'gainsboro'
+color.F5F5F5 = 'whitesmoke'
+color.FFFFFF = 'white'
+
+[production : common]
+; Debugging and Testing parameters
+option.development = false ;Tells templates that this is a production server
+option.admin_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.admin_debug_size = 800 ;Width in pixels of front debug window
+option.front_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.front_debug_size = 800 ;Width in pixels of front debug window
+option.preview = true ;Use "preview=1" in links to support preview feature
+option.checkout_pre_fill = false ;Use for testing, prefills checkout data for convenience
+debug.level = 0 ;Debug level - 0=off
+debug.view_parameters = false ;Display all View tags and information
+debug.housing_query = false ;Display main housing query
+debug.pricing = false ;Detailed information on pricing and cost calculations
+debug.checkout = false ;Display checkout processing steps and data
+debug.mail = false ;Display mail rather than send it
+debug.glmpdf = false ;Display calibration grids in PDFs
+
+[development : common]
+; Debugging and Testing parameters
+option.development = true ;Tells templates that this is a development server
+option.admin_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.admin_debug_size = 800 ;Width in pixels of front debug window
+option.front_debug = false ;If true causes system to dump diagnostic data to a separate window
+option.front_debug_size = 800 ;Width in pixels of front debug window
+option.preview = true ;Use "preview=1" in links to support preview feature
+option.checkout_pre_fill = false ;Use for testing, prefills checkout data for convenience
+debug.level = 0 ;Debug level - 0=off
+debug.view_parameters = false ;Display all View tags and information
+debug.housing_query = false ;Display main housing query
+debug.pricing = false ;Detailed information on pricing and cost calculations
+debug.checkout = false ;Display checkout processing steps and data
+debug.mail = false ;Display mail rather than send it
+debug.glmpdf = false ;Display calibration grids in PDFs
+
+[chuck : common]
+; Debugging and Testing parameters
+option.development = true ;Tells templates that this is a development server
+option.admin_debug = true ;If true causes system to dump diagnostic data to a separate window
+option.admin_debug_size = 800 ;Width in pixels of front debug window
+option.front_debug = true ;If true causes system to dump diagnostic data to a separate window
+option.front_debug_size = 800 ;Width in pixels of front debug window
+option.preview = false ;Use "preview=1" in links to support preview feature
+option.checkout_pre_fill = true ;Use for testing, prefills checkout data for convenience
+debug.level = 1 ;Debug level - 0=off, 1=Show Function Calls
+debug.view_parameters = true ;Display all View tags and information
+debug.housing_query = true ;Display main housing query
+debug.pricing = true ;Detailed information on pricing and cost calculations
+debug.checkout = true ;Display checkout processing steps and data
+debug.mail = true ;Display mail rather than send it
+debug.glmpdf = true ;Display calibration grids in PDFs
diff --git a/controllers/AdminController.php b/controllers/AdminController.php
new file mode 100644
index 0000000..69d2c94
--- /dev/null
+++ b/controllers/AdminController.php
@@ -0,0 +1,1051 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: EventManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/*
+ * Need to explain all this
+ */
+class EventManagementPage
+{
+
+ public $level;
+
+ function setUserLevel($level)
+ {
+ $this->level = $level;
+ }
+
+ function checkPermission($userPermissionLevel)
+ {
+ if ($userPermissionLevel >= $this->level) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
+
+/**
+ * EventManagementAdminIndexController class
+ *
+ * Event Management System - Admin main index
+ *
+ * PHP version 5
+ *
+ * @category Reservations_Front_End
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: EventManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementAdminIndexController
+{
+
+ /**
+ * Debug Information
+ * @var $adminDebug
+ * @access public
+ */
+ private $adminDebug = '';
+ private $adminDebugMenu = '';
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ private $applicationConfig;
+ private $serverConfig;
+ private $siteConfig;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $isa;
+ public $imageServer;
+ /**
+ * Reason for any problems that come up
+ * @var unknown
+ * @access public
+ */
+ public $reason = array();
+ /**
+ * Current Action
+ * Default is set to SelectConv
+ * @var $Action
+ * @access public
+ */
+ public $Action = 'SelectConv';
+ /**
+ * Template to use for output
+ * @var unknown
+ * @access public
+ */
+ public $flexyOptions;
+ public $template;
+ public $page;
+ /**
+ * User Level
+ * @var unknown
+ * @access public
+ */
+ public $userLevel = false;
+ /**
+ * User Interface
+ * @var unknown
+ * @access public
+ */
+ public $interface = false;
+ public $userInterface = false;
+ public $userInterfaces = false;
+ public $userInterfacesSelectable = false;
+
+ public $customFeatures = false;
+ public $userMemberID = false;
+ public $memberName = false;
+ public $userMemberVenueName = false;
+ public $MemberUser = false;
+ public $MemberUserValid = false;
+ public $AdminUser = false;
+ public $tabList = false;
+ public $blockTab = false;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($applicationConfig, $serverConfig, $siteConfig)
+ {
+
+ // Save config data and build a common config object
+ $this->applicationConfig = $applicationConfig;
+ $this->serverConfig = $serverConfig;
+ $this->siteConfig = $siteConfig;
+ $this->buildIntegratedConfig();
+
+ // Setup some required defines for this application
+ $this->setupDefines();
+
+ // Create database connection
+ $this->dbh = Toolkit_Database::getInstance();
+
+ // Set debug file name that includes remote address to keep users separate
+ if ($this->config->option->admin_debug) {
+ define('DEBUG_DATA_FILENAME', '/tmp/EventManagement.'.$_SERVER['REMOTE_ADDR'].'.debug.html');
+ }
+
+ // If there's no custom front-end, then disable custom features (i.e. Misc menu in admin)
+ $this->customFeatures = false;
+ if ($this->config->custom_prefix != '') {
+ $this->customFeatures = true;
+ }
+
+ // Start Session
+ $this->startSession();
+
+ // Get requested action
+ $this->getRequestedAction();
+
+ // Check for a member user
+ $this->checkMemberUser();
+
+ // Check if there's a request to reset all selected items
+ $this->checkResetSelected();
+
+ // User interface selection
+ $this->userInterfaceSelection();
+
+ // Track selected tabs so they aren't repeated in the user interface
+ $this->trackTabs();
+
+ // Setup page and template configurations and add some standard page data
+ $this->setupTemplate();
+
+ // Setup URLs and Locations for templates
+ $this->setupURLs();
+
+ // Add start of request debug data
+ $this->startOfRequestDebug();
+
+ // Perform requested action and add this to debug
+ $this->performAction();
+
+ // Display Output
+ $this->displayOutput();
+
+ // Output debug information if that's enabled
+ $this->displayDebug();
+
+ }
+
+ /**
+ * Assemble all required config data into $this->config
+ *
+ * @return void
+ */
+ private function buildIntegratedConfig()
+ {
+
+ // Set common apps base location
+ define('COMMON_APP_BASE', '/var/www/server/CommonApps/');
+
+ // Get customer's config for this application and Merge in customer's main application.ini
+ $this->config = new Zend_Config_Ini(
+ BASE_PATH.'config/applications/EventManagement.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($this->applicationConfig->event_management);
+ $this->config->owner = $this->siteConfig->owner;
+ $this->config->file_server = $this->serverConfig->file_server;
+
+ // Set location for this application
+ define('EVENT_MANAGEMENT_APP_BASE', COMMON_APP_BASE.$this->config->version.'/');
+
+ // Get common config data for this application and merge in site specific config
+ $EMConfig = new Zend_Config_Ini(
+ EVENT_MANAGEMENT_APP_BASE.'configs/common.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($EMConfig);
+
+ }
+
+ /**
+ * Set system defines
+ *
+ * @return void
+ */
+ private function setupDefines()
+ {
+
+ // Set datestyle string for DB results
+ define('DATE_STYLE_STRING', $this->config->misc->datestyle );
+
+ // Set common apps base location
+ define('DATA_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->dataAbstractLocation.'/DataAbstract.php');
+ define('PDF_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->pdfAbstractLocation.'/GlmPdf.php');
+ define('IMAGE_SERVER_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->imageServerAbstractLocation.'/Server.php');
+
+ // Also set a defined parameter for access to the File/Image Server
+ define('IMAGE_SERVER_PREFIX', $this->config->file_server->secure.$this->config->file_server->owner_id.'/');
+
+ }
+
+ /**
+ * Start Session
+ *
+ * @return object containing array as sub-objects
+ */
+ function startSession($force = false)
+ {
+ // If we haven't started sessions yet
+ if (!isset($_SESSION)) {
+ session_start();
+ }
+
+ // Use "session_reset=true" in link to force a reset
+ if ($_REQUEST['session_reset'] == 'true') {
+ $force = true;
+ }
+
+ // Set a different session name if the user is coming from the front end as an ADMIN_LOGIN_USER
+ if (defined('MEMBER_USER') && MEMBER_USER) {
+ define('GLM_EVENT_SESSION', 'GLM_EVENT_MGT_LOGIN_USER');
+ } else {
+ define('GLM_EVENT_SESSION', 'GLM_EVENT_MGT_ADMIN');
+
+ // Define MEMBER_USER as false so we don't have to keep checking if it's defined
+ define('MEMBER_USER', false);
+ }
+
+ // If the session timeout has past then reset session
+ if ($_SESSION[GLM_EVENT_SESSION]['timeOut'] < time()) {
+ $force = true;
+
+ // Only notify the user if the session has timed out in the last hour
+ if (time() - $_SESSION[GLM_EVENT_SESSION]['timeOut'] < 60*60 ) {
+ $this->reason[] = 'Your user session has timed out due to inactivity.';
+ }
+ }
+
+ // If requested or not yet set, create a clean session array
+ if ($force || !isset($_SESSION[GLM_EVENT_SESSION])) {
+
+ // But save certain things
+ $this->interface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+ if ($_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $userMember = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ $userID = $_SESSION[GLM_EVENT_SESSION]['MemberUser'];
+ $userLevel = $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'];
+ } else {
+ $userID = false;
+ $userLevel = $this->config->permissions_numb->none;
+ }
+
+ // If full reset then set user interface back to default
+ if ($force) {
+ $this->interface = $this->config->default_admin_interface;
+ }
+
+ // create GLM_HOUSING session with all parameters false
+ $_SESSION[GLM_EVENT_SESSION] = array(
+ 'timeOut' => false,
+ 'Event' => false,
+ 'Member' => $userMember,
+ 'Accom' => false,
+ 'Inven' => false,
+ 'Team' => false,
+ 'Booking' => false,
+ 'Reservation' => false,
+ 'State' => false,
+ 'Division' => false,
+ 'Contact' => false,
+ 'Entrance' => false,
+ 'Section' => false,
+ 'Performance' => false,
+ 'Promo' => false,
+ 'Ticket' => false,
+ 'TicketInventory' => false,
+ 'Interface' => $this->interface,
+ 'TabsSelected' => false,
+ 'Order' => false,
+ 'MemberUser' => $userID,
+ 'MemberUserLevel' => $userLevel,
+ 'VoucherCoupon' => false
+ );
+
+ }
+
+ // Reset session timeout to current time plus timeout length in minutes
+ $_SESSION[GLM_EVENT_SESSION]['timeOut'] = strtotime('now +'.$this->config->admin_session_timeout.' minutes');
+
+ $this->addDebug('startSession()', 'Session timeout at: '.date('r', $_SESSION[GLM_EVENT_SESSION]['timeOut']).' ('.$_SESSION[GLM_EVENT_SESSION]['timeOut'].')');
+
+ }
+
+ /**
+ * Get requested action
+ *
+ * @return void
+ */
+ private function getRequestedAction()
+ {
+
+ // Try both GET and POST
+ if (!($this->Action = filter_input(INPUT_GET, 'Action', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) &&
+ !($this->Action = filter_input(INPUT_POST, 'Action', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH))
+ ) {
+ // No Action provided, so doing default
+ $this->Action = 'Index_index';
+ }
+
+ }
+
+ /**
+ * Check for member user
+ *
+ * @return void
+ */
+ private function checkMemberUser()
+ {
+
+ // Start with assumption that we don't have a valid member user
+ $this->MemberUserValid = false;
+
+ // Override for debug window
+ if ($this->Action == "Debug_start" || $this->Action == "Debug_update") {
+ $this->MemberUser = false;
+ $this->AdminUser = true;
+ }
+
+ // Check if this is a member logout. If so, send user back to front-end.
+ if ($_REQUEST['EMlogout'] == 'true') {
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] = 0;
+
+ echo '
+ ';
+ }
+
+ // If this is a member user, and we're not processing a debug request
+ if (MEMBER_USER && $this->Action != "Debug_start" && $this->Action != "Debug_update") {
+
+ // Check if we aren't getting a login request and we already have a member user login
+ if ($this->Action != "User_login" && $_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+
+ // Check the current user level
+ $sql = "
+ SELECT C.id, C.user_rights, C.active, C.affiliation, C.fname, C.lname, M.name
+ FROM eventmgt.res_contact C, eventmgt.member M
+ WHERE C.id = ".$_SESSION[GLM_EVENT_SESSION]['MemberUser']."
+ AND M.id = C.affiliation
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $contact = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // If the contact has been deleted, is marked inactive, or had their rights changed
+ if ($contact == false || !$contact['active'] || $contact['user_rights'] != $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel']) {
+
+ // Send the user back to login
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = false;
+ $reason =
+ "Your session is being reset. This can happen for one of the following reasons. "
+ ."Your permissions have changed, "
+ ."your user account has been marked inactive, "
+ ."your user account has been deleted, "
+ ."or there has been an unexpected system error.";
+ echo '
+
+ ';
+ exit;
+
+ }
+
+ // Otherwise we must not have a current login
+ } else {
+
+ // Assume we're not going to get logged in and we're going to send them back
+ $this->Action = 'User_login';
+
+ $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
+ $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
+
+ // Check if we have email and password supplied
+ if ($email != '' && $password != '') {
+
+ $loginFail = false;
+
+ // Crypt password
+ $pwCrypt = crypt($password);
+
+ // Check contact table for user with the supplied E-Mail address
+ $sql = "
+ SELECT C.id, C.password, C.user_rights, C.active, C.contact_type, C.affiliation, C.fname, C.lname, M.name
+ FROM eventmgt.res_contact C, eventmgt.member M
+ WHERE (C.email = '$email' OR C.login_id = '$email')
+ AND M.id = C.affiliation
+ ;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $contact = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ // If we found a contact with this E-Mail address that's active
+ if ($contact != false && $contact['active'] && $contact['contact_type'] == 2) {
+
+ // Does the crypt match?
+ if (crypt($password, $contact['password']) == $contact['password']) {
+
+ // Yep, so send user to the admin home
+ $this->Action = 'Index_index';
+
+ // And save the user login info
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = $contact['affiliation'];
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = $contact['id'];
+ $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] = $contact['user_rights'];
+
+ } else {
+ $loginFail = true;
+ }
+
+ } else {
+ $loginFail = true;
+ }
+
+ if ($loginFail) {
+ $this->reason[] = 'You did not supply a valid E-Mail address or Log in ID and password.';
+ }
+
+ }
+
+ } // Don't have member user login
+
+ } else {
+ if ($this->Action != "Debug_start" && $this->Action != "Debug_update") {
+ // The user is not a MemberUser, so must be an admin user - Give full permissions
+ $_SESSION[GLM_EVENT_SESSION]['MemberUser'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] = 0;
+ }
+ }
+
+ // This stuffs the current user level into the EventManagementPage class parameter
+ if ($_SESSION[GLM_EVENT_SESSION]['MemberUserLevel'] > 0) {
+ $this->userMemberID = $_SESSION[GLM_EVENT_SESSION]['Member'];
+ $this->memberName = $contact['fname']." ".$contact['lname'];
+ $this->userMemberVenueName = $contact['name'];
+ } else {
+ $this->userMemberID = false;
+ $this->memberName = '';
+ $this->userMemberVenueName = '';
+ }
+
+ }
+
+
+ /**
+ * Check if selected items reset has been requested
+ *
+ * @return void
+ */
+ private function checkResetSelected()
+ {
+
+ // If requested, reset all selected items in the session - This is done with all main tabs
+ if ($_REQUEST['resetSelected'] == 'true') {
+
+ $_SESSION[GLM_EVENT_SESSION]['Event'] = false;
+ if (!$_SESSION[GLM_EVENT_SESSION]['MemberUser']) {
+ $_SESSION[GLM_EVENT_SESSION]['Member'] = false;
+ }
+ $_SESSION[GLM_EVENT_SESSION]['Accom'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Team'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Booking'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Reservation'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['State'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Division'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Contact'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Section'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Performance'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Ticket'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['TicketInventory'] = false;
+ $_SESSION[GLM_EVENT_SESSION]['Order'] = false;
+
+ }
+
+ }
+
+ /**
+ * User Interface selection (template dir)
+ *
+ * @return void
+ */
+ private function userInterfaceSelection()
+ {
+
+ // Is there a request for a specific interface
+ if (isset($_REQUEST['interface']) &&
+ in_array($_REQUEST['interface'], $this->config->admin_interface->toArray())
+ ) {
+ $this->interface = $_REQUEST['interface'];
+ // Oherwise, do we have an interface selection in the user session?
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Interface']) && $_SESSION[GLM_EVENT_SESSION]['Interface'] != '') {
+ $this->interface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+ // If neither, then use default user interface.
+ } else {
+ $this->interface = $this->config->default_admin_interface;
+ }
+
+ // Update session and page to show selected user interface
+ $_SESSION[GLM_EVENT_SESSION]['Interface'] = $this->interface;
+ $this->userInterface = $this->interface;
+
+ // Provide list of user interfaces to page
+ $interfaces = $this->config->admin_interface->toArray();
+ $userInterfaces = array();
+ foreach ($interfaces as $i) {
+ $userInterfaces[] = array(
+ 'directory' => $i,
+ 'name' => $i,
+ 'selected' => ($i == $this->interface)
+ );
+ }
+
+ // If there's more than 1 user interface then tell the template to display user interface selection
+ $this->userInterfacesSelectable = ($this->config->admin_interface->selectable && count($interfaces) > 1);
+ $this->userInterfaces = $this->bindArrayToObject($userInterfaces);
+
+ }
+
+ /**
+ * Track tabs that are selected
+ *
+ * This is to keep from displaying another tab in a
+ * lower layer that's already been displayed.
+ *
+ * @return void
+ */
+ private function trackTabs()
+ {
+
+ // If tab list is provided
+ if (isset($_REQUEST['tabList'])) {
+ $this->tabList = $_REQUEST['tabList'];
+ } else {
+ $this->tabList = '';
+ }
+ if ($this->tabList != '') {
+ $this->tabList .= ',';
+ }
+ $this->tabList .= $this->Action;
+
+ $blockTab = array();
+ $nt = explode(',', $this->tabList);
+ foreach ($nt as $t) {
+ $blockTab[$t] = true;
+ }
+ $this->blockTab = $this->bindArrayToObject($blockTab);
+
+ }
+
+ /**
+ * Set template configuration
+ *
+ * @return void
+ */
+ private function setupTemplate()
+ {
+ // Test if there is a local templates directory for the Web site
+ if (is_dir(BASE_PATH.'admin/EventManagement/templates')) {
+ $templatesDir = BASE_PATH.'admin/EventManagement/templates/admin/';
+ } else {
+ // Otherwise use the templates in this app
+ $templatesDir = EVENT_MANAGEMENT_APP_BASE.'views/admin/';
+ }
+
+ // Setup Template and Page
+ $this->flexyOptions = array(
+ 'templateDir' => $templatesDir,
+ 'compileDir' => BASE_PATH.'/templates/compiled',
+ 'forceCompile' => false,
+ 'flexyIgnore' => true,
+ 'allowPHP' => true,
+ 'debug' => false
+ );
+ $this->template = new HTML_Template_Flexy($this->flexyOptions);
+ $this->page = new EventManagementPage();
+
+ // Add some standard page data
+ $this->page->startScript = '
+ ';
+ }
+
+ }
+
+ }
+
+ /**
+ * Get all general search lists - Events, Members, etc
+ *
+ * @return object containing array as sub-objects
+ */
+ function getSearchLists()
+ {
+ // Get full list of events
+ $sql = "SELECT id, name, event_code, active, end_date < 'now' AS expired, team_event
+ FROM eventmgt.event
+ ORDER BY name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $eventsList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ // Get full list of members
+ $sql = "SELECT id, name FROM eventmgt.member ORDER BY name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $membersList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ while( list($key, $val) = each( $membersList ) ) {
+ $membersList[$key]['name'] = addslashes($val['name']);
+ }
+
+ // Get full list of Teams
+ $sql = "SELECT id, name FROM eventmgt.team ORDER BY name;";
+ $stmt = $this->dbh->prepare($sql);
+ $stmt->execute();
+ $teamsList = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ while( list($key, $val) = each( $teamsList ) ) {
+ $teamsList[$key]['name'] = addslashes($val['name']);
+ }
+
+ $searchLists = array(
+ 'events' => $eventsList,
+ 'teamList' => $teamsList,
+ 'members' => $membersList
+ );
+
+ if ($this->config->option->admin_debug) {
+ $this->adminDebug .= "
EventManagement.php: getSearchLists()
".print_r($searchLists,1)."
";
+ }
+
+ return $searchLists;
+ }
+
+ /**
+ * Format a number as money
+ *
+ * @param $value Value to format
+ * @param $option Options that control output
+ * NOPREFIX stops the "$" prefix
+ *
+ * @return none
+ * @access public
+ */
+ private function money($value, $option = "")
+ {
+
+ if ($option == "NOPREFIX")
+ $prefix = "";
+ else
+ $prefix = "$";
+
+ // Do value sanity check
+
+ if (!is_numeric($value))
+ return ($prefix."0.00");
+
+ return ($prefix.number_format($value, 2, ".", ","));
+ }
+
+
+}
+
+// Start Event Management Admin - Pass the site's global application config data
+$eh = new EventManagementAdminIndexController($GLOBALS['applicationConfig'], $GLOBALS['serverConfig'], $GLOBALS['siteConfig']);
+
+// If this is an admin user initial entry or if this is an admin user login
+if (!(defined('SHOW_IN_SITE') && SHOW_IN_SITE)) {
+ exit;
+}
+
+
+
+?>
diff --git a/controllers/FrontController.php b/controllers/FrontController.php
new file mode 100644
index 0000000..66f9e6d
--- /dev/null
+++ b/controllers/FrontController.php
@@ -0,0 +1,909 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: FrontController.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/*
+
+Custom Index file
+ {GLM} is replaced with a template include file that calls the selected template.
+
+If custom index
+
+ base_url is /index.phtml - directly calls front-end controller
+
+ Controller determines action and calls proper include file for that action
+ returns selected template file and data
+
+ Controller
+ sets page->template parameter
+ calls custom index template
+ Template uses page-template parameter to include the target template.
+
+else
+ base_url is specified static page
+end
+
+*/
+
+/**
+ * EventManagementFrontIndexController class
+ *
+ * Event Management System - Front end main index
+ *
+ * PHP version 5
+ *
+ * @category Reservations_Front_End
+ * @package EventManagement
+ * @author Chuck Scott
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: FrontController.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+class EventManagementIndexController
+{
+
+ /**
+ * Front End Support
+ * @var $frontDebug
+ * @access public
+ */
+ public $support = false;
+ /**
+ * Debug Information
+ * @var $frontDebug
+ * @access public
+ */
+ public $frontDebug = '';
+ private $frontDebugMenu = '';
+ /**
+ * Configuration information object
+ * @var $ini
+ * @access public
+ */
+ public $config;
+ /**
+ * Database Object
+ * @var $dbh
+ * @access public
+ */
+ public $dbh;
+ /**
+ * File/Image server adapter
+ * @var $isa
+ * @var $imageServer
+ * @access public
+ */
+ public $isa;
+ public $imageServer;
+ /**
+ * Reason for any problems that come up
+ * @var unknown
+ * @access public
+ */
+ public $reason = array();
+ /**
+ * Have Cart
+ * @var $haveCart
+ * @access public
+ */
+ public $haveCart = false;
+ /**
+ * Current Action
+ * Default is set to SelectConv
+ * @var $Action
+ * @access public
+ */
+ public $Action = '';
+ /**
+ * Template to use for output
+ * @var unknown
+ * @access public
+ */
+ public $flexyOptions;
+ public $template;
+ private $page;
+ private $smarty;
+ /**
+ * User Interface
+ * @var unknown
+ * @access public
+ */
+ private $userInterface = false;
+ private $interfaceType = false;
+ private $userInterfaces = false;
+ private $userInterfacesSelectable = false;
+ public $memberUser = false;
+
+ private $resetSession = false;
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($applicationConfig, $serverConfig, $siteConfig)
+ {
+
+ // Save config data and build a common config object
+ $this->applicationConfig = $applicationConfig;
+ $this->serverConfig = $serverConfig;
+ $this->siteConfig = $siteConfig;
+ $this->buildIntegratedConfig();
+
+ // Setup some required defines for this application
+ $this->setupDefines();
+
+ // Create database connection
+ $this->dbh = Toolkit_Database::getInstance();
+
+ // Set debug file name
+ if ($this->config->option->front_debug) {
+ define('DEBUG_DATA_FILENAME', '/tmp/EventManagement.'.$_SERVER['REMOTE_ADDR'].'.debug.html');
+ }
+
+ // Provide front-end support class
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/front/classes/support.php';
+ $this->support = new EventManagementFrontSupport($this->dbh, $this->config);
+
+ // start this user session
+ $this->startSession();
+
+ // User interface selection
+ $this->userInterfaceSelection();
+
+ // Setup page and template configurations and add some standard page data
+ $this->setupTemplate();
+
+ // Perform requested action and add this to debug
+ $this->performAction();
+
+ // Display Output
+ $this->displayOutput();
+
+ // Check if we need to clear the session
+ if ($this->resetSession) {
+ $this->startSession(true);
+ }
+
+ // Output debug information if that's enabled
+ $this->displayDebug();
+
+ // If this is a debug output page then stop here.
+ if (substr($this->Action,0,6) == 'Debug_') {
+ exit;
+ }
+
+ } // _constructor
+
+ /**
+ * Assemble all required config data into $this->config
+ *
+ * @return void
+ */
+ private function buildIntegratedConfig()
+ {
+
+ // Set common apps base location
+ define('COMMON_APP_BASE', '/var/www/server/CommonApps/');
+
+ // Get customer's config for this application and Merge in customer's main application.ini
+ $this->config = new Zend_Config_Ini(
+ BASE_PATH.'config/applications/EventManagement.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($this->applicationConfig->event_management);
+ $this->config->owner = $this->siteConfig->owner;
+ $this->config->file_server = $this->serverConfig->file_server;
+
+ // Set location for this application
+ define('EVENT_MANAGEMENT_APP_BASE', COMMON_APP_BASE.$this->config->version.'/');
+
+ // Get common configuration for this application
+ $EMconfig = new Zend_Config_Ini(
+ EVENT_MANAGEMENT_APP_BASE.'configs/common.ini',
+ strtolower($_ENV['GLM_HOST_ID']),
+ array('allowModifications' => true)
+ );
+ $this->config->merge($EMconfig);
+
+ }
+
+ /**
+ * Set system defines
+ *
+ * @return void
+ */
+ private function setupDefines()
+ {
+ // Set datestyle string for DB results
+ define('DATE_STYLE_STRING', $this->config->misc->datestyle );
+
+ // Set common apps base location
+ define('DATA_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->dataAbstractLocation.'/DataAbstract.php');
+ define('PDF_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->pdfAbstractLocation.'/GlmPdf.php');
+ define('IMAGE_SERVER_ABSTRACT', COMMON_APP_BASE.'CommonAbstracts/'.$this->config->imageServerAbstractLocation.'/Server.php');
+
+ define('GLM_EVENT_SESSION', 'GLM_EVENT_MGT_FRONT');
+
+ // Also set a defined parameter for access to the File/Image Server
+ define('IMAGE_SERVER_PREFIX', $this->config->file_server->secure.$this->config->file_server->owner_id.'/');
+
+ // Set base script - If there's an application URL defined, use that, otherwise use page ID
+ $baseApplicationScript = ($this->config->application_url != '' ?
+ CURRENT_BASE_URL.$this->config->application_url.'/?x=1' :
+ CURRENT_BASE_URL.'index.php?catid='.$this->config->application_page
+ );
+ define('BASE_APPLICATION_SCRIPT', $baseApplicationScript);
+
+ // Set base URL
+ $baseApplicationUrl = ($this->config->application_page == 0 ?
+ $baseScript :
+ CURRENT_BASE_URL.'common/EventManagement/'
+ );
+ define('BASE_APPLICATION_URL', $baseApplicationUrl);
+
+ }
+
+ /**
+ * Destroy Event Management Front-end Session
+ *
+ * @return object containing array as sub-objects
+ */
+ function destroySession()
+ {
+ unset($_SESSION[GLM_EVENT_SESSION]);
+ return;
+ }
+
+ /**
+ * Start Session
+ *
+ * @return object containing array as sub-objects
+ */
+ function startSession($force = false)
+ {
+
+ // If we haven't started sessions yet
+ if (!isset($_SESSION)) {
+ session_start();
+ }
+
+ // Use "session_reset=true" in link to force a reset
+ if ($_REQUEST['session_reset'] == 'true') {
+ $force = true;
+ }
+
+ // If the session timeout has past then reset session
+ if ($_SESSION[GLM_EVENT_SESSION]['timeOut'] < time()) {
+
+ $force = true;
+
+ // Only notify the user if the session has timed out in the last hour
+ if (time() - $_SESSION[GLM_EVENT_SESSION]['timeOut'] < 60*60 ) {
+ $this->reason[] = 'Your user session has timed out due to inactivity and your cart has been cleared.';
+ }
+
+ // If not adding items to cart or starting with sectionSelect, reset Action
+ if ($_REQUEST['Action'] != 'Shop_sectionSelect' && $_REQUEST['cart'] != 'add') {
+ $this->Action = 'Shop_start';
+ }
+
+ }
+
+ // If requested or not yet set, create a clean GLM_HOUSING session array
+ if ($force || !isset($_SESSION[GLM_EVENT_SESSION])) {
+
+ // But save interface
+ $this->userInterface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+
+ // If full reset then clear this also
+ if ($force) {
+ $this->userInterface = false;
+ }
+
+ // create GLM_HOUSING session with all parameters false
+ $_SESSION[GLM_EVENT_SESSION] = array(
+ 'SessionID' => md5(($_SERVER["REMOTE_ADDR"].'-'.time())),
+ 'PseudoRand' => false,
+ 'permitInactive' => $this->permitInactive,
+ 'timeOut' => false,
+ 'Event' => false,
+ 'Member' => false,
+ 'Accom' => false,
+ 'Inven' => false,
+ 'Team' => false,
+ 'Booking' => false,
+ 'Reservation' => false,
+ 'State' => false,
+ 'Division' => false,
+ 'Contact' => false,
+ 'Entrance' => false,
+ 'Section' => false,
+ 'Performance' => false,
+ 'Ticket' => false,
+ 'TicketInventory' => false,
+ 'Interface' => $this->userInterface,
+ 'Search' => false,
+ 'Cart' => false,
+ 'CartIndex' => 0,
+ 'OptServCart' => false,
+ 'TicketCart' => false,
+ 'ContactInput' => false,
+ 'TicketPayments' => false,
+ 'AdminUser' => false
+ );
+
+ // Initialze Cart
+ $this->clearCart();
+
+ $this->addDebug("startSession()", 'Session Reset', false);
+
+ }
+
+ // Reset session timeout to current time plus timeout length in minutes
+ $_SESSION[GLM_EVENT_SESSION]['timeOut'] = strtotime('now +'.$this->config->session_timeout.' minutes');
+
+ // Now let's check for an admin login user who might have more privileges than a normal front-end user
+ if (isset($_REQUEST['adminUserCheck']) && $_REQUEST['adminUserCheck'] != '') {
+
+/* Temporarily bypassed due to issues with office computer Check Failures.
+ // Check admin user ID and check string
+ $check = md5($this->config->orderVerificationSecret.$_SERVER['REMOTE_ADDR'].date('m/d/Y'));
+ if ($_REQUEST['adminUserCheck'] != $check) {
+ echo "Check failure:";
+ exit;
+ }
+*/
+
+ $_SESSION[GLM_EVENT_SESSION]['AdminUser'] = true;
+ }
+
+ $this->addDebug('startSession()', 'Session timeout at: '.date('r', $_SESSION[GLM_EVENT_SESSION]['timeOut']).' ('.$_SESSION[GLM_EVENT_SESSION]['timeOut'].')');
+
+
+ }
+
+ /**
+ * User Interface selection (template dir)
+ *
+ * @return void
+ */
+ private function userInterfaceSelection()
+ {
+
+ // Is there a request for a specific interface
+ if (isset($_REQUEST['interface']) &&
+ in_array($_REQUEST['interface'], $this->config->front_interface->toArray())
+ ) {
+ $this->userInterface = $_REQUEST['interface'];
+ // Oherwise, do we have an interface selection in the user session?
+ } elseif (isset($_SESSION[GLM_EVENT_SESSION]['Interface']) && $_SESSION[GLM_EVENT_SESSION]['Interface'] != '') {
+ $this->userInterface = $_SESSION[GLM_EVENT_SESSION]['Interface'];
+ // If neither, then use default user interface.
+ } else {
+ $this->userInterface = $this->config->default_front_interface;
+ }
+
+ // Update session with current user interface
+ $_SESSION[GLM_EVENT_SESSION]['Interface'] = $this->userInterface;
+
+ // Get interface type (flexy or smarty)
+ $this->interfaceType = $this->config->front_interface_type->{$this->userInterface};
+
+ // Provide list of user interfaces to page
+ $interfaces = $this->config->front_interface->toArray();
+ $userInterfaces = array();
+ foreach ($interfaces as $i) {
+ $userInterfaces[] = array(
+ 'directory' => $i,
+ 'name' => $i,
+ 'selected' => ($i == $interface)
+ );
+ }
+
+ // If there's more than 1 user interface then tell the template to display user interface selection
+ $this->userInterfacesSelectable = ($this->config->front_interface->selectable && count($interfaces) > 1);
+ $this->userInterfaces = $this->bindArrayToObject($userInterfaces);
+
+ $this->addDebug("userInterfaceSelection()", $this->userInterface.' (template engine: '.$this->interfaceType.')', false);
+
+ }
+
+ /**
+ * Set template configuration
+ *
+ * @return void
+ */
+ private function setupTemplate()
+ {
+
+ // Test if there is a local templates directory for the Web site
+ if (is_dir(BASE_PATH.'admin/EventManagement/templates')) {
+ $templatesDir = BASE_PATH.'admin/EventManagement/templates/front/';
+ } else {
+ // Otherwise use the templates in this app
+ $templatesDir = EVENT_MANAGEMENT_APP_BASE.'views/front/';
+ }
+
+ switch ($this->interfaceType) {
+
+ case 'smarty':
+
+ // Load Smarty class and create instance
+ require(COMMON_APP_BASE.'Smarty/3.1/Smarty.class.php');
+ $this->smarty = new Smarty();
+
+ // Setup required Smarty paths
+ $this->smarty->setTemplateDir($templatesDir);
+ $this->smarty->setCompileDir(BASE_PATH.'/smarty/templates_c');
+ $this->smarty->setCacheDir(BASE_PATH.'/smarty/cache');
+ $this->smarty->setConfigDir(BASE_PATH.'/smarty/configs');
+
+ break;
+
+ case 'flexy':
+ // Setup Template and Page
+ $this->flexyOptions = array(
+ 'templateDir' => $templatesDir,
+ 'compileDir' => BASE_PATH.'/templates/compiled',
+ 'forceCompile' => false,
+ 'flexyIgnore' => true,
+ 'allowPHP' => true,
+ 'debug' => false
+ );
+ $this->template = new HTML_Template_Flexy($this->flexyOptions);
+ $this->page = new stdClass();
+
+ break;
+ }
+
+ // Get misc system configuration data for use below
+ require_once EVENT_MANAGEMENT_APP_BASE.'models/admin/classes/misc.php';
+ $Misc = new EventManagementAdminMisc($this->dbh, $this->config);
+ $miscConfigDetail = $Misc->getEntry(1);
+
+ // Get some standard page data
+ $this->templateAssign(
+ array(
+
+ 'owner' => $this->bindArrayToObject($this->config->owner->toArray()),
+
+ 'startScript' => '
+ ';
+
+ }
+
+ }
+
+ /*
+ * Assign parameters to the template
+ *
+ * @param array Array of arrays with parameter name, value pairs
+ * or
+ * @param text parameter name
+ * @param {whatever} parameter value
+ *
+ * @return void
+ */
+ private function templateAssign($params, $value = false)
+ {
+
+ // If this is a single assignment
+ if ($value != false) {
+
+ switch ($this->interfaceType) {
+ case 'smarty':
+ $this->smarty->assign($param, $value);
+ break;
+ case 'flexy':
+ $this->page->{$params} = $value;
+ break;
+ }
+
+ // Otherwise it's an array of parameter/value pairs
+ } else {
+
+ while (list($key, $value) = each($params)) {
+
+ switch ($this->interfaceType) {
+ case 'smarty':
+ $this->smarty->assign($key, $value);
+ break;
+ case 'flexy':
+ $this->page->{$key} = $value;
+ break;
+ }
+
+ }
+
+ }
+
+ }
+
+ /**
+ * If debug for mail turned on, display E-Mail messages rather than send them
+ *
+ * @access public
+ */
+ public function debug_mail( $to, $subject, $message, $headers = '', $parameters = '' )
+ {
+ if( $this->config->debug->mail )
+ {
+ $mailDebug = '
+
+
MAIL DEBUG
+
Recipient(s): '.$to.'
+
Subject: '.$subject.'
+
Headers:
'.$headers.'
+
Parameters:
'.$parameters.'
+
Message Content: '.$message.'
+
+
+ ';
+
+ // If front-debug is enabled, display in debug window
+ if ($this->config->option->front_debug) {
+ $this->addDebug('Email Message', $subject, $mailDebug, true);
+ } else {
+ // Otherwise display in-line.
+ echo $mailDebug;
+ }
+
+ return( true );
+ } else {
+ return( mail( $to, $subject, $message, $headers, $parameters ) );
+ }
+ }
+
+
+
+
+} // EventManagementIndexController
+
+// Start Event Management Front-End - Pass the site's global application config data
+//$eh = new EventManagementIndexController($applicationConfig, $serverConfig);
+//exit;
+
+?>
diff --git a/data/DatabaseModificationsForTicketing.sql b/data/DatabaseModificationsForTicketing.sql
new file mode 100644
index 0000000..93f3931
--- /dev/null
+++ b/data/DatabaseModificationsForTicketing.sql
@@ -0,0 +1,2 @@
+
+Updates to database required for current updates
diff --git a/data/EventManagement.sql b/data/EventManagement.sql
new file mode 100644
index 0000000..c57b235
--- /dev/null
+++ b/data/EventManagement.sql
@@ -0,0 +1,1183 @@
+CREATE SCHEMA eventmgt;
+
+ALTER SCHEMA eventmgt OWNER TO postgres;
+GRANT ALL ON SCHEMA eventmgt TO nobody;
+
+CREATE TABLE eventmgt.misc
+(
+ id integer,
+ intro_text text,
+ section_text text,
+ ticket_text text,
+ ticket_opt_text text,
+ cart_text text,
+ checkout_text text,
+ success_text text,
+ tracking text,
+ no_payment_reasons text,
+ opt_field_1_name text,
+ opt_field_2_name text,
+ opt_field_3_name text,
+ central_payment smallint
+);
+
+ALTER TABLE eventmgt.misc OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.misc FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.misc FROM postgres;
+GRANT ALL ON TABLE eventmgt.misc TO postgres;
+GRANT ALL ON TABLE eventmgt.misc TO nobody;
+
+INSERT INTO eventmgt.misc
+ (id, intro_text, section_text, ticket_text, ticket_opt_text, cart_text, checkout_text, success_text, central_payment)
+ VALUES
+ (1, 'Intro text', 'Section selection text', 'Ticket selection text', 'Ticket option selection text', 'Cart text', 'Checkout text', 'Checkout success text', 0);
+
+
+CREATE TABLE eventmgt.fees
+(
+id SERIAL,
+affiliation_type smallint,
+owner smallint,
+fee_method smallint,
+room_specific bool,
+name text,
+fee_amount float,
+taxable bool,
+itemize bool,
+event_specific bool,
+event smallint,
+optional_service bool,
+service_quant bool,
+service_max_quant smallint,
+descr text
+);
+
+ALTER TABLE eventmgt.fees OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.fees FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.fees FROM postgres;
+GRANT ALL ON TABLE eventmgt.fees TO postgres;
+GRANT ALL ON TABLE eventmgt.fees TO nobody;
+GRANT ALL ON TABLE eventmgt.fees_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.fees_id_seq TO nobody;
+
+CREATE INDEX fees_id_index ON eventmgt.fees ( id );
+CREATE INDEX fees_owner_index ON eventmgt.fees ( owner );
+
+CREATE TABLE eventmgt.division
+ (
+ id SERIAL,
+ event integer,
+ name text,
+ descr text,
+ notes text
+ );
+
+ALTER TABLE eventmgt.division OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.division FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.division FROM postgres;
+GRANT ALL ON TABLE eventmgt.division TO postgres;
+GRANT ALL ON TABLE eventmgt.division TO nobody;
+GRANT ALL ON TABLE eventmgt.division_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.division_id_seq TO nobody;
+
+CREATE INDEX division_id_index ON eventmgt.division ( id );
+CREATE INDEX division_event_index ON eventmgt.division ( event );
+
+CREATE TABLE eventmgt.state_rep
+ (
+ id SERIAL,
+ event integer,
+ code text,
+ password text,
+ descr text,
+ notes text
+ );
+
+ALTER TABLE eventmgt.state_rep OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.state_rep FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.state_rep FROM postgres;
+GRANT ALL ON TABLE eventmgt.state_rep TO postgres;
+GRANT ALL ON TABLE eventmgt.state_rep TO nobody;
+GRANT ALL ON TABLE eventmgt.state_rep_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.state_rep_id_seq TO nobody;
+
+CREATE INDEX state_rep_id_index ON eventmgt.state_rep ( id );
+CREATE INDEX state_rep_event_index ON eventmgt.state_rep ( event );
+
+
+CREATE TABLE eventmgt.room_block
+ (
+ id SERIAL,
+ event integer,
+ state_rep integer,
+ team integer,
+ member integer,
+ block_name integer
+ );
+
+ALTER TABLE eventmgt.room_block OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.room_block FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.room_block FROM postgres;
+GRANT ALL ON TABLE eventmgt.room_block TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block TO nobody;
+GRANT ALL ON TABLE eventmgt.room_block_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block_id_seq TO nobody;
+
+CREATE INDEX room_block_id_index ON eventmgt.room_block ( id );
+CREATE INDEX room_block_event_index ON eventmgt.room_block ( event );
+CREATE INDEX room_block_state_rep_index ON eventmgt.room_block ( state_rep );
+CREATE INDEX room_block_team_index ON eventmgt.room_block ( team );
+CREATE INDEX room_block_member_index ON eventmgt.room_block ( member );
+
+
+CREATE TABLE eventmgt.room_block_seg
+ (
+ id SERIAL,
+ block integer,
+ event integer,
+ accommodation integer,
+ allocated smallint,
+ available smallint
+ );
+
+ALTER TABLE eventmgt.room_block_seg OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.room_block_seg FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.room_block_seg FROM postgres;
+GRANT ALL ON TABLE eventmgt.room_block_seg TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block_seg TO nobody;
+GRANT ALL ON TABLE eventmgt.room_block_seg_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.room_block_seg_id_seq TO nobody;
+
+CREATE INDEX room_block_seg_id_index ON eventmgt.room_block_seg ( id );
+CREATE INDEX room_block_seg_block_index ON eventmgt.room_block_seg ( block );
+CREATE INDEX room_block_seg_event_index ON eventmgt.room_block_seg ( event );
+CREATE INDEX room_block_seg_accommodation_index ON eventmgt.room_block_seg ( accommodation );
+
+
+CREATE TABLE eventmgt.team
+ (
+ id SERIAL,
+ event integer,
+ division integer,
+ state integer,
+ name text,
+ team_code text,
+ participants smallint,
+ room_block integer,
+ notes text
+ );
+
+ALTER TABLE eventmgt.team OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.team FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.team FROM postgres;
+GRANT ALL ON TABLE eventmgt.team TO postgres;
+GRANT ALL ON TABLE eventmgt.team TO nobody;
+GRANT ALL ON TABLE eventmgt.team_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.team_id_seq TO nobody;
+
+CREATE INDEX team_id_index ON eventmgt.team ( id );
+CREATE INDEX team_code_index ON eventmgt.team ( team_code );
+CREATE INDEX team_event_index ON eventmgt.team ( event );
+
+
+CREATE TABLE eventmgt.team_roster
+ (
+ id SERIAL,
+ team integer,
+ lname text,
+ fname text,
+ pos text,
+ notes text
+ );
+
+ALTER TABLE eventmgt.team_roster OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.team_roster FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.team_roster FROM postgres;
+GRANT ALL ON TABLE eventmgt.team_roster TO postgres;
+GRANT ALL ON TABLE eventmgt.team_roster TO nobody;
+GRANT ALL ON TABLE eventmgt.team_roster_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.team_roster_id_seq TO nobody;
+
+CREATE INDEX team_roster_id_index ON eventmgt.team_roster ( id );
+CREATE INDEX team_roster_team_index ON eventmgt.team_roster ( team );
+
+
+
+CREATE TABLE eventmgt.team_property
+ (
+ id SERIAL,
+ team integer,
+ property integer,
+ event integer,
+ start date,
+ stop date
+ );
+
+ALTER TABLE eventmgt.team_property OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.team_property FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.team_property FROM postgres;
+GRANT ALL ON TABLE eventmgt.team_property TO postgres;
+GRANT ALL ON TABLE eventmgt.team_property TO nobody;
+GRANT ALL ON TABLE eventmgt.team_property_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.team_property_id_seq TO nobody;
+
+CREATE INDEX team_property_id_index ON eventmgt.team_property ( id );
+CREATE INDEX team_property_team_id_index ON eventmgt.team_property ( team );
+CREATE INDEX team_property_property_id_index ON eventmgt.team_property ( property );
+CREATE INDEX team_property_event_id_index ON eventmgt.team_property ( event );
+
+
+CREATE TABLE eventmgt.accommodation
+ (
+ id SERIAL,
+ member integer,
+ name text,
+ title text,
+ category smallint,
+ descr text,
+ image text,
+ quant integer,
+ occupants smallint,
+ maxoccupants smallint,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.accommodation OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.accommodation FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.accommodation FROM postgres;
+GRANT ALL ON TABLE eventmgt.accommodation TO postgres;
+GRANT ALL ON TABLE eventmgt.accommodation TO nobody;
+GRANT ALL ON TABLE eventmgt.accommodation_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.accommodation_id_seq TO nobody;
+
+CREATE INDEX accommodation_id_index ON eventmgt.accommodation (id);
+CREATE INDEX accommodation_member_index ON eventmgt.accommodation (member);
+
+CREATE TABLE eventmgt.entrance
+ (
+ id SERIAL,
+ member integer,
+ name text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ country text,
+ zip text,
+ phone text,
+ lat float,
+ lon float,
+ descr text,
+ image text,
+ color text,
+ notes text,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.entrance OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.entrance FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.entrance FROM postgres;
+GRANT ALL ON TABLE eventmgt.entrance TO postgres;
+GRANT ALL ON TABLE eventmgt.entrance TO nobody;
+GRANT ALL ON TABLE eventmgt.entrance_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.entrance_id_seq TO nobody;
+
+CREATE INDEX entrance_id_index ON eventmgt.entrance (id);
+CREATE INDEX entrance_member_index ON eventmgt.entrance (member);
+CREATE INDEX entrance_sort_index ON eventmgt.entrance (sort);
+
+CREATE TABLE eventmgt.section
+ (
+ id SERIAL,
+ member integer,
+ name text,
+ descr text,
+ image text,
+ entrance integer,
+ notes text,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.section OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.section FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.section FROM postgres;
+GRANT ALL ON TABLE eventmgt.section TO postgres;
+GRANT ALL ON TABLE eventmgt.section TO nobody;
+GRANT ALL ON TABLE eventmgt.section_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.section_id_seq TO nobody;
+
+CREATE INDEX section_id_index ON eventmgt.section (id);
+CREATE INDEX section_member_index ON eventmgt.section (member);
+CREATE INDEX section_sort_index ON eventmgt.section (sort);
+
+CREATE TABLE eventmgt.performance
+ (
+ id SERIAL,
+ member smallint,
+ name text,
+ active boolean,
+ admin_only boolean,
+ descr text,
+ short_descr text,
+ start_date date,
+ end_date date,
+ purch_leadtime smallint,
+ image text,
+ policy text,
+ voucher_text text,
+ conf_text text,
+ notes text,
+ promote_in_cart boolean,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.performance OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.performance FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.performance FROM postgres;
+GRANT ALL ON TABLE eventmgt.performance TO postgres;
+GRANT ALL ON TABLE eventmgt.performance TO nobody;
+GRANT ALL ON TABLE eventmgt.performance_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.performance_id_seq TO nobody;
+
+CREATE INDEX performance_id_index ON eventmgt.performance (id);
+CREATE INDEX performance_member_index ON eventmgt.performance (member);
+CREATE INDEX performance_sort_index ON eventmgt.performance (sort);
+
+CREATE TABLE eventmgt.ticket
+ (
+ id SERIAL,
+ active boolean,
+ admin_only boolean,
+ ticket_type integer,
+ member integer,
+ name text,
+ title text,
+ section smallint,
+ date_specific boolean,
+ days_of_week integer,
+ start_date date,
+ end_date date,
+ time_specific boolean,
+ ticket_time time,
+ unlimited_use boolean,
+ uses smallint,
+ performance smallint,
+ unlimited_quant boolean,
+ quant integer,
+ consignment_type smallint,
+ cart_sticky boolean,
+ show_on_start boolean,
+ price float,
+ descr text,
+ image text,
+ voucher_text text,
+ voucher_type integer,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.ticket OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_id_seq TO nobody;
+
+CREATE INDEX ticket_id_index ON eventmgt.ticket (id);
+CREATE INDEX ticket_member_index ON eventmgt.ticket (member);
+CREATE INDEX ticket_section_index ON eventmgt.ticket (section);
+
+CREATE TABLE eventmgt.ticket_package
+ (
+ id SERIAL,
+ package integer,
+ ticket integer,
+ member integer,
+ performance integer,
+ quant integer,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.ticket_package OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_package FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_package FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_package TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_package TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_package_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_package_id_seq TO nobody;
+
+CREATE INDEX ticket_package_id_index ON eventmgt.ticket_package (id);
+CREATE INDEX ticket_package_package_index ON eventmgt.ticket_package (package);
+CREATE INDEX ticket_package_ticket_index ON eventmgt.ticket_package (ticket);
+
+CREATE TABLE eventmgt.member_scans_for
+ (
+ id SERIAL,
+ member integer,
+ scans_for integer
+ );
+
+ALTER TABLE eventmgt.member_scans_for OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.member_scans_for FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.member_scans_for FROM postgres;
+GRANT ALL ON TABLE eventmgt.member_scans_for TO postgres;
+GRANT ALL ON TABLE eventmgt.member_scans_for TO nobody;
+GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO nobody;
+
+CREATE INDEX member_scans_for_id_index ON eventmgt.member_scans_for (id);
+CREATE INDEX member_scans_for_member_index ON eventmgt.member_scans_for (member);
+CREATE INDEX member_scans_for_scans_for_index ON eventmgt.member_scans_for (scans_for);
+
+
+CREATE TABLE eventmgt.ticket_inventory
+ (
+ id SERIAL,
+ ticket integer,
+ member integer,
+ quant integer,
+ available integer,
+ sold integer,
+ ticket_date date,
+ ticket_time time,
+ active boolean
+ );
+
+ALTER TABLE eventmgt.ticket_inventory OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_inventory FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_inventory FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_inventory TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_inventory TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_inventory_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_inventory_id_seq TO nobody;
+
+CREATE INDEX ticket_inventory_id_index ON eventmgt.ticket_inventory (id);
+CREATE INDEX ticket_inventory_ticket_index ON eventmgt.ticket_inventory (ticket);
+CREATE INDEX ticket_inventory_member_index ON eventmgt.ticket_inventory (member);
+CREATE INDEX ticket_inventory_date_index ON eventmgt.ticket_inventory (ticket_date);
+
+CREATE TABLE eventmgt.ticket_add_on
+ (
+ id SERIAL,
+ ticket integer,
+ name text,
+ descr text,
+ add_on_type integer,
+ max_quant integer,
+ unit_name text,
+ unit_cost float
+ );
+
+ALTER TABLE eventmgt.ticket_add_on OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_add_on FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_add_on FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_add_on TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_add_on TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_add_on_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_add_on_id_seq TO nobody;
+
+CREATE INDEX ticket_add_on_id_index ON eventmgt.ticket_add_on (id);
+CREATE INDEX ticket_add_on_ticket_index ON eventmgt.ticket_add_on (ticket);
+
+CREATE TABLE eventmgt.promo_code
+ (
+ id SERIAL,
+ name text,
+ long_name text,
+ descr text,
+ start_date date,
+ end_date date,
+ notes text
+ );
+
+ALTER TABLE eventmgt.promo_code OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.promo_code FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.promo_code FROM postgres;
+GRANT ALL ON TABLE eventmgt.promo_code TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_code TO nobody;
+GRANT ALL ON TABLE eventmgt.promo_code_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_code_id_seq TO nobody;
+
+CREATE INDEX promo_code_id_index ON eventmgt.promo_code (id);
+CREATE INDEX promo_code_start_date_index ON eventmgt.promo_code (start_date);
+CREATE INDEX promo_code_end_date_index ON eventmgt.promo_code (end_date);
+
+CREATE TABLE eventmgt.promo_ticket
+ (
+ id SERIAL,
+ promo integer,
+ ticket integer,
+ promo_type integer,
+ amount float,
+ notes text
+ );
+
+ALTER TABLE eventmgt.promo_ticket OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.promo_ticket FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.promo_ticket FROM postgres;
+GRANT ALL ON TABLE eventmgt.promo_ticket TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_ticket TO nobody;
+GRANT ALL ON TABLE eventmgt.promo_ticket_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_ticket_id_seq TO nobody;
+
+CREATE INDEX promo_ticket_id_index ON eventmgt.promo_ticket (id);
+CREATE INDEX promo_ticket_ticket_index ON eventmgt.promo_ticket (ticket);
+
+CREATE TABLE eventmgt.room_detail
+ (
+ id SERIAL,
+ member integer,
+ accommodation integer,
+ occupants smallint,
+ room_type smallint,
+ bath_type smallint,
+ pullout_beds smallint,
+ single_beds smallint,
+ double_beds smallint,
+ queen_beds smallint,
+ king_beds smallint,
+ tv bool,
+ fridge bool,
+ safe bool,
+ descr text,
+ image text,
+ sort smallint
+ );
+
+ALTER TABLE eventmgt.room_detail OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.room_detail FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.room_detail FROM postgres;
+GRANT ALL ON TABLE eventmgt.room_detail TO postgres;
+GRANT ALL ON TABLE eventmgt.room_detail TO nobody;
+GRANT ALL ON TABLE eventmgt.room_detail_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.room_detail_id_seq TO nobody;
+
+CREATE INDEX room_detail_id_index ON eventmgt.room_detail (id);
+CREATE INDEX room_detail_member_index ON eventmgt.room_detail (member);
+CREATE INDEX room_detail_accom_index ON eventmgt.room_detail (accommodation);
+
+
+CREATE TABLE eventmgt.res_contact
+ (
+ id SERIAL,
+ contact_type int,
+ affiliation int,
+ fname text,
+ lname text,
+ org text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ country text,
+ zip text,
+ org_url text,
+ office_phone text,
+ mobile_phone text,
+ alt_phone text,
+ fax text,
+ email text,
+ login_id text,
+ alt_email text,
+ image text,
+ notes text,
+ create_date date,
+ active bool,
+ password text,
+ user_rights int
+ );
+
+ALTER TABLE eventmgt.res_contact OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.res_contact FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.res_contact FROM postgres;
+GRANT ALL ON TABLE eventmgt.res_contact TO postgres;
+GRANT ALL ON TABLE eventmgt.res_contact TO nobody;
+GRANT ALL ON TABLE eventmgt.res_contact_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.res_contact_id_seq TO nobody;
+
+CREATE INDEX res_contact_id_index ON eventmgt.res_contact (id);
+CREATE INDEX res_contact_affiliation_index ON eventmgt.res_contact (affiliation);
+CREATE INDEX res_contact_city_index ON eventmgt.res_contact (city);
+CREATE INDEX res_contact_email_index ON eventmgt.res_contact (email);
+CREATE INDEX res_contact_fname_index ON eventmgt.res_contact (fname);
+CREATE INDEX res_contact_lname_index ON eventmgt.res_contact (lname);
+CREATE INDEX res_contact_zip_index ON eventmgt.res_contact (zip);
+CREATE INDEX res_contact_login_id_index ON eventmgt.res_contact (login_id);
+
+
+CREATE TABLE eventmgt.event
+ (
+ id SERIAL,
+ name text,
+ event_code text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ descr text,
+ event_dates text,
+ active bool,
+ image text,
+ team_event bool,
+ days smallint,
+ start_date date,
+ end_date date,
+ cutoff_date date,
+ req_stay bool,
+ req_stay_arrive date,
+ req_stay_depart date,
+ req_stay_notice text,
+ open_res_date date,
+ conf_hours integer,
+ inven_hold_time integer,
+ sort smallint,
+ lat float,
+ lon float,
+ multiple_rooms bool,
+ max_rooms smallint,
+ cart_text text,
+ res_policy text,
+ can_policy text,
+ pmt_policy text,
+ res_msg text,
+ conf_msg text,
+ reserve_by_code bool,
+ central_payment bool,
+ central_payment_email text,
+ host_property smallint,
+ parking_image text,
+ parking_descr text
+ );
+
+ALTER TABLE eventmgt.event OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.event FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.event FROM postgres;
+GRANT ALL ON TABLE eventmgt.event TO postgres;
+GRANT ALL ON TABLE eventmgt.event TO nobody;
+GRANT ALL ON TABLE eventmgt.event_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.event_id_seq TO nobody;
+
+CREATE INDEX event_id_index ON eventmgt.event ( id );
+CREATE INDEX event_sort_index ON eventmgt.event ( sort );
+
+
+CREATE TABLE eventmgt.event_prop_dist
+ (
+ id SERIAL,
+ event integer,
+ event_lat float,
+ event_lon float,
+ member integer,
+ memb_lat float,
+ memb_lon float,
+ summary text,
+ start_addr text,
+ end_addr text,
+ distance text,
+ duration text
+ );
+
+ALTER TABLE eventmgt.event_prop_dist OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.event_prop_dist FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.event_prop_dist FROM postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_dist TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_dist TO nobody;
+GRANT ALL ON TABLE eventmgt.event_prop_dist_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_dist_id_seq TO nobody;
+
+CREATE INDEX event_prop_event_index ON eventmgt.event_prop_dist (event);
+CREATE INDEX event_prop_member_index ON eventmgt.event_prop_dist (member);
+
+
+CREATE TABLE eventmgt.inventory
+ (
+ id SERIAL,
+ date date,
+ member integer,
+ accommodation integer,
+ event integer,
+ assigned smallint,
+ available smallint,
+ rate float,
+ add_person float,
+ room_block text,
+ res_policy text,
+ can_policy text,
+ min_nights integer,
+ descr text
+ );
+
+ALTER TABLE eventmgt.inventory OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.inventory FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.inventory FROM postgres;
+GRANT ALL ON TABLE eventmgt.inventory TO postgres;
+GRANT ALL ON TABLE eventmgt.inventory TO nobody;
+GRANT ALL ON TABLE eventmgt.inventory_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.inventory_id_seq TO nobody;
+
+CREATE INDEX inventory_id_index ON eventmgt.inventory ( id );
+CREATE INDEX inventory_date_index ON eventmgt.inventory ( date );
+CREATE INDEX inventory_member_index ON eventmgt.inventory ( member );
+CREATE INDEX inventory_accom_index ON eventmgt.inventory ( accommodation );
+
+
+CREATE TABLE eventmgt.inven_hold
+ (
+ id SERIAL,
+ hold_type integer,
+ inventory integer,
+ quant integer,
+ expire_time timestamp,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.inven_hold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.inven_hold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.inven_hold FROM postgres;
+GRANT ALL ON TABLE eventmgt.inven_hold TO postgres;
+GRANT ALL ON TABLE eventmgt.inven_hold TO nobody;
+GRANT ALL ON TABLE eventmgt.inven_hold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.inven_hold_id_seq TO nobody;
+
+CREATE INDEX inven_hold_inventory_index ON eventmgt.inven_hold (inventory);
+CREATE INDEX inven_hold_session_id_index ON eventmgt.inven_hold (session_id);
+
+
+CREATE TABLE eventmgt.member
+ (
+ id SERIAL,
+ member_type smallint,
+ name text,
+ descr text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ lat float,
+ lon float,
+ active boolean,
+ cards_accepted smallint,
+ payment_gateway smallint,
+ gateway_par1 text,
+ gateway_par2 text,
+ gateway_par3 text,
+ gateway_par4 boolean,
+ gateway_par5 text,
+ paypal boolean,
+ paypal_client_id text,
+ paypal_secret text,
+ paypal_mode smallint,
+ image text,
+ parking_map text,
+ ticket_sec_map text,
+ ticket_spec_req boolean,
+ ticket_policy text,
+ intro_text text,
+ checkout_email text,
+ phone text,
+ email text,
+ proc_email text,
+ proc_email2 text,
+ checkout_notify boolean,
+ check_in time,
+ check_out time,
+ def_res_pol text,
+ def_can_pol text,
+ notes text,
+ amen_1 boolean,
+ amen_2 boolean,
+ amen_3 boolean,
+ amen_4 boolean,
+ amen_5 boolean,
+ amen_6 boolean,
+ amen_7 boolean,
+ amen_8 boolean,
+ amen_9 boolean,
+ amen_10 boolean,
+ def_ticket_pol text,
+ sort integer,
+ checkout_opt_1 text,
+ checkout_opt_2 text,
+ checkout_opt_3 text
+ );
+
+ALTER TABLE eventmgt.member OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.member FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.member FROM postgres;
+GRANT ALL ON TABLE eventmgt.member TO postgres;
+GRANT ALL ON TABLE eventmgt.member TO nobody;
+GRANT ALL ON TABLE eventmgt.member_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.member_id_seq TO nobody;
+
+CREATE INDEX member_id_index ON eventmgt.member ( id );
+
+CREATE TABLE eventmgt.amenities
+ (
+ id SERIAL,
+ affiliation_type smallint,
+ owner smallint,
+ name text,
+ quant int,
+ descr text
+ );
+
+ALTER TABLE eventmgt.amenities OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.amenities FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.amenities FROM postgres;
+GRANT ALL ON TABLE eventmgt.amenities TO postgres;
+GRANT ALL ON TABLE eventmgt.amenities TO nobody;
+GRANT ALL ON TABLE eventmgt.amenities_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.amenities_id_seq TO nobody;
+
+CREATE INDEX amenities_id_index ON eventmgt.amenities ( id );
+CREATE INDEX amenities_owner_index ON eventmgt.amenities ( owner );
+
+
+CREATE TABLE eventmgt.event_prop
+ (
+ id SERIAL,
+ event integer,
+ property integer
+ );
+
+ALTER TABLE eventmgt.event_prop OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.event_prop FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.event_prop FROM postgres;
+GRANT ALL ON TABLE eventmgt.event_prop TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop TO nobody;
+GRANT ALL ON TABLE eventmgt.event_prop_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.event_prop_id_seq TO nobody;
+
+CREATE INDEX event_prop_event_id_index ON eventmgt.event_prop ( event );
+CREATE INDEX event_prop_property_id_index ON eventmgt.event_prop ( property );
+
+CREATE TABLE eventmgt.reservation
+ (
+ id SERIAL,
+ user_trace_info text,
+ fname text,
+ lname text,
+ org text,
+ team_id smallint,
+ state_rep smallint,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ phone text,
+ email text,
+ email_ok bool,
+ date_entered date,
+ arrive_date date,
+ nights smallint,
+ rooms smallint,
+ adults smallint,
+ team smallint,
+ member integer,
+ accommodation int,
+ room_block integer,
+ arrival text,
+ event smallint,
+ event_name text,
+ event_start date,
+ event_end date,
+ payby smallint,
+ cctype text,
+ ccnumber text,
+ expire text,
+ ccname text,
+ cccode text,
+ hotel_price float,
+ taxes float,
+ grand_total float,
+ confirmation smallint,
+ confirmed bool,
+ declined bool,
+ conf_numb text,
+ date_confirmed date,
+ conf_by text,
+ conf_message text,
+ special_needs text,
+ notes text,
+ res_detail text,
+ summary text
+ );
+
+ALTER TABLE eventmgt.reservation OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.reservation FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.reservation FROM postgres;
+GRANT ALL ON TABLE eventmgt.reservation TO postgres;
+GRANT ALL ON TABLE eventmgt.reservation TO nobody;
+GRANT ALL ON TABLE eventmgt.reservation_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.reservation_id_seq TO nobody;
+
+CREATE INDEX reservation_id_index ON eventmgt.reservation ( id );
+CREATE INDEX reservation_lname_index ON eventmgt.reservation ( lname );
+CREATE INDEX reservation_fname_index ON eventmgt.reservation ( fname );
+CREATE INDEX reservation_email_index ON eventmgt.reservation ( email );
+CREATE INDEX reservation_arrive_index ON eventmgt.reservation ( arrive_date );
+
+
+CREATE TABLE eventmgt.ticket_order
+ (
+ id SERIAL,
+ user_trace_info text,
+ active boolean,
+ fname text,
+ lname text,
+ addr1 text,
+ addr2 text,
+ city text,
+ state text,
+ zip text,
+ country text,
+ phone text,
+ email text,
+ email_ok bool,
+ opt_field_1_name text,
+ opt_field_1 text,
+ opt_field_2_name text,
+ opt_field_2 text,
+ opt_field_3_name text,
+ opt_field_3 text,
+ purchase_date date,
+ member integer,
+ cctype text,
+ ccnumber text,
+ expire text,
+ ccname text,
+ ccconf text,
+ charge_total float,
+ special_needs text,
+ notes text,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.ticket_order OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_order FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_order FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_order TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_order TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_order_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_order_id_seq TO nobody;
+
+CREATE INDEX ticket_order_id_index ON eventmgt.ticket_order ( id );
+CREATE INDEX ticket_order_lname_index ON eventmgt.ticket_order ( lname );
+CREATE INDEX ticket_order_fname_index ON eventmgt.ticket_order ( fname );
+CREATE INDEX ticket_order_email_index ON eventmgt.ticket_order ( email );
+CREATE INDEX ticket_order_purchase_date_index ON eventmgt.ticket_order ( purchase_date );
+CREATE INDEX ticket_order_member_index ON eventmgt.ticket_order ( member );
+CREATE INDEX ticket_order_session_id_index ON eventmgt.ticket_order ( session_id );
+
+
+CREATE TABLE eventmgt.ticket_sold
+ (
+ id SERIAL,
+ ticket_order integer,
+ member integer,
+ member_name text,
+ assigned boolean,
+ assigned_from integer,
+ assigned_from_name text,
+ performance smallint,
+ performance_name text,
+ entrance smallint,
+ entrance_name text,
+ entrance_color text,
+ section smallint,
+ section_name text,
+ ticket integer,
+ ticket_name text,
+ is_package boolean,
+ package_sold_id text,
+ ticket_package integer,
+ package_name text,
+ date_specific boolean,
+ ticket_date date,
+ time_specific boolean,
+ ticket_time time,
+ start_date date,
+ end_date date,
+ likely_date date,
+ price_paid float,
+ policies text,
+ unlimited_use boolean,
+ numb_uses smallint,
+ numb_claimed smallint,
+ time_claimed timestamp,
+ voucher_type smallint,
+ voucher_text text,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.ticket_sold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_sold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_sold FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_sold TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_sold TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_sold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_sold_id_seq TO nobody;
+
+CREATE INDEX ticket_sold_id_index ON eventmgt.ticket_sold ( id );
+CREATE INDEX ticket_sold_ticket_order_index ON eventmgt.ticket_sold ( ticket_order );
+CREATE INDEX ticket_sold_member_index ON eventmgt.ticket_sold ( member );
+CREATE INDEX ticket_sold_assigned_from_index ON eventmgt.ticket_sold ( assigned_from );
+CREATE INDEX ticket_sold_performance_index ON eventmgt.ticket_sold ( performance );
+CREATE INDEX ticket_sold_ticket_index ON eventmgt.ticket_sold ( ticket );
+CREATE INDEX ticket_sold_ticket_date_index ON eventmgt.ticket_sold ( ticket_date );
+CREATE INDEX ticket_sold_likely_date_index ON eventmgt.ticket_sold ( likely_date );
+CREATE INDEX ticket_sold_time_claimed_index ON eventmgt.ticket_sold ( time_claimed );
+CREATE INDEX ticket_sold_session_id_index ON eventmgt.ticket_sold ( session_id );
+CREATE INDEX ticket_sold_package_sold_id_index ON eventmgt.ticket_sold ( package_sold_id );
+CREATE INDEX ticket_sold_ticket_package_index ON eventmgt.ticket_sold ( ticket_package );
+
+CREATE TABLE eventmgt.add_on_sold
+ (
+ id SERIAL,
+ ticket_order integer,
+ ticket_sold integer,
+ add_on_name text,
+ add_on_type integer,
+ add_on_type_name text,
+ unit_name text,
+ unit_price float,
+ quant integer,
+ price_paid float,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.add_on_sold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.add_on_sold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.add_on_sold FROM postgres;
+GRANT ALL ON TABLE eventmgt.add_on_sold TO postgres;
+GRANT ALL ON TABLE eventmgt.add_on_sold TO nobody;
+GRANT ALL ON TABLE eventmgt.add_on_sold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.add_on_sold_id_seq TO nobody;
+
+CREATE INDEX add_on_sold_id_index ON eventmgt.add_on_sold ( id );
+CREATE INDEX add_on_sold_ticket_order_index ON eventmgt.add_on_sold ( ticket_order );
+CREATE INDEX add_on_sold_ticket_sold_index ON eventmgt.add_on_sold ( ticket_sold );
+CREATE INDEX add_on_sold_session_id_index ON eventmgt.add_on_sold ( session_id );
+
+CREATE TABLE eventmgt.promo_sold
+ (
+ id SERIAL,
+ ticket_order integer,
+ ticket_sold integer,
+ promo integer,
+ promo_name text,
+ promo_type integer,
+ promo_type_name text,
+ amount float,
+ session_id text
+ );
+
+ALTER TABLE eventmgt.promo_sold OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.promo_sold FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.promo_sold FROM postgres;
+GRANT ALL ON TABLE eventmgt.promo_sold TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_sold TO nobody;
+GRANT ALL ON TABLE eventmgt.promo_sold_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.promo_sold_id_seq TO nobody;
+
+CREATE INDEX promo_sold_id_index ON eventmgt.promo_sold ( id );
+CREATE INDEX promo_sold_ticket_order_index ON eventmgt.promo_sold ( ticket_order );
+CREATE INDEX promo_sold_ticket_sold_index ON eventmgt.promo_sold ( ticket_sold );
+CREATE INDEX promo_sold_promo_index ON eventmgt.promo_sold ( promo );
+CREATE INDEX promo_sold_session_id_index ON eventmgt.promo_sold ( session_id );
+
+
+CREATE TABLE eventmgt.ticket_claim_tracking
+ (
+ id SERIAL,
+ ticket_order integer,
+ ticket_sold integer,
+ time_of_action timestamp,
+ action_type smallint,
+ quant smallint,
+ scan_user integer,
+ scan_name text,
+ attendance smallint,
+ attendee_name text,
+ attendee_notes text
+ );
+
+ALTER TABLE eventmgt.ticket_claim_tracking OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.ticket_claim_tracking FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.ticket_claim_tracking FROM postgres;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking TO nobody;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.ticket_claim_tracking_id_seq TO nobody;
+
+CREATE INDEX ticket_claim_tracking_id_index ON eventmgt.ticket_claim_tracking ( id );
+CREATE INDEX ticket_claim_tracking_order_index ON eventmgt.ticket_claim_tracking ( ticket_order );
+CREATE INDEX ticket_claim_tracking_sold_index ON eventmgt.ticket_claim_tracking ( ticket_sold );
+CREATE INDEX ticket_claim_tracking_scan_user_index ON eventmgt.ticket_claim_tracking ( scan_user );
+
+
+CREATE TABLE eventmgt.attendance
+ (
+ id SERIAL,
+ member smallint,
+ name text,
+ notes text,
+ attendance_date timestamp,
+ entrance_start_time timestamp,
+ entrance_end_time timestamp,
+ perf_start_time timestamp,
+ perf_end_time timestamp
+ );
+
+ALTER TABLE eventmgt.attendance OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.attendance FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.attendance FROM postgres;
+GRANT ALL ON TABLE eventmgt.attendance TO postgres;
+GRANT ALL ON TABLE eventmgt.attendance TO nobody;
+GRANT ALL ON TABLE eventmgt.attendance_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.attendance_id_seq TO nobody;
+
+CREATE INDEX attendance_id_index ON eventmgt.attendance ( id );
+CREATE INDEX attendance_lmember_index ON eventmgt.attendance ( member );
+CREATE INDEX attendance_performance_index ON eventmgt.attendance ( performance );
+CREATE INDEX attendance_attendance_date_index ON eventmgt.attendance ( attendance_date );
+CREATE INDEX attendance_entrance_start_time_index ON eventmgt.attendance ( entrance_start_time );
+CREATE INDEX attendance_perf_start_time_index ON eventmgt.attendance ( perf_start_time );
+
+
+CREATE TABLE eventmgt.voucher_coupons
+ (
+ id SERIAL,
+ name text,
+ active boolean,
+ display_from timestamp,
+ display_to timestamp,
+ coupon_type smallint,
+ coupon_image text,
+ coupon_position smallint,
+ stretch_to_fit boolean,
+ padding integer,
+ show_border boolean,
+ max_display_count smallint,
+ display_count integer,
+ notes text
+ );
+
+ALTER TABLE eventmgt.voucher_coupons OWNER TO postgres;
+REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM PUBLIC;
+REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM postgres;
+GRANT ALL ON TABLE eventmgt.voucher_coupons TO postgres;
+GRANT ALL ON TABLE eventmgt.voucher_coupons TO nobody;
+GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO postgres;
+GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO nobody;
+
+CREATE INDEX voucher_coupons_id_index ON eventmgt.voucher_coupons ( id );
+CREATE INDEX voucher_coupons_from_index ON eventmgt.voucher_coupons ( display_from );
+CREATE INDEX voucher_coupons_to_index ON eventmgt.voucher_coupons ( display_to );
+
diff --git a/docs/Current_Deployment_Notes.txt b/docs/Current_Deployment_Notes.txt
new file mode 100644
index 0000000..4be5dc8
--- /dev/null
+++ b/docs/Current_Deployment_Notes.txt
@@ -0,0 +1,638 @@
+Current Deployment Notes
+========================
+
+
+NEW CHANGES
+
+ DATABASE CHANGES
+ ----------------
+
+ CREATE TABLE eventmgt.voucher_coupons
+ (
+ id SERIAL,
+ name text,
+ active boolean,
+ display_from timestamp,
+ display_to timestamp,
+ coupon_type smallint,
+ coupon_image text,
+ coupon_position smallint,
+ stretch_to_fit boolean,
+ padding integer,
+ show_border boolean,
+ max_display_count smallint,
+ display_count integer,
+ notes text
+ );
+
+ ALTER TABLE eventmgt.voucher_coupons OWNER TO postgres;
+ REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM PUBLIC;
+ REVOKE ALL ON TABLE eventmgt.voucher_coupons FROM postgres;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons TO postgres;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons TO nobody;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO postgres;
+ GRANT ALL ON TABLE eventmgt.voucher_coupons_id_seq TO nobody;
+
+ CREATE INDEX voucher_coupons_id_index ON eventmgt.voucher_coupons ( id );
+ CREATE INDEX voucher_coupons_from_index ON eventmgt.voucher_coupons ( display_from );
+ CREATE INDEX voucher_coupons_to_index ON eventmgt.voucher_coupons ( display_to );
+
+
+
+ ALTER TABLE eventmgt.ticket_sold ADD COLUMN package_name text;
+ update eventmgt.ticket_sold set package_name = '';
+ ALTER TABLE eventmgt.ticket_sold ADD COLUMN is_package boolean;
+ update eventmgt.ticket_sold SET is_package = false;
+
+ ALTER TABLE eventmgt.ticket_sold ADD COLUMN package_sold_id text;
+
+ CREATE INDEX ticket_sold_package_sold_id_index ON eventmgt.ticket_sold ( package_sold_id );
+ CREATE INDEX ticket_sold_ticket_package_index ON eventmgt.ticket_sold ( ticket_package );
+
+ CREATE TABLE eventmgt.attendance
+ (
+ id SERIAL,
+ member smallint,
+ name text,
+ notes text,
+ attendance_date timestamp,
+ entrance_start_time timestamp,
+ entrance_end_time timestamp,
+ perf_start_time timestamp,
+ perf_end_time timestamp
+ );
+
+ ALTER TABLE eventmgt.attendance OWNER TO postgres;
+ REVOKE ALL ON TABLE eventmgt.attendance FROM PUBLIC;
+ REVOKE ALL ON TABLE eventmgt.attendance FROM postgres;
+ GRANT ALL ON TABLE eventmgt.attendance TO postgres;
+ GRANT ALL ON TABLE eventmgt.attendance TO nobody;
+ GRANT ALL ON TABLE eventmgt.attendance_id_seq TO postgres;
+ GRANT ALL ON TABLE eventmgt.attendance_id_seq TO nobody;
+
+ CREATE INDEX attendance_id_index ON eventmgt.attendance ( id );
+ CREATE INDEX attendance_lmember_index ON eventmgt.attendance ( member );
+ CREATE INDEX attendance_attendance_date_index ON eventmgt.attendance ( attendance_date );
+ CREATE INDEX attendance_entrance_start_time_index ON eventmgt.attendance ( entrance_start_time );
+ CREATE INDEX attendance_perf_start_time_index ON eventmgt.attendance ( perf_start_time );
+
+ ALTER TABLE eventmgt.ticket_claim_tracking ADD COLUMN attendance smallint;
+ ALTER TABLE eventmgt.ticket_claim_tracking ADD COLUMN attendee_name text;
+ ALTER TABLE eventmgt.ticket_claim_tracking ADD COLUMN attendee_notes text;
+ CREATE INDEX ticket_claim_tracking_attendance_index ON eventmgt.ticket_claim_tracking ( attendance );
+ UPDATE eventmgt.ticket_claim_tracking SET attendance = 0, attendee_name = '', attendee_notes = '';
+
+ CREATE TABLE eventmgt.member_scans_for
+ (
+ id SERIAL,
+ member integer,
+ scans_for integer
+ );
+
+ ALTER TABLE eventmgt.member_scans_for OWNER TO postgres;
+ REVOKE ALL ON TABLE eventmgt.member_scans_for FROM PUBLIC;
+ REVOKE ALL ON TABLE eventmgt.member_scans_for FROM postgres;
+ GRANT ALL ON TABLE eventmgt.member_scans_for TO postgres;
+ GRANT ALL ON TABLE eventmgt.member_scans_for TO nobody;
+ GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO postgres;
+ GRANT ALL ON TABLE eventmgt.member_scans_for_id_seq TO nobody;
+
+ CREATE INDEX member_scans_for_id_index ON eventmgt.member_scans_for (id);
+ CREATE INDEX member_scans_for_member_index ON eventmgt.member_scans_for (member);
+ CREATE INDEX member_scans_for_scans_for_index ON eventmgt.member_scans_for (scans_for);
+
+
+
+
+ CONFIG CHANGES
+ --------------
+
+ ; Terms used to refer to an attendance
+ term.attendance.norm = "attendance"
+ term.attendance.cap = "Attendance"
+ term.attendance.plur = "attendance"
+ term.attendance.plur_cap = "Attendance"
+
+ ; Terms used to refer to an attendee
+ term.attendee.norm = "attendee"
+ term.attendee.cap = "Attendee"
+ term.attendee.plur = "attendees"
+ term.attendee.plur_cap = "Attendees"
+
+ ; Terms used to refer to an attendance log
+ term.attendance_log.norm = "attendance log"
+ term.attendance_log.cap = "Attendance Log"
+ term.attendance_log.plur = "attendance logs"
+ term.attendance_log.plur_cap = "Attendance Logs"
+
+ ; Terms used to refer to entering (attendance)
+ term.attendance_entering.norm = "entering"
+ term.attendance_entering.cap = "Entering"
+ term.attendance_entering.plur = "entering"
+ term.attendance_entering.plur_cap = "Entering"
+
+ ; Terms used to refer to Coupons (advertisements) for vouchers
+ term.coupon.norm = "voucher coupon"
+ term.coupon.cap = "Voucher Coupon"
+ term.coupon.plur = "voucher coupons"
+ term.coupon.plur_cap = "Voucher Coupons"
+
+
+
+------------END OF NEW CHANGES NOTES------------------------------------
+
+Mackinaw Lakeshore Development (Mackinaw City)
+Username: hydrojet955
+Password: Mc33BoAt
+Current API Login ID: 6AkBG3xJ7HB
+Current Transaction Key: 6tJ5BxaB4X4f37JE
+
+Star Line Mackinac Island Passenger Service Inc. (St Ignace)
+Username: hydrojet956
+Password: Mc34BoAt
+Current API Login ID: 3Wazxf7G5u97
+Current Transaction Key: 3TW7f7Z28p5m4x9Y
+
+
+Database Update Notes
+---------------------
+
+
+
+Temporary Notes from Notepad
+----------------------------
+
+Jodie Things and other thing I've noticed
+
+* Include contact permission options to enable access to all locations data
+
+* Fix problems with Likely date not being validated
+ DONE
+
+* Check on correct "From:" E-Mail address for confirmation messages.
+
+* Agree to policies on checkout page not staying as what was selected when checkout fails.
+
+* Session ID or something not going to Authorize.net for use as an order ID.
+
+* Inventory may not be being created when a ticket is created.
+
+Longer term Jodie Things
+
+* One credit card checkout form
+
+* Need to consider limits on report results.
+
+To do
+
+* Can't use Add-ons for children in sunset cruises
+
+* Promo Codes not working on checkout - Check again
+ DONE
+
+* Make sure promo codes respect time ranges
+ DONE
+
+* Add "Code Recognized" indication to cart
+
+* Check if we should be storing ID of Add-on in add_on_sold table.
+
+* Make Checkout Results look like current checkout page for tables.
+ DONE
+
+* make likely date = ticket date if fixed date
+
+* may be issue with selection on "Ticket Select" page (cruises) when there's unlimited quantity and the underlying quant field is 0 or null.
+
+* Flag to permit voucher scanning by contact from any location
+
+* Ticket claim tracking
+
+* Check if login user can check/claim tickets at all locations - May need to make this a configuration option per customer.
+ Use option to suppress location name at top of page.
+
+
+
+Done
+
+* checkout now storing add-ons correctly
+
+* Vouchers now showing add-ons correctly
+
+* Sticky items showing up when category is active = false
+
+
+
+
+
+Current modifications to complete for Star Line
+-----------------------------------------------
+
+QUESTIONS
+
+ Are the dates on promo codes the date of purchase or the date of use?
+ ANSWER: Date of sale.
+
+Vouchers:
+
+ * Specified color per dock for voucher and for display when scanning vouchers.
+ Not always displaying correctly - Check
+ DONE - If not an assignment, the Section must specify an entrance and entrance must have color.
+
+ * 90 deg Rotated text not displaying in the correct position and moves as text changes.
+ DONE - Needed to use "left" for $align in glmpdfPlaceText() then "position=center" in the optlist.
+
+ * Summary of items purchased and totals on voucher cover page
+ DONE
+
+ * Policies per location for display on cover sheet of voucher.
+ DONE
+
+ * Simple (limited) text per category (performance) for display on bottom of voucher.
+ DONE
+
+ * Provide for blocking of printing Voucher Barcode if card will be printed and mailed. Note on voucher.
+ DONE - NEED TO TEST WITH PURCHASE
+
+ * Properly show add-ons
+ DONE
+
+Voucher related functionality:
+
+ * Ability to show just barcode for a specific voucher for possible scanning from a phone.
+ NOT DOING AT THIS TIME
+
+ * Ability of customers to enter a voucher number (and check code) to view order and re-print vouchers and display barcode for phone scanning.
+ NOT DOING AT THIS TIME
+
+ * Check on auto-scaling image on Voucher
+
+ * Check fonts on Dev53 used by Vouchers
+
+Front-End General:
+
+ * Removed number of "uses" from display on Front-end. Relying on descriptions to say how the tickets will be used.
+ DONE
+
+ * Fixed improper reference to ticket.ticket_name when should have been ticket.ticket_title for use on front-end.
+ DONE
+
+ * Test in Chrome and other browsers
+
+ * Test in mobile widths
+
+ * Check sort order of all output
+ DONE - for everything we're showing for Star Line
+
+ * Make sure that all available data can be displayed. (descriptions, images, etc). Set configurable options (in config/applications/EventManagement.ini) to turn those on/off.
+ DONE
+
+ * Sale of "group" tickets, like 2 Adults and 2 Children, should be on one voucher (which they are now). Need to confirm with Star Line.
+ DONE - Must be this way as they are group tickets.
+
+ * Look for "Check if we're receiving an array of new additions" in front/classes/support.php and check on this.
+
+ * Make sure add-ons work on ticketSelect page.
+
+ * Check that all new information is passed all the way through to orders
+
+Cart Page:
+
+ * Check on ordering of categories. They don't seem to follow the sort order field in the database.
+ DONE
+
+ * Have "nights" selection for valet parking display right away when user selects quantity for valet parking.
+ DONE - Decided to show it all the time for now.
+
+ * Have resubmit updates try to return to the same page scroll position.
+ DONE
+
+ * Check on not showing Dock selection or likely departure date unless they're needed. This is interfering with ordering things that don't need them.
+ DONE
+
+ * Consider adding a notice overlay when the first thing is selected that needs dock and date selection to instruct user that they need to enter that information.
+
+ * Remove the "reprint a previous order" thing from the top of the page.
+ DONE
+
+ * Added short descriptions to Categories. In cart use short description instead of normal when less than 600 wide.
+ DONE
+
+Checkout page:
+
+ * Make checkout page items lists look like Cart page
+ DONE - But might need to check what's store
+
+ * Make checkout prompt fields configurable in customer config file.
+ DONE
+
+ * Add a few optional/configurable text fields for checkout
+ DONE
+
+ * Fixed Special Requests field showing when not requested
+ DONE
+
+ * Fixed improper reference to ticket.ticket_name when should have been ticket.ticket_title for use on front-end.
+ DONE
+
+ * Fixed missing info for ticket orders.
+ DONE
+
+ * Check storage of promotions with purchase
+
+ * Check storage of Add-Ons with purchase
+ DONE
+
+Admin:
+
+ * Admin Login and improved colored claim scan results indications
+ DONE
+
+ * Test in Chrome and other browsers
+
+ * See if can do better with consignment type text - less confusing
+ DONE - Might want to move text for these things to customer config
+
+ * Add time override to inventory - Default to that set in the ticket
+ Added to inventory edit
+ Need to use that time throughout the rest of admin and front-end
+ SUSPENDED FOR NOW
+
+ * Fix issues with small and large list switching and alignment of columns when selecting large/small or resizing window.
+ DONE
+
+ * Redisplay lists when something is added deleted or edited.
+ Need to add feature to know where the list is so it can be updated.
+ Working on this....
+
+ * Low-level front-end admin access.
+ DONE
+
+ * Background color on scan of voucher to show Pass/No Pass status.
+ DONE
+
+ * Inventory calendars not showing all dates at times
+
+ * Add link from a performance to permit purchasing from admin even if performance or ticket is not active.
+ Added flag to ticket to permit active boolean, but need to Respect in front-end.
+
+ * Add any needed reporting for promotions
+
+ * Add any needed reporting for Add-Ons
+
+ * Consider copying default ticket time into inventory so that a specific inventory item can have the time of the event adjusted.
+ Only do this if there's time available for the change.
+
+ * Consider adding a "Category" parameter to performances to permit categorizing performances. (This would mean changing how we use these terms for Star Line.)
+
+Not-categorized:
+
+* May need to consider non-date-related items such as purchased physical items (books, etc) - Don't show likely departure date in cart for these.
+
+* Consider adding year/season to all ticket data and establishing a "seasonal" option that lets admin select a year/season to work with.
+
+* Check Member Ticket Policy - Does not seem to be in detail or edit.
+
+* Agree to policies on checkout needs to be in red - required.
+
+* Need to complete tracking of multiple claims for tickets that can be claimed more than once.
+ Database seems to be setup, but need to add tracking and display in ticket sold display
+
+* Need to add code to handle editing of tickets sold.
+
+* Check on adding entrance to ticket. May not always be able to use "Entrance" from section
+ i.e. Sunset Cruises.
+ DONE - may need some work later to make this more universal
+
+* Check on doing a pop-up message when checkout completed instructing users to print tickets or retain order and voucher numbers.
+
+* Voucher cover page
+ Web address
+ Phone Numbers
+ Maps??? Or do the appropriate map with each voucher.
+
+* Set a date range for creating inventory in ticket edit
+ This should be used as the date range when building inventory
+ It should be the dates checked when checking if inventory needs to be added or turned off
+ It should default to the date range specified in the event
+ DONE - But not defaulting to performance dates
+
+* Need to handle Valet Parking
+ Valet parking is charged per night.
+ Consider this a ticket "Add-On" item
+ Select 1 or multiple for an add-on item (yes/no or quantity)
+ Optional Price per add-on
+ Include field to say what this is (i.e "Per Night", or "Each")
+ Should show on line below primary line for ticket.
+
+ Ticket Add-On
+
+ * create table ticket_add_on
+ name
+ description
+ type (single (option), selected quantity,
+ other - perhaps packaging of other tickets)
+ see "ticket_add_on_type" in config
+ max quantity if quantity related
+ unit name
+ unit amount
+
+ * Add admin management of add-ons for a specific ticket
+
+ * Add handling of add-ons when selecting tickets and in cart and checkout
+
+ * Add handling of add-ons in reporting.
+
+ Added to admin but not done on front-end
+
+* Promo Code
+ Entry of Promo Code text
+ Each promo code has list of tickets it applies to
+ Each promo code provides either percentage or $ amount
+
+ promo_code
+ id SERIAL,
+ name text,
+ descr text,
+ start_date date,
+ end_date date,
+ notes text
+
+ promo_ticket
+
+ id SERIAL,
+ ticket text,
+ promo_type integer,
+ amount float,
+ notes text
+
+
+* Check on entrance display in Section selection page.
+
+Completed
+
+* Toggle list size button for lists in admin.
+ DONE
+
+* Need to add time specific, # of uses, and number of claims to ticket sold data
+ DONE
+
+* For vouchers "Round Trip Ticket", "Retain this ticket for your return trip.
+ Now configurable text per ticket or event
+ DONE
+
+* Forget session button when running on Development server
+ Added to bottom of all pages if running on a development server
+ DONE
+
+* Add better "Please Wait" thingy.
+ Added pop-up/overlay for pages needing this.
+ DONE
+
+* Departure date for non-date-specific tickets
+ Added likely departure date to cart and likely date to checkout
+ Need to add to ticket order information also
+ DONE
+
+* Remove "Each" from cart and checkout tables
+ DONE
+
+* Add second doc (location) handling for St. Ignace
+ Added "Entrance" feature to ticketing system and termed this as "Docks" for Star Line
+ Still need to get this printing on summaries and vouchers
+ DONE
+
+* Checkout contact information "Please send information ..." should default to checked.
+ DONE
+
+* "Print Vouchers" to "Print Boarding Passes" ???
+ Changed terms used for "Voucher" to "Boarding Pass"
+ DONE
+
+* Enable browser menus on the voucher window so people can print.
+ Enabled menus and added window.print() to script
+ DONE
+
+-------
+
+
+
+* Create new optional Purchase process for Star Line
+ See "Streamlined Ticketing for Star Line.odg"
+
+ Venues need "type"
+ type 1 Standard Location/venue
+ Can sell items
+ type 2 Standard Location/venue + Sell through other venues
+ Can sell items
+ Can offer items for sale by other locations
+ Must flag items to be sold this way
+ Other vendors must be approved by this vendor to sell their stuff
+ Items must be flagged as sellable by others
+ (may want to have specific ticket negotiations)
+ type 3 Non-sales vendor, tickets only sold by type 1 or 2 locations/venues on this system
+ Does not sell items
+ Items of Type 3 are available for sale by type 2
+
+ Ticket need flag that permits them to be sold by other vendors
+
+ Need flag for ticket that causes it to always be shown on cart - even with 0 quantity.
+
+ Ticket sold needs pointer to vendor who sold the ticket/item (in addition to the point to the member who's tickets they are)
+
+* Try to sort cart by ticket sort order
+
+* Set global terms
+ location: Departing From
+ (Consider adding categories of events)
+ Event: Category ???
+ Section: Section
+ Ticket: Item
+ Inventory: Inventory
+
+* Get info on Motorola hand scanners for Jerry - May need 8 to 10 - Most WiFi but some Cell.
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning#
+
+ Possible options - Prices approx
+
+ Simple for use with computer
+ $108 (Amazon) http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning/General+Purpose+Scanners/LI2208
+ $380 (Amazon) http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning/General+Purpose+Scanners/LI4278
+
+ Wireless
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MT2000+Series+Handheld+Mobile+Terminals_US-EN
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MC55A0
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Bar+Code+Scanning/Rugged+Scanners/MT2000+Series+Handheld+Mobile+Terminals_US-EN
+
+ Ruggedized Mobile Computer
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MC3100_US-EN
+
+ Cell Capable
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/TC55#specs_tab
+ http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Mobile+Computers/Handheld+Computers/MC67
+
+
+* Create Venue - Event - Section - Ticket - Inventory summary with flags for issues in Admin area
+ Expandable sections might be good
+
+* Update reports to work correctly with all new changes
+
+* Add Month and Day of Week enable/dissable for inventory edit page
+ * Consider being able to highlight date cells and do bulk edit with them.
+
+* Update Help file and enable context sensitive admin help
+
+
+
+Issues to check on
+------------------
+
+* Make sure default inventory is created when tickets are created.
+
+* Make sure that tickets are not presented on the front-end unless there's inventory
+
+* Make sure that non-date-specific inventory is handled correctly
+ * Inventory edit updates quantities properly
+ * Front-end and reports use correct numbers
+
+* Make sure we're using the right name/title for tickets and other things (internal vs user terms)
+
+* Check on content of stored purchase summary
+
+* Check that credit card type and name on cart are stored in order detail
+
+* Make sure that multiple claims per ticket is working correctly and showing on back-end correctly
+
+
+
+
+
+
+OLD INFO - MAY NOT BE RELEVANT ANYMORE
+
+* Change any fees of type 11 or 12 that are in use to type 10
+* Check to make sure Toolkit/EventManagement/config.ini has updated fee definitions
+
+; Fee Method
+fee_method.fixed_stay = 1
+fee_method.fixed_accom = 2
+fee_method.fixed_accomnight = 3
+fee_method.percent_stay = 10
+
+; Fee Method Numbers - admin
+fee_method_numb.1 = "Per Reservation - Fixed Fee"
+fee_method_numb.2 = "Per Room - Fixed Fee"
+fee_method_numb.3 = "Per Night - Fixed Fee"
+fee_method_numb.10 = "% of Room Rate"
+
+; Fee Method Numbers - Front End
+fee_method_numb_fe.1 = "Per Reservation"
+fee_method_numb_fe.2 = "Per Room"
+fee_method_numb_fe.3 = "Per Night"
+fee_method_numb_fe.10 = "Per Room"
+
+
+alter table convention add column central_payment boolean;
+alter table convention add column central_payment_email text;
+alter table convention add column host_property smallint;
+update convention set central_payment = 'f', central_payment_email = '', host_property = 0;
diff --git a/docs/Delete_Event.sql b/docs/Delete_Event.sql
new file mode 100644
index 0000000..1ec7fea
--- /dev/null
+++ b/docs/Delete_Event.sql
@@ -0,0 +1,21 @@
+
+-- Find event ID
+SELECT id, name, conv_code, start_date, end_date FROM convention;
+
+
+-- Replace {CONV ID} with desired event id
+DELETE FROM team_roster WHERE team IN (SELECT id FROM team WHERE conv = {CONV ID});
+DELETE FROM team_property WHERE conv = {CONV ID};
+DELETE FROM team_property WHERE conv = {CONV ID};
+DELETE FROM state_rep WHERE conv = {CONV ID};
+DELETE FROM division WHERE conv = {CONV ID};
+DELETE FROM room_block WHERE conv = {CONV ID};
+DELETE FROM room_block_seg WHERE conv = {CONV ID};
+DELETE FROM inven_hold WHERE inventory IN (SELECT id FROM inventory WHERE conv = {CONV ID});
+DELETE FROM inventory WHERE conv = {CONV ID};
+DELETE FROM reservation WHERE conv = {CONV ID};
+DELETE FROM fees WHERE affiliation_type = 1 AND owner = {CONV ID};
+DELETE FROM conv_prop_dist WHERE convention = {CONV ID};
+DELETE FROM event_prop WHERE event = {CONV ID};
+DELETE FROM convention WHERE id = {CONV ID};
+
diff --git a/docs/Development_Notes.txt b/docs/Development_Notes.txt
new file mode 100644
index 0000000..47d4be3
--- /dev/null
+++ b/docs/Development_Notes.txt
@@ -0,0 +1,513 @@
+Current Work
+------------
+
+Notes regarding modifications to Ticketing to support ferry services
+
+Things to update
+----------
+SQL and database changes required for current updates
+
+alter table eventmgt.ticket add column unlimited_quant boolean;
+update eventmgt.ticket set unlimited_quant = false;
+alter table eventmgt.misc drop column return_url;
+alter table eventmgt.misc add column intro_text text;
+alter table eventmgt.misc add column ticket_text text;
+alter table eventmgt.misc add column ticket_opt_text text;
+alter table eventmgt.misc add column cart_text text;
+alter table eventmgt.misc add column checkout_text text;
+alter table eventmgt.misc add column success_text text;
+update eventmgt.misc set
+ intro_text = 'Intro text',
+ ticket_text = 'Ticket selection text',
+ ticket_opt_text = 'Ticket option selection text',
+ cart_text = 'Cart text',
+ checkout_text = 'Checkout text',
+ success_text = 'Checkout success text';
+
+Above needed for current devdb copy
+
+alter table eventmgt.ticket add column section_specific boolean;
+alter table eventmgt.ticket add column time_specific boolean;
+alter table eventmgt.ticket add column date_specific boolean;
+alter table eventmgt.ticket add column unlimited_use boolean;
+alter table eventmgt.ticket add column start_date date;
+alter table eventmgt.ticket add column end_date date;
+alter table eventmgt.ticket add column uses smallint;
+update eventmgt.ticket set
+ section_specific = true,
+ time_specific = true,
+ date_specific = true,
+ unlimited_use = false,
+ start_date = null,
+ end_date = null,
+ uses = 1;
+
+
+
+How to add a new main tab item to admin
+---------------------------------------
+
+* Edit view index.html and add a new tab where desired.
+* Set "emTabId" for that tab to the desired model and action (i.e. Attendees_list}
+* Create a matching directory under both...
+ models/admin/actions/{model}
+ views/admin/tickets/{model}
+* Add action include files in models/admin/actions/{model}. Typically these are...
+ add.inc, confirmDelete.inc, delete,inc, detail.inc, edit.inc, insert.inc, list.inc, selected.inc, update.inc
+* Add view files in views/admin/tickets/{model}. Typically these are...
+ added.html, deleted,html, detail.html, edit.html, list.html
+
+
+
+
+Update CommonAbstracts-PDF-V0
+-------------
+
+High priority for Starline
+
+* Check on creating tickets for an event needing to select the venu
+* Check on permitting selection of both date specific and non date specific tickets for the same event
+* Options to set defaults for checkboxes when creating tickets
+
+* Options for tickets
+ * No Section
+ * No time
+ * Non-date specific
+ * Active for specified range of dates for non-date specific tickets
+ * Multiple scans/uses for a single ticket - Specified number
+ * Unlimited scans/uses for ticket
+ * Unlimited inventory
+* Track Scan time, location, user when claiming tickets
+
+* Convert to Smarty Templates
+* Create admin/log-in user ticket sales interface
+* If a single venue, default to that venue when creating tickets and other things
+* Recommend other tickets/sales on ticket selection
+* Packaging
+ * Purchase multiple tickets as one item
+* Pre-sales to other sales agents
+ * Create agents to sell (use contacts with specified permissions)
+ * Track sales agent / means of sale for each ticket sold
+ Add "sold_by" field to ticket_sold table
+* Add filters to lists
+ * Active/inactive
+ * Venue
+ * Section
+ * Date range for ticket orders
+
+
+* Check on support for portable bar-code readers with audible/light/display confirmation.
+ BarcodesInc, Chicago 1-800-351-9962
+ * Hand held, weather proof, bar-code, WiFi, optional link to cell phone/service, display/audio for confirmation/info
+
+
+
+
+
+Things to check on
+
+* Checkout permitted with no cart contents if re-displaying checkout
+* on checkout fail (field not filled in) says "This venue does not have a payment method configured. Please call this venue to purchase tickets."
+* Need ability to display prototype of all E-Mail messages sent. Optionally all forms.
+
+
+
+
+* Need to split and verify application.ini file into common app and user configuration files.
+
+* Moving schema from reservations to eventmgt
+* Moving table convention to table event
+* Moving fields that point to event (convention) to event
+* Move ..._APP_BASE to THIS_APP_BASE as appropriate
+
+
+
+
+
+FROM V2 - Much still needs to be implemented
+
+Notes from 2/1/2013
+
+Do something to deal with someone double selecting the same available inventory into their cart.
+Cart should check for actual maximums available or we can implement the selected inventory hold.
+
+Check all property fees to see if any type 1 or type 10 are set as "Fee is selectable per room":
+
+For event fees, per room % of room rate seems to be superfluous.
+
+May need to check for per Reservation optional fee that's not per room on accommodations selection page.
+
+----
+
+
+
+DB updates
+ alter table convention add column central_payment boolean;
+ alter table convention add column central_payment_email text;
+ alter table convention add column host_property smallint;
+ update convention set central_payment = 'f', central_payment_email = '', host_property = 0;
+
+
+In procees
+ Central Payment
+ Admin work
+ * central_payment Flag
+ * central_payment_email Who gets bills
+ Request credit card Flag
+ Show prices to guests Flag
+ ??? Billing/payment reconciliation to members ???
+ Front-end
+ Request credit card if set
+ Send reservation to Prop
+ Send billing to central billing
+ Members Area
+ Look through to find things that might need to be fixed up
+ ??? payment reconciliation to members ???
+ Host Property
+ Admin
+ * Work completed
+ Front End
+ Need to display host propert at top of lists
+ Highlight background?
+
+
+
+
+
+General Development Notes
+
+alter table
+
+Fees Matrix
+
+ Available with
+ Applied at level Event Property
+ Per Reservation - Fixed Fee
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No No
+
+ Per Room - Fixed Fee
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No Yes
+
+ Per Night - Fixed Fee
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No Yes
+
+ % of Room Rate
+
+ Optional Off Property Yes Yes
+ Optional On Property Yes Yes
+ Selectable per room Accommodation No Yes
+
+
+Misc Notes
+----------
+
+Pending database updates for live servers
+-----------------------------------------
+
+For geo mapping address
+/*
+include this link
+http://maps.googleapis.com/maps/api/js?sensor=true
+
+// For the Event Map
+// Create a jquery dialog with #map-dialog
+$('#map-dialog').dialog({
+height: 480,
+width: 520,
+modal: true,
+autoOpen: false
+});
+$("#map-it").click(function(e){
+e.preventDefault();
+$("#map-dialog").dialog('open');
+GLM_GeoMap.initialize();
+});
+
+
+
+
+*/
+
+Site Status
+-----------
+
+ Server Site Version Notes
+ dev52 Development V1, V2
+ dev53 Development (pending)
+ ws0 app.gaslightmedia.com V1, V2
+ ws3 app.gaslightmedia.com V1, V2
+ www.discoverkalamazoo.com V2
+
+
+Task List
+---------
+
+GENERAL
+
+** Check for International Address Support
+ DONE
+
+** Add fields for E-Mail addresses to event (general contact, internal contact, from address)
+ Can we use Discover Kalamazoo in the from line and GeneralInfo@DiscoverKalamazoo.com as the email address? - Jodie
+
+** Ability to select an event that is charged to a central entity rather than to each attendee
+
+** Check owner name salutation line in confirmation e-mails.
+
+** Event ID as access to event registrations
+ DONE
+
+** Host property selection in event
+
+** Display of date/rates when rates are inconsistent for a stay
+
+* Purge any previous customer info or links from system (greatlakesbay)
+
+* Need to change calendar.phtml pop-up to all JAVAscript using a layer at some point.
+
+* Add "conv" field to inven_hold table to make it easier to identify by event.
+
+ADMIN AREA
+
+** Add Team filter and output sorting options to Reservations report
+
+* Add check for inventory that doesn't match the evnet dates when the dates for an event are changed.
+ Add check for this whenever the event is selected and prominantly warn the user.
+ Make sure that inventory associated with an event is displayed even if it's outside the date range for the event.
+ Add warning to inventory that is outside the date range for an event when listing/viewing that inventory.
+
+* Need to have system check to make sure inventory is in a rational date frame for the event. If the event date
+ changes, it needs to still be able to display what inventory is in there (which it seems to have a problem with)
+ and needs to warn the admin user that the inventory needs to be change. Consider adding code such that if the
+ event start date changes that all inventory slides the same number of days.
+
+* Add Division to reservation reports
+
+* Add Division to Events->Reservations list and detail
+
+* Check fees/taxes detail output to make sure $ & % are displayed correctly for selected type.
+
+* Add date for earliest possible reservation used to block reservations prior to a certain date.
+
+* Reservations report
+ Add table ordered by State Rep, Team
+ ***DONE*** Add filter for State Rep
+
+* Add map drag-drop capability for Lat/Lon input and refining positions.
+ Ask Steve for his code.
+
+* Check on styles properly loading for printed reports
+
+* Set table headers to not scroll in admin areas
+
+* Add property search field for Inventory list summary screen
+
+* Add delete functions to dataAbstract.php and appropriate admin areas
+ ***DONE*** Contacts
+ Events
+ Event Fees & Taxes
+ State Reps
+ Divisions
+ Teams
+ ***DONE*** Inventory ( this is done in inventory edit - now checking for room blocks first )
+ Properties
+ Property Fees & Taxes
+ Property Accommodations
+
+* Reports - Complete basic reports
+ ***DONE*** Room block Reports
+ Room Requests
+ Reservations
+ Finance
+
+* Help - complete help texts and Quickhelp popups
+
+* When inventory is added, see if it's easy to have the inventory summary at the top scroll to the selected property
+
+* Build default teams using "Division" names when a division or State rep is added
+
+* Add ability to include sort links at top of tables
+
+* Add demographics info to reports
+
+* Auto-generate default "access codes" (currently "Team code") to produce rational password style string
+ {word}{nnn}{word} kind of password
+
+* Auto-generate team records when state-division is added
+
+* Check for and fix "&" in Room Block Report
+
+RESERVATIONS FRONT-END
+
+* System does not handle the situation where all of the inventory for an event is well outside the date range of the event.
+ (See similar issue for admin area above). If this happens it should not break but rather show no properties available.
+
+* Accommodations image problem
+
+* Add support for Fee/Tax guest optional items and optional quantities.
+
+* Check for earliest possible reservation date and display that instead of link to event on event selection page if it's not time to reserve yet.
+
+* Room Blocks Front-end lists, include fees/taxes in property detail pages just below room-blocks list.
+
+* Move fees/taxes on property detail page, to just below accommodation selection
+ Move "Add Selected Accommodation" button to bottom of list.
+
+* Mage sure "Must arrive by" and "Must not depart before" dates are displayed correctly and that default arrive/depart search dates are correct.
+
+* Add "Must arrive by" and "Must not depart before" dates to Event Selection screen
+
+* Keep pending reservations selections (on hold) from being reserved by others
+
+* Need to deal with checkout problem where there might be more than one room block that matches the same accommodation and team.
+ Currently not able to distribute consumption of rooms between multiple room blocks where the conv, state, team, and accomodation all match.
+
+* Make sure reservations respect
+ req_stay_arrive
+ req_stay_depart dates
+ ***DONE*** open_res_date
+ cutoff_date
+
+* Setup default and custom E-Mail message templates (by event) for sending to visitor on making the reservation. (file in this directory)
+
+* Check "OK to send" setting. Make sure it's respected on checkout
+
+* Check cart to make sure that there is availability for all cart entries
+ Currently only checking each separately
+ Consider combining same accommodation to make one entry
+
+* Add check-in and check-out times to conf E-Mail to visitors
+
+* On property profile (unit selection) page add the following:
+ Room Amenitites
+ Distance from Event
+ Consider moving number of rooms, credit card data to right had side as in main site
+ Make sure all appropriate data displayed in main site member profile pages is displayed
+ Consider moving description to below room list to minimize scrolling
+ Consider making profile page and property selection page similar
+
+* Check to make sure any session timeout is handled properly.
+
+* Reservations submitted E-Mail messages need to be customizable by event.
+
+* E-Mail sent when submitting reservation should include driving directions
+
+* Fix arrive_date stored with reservation request
+
+* Add storage of fees summary into reservations request then fix reservations reports to use that data
+
+MEMBERS FRONT-END
+
+* Fix problem with editing reservation dates and such.
+ Note that line with "calc_unit_totals()" call has been commented out.
+
+* Complete processing of accommodation quantity and date changes when updating a reservation.
+ Check again for availability
+ Rebuild summary
+ Note changes in Notes field.
+
+* Fix "fudged" min and max reservations available dates for modifying reservations
+ Should be based on actual availability for each accommodation
+
+* Create "print" option for printing out reservation detail for a selected reservation.
+
+* Change to appearance similar to back-end tables
+
+* Add copy of policies to reservation confirmation E-Mail
+
+* When declining reservations do not send E-Mail to visitor, only send E-Mail to event contacts (King Comm.)
+
+* Check reservations daily(hourly?) and send warning notices of unconfirmed reservations (see conf_hours) to members and summary to event contacts.
+
+* Confirmation E-Mail messages need to be customizable by event.
+ Need to be able to say whether credit card will be charged upon reservation or at checkin.
+
+* Change conf message to HTML and use view file
+
+* Driving directions link on Confirmation E-Mail
+
+* Ability to edit reservations dates
+ When storing, update all inventory and room block availability numbers
+ Recalculate all charges, fess, and totals
+ Update reservation record with new data
+ Add to notes for this reservations record how it was modified
+
+STATE-REP ROOM BLOCK SUMMARY
+
+
+
+OTHER NOTES ON USE
+
+Info on sending test message to properties for a specific event
+---------------------------------------------------------------
+* Enter front-end reservations as a team or regular visitor.
+* Select accommodations for a single property
+* Proceed to checkout
+* Under "Billing Information" in the "First Name" field enter "Event Test Property Message"
+* Fill out rest of information and submit
+ You may use the 0011001100110011 pseudo creadit card number
+* System will produce a single test message to the "cscott@gaslightmedia.com" address for testing this mode
+* To have the test message sent to all properties associated with the selected event enter "Production Mode" in the "Last Name" field.
+* Messages will contain
+ - "John Doe" information for the billed party
+ - Will be addressed to each property
+ - Will NOT contain any of the credit card information submitted
+ - Will contain the exact selected reservations summary and totals selected in the cart
+ - Will NOT clear the cart or create an actual reservation
+
+
+PHASE 2 WORK
+
+* Property defines cut-off date for reservations if not defined in Event
+
+
+
+
+How to delete an entire event
+-----------------------------
+
+Delete data in this order
+
+Table Link to Link field
+----------------------- --------------- -------------------------------------------
+ SELECT id, name, conv_code, start_date, end_date FROM convention;
+team_roster team team = {team for specified event}
+ DELETE FROM team_roster WHERE team IN (SELECT id FROM team WHERE conv = {CONV ID});
+team_property convention conv = {convention}
+ DELETE FROM team_property WHERE conv = {CONV ID};
+team convention conv = {convention}
+ DELETE FROM team_property WHERE conv = {CONV ID};
+state_rep convention conv = {convention}
+ DELETE FROM state_rep WHERE conv = {CONV ID};
+division convention conv = {convention}
+ DELETE FROM division WHERE conv = {CONV ID};
+room_block convention conv = {convention}
+ DELETE FROM room_block WHERE conv = {CONV ID};
+room_block_seg convention conv = {convention}
+ DELETE FROM room_block_seg WHERE conv = {CONV ID};
+inven_hold inventory inventory = {inv for specified event}
+ DELETE FROM inven_hold WHERE inventory IN (SELECT id FROM inventory WHERE conv = {CONV ID});
+inventory convention conv = {convention}
+ DELETE FROM inventory WHERE conv = {CONV ID};
+res_contact ???
+reservation convention conv = {convention}
+ DELETE FROM reservation WHERE conv = {CONV ID};
+fees convention affiliation_type = 1, owner = {convention}
+ DELETE FROM fees WHERE affiliation_type = 1 AND owner = {CONV ID};
+conv_prop_dist convention convention = {convention}
+ DELETE FROM conv_prop_dist WHERE convention = {CONV ID};
+event_prop convention event = {convention}
+ DELETE FROM event_prop WHERE event = {CONV ID};
+convention
+ DELETE FROM convention WHERE id = {CONV ID};
+
+
diff --git a/docs/Field Specifications b/docs/Field Specifications
new file mode 100644
index 0000000..05784ab
--- /dev/null
+++ b/docs/Field Specifications
@@ -0,0 +1,271 @@
+Field Definitions Specification
+
+Fields are specified using an array of field specification arrays.
+
+Sample:
+
+ $this->fields = array(
+
+ // Record ID
+ 'id' => array(
+ 'field' => 'id',
+ 'as' => false,
+ 'type' => 'integer',
+ 'filter' => 'int',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Name of event
+ 'name' => array(
+ 'field' => 'name',
+ 'as' => false,
+ 'type' => 'text',
+ 'filter' => 'string',
+ 'required' => true,
+ 'unique' => true,
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+
+The index for fields must be unique, but three may be multiple entries for a
+single field ('field') in the database table.
+
+
+Field Specifications:
+
+(array index) The array index is only used to permit multiple entries for the
+ same database field. This permits including the field several
+ times so it can be processed differently based on the operation
+ being performed or can be displayed multiple time but each in a
+ different way.
+
+'field' Name of field in database table
+
+'as' Name to use for this field for all operations other than for talking
+ with the database. Doing this keeps any possible multiple instances
+ of use of a single database field separate. (see array index above)
+
+ If this is not specified, then the actual database field name is
+ used for these purposes.
+
+
+'type' Type of field - Possible field types are...
+
+ 'integer',
+ 'float',
+ 'money',
+ 'percent',
+ 'pointer',
+ 'list',
+ 'bitmap', like list but permits multi-pick
+ 'text',
+ 'checkbox',
+ 'email',
+ 'date',
+ 'time',
+ 'phone',
+ 'image',
+ 'latitude', Data is an array of (dir,deg,min,sec);
+ 'longitude' " " "
+ "dir" is - for West and South
+
+'filter' Optional filter - See PHP filter_input() "filter" parameter.
+ Currently only for type "text"
+ FILTER_SANITIZE_FULL_SPECIAL_CHARS does not seem to be defined at this time.
+
+'filter_options' Optional filter options - See PHP filter_input() "options" parameter.
+ Currently only for type "text"
+
+'required' If set and true, field data must be supplied
+
+'unique' If set and true, must be a unique value
+
+'default' If set and true use this value as the default for input fields.
+ Dates/times are expected to be timestamps
+ There is no default image capability
+
+'use' Character(s) that indicate which operations to use this field with.
+
+ l = Listing records
+ g = Get - Displaying a record
+ n = Setup input for a new record
+ i = Insert new record
+ e = Edit an existing record
+ u = Update an edited record
+ d = Ask for verification of deletion of a record
+ c = Confirm delete and delete record.
+ a = All above operations
+
+'minValue' Minimum acceptable value (numeric)
+ Dates are specified as timestamp
+
+'maxValue' Maximum acceptable value (numeric)
+ Dates are specified as timestamp
+
+'p_table' Table to get related data from for pointer types
+
+'p_field' Field to get related data from for field types
+
+'p_id' name of ID field in related data table
+
+'p_where' Additional WHERE clause for getting possible values from related table.
+
+'p_from' Additional FROM tables for getting possible values from related table.
+ See example in dataMembers.php
+
+'p_blank' If set or true provide a "blank" option for pointer input
+
+'p_sort' Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet.
+
+'p_orderby' Optional "ORDER BY" clause for results from table pointed to by pointer
+
+'p_autoadd' Option to permit the addition of a new entry using a text input field
+
+'p_sum' If true causes a numeric sum of all returned values from the target table/column
+
+'p_static' A static pointer that does not do a lookup for a list of values, only a single value reference
+
+'output_type' Optional type to use for output. Useful with pointers.
+
+'latlon_type' Optional specification for lat/lon output (DMS, DM, or D)
+
+'view_only' View only field, do not check for input or store, only provide data from record.
+
+'list' Required with field type 'list' - includes simple array where...
+ array key is value for option
+ array value is name for option
+
+'bitmap' Required with field type 'bitmap' - includes array of (position, name) for each option
+ array key is a value indicating the bit position (i.e. 1, 2, 3, 4) starting with 1 rather than 0 (it will be converted)
+ array value is the name for the option
+
+'list_keytype' Type of key field (default is 'text')
+ 'text' A Text key - expects a text field in the database
+ 'int' An Integer key - expects a numeric field in the database
+
+'output_format' Optional output format specification as would be used in printf()
+ Use only the actual format and not the type identifier (i.e. "02.2" rather than "%f02.2")
+
+'no_stripslashes' Don't strip slashes when recalling this field from the database.
+
+'quicktip' Text description of this field and its use.
+
+
+Data specification for various types
+------------------------------------
+
+Type 'list'
+
+ Return data
+
+ array(
+ 'list' => array(
+ array('name' => {name}, 'value' => {value}, 'default' => {true if default or selected},
+ ....
+ ),
+ 'value' => {value of selected option},
+ 'name' => {name of selected option}
+ )
+
+Type 'bitmap'
+
+ Return data
+
+ array(
+ 'bitmap' => array(
+ array('name' => {name}, 'value' => {value}, 'default' => {true if default or selected},
+ ....
+ ),
+ 'value' => {value of selected option},
+ 'names' => array( {simple list of names of selected options} )
+ )
+
+Type 'date'
+
+ Input data fields
+
+ When using single input text field, input field is name of field
+
+ When using separate M, D, Y picklist or input fields
+
+ '{field}_month'
+ '{field}_day'
+ '{field}_year'
+
+ Return data
+
+ array(
+ 'date' => {text date},
+ 'timestamp' => {timestamp},
+ 'date_list' => array(
+ 'month' => {picklist array},
+ 'day' => {picklist array},
+ 'year' => {picklist array}
+ ),
+ )
+
+Type 'time'
+
+ Input data fields
+
+ When using single input text field, input field is name of field
+
+ When using separate H, M picklist or input fields
+
+ '{field}_hour'
+ '{field}_min'
+ '{field}_ampm'
+
+
+ Return data
+
+ array(
+ 'time' => {text time},
+ 'time_list' => array(
+ 'hour' => {picklist array},
+ 'min' => {picklist array},
+ 'ampm' => {picklist array}
+ ),
+ )
+
+
+Types 'latitude' & 'longitude'
+
+ Return data
+
+ array(
+ 'dir' => {direction: -1 = S or W, +1 = N or E},
+ 'dir_list' => array(
+ array('name' => 'N', 'value' => 1, 'default' => {true if default or selected}),
+ array('name' => 'S', 'value' => -1, 'default' => {true if default or selected})
+ ),
+ 'deg' => {degrees},
+ 'min' => {minutes},
+ 'sec' => {seconds}
+ )
+
+
+Type 'image'
+
+ Input fields
+
+ '{field}_delete' Name of checkbox field to delete image
+ '{field}_new' Name of file input field to save new image
+
+
+Type 'picklist'
+
+ Parameters for {picklist array}
+
+ 'name' Name to use for this option
+ 'value' Value to return when this option is selected
+ 'default' True if this option is currently selected
+
+
+
diff --git a/docs/Install.txt b/docs/Install.txt
new file mode 100644
index 0000000..254f460
--- /dev/null
+++ b/docs/Install.txt
@@ -0,0 +1,226 @@
+Install Instructions
+
+* This version of Event Management is a New Common App so it's in /var/www/server/CommonApps/EventManagement_V?
+
+* Add the following files/directories if they don't already exist
+
+ /common Directory containing symbolic links to a "web" directory in a common application
+ If creating directory, set svn:ignore for all files below that directory.
+
+ /admin/EventManagement Directory containing a file to kick off EventManagement admin functions
+ /config/applications Directory containing ini files for specific applications
+
+* Add the following symbolic links in the Web site /common directory
+
+ ln -s /var/www/server/CommonApps/EventManagement_V{version}/web EventManagement
+ ln -s /var/www/server/CommonApps/Public Public
+ touch Only_symbolic_links_in_this_directory-do_not_add_to_repository
+
+* Copy the contents of the docs/admin/EventManagement directory to /admin/EventManagement
+
+* Copy the contents of docs/config/applications directory to /config/applications
+
+* Check if the contents of docs/Barcode already exist in "/usr/share/fonts/truetype/barcode".
+ If not, copy docs/Barcode to /usr/share/fonts/truetype/barcode
+
+* Edit site's /config/application.ini.
+
+ Make sure the following is near the top of the file
+
+ ; CommonApps configuration
+ commonApps.base_path = "/var/www/server/CommonApps/"
+
+ Remove any any old configuration for EventManagement and add the following
+
+ ; Turn the events management application On or Off
+ event_management.application = On
+ event_management.version = "EventManagement_V3"
+
+* Make sure site loads jquery
+
+* Create a Toolbox page for the EventManagement front-end and note catid
+
+* Create a Toolbox page for the EventManagement Member's login and note catid
+
+* Add eventmgt schema to database - data/EventManagement.sql
+
+* Edit /admin/nav.phtml and add the following
+
+ if (defined('EVENT_MANAGEMENT') && EVENT_MANAGEMENT) {
+ $nav['Event Management'] = BASE_URL.'admin/EventManagement/EventManagement.php';
+ }
+
+* Edit /config/applications/EventManagement.ini and set at least
+
+ "home_page", "members_only_page" with ID's for pages created above
+
+* Make sure there's not reference to a "reservations" schema in /Toolkit/Database.php
+
+* Create file in /static directory for the front-end catid with the following...
+
+ commonApps->base_path.$GLOBALS['applicationConfig']->event_management->version.'/controllers/FrontController.php';
+ $html = new EventManagementIndexController($GLOBALS['applicationConfig'], $GLOBALS['serverConfig'], $GLOBALS['siteConfig']);
+ ?>
+
+* Create file in /static directory for the admin login catid with the following...
+
+ event_management->version.'/controllers/AdminController.php';
+ ?>
+
+* Check to make sure site has owner information in the config/site.ini file.
+
+ ; Web Site Owner Information - for use by certain applications
+ owner.name = "Gaslight Media"
+ owner.short_name = "GLM"
+ owner.address1 = "120 E. Lake St."
+ owner.address2 = False
+ owner.city = "Petoskey"
+ owner.state = "MI"
+ owner.zip = "49770"
+ owner.country = "US"
+ owner.phone = "231-487-0692"
+ owner.toll_free = False
+
+
+HEREHERHRHERHERHE
+
+
+
+// **************** below is OLD ***********************
+
+* Add the contents of the documentation/config/application.ini file to /config/application.ini
+
+* Add a page for the Event Reservations front-end and note the catid
+
+* Add a page for the members only area Event Housing and note the catid
+
+* Update the following files to include the necessary references to Event Management
+ For old sites without ini files and schemas use replacements in Old sites below.
+
+ /setup.phtml
+
+ /**
+ * Site has Event Management
+ */
+ define('EVENT_MANAGEMENT', $applicationConfig->event_management->application);
+ define('EVENT_MANAGEMENT_HOME_PAGE', $applicationConfig->event_management->home_page);
+ define('EVENT_MANAGEMENT_MEMBERS_PAGE', $applicationConfig->event_management->members_only_page);
+
+
+; Turn the events management application On or Off
+event_management.application = On
+event_management.common_apps = "/var/www/server/CommonApps/"
+event_management.base_path = "/var/www/server/CommonApps/EventManagement_V3/"
+; The page id in the toolbox that is the entry page for Event management - Generally set for each server
+event_management.home_page = 130
+event_management.members_only_page = 131
+
+
+ ; Turn the events management application On or Off
+ event_management.application = On
+ ; The page id in the toolbox that is the entry page for Event management - Generally set for each server
+ event_management.home_page = 239
+ event_management.members_only_page = 240
+
+ ************ NOT NEEDED ANY MORE ************
+ /Toolkit/Database.php in _setSearchPath() function - *** Only if site already has schemas!!! ***
+
+ if (defined('EVENT_MANAGEMENT') && EVENT_MANAGEMENT) {
+ // define event management search path
+ $stmt->bindValue(':schema', 'reservations', PDO::PARAM_STR);
+ $stmt->execute();
+ }
+ *********************************************
+
+ /admin/nav.phtml
+
+ if (defined('EVENT_MANAGEMENT') && EVENT_MANAGEMENT) {
+ $nav['Event Management'] = 'admin/EventManagement/EventManagement.php';
+ }
+
+ /static/{front-end-page}
+
+
+
+ /static/{member-admin-page}
+
+
+
+* Fix member login problem with some sites.
+
+ /memberdb/index.php -- Move logout before auth start
+
+ $memberAuth =& new Toolkit_Members_Auth($root, 'DB', array(), '', false);
+ $memberAuth->setIdle();
+ if (isset($_GET['logout']) || isset($_POST['doLogin'])) {
+ $memberAuth->logout();
+ }
+ $memberAuth->start();
+
+ /memberdb/classes/class_user.inc -- Add user name to logout button.
+
+ $out .= '