//configuration
$this->scheme["config"]=array(
"ckey"=>array("string:32","primarykey"),
- "cval"=>array("string:32")
+ "cval"=>array("string")
);
//clients
$this->scheme["host"]=array(
//if hostkey is NULL it is a special host (_any, _anon, _online)
"hostkey"=>array("string")
);
- //users
+ //client users (ticket sellers, admins, etc.; for customers and web logins see below)
$this->scheme["users"]=array(
"uname" => array("string:64","primarykey"),
- "passwd" => array("string","notnull")
+ "passwd" => array("string","notnull"),
+ //more detailed data that can be displayed to customers
+ "description" => array("text")
);
$this->scheme["userrole"]=array(
"uname" =>array("string:64","notnull","foreignkey:users:uname","index"),
// this needs to change to 64-bit int in 2038
"timeout"=>array("int32","notnull")
);
+
+ //rooms
+ $this->scheme["room"]=array(
+ "roomid" => array("string:64","primarykey"),
+ "capacity" => array("int32","notnull"),
+ "description" => array("text")
+ );
+ //event
+ $this->scheme["event"]=array(
+ "eventid" => array("int32","primarykey"),
+ //display data
+ "title" => array("string","notnull"),
+ "artist" => array("string","notnull"),
+ "description" => array("text"),
+ //timing and location
+ "starttime" => array("int32","notnull"),
+ "endtime" => array("int32","notnull"),
+ "roomid" => array("string:64","foreignkey:room:roomid"),
+ //initially a copy from room, can be adjusted
+ "capacity" => array("int32","notnull"),
+ //default pricing in cents
+ "defaultprice" => array("int32","notnull"),
+ //if not null/empty: event has been cancelled
+ "cancelreason" => array("string")
+ );
+ //customer
+ $this->scheme["customer"]=array(
+ "customerid" => array("int32","primarykey"),
+ //contact data
+ "name" => array("string",notnull),
+ "address" => array("string"),
+ "contact" => array("string"),//phone or something
+ "comments" => array("text"),
+ //online login data
+ "email" => array("string"),
+ "passwd" => array("string:64"),//salted SHA-1 hash of passwd
+ );
+ //orders by customers
+ $this->scheme["order"]=array(
+ "orderid" => array("int32","primarykey"),
+ //customer
+ "customerid" => array("int32","foreignkey:customer:customerid"),
+ //seller (_online for web forms)
+ "soldby" => array("string:64","foreignkey:users:uname"),
+ //if not null/empty: this address for delivery, customer address for invoice
+ "deliveryaddress" => array("string"),
+ //if not null/empty: lodge/deposit the tickets at a seller with _deposit flag
+ "depositat" => array("string:64","foreignkey:users:uname"),
+ //status, see ORDER_* constants
+ "status" => array("int32","notnull"),
+ "ordertime" => array("int32","notnull"),
+ "senttime" => array("int32"),
+ //comments made on web form (eg. "urgently needed for dads birthday")
+ "comments" => array("text")
+ );
+ //tickets
+ $this->scheme["ticket"]=array(
+ "ticketid" => array("int64","primarykey"),
+ "eventid" => array("int32","foreignkey:event:eventid"),
+ //initially a copy from event, can be adjusted by seller
+ "price" => array("int32","notnull"),
+ //status of ticket (see TICKET_* constants)
+ "status" => array("int32","notnull"),
+ //if status is reserved, this contains the reserving seller
+ "reservedby" => array("string:64","foreignkey:users:uname"),
+ "reservetimeout" => array("int32"),
+ //sold to someone (may be NULL for direct sales or reserves)
+ "oderid" => array("int32","foreignkey:orders:orderid")
+ );
+ //vouchers and re-imbursments
+ $this->scheme["voucher"]=array(
+ //a 16char code (code39: case-insensitive letters+digits) for the voucher)
+ "voucherid" => array("string:16","primarykey"),
+ //if ordered: order-info
+ "price" => array("int32","notnull"),
+ "oderid" => array("int32","foreignkey:orders:orderid"),
+ //unix-timestamp of original sales date/time
+ "salestime" => array("int32","notnull"),
+ //remaining value in cents
+ "value" => array("int32","notnull")
+ );
}
/**return the tables to be created in order*/
}
};
$dbScheme=new DbScheme;
+
+/**ticket has been reserved by a seller*/
+define("TICKET_RESERVED",0);
+/**ticket is part of an order or has been sold independently*/
+define("TICKET_SOLD",10);
+/**ticket has been used*/
+define("TICKET_USED",20);
+/**the ticket has been paid, not used, but is to be reimbursed*/
+define("TICKET_REVERSE",30);
+/**ticket has been cancelled*/
+define("TICKET_CANCELLED",40);
+
+/**an order has been placed*/
+define("ORDER_PLACED",0);
+/**the order has been sent out*/
+define("ORDER_SENT",10);
+/**the order has been paid*/
+define("ORDER_PAID",20);
+/**the order is to be reversed (it has been paid, but is to be cancelled)*/
+define("ORDER_REVERSE",30);
+/**the order has been cancelled*/
+define("ORDER_CANCELLED",40);
+
+
?>
\ No newline at end of file