splitting the wob files into separate directories, one for each layer (db, class...
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Tue, 6 Jul 2010 10:46:40 +0000 (10:46 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Tue, 6 Jul 2010 10:46:40 +0000 (10:46 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@531 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

28 files changed:
wob/classes/basics.wolf [new file with mode: 0644]
wob/classes/cart.wolf [moved from wob/cart.wolf with 73% similarity]
wob/classes/customer.wolf [new file with mode: 0644]
wob/classes/event.wolf [new file with mode: 0644]
wob/classes/order.wolf [new file with mode: 0644]
wob/classes/template.wolf [new file with mode: 0644]
wob/classes/user.wolf [new file with mode: 0644]
wob/customer.wolf [deleted file]
wob/db/audit.wolf [moved from wob/audit.wolf with 100% similarity]
wob/db/basics.wolf [new file with mode: 0644]
wob/db/cart.wolf [new file with mode: 0644]
wob/db/customer.wolf [new file with mode: 0644]
wob/db/db.wolf [new file with mode: 0644]
wob/db/event.wolf [new file with mode: 0644]
wob/db/order.wolf [new file with mode: 0644]
wob/db/template.wolf [new file with mode: 0644]
wob/db/user.wolf [new file with mode: 0644]
wob/event.wolf [deleted file]
wob/magicsmoke.wolf
wob/order.wolf [deleted file]
wob/template.wolf [deleted file]
wob/transact/basics.wolf [moved from wob/basics.wolf with 52% similarity]
wob/transact/cart.wolf [new file with mode: 0644]
wob/transact/customer.wolf [new file with mode: 0644]
wob/transact/event.wolf [new file with mode: 0644]
wob/transact/order.wolf [new file with mode: 0644]
wob/transact/template.wolf [new file with mode: 0644]
wob/transact/user.wolf [moved from wob/user.wolf with 67% similarity]

diff --git a/wob/classes/basics.wolf b/wob/classes/basics.wolf
new file mode 100644 (file)
index 0000000..76b2bfc
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Basic MagicSmoke WOLF
+  - base tables for login etc.
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Class name="Flag">
+               <Doc>Transport class for flags and their descriptions. They are actually stored in the config table.</Doc>
+               <Abstract lang="php"/>
+               <Property name="flag" type="astring"/>
+               <Property name="description" type="string"/>
+       </Class>
+</Wolf>
similarity index 73%
rename from wob/cart.wolf
rename to wob/classes/cart.wolf
index ca8afb4..bd025e1 100644 (file)
@@ -7,57 +7,8 @@
    - see COPYING.AGPL for details
    -->
 <Wolf>
-       <Table name="cart" backup="no">
-               <Column name="cartid" type="string:32" primarykey="yes">
-                       the cookie for this cart
-                       <Call lang="php" method="WebCart::getNewCartId()"/>
-               </Column>
-               <Column name="timeout" type="int64" notnull="yes">when the cart expires</Column>
-               <Column name="customerid" type="int32" foreignkey="customer:customerid" null="yes">
-                       ID of the customer connected to this cart.
-               </Column>
-               <Column name="invoiceaddress" type="int64" foreignkey="address:addressid" null="yes">
-                       If not null: the address the invoice goes to.
-               </Column>
-               <Column name="deliveryaddress" type="int64" foreignkey="address:addressid" null="yes">
-                       If not null: the address the delivery goes to.
-                       If null: assumed to be identical to invoiceaddress.
-               </Column>
-               <Column name="comment" type="text" null="yes">customer comments during order process</Column>
-               <Column name="shippingtype" type="int32" null="yes" foreignkey="shipping:shipid">
-               pointer to shipping type (none per default, programmatic default is in config)
-               </Column>
-       </Table>
-       <Table name="cartticket" backup="no">
-               <Column name="cartid" type="string:32" notnull="yes" foreignkey="cart:cartid" primarykey="yes"/>
-               <!--tickets in the cart-->
-               <Column name="eventid" type="int32" notnull="yes" foreignkey="event:eventid" primarykey="yes"/>
-               <Column name="pricecategoryid" type="int32" foreignkey="pricecategory:pricecategoryid" primarykey="yes"/>
-               <Column name="amount" type="int32" notnull="yes"/>
-               <!-- Column name="seating" type="string:32" null="yes"/ -->
-       </Table>
-       <Table name="cartvoucher" backup="no">
-               <Column name="cvid" type="seq64" primarykey="yes"/>
-               <Column name="cartid" type="string:32" notnull="yes" foreignkey="cart:cartid"/>
-               <Column name="value" type="int32" notnull="yes">voucher value in cents</Column>
-       </Table>
-       <Table name="cartitem" backup="no">
-               <Column name="ciid" type="seq64" primarykey="yes"/>
-               <Column name="cartid" type="string:32" notnull="yes" foreignkey="cart:cartid"/>
-               <Column name="productid" type="int32" foreignkey="product:productid" notnull="yes"/>
-               <Column name="amount" type="int32" notnull="yes"/>
-       </Table>
-       
-       <Table name="websession" backup="no">
-               <Column name="sessionid" type="string:64" primarykey="yes"/>
-               <!--/customer-->
-               <Column name="customerid" type="int32" notnull="yes" foreignkey="customer:customerid"/>
-               <!--unix timestamp at which to delete this session-->
-               <Column name="timeout" type="int64" notnull="yes"/>
-       </Table>
-       
-       
        <Class name="CartTicket">
+               <Doc>Encapsulates tickets for a specific event in a specific price category as they are stored in the cart. One instance of CartTicket can contain several tickets. This class is used by the client to tell the server about new orders and by the Web UI to actually store its cart.</Doc>
                <Enum name="TicketValidationState">
                        <Value name="Ok">The tickets can be sold</Value>
                        <Value name="EventOver">The event is already over</Value>
@@ -98,6 +49,7 @@
        
        
        <Class name="CartVoucher">
+               <Doc>Encapsulates vouchers as they are stored in the cart. Used by the client to tell the server about new orders. Used by the Web UI to actually store its cart.</Doc>
                <Enum name="ValidationState">
                        <Value name="Ok">The voucher can be sold</Value>
                        <Value name="InvalidValue">The value is not one of the allowed ones and you do not have the privilege to set an arbitrary one, or the value is negative or zero.</Value>
                     inc/renderer/cart_listing.php - WebCart - is the UI part, which cares about rendering the cart to the user
                     inc/wext/webcart.php - WOWebCart - is the backend part, that cares about conversion to/from the database -->
                <Abstract lang="php"/>
-               <Doc>The cart as used by the web user interface, this maps into the cart tables. This class is never used by the </Doc>
+               <Doc>The cart as used by the web user interface, this maps into the cart tables. This class is never used by the remote client.</Doc>
                <Property name="cartid" type="astring">The cart ID of this session</Property>
                <Property name="timeout" type="int">When the cart will be automatically deleted</Property>
                <Property name="customerid" type="int32">The customer of this cart</Property>
                        </Map>
                </Mapping>
        </Class>
-       
-       <Transaction name="WebCartAddTicket">
-               <Doc>Called from the Web UI only: adds tickets to a specific event</Doc>
-               <Input>
-                       <Var name="cartid" type="astring">The cart to add into</Var>
-                       <Var name="eventid" type="int">The event to buy tickets for</Var>
-                       <Var name="pricecategoryid" type="int">Price category of that event</Var>
-                       <Var name="amount" type="int">amount of tickets</Var>
-               </Input>
-               <Call lang="php" method="WOWebCart::addTickets($this);"/>
-               <Output/>
-       </Transaction>
 </Wolf>
\ No newline at end of file
diff --git a/wob/classes/customer.wolf b/wob/classes/customer.wolf
new file mode 100644 (file)
index 0000000..0474b9f
--- /dev/null
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Customer MagicSmoke WOLF
+  - customer management
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Class name="Country">
+               <Property name="id" type="astring"/>
+               <Property name="name" type="astring"/>
+               <Mapping table="country">
+                       <Map property="id" column="countryid"/>
+                       <Map property="name" column="countryname"/>
+               </Mapping>
+       </Class>
+       <Class name="Address">
+               <Abstract lang="qt"/><!-- eg. fullAddress() method -->
+               <Property name="addressid" type="int64"/>
+               <Property name="customerid" type="int32"/>
+               <Property name="lastused" type="int64"/>
+               <Property name="name" type="string"/>
+               <Property name="addr1" type="string"/>
+               <Property name="addr2" type="string"/>
+               <Property name="city" type="string"/>
+               <Property name="state" type="string"/>
+               <Property name="zipcode" type="string"/>
+               <Property name="countryid" type="astring"/>
+               <Property name="isdeleted" type="bool"/>
+               
+               <Property name="country" type="Country"/>
+               
+               <Mapping table="address">
+                       <Map column="addressid"/>
+                       <Map column="customerid"/>
+                       <Map column="lastused"/>
+                       <Map column="name"/>
+                       <Map column="addr1"/>
+                       <Map column="addr2"/>
+                       <Map column="city"/>
+                       <Map column="state"/>
+                       <Map column="zipcode"/>
+                       <Map column="countryid"/>
+                       <Map column="isdeleted"/>
+                       <Map property="country">
+                               <Call lang="php" method="WOCountry::fromTablecountry(WTcountry::getFromDB($table->countryid))"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       <Class name="ContactType">
+               <Property name="contacttypeid" type="int32"/>
+               <Property name="contacttype" type="string"/>
+               <Property name="uriprefix" type="string"/>
+               <Mapping table="contacttype">
+                       <Map column="contacttypeid"/>
+                       <Map column="contacttype"/>
+                       <Map column="uriprefix"/>
+               </Mapping>
+       </Class>
+       
+       <Class name="Contact">
+               <Property name="contactid" type="int64"/>
+               <Property name="customerid" type="int32"/>
+               <Property name="contacttypeid" type="int32"/>
+               <Property name="contact" type="string"/>
+               
+               <Property name="contacttype" type="ContactType"/>
+               
+               <Mapping table="contact">
+                       <Map column="contactid"/>
+                       <Map column="customerid"/>
+                       <Map column="contacttypeid"/>
+                       <Map column="contact"/>
+                       <Map property="contacttype">
+                               <Call lang="php" method="WOContactType::fromTablecontacttype(WTcontacttype::getFromDB($table->contacttypeid))"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       <Class name="Customer">
+               <Abstract lang="qt"/>
+               <Abstract lang="php"/>
+               <Property name="id" type="int"/>
+               <Property name="title" type="string"/>
+               <Property name="firstname" type="string"/>
+               <Property name="name" type="string"/>
+               <Property name="comments" type="string"/>
+               <!--online login data-->
+               <Property name="email" type="string"/>
+               <!-- password is never sent from server to client -->
+               
+               <Property name="addresses" type="List:Address"/>
+               <Property name="contacts" type="List:Contact"/>
+               
+               <Mapping table="customer">
+                       <Map column="customerid" property="id"/>
+                       <Map column="title"/>
+                       <Map column="firstname"/>
+                       <Map column="name"/>
+                       <Map column="comments"/>
+                       <Map column="email"/>
+                       <Map property="addresses">
+                               <Call lang="php" method="WOAddress::fromTableArrayaddress(WTaddress::selectFromDB('customerid='.$GLOBALS['db']->escapeInt($table->customerid)))"/>
+                       </Map>
+                       <Map property="contacts">
+                               <Call lang="php" method="WOContact::fromTableArraycontact(WTcontact::selectFromDB('customerid='.$GLOBALS['db']->escapeInt($table->customerid)))"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       <Class name="CustomerInfo">
+               <Abstract lang="qt"/><!-- abstract is needed on C++ side -->
+               <Doc>This class encapsulates the most basic information about a customer.</Doc>
+               <Doc>For more complex tasks the Customer class is used.</Doc>
+               <Property name="customerid" type="int"/>
+               <Property name="title" type="string"/>
+               <Property name="firstname" type="string"/>
+               <Property name="name" type="string"/>
+               <Mapping table="customer">
+                       <Map column="customerid"/>
+                       <Map column="title"/>
+                       <Map column="firstname"/>
+                       <Map column="name"/>
+               </Mapping>
+       </Class>
+</Wolf>
\ No newline at end of file
diff --git a/wob/classes/event.wolf b/wob/classes/event.wolf
new file mode 100644 (file)
index 0000000..86cbde9
--- /dev/null
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Event Definition MagicSmoke WOLF
+  - declares everything needed to define events
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Class name="Artist">
+               <Abstract lang="php"/>
+               <Property name="id" type="int" id="yes"/>
+               <Property name="name" type="string"/>
+               <Property name="description" type="string"/>
+               <Property name="comment" type="string"/>
+               <Property name="flags" type="astring"/>
+               <Property name="canuse" type="bool"/>
+               <Property name="tags" type="astring"/>
+               
+               <Mapping table="artist">
+                       <Map column="artistid" property="id"/>
+                       <Map column="artistname" property="name"/>
+                       <Map column="description"/>
+                       <Map column="comment"/>
+                       <Map column="flags"/>
+                       <Map column="tags"/>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="PriceCategory">
+               <Abstract lang="php"/>
+               <Property name="pricecategoryid" type="int"/>
+               <Property name="name" type="string"/>
+               <Property name="abbreviation" type="astring"/>
+               <Property name="formula" type="string"/>
+               <Property name="flags" type="string"/>
+               <Property name="tags" type="string"/>
+               <Property name="canuse" type="bool"/>
+               <Mapping table="pricecategory">
+                       <Map column="pricecategoryid"/>
+                       <Map column="name"/>
+                       <Map column="abbreviation"/>
+                       <Map column="formula"/>
+                       <Map column="flags"/>
+                       <Map column="tags"/>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="EventPrice">
+               <Abstract lang="php"/>
+               <Property name="eventid" type="int"/>
+               <Property name="pricecategoryid" type="int"/>
+               <Property name="pricecategory" type="PriceCategory"/>
+               <Property name="maxavailable" type="int32"/>
+               <Property name="price" type="int32"/>
+               <Property name="prio" type="int32"/>
+               <Property name="flags" type="string"/>
+               <Property name="tags" type="string"/>
+               <Property name="canuse" type="bool"/>
+               
+               <Property name="amounttickets" type="int">calculated property: contains the amount of tickets currently contained in this price, ignored if sent from client</Property>
+               <Property name="amountticketsblock" type="int">calculated property: contains the amount of tickets currently contained in this price that are actually usable or reserved, ignored if sent from client</Property>
+               
+               <Mapping table="eventprice">
+                       <Map column="eventid"/>
+                       <Map column="pricecategoryid"/>
+                       <Map column="maxavailable"/>
+                       <Map column="price"/>
+                       <Map column="flags"/>
+                       <Map column="tags"/>
+                       <Map column="prio"/>
+                       <Map property="pricecategory">
+                               <Call lang="php" method="WOPriceCategory::fromTablepricecategory(WTpricecategory::getFromDB($table->pricecategoryid))"/>
+                       </Map>
+                       <Map property="amounttickets">
+                               <Call lang="php" method="$data->getAmountTicketsFromDB()"/>
+                       </Map>
+                       <Map property="amountticketsblock">
+                               <Call lang="php" method="$data->getAmountTicketsBlockFromDB()"/>
+                       </Map>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="Event">
+               <Abstract lang="qt"/>
+               <Abstract lang="php"/>
+               <Property name="id" type="int" id="yes"/>
+               <Property name="start" type="int64"/>
+               <Property name="end" type="int64"/>
+               <Property name="capacity" type="int"/>
+               <Property name="price" type="List:EventPrice"/>
+               <Property name="title" type="string"/>
+               <Property name="artistid" type="int"/>
+               <Property name="artist" type="Artist"/>
+               <Property name="room" type="string"/>
+               <Property name="seatplanid" type="int"/>
+               <Property name="iscancelled" type="bool"/>
+               <Property name="cancelreason" type="string"/>
+               <Property name="amountSold" type="int"/>
+               <Property name="amountReserved" type="int"/>
+               <Property name="amountFree" type="int"/>
+               <Property name="description" type="string"/>
+               <Property name="comment" type="string"/>
+               <Property name="tax" type="int"/>
+               <Property name="flags" type="string"/>
+               <Property name="tags" type="string"/>
+               <Property name="canuse" type="bool"/>
+               
+               <Mapping table="event">
+                       <Map column="eventid" property="id"/>
+                       <Map column="title"/>
+                       <Map column="artistid"/>
+                       <Map property="artist">
+                               <Call lang="php" method="WOArtist::fromTableartist(WTartist::getFromDB($table->artistid))"/>
+                       </Map>
+                       <Map column="description"/>
+                       <Map column="comment"/>
+                       <Map column="starttime" property="start"/>
+                       <Map column="endtime" property="end"/>
+                       <Map column="roomid" property="room"/>
+                       <Map column="seatplanid"/>
+                       <Map column="capacity"/>
+                       <Map column="iscancelled"/>
+                       <Map column="flags"/>
+                       <Map column="tags"/>
+                       <Map column="tax"/>
+                       <Map column="cancelreason"/>
+                       <Map property="price">
+                               <Call lang="php" method="WOEventPrice::fromTableArrayeventprice(WTeventprice::selectFromDB('eventid='.$GLOBALS['db']->escapeInt($table->eventid),'ORDER BY prio'))"/>
+                       </Map>
+                       <Map property="amountSold">
+                               <Call lang="php" method="$data->getAmountSoldFromDB()"/>
+                       </Map>
+                       <Map property="amountReserved">
+                               <Call lang="php" method="$data->getAmountReservedFromDB()"/>
+                       </Map>
+                       <Map property="amountFree">
+                               <Call lang="php" method="$data->getcapacity()-$data->getamountSold()-$data->getamountReserved()"/>
+                       </Map>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="Room">
+               <Abstract lang="php"/>
+               <Property name="id" type="string"/>
+               <Property name="capacity" type="int"/>
+               <Property name="description" type="string"/>
+               
+               <Mapping table="room">
+                       <Map column="roomid" property="id"/>
+                       <Map column="capacity"/>
+                       <Map column="description"/>
+               </Mapping>
+       </Class>
+</Wolf>
\ No newline at end of file
diff --git a/wob/classes/order.wolf b/wob/classes/order.wolf
new file mode 100644 (file)
index 0000000..3343275
--- /dev/null
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Order MagicSmoke WOLF
+  - Tables and Comm Objects for Orders, Tickets, Vouchers, etc.
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Class name="Shipping">
+               <Doc>This class encapsulates shipping types.</Doc>
+               <Abstract lang="php"/>
+               <Property name="shipid" type="int"/>
+               <Property name="cost" type="int"/>
+               <Property name="flags" type="string"/>
+               <Property name="canuse" type="bool"/>
+               <Property name="description" type="string"/>
+               <Mapping table="shipping">
+                       <Map column="shipid"/>
+                       <Map column="cost"/>
+                       <Map column="flags"/>
+                       <Map column="description"/>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <!-- both sides implement some additional logic, hence abstract -->
+       <Class name="Ticket" abstract="yes">
+               <Doc>This class represents the data of a ticket as stored in the database.</Doc>
+               <Enum name="TicketState" refColumn="ticket:status"/>
+               <Property name="ticketid" type="astring" id="yes">uniquely identifies the ticket, this ID is automatically generated when the ticket is created  by the server</Property>
+               <Property name="eventid" type="int"/>
+               <Property name="price" type="int"/>
+               <Property name="status" type="TicketState"/>
+               <Property name="orderid" type="int"/>
+               <Property name="pricecategoryid" type="int"/>
+               <Property name="pricecategory" type="PriceCategory"/>
+               
+               <Mapping table="ticket">
+                       <Map column="ticketid"/>
+                       <Map column="price"/>
+                       <Map column="eventid"/>
+                       <Map column="status"/>
+                       <Map column="orderid" property="orderid"/>
+                       <Map column="pricecategoryid"/>
+                       <Map property="pricecategory">
+                               <Call lang="php" method="WOPriceCategory::fromTablepricecategory(WTpricecategory::getFromDB($table->pricecategoryid))"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="Voucher">
+               <Abstract lang="qt"/>
+               <Enum name="VoucherState">
+                       <Value name="Ok"/>
+                       <Value name="InvalidValue"/>
+                       <Value name="InvalidPrice"/>
+               </Enum>
+               <Property name="voucherid" type="astring" id="yes"/>
+               <Property name="value" type="int"/>
+               <Property name="price" type="int" optional="1"/>
+               <Property name="status" type="VoucherState" optional="1"/>
+               <Property name="isused" type="bool"/>
+               <Property name="orderid" type="int"/>
+               <Mapping table="voucher">
+                       <Map column="voucherid"/>
+                       <Map column="value"/>
+                       <Map column="price"/>
+                       <Map column="orderid"/>
+                       <Map column="isused"/>
+                       <Map property="status">
+                               <!-- dummy, since this conversion is only used for existing valid vouchers -->
+                               <Call lang="php" method="self::Ok"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="ItemInfo">
+               <Doc>used for basic info about items</Doc>
+               <Property name="itemid" type="int"/>
+               <Property name="productid" type="int"/>
+               <Property name="productname" type="string"/>
+               <Property name="orderid" type="int"/>
+               <Property name="amount" type="int"/>
+               <Property name="totalprice" type="int"/>
+               
+               <Mapping table="item">
+                       <Map column="itemid"/>
+                       <Map column="productid"/>
+                       <Map column="orderid"/>
+                       <Map column="amount"/>
+                       <Map column="totalprice"/>
+                       <Map property="productname">
+                               <Call lang="php" method="WTproduct::getFromDB($data->prop_productid)->name"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="Order" abstract="yes">
+               <Doc>This class represents an order in its entirety, including any items sold in it.</Doc>
+               <Enum name="OrderState" refColumn="order:status" />
+               
+               <Property name="orderid" type="int"/>
+               <Property name="customerid" type="int"/>
+               <Property name="customer" type="CustomerInfo"/>
+               <Property name="invoiceaddressid" type="int64"/>
+               <Property name="invoiceaddress" type="Address"/>
+               <Property name="deliveryaddressid" type="int64"/>
+               <Property name="deliveryaddress" type="Address"/>
+               <Property name="soldby" type="astring"/>
+               
+               <Property name="tickets" type="List:Ticket"/>
+               <Property name="vouchers" type="List:Voucher"/>
+               <Property name="items" type="List:ItemInfo"/>
+               
+               <Property name="status" type="OrderState"/>
+               
+               <Property name="amountpaid" type="int">amount that has been paid for this order</Property>
+               <Property name="amountdue" type="int">amount that needs to be paid, negative if too much has been paid</Property>
+               <Property name="totalprice" type="int">total price for this order (including shipping and all items)</Property>
+               <Property name="shippingcosts" type="int">costs for shipping</Property>
+               
+               <Property name="shippingtypeid" type="int"/>
+               <Property name="shippingtype" type="Shipping"/>
+               
+               <Property name="ordertime" type="int64"/>
+               <Property name="senttime" type="int64"/>
+               
+               <Property name="comments" type="string"/>
+               <!-- etc.pp. -->
+               
+               <Mapping table="order">
+                       <Map column="orderid"/>
+                       <Map column="customerid"/>
+                       <Map property="customer"><Call lang="php" method="WOCustomerInfo::fromTablecustomer(WTcustomer::getFromDB($data->prop_customerid))"/></Map>
+                       <Map column="soldby"/>
+                       <Map column="invoiceaddress" property="invoiceaddressid"/>
+                       <Map column="deliveryaddress" property="deliveryaddressid"/>
+                       <Map property="invoiceaddress"><Call lang="php" method="WOAddress::fromTableaddress(WTaddress::getFromDB($table->invoiceaddress))"/></Map>
+                       <Map property="deliveryaddress"><Call lang="php" method="WOAddress::fromTableaddress(WTaddress::getFromDB($table->deliveryaddress))"/></Map>
+                       <Map column="amountpaid"/>
+                       <Map column="status"/>
+                       <Map column="shippingcosts"/>
+                       <Map column="shippingtype" property="shippingtypeid"/>
+                       <Map property="shippingtype"><Call lang="php" method="WOShipping::fromTableshipping(WTshipping::getFromDB($table->shippingtype))"/></Map>
+                       <Map column="ordertime"/>
+                       <Map column="senttime"/>
+                       <Map column="comments"/>
+                       
+                       <Map property="tickets"><Call lang="php" method="WOTicket::fromTableArrayticket(WTticket::selectFromDB('orderid='.$GLOBALS['db']->escapeInt($table->orderid)))"/></Map>
+                       <Map property="vouchers"><Call lang="php" method="WOVoucher::fromTableArrayvoucher(WTvoucher::selectFromDB('orderid='.$GLOBALS['db']->escapeInt($table->orderid)))"/></Map>
+                       <Map property="items"><Call lang="php" method="WOItemInfo::fromTableArrayitem(WTitem::selectFromDB('orderid='.$GLOBALS['db']->escapeInt($table->orderid)))"/></Map>
+                               
+                       <Map property="totalprice"><Call lang="php" method="$data->getTotalPrice()"/></Map>
+                       <Map property="amountdue"><Call lang="php" method="$data->prop_totalprice - $data->prop_amountpaid"/></Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="OrderInfo" abstract="yes">
+               <Doc>This class represents the main information about an order as shown in lists.</Doc>
+               <Enum name="OrderState" refColumn="order:status" />
+               
+               <Property name="orderid" type="int"/>
+               <Property name="customerid" type="int"/>
+               <Property name="soldby" type="astring"/>
+               
+               <Property name="amounttickets" type="int"/>
+               <Property name="amountvouchers" type="int"/>
+               <Property name="amountitems" type="int"/>
+               
+               <Property name="status" type="OrderState"/>
+               
+               <Property name="amountpaid" type="int">amount that has been paid for this order</Property>
+               <Property name="amountdue" type="int">amount that needs to be paid, negative if too much has been paid</Property>
+               <Property name="totalprice" type="int">total price for this order (including shipping and all items)</Property>
+               <Property name="shippingcosts" type="int">costs for shipping</Property>
+               
+               <Property name="ordertime" type="int64"/>
+               <Property name="senttime" type="int64"/>
+               <!-- etc.pp. -->
+               <Mapping table="order">
+                       <Map column="orderid"/>
+                       <Map column="customerid"/>
+                       <Map column="soldby"/>
+                       <Map column="status"/>
+                       <Map column="ordertime"/>
+                       <Map column="senttime"/>
+                       <Map column="amountpaid"/>
+                       <Map column="shippingcosts"/>
+                       
+                       <Map property="totalprice">
+                               <Call lang="php" method="$data->getTotalPriceFromDB()"/>
+                       </Map>
+                       <Map property="amountdue">
+                               <Call lang="php" method="$data->prop_amountdue=$data->prop_totalprice - $data->prop_amountpaid"/>
+                       </Map>
+                       <Map property="amounttickets">
+                               <Call lang="php" method="$data->getAmountTicketsFromDB()"/>
+                       </Map>
+                       <Map property="amountvouchers">
+                               <Call lang="php" method="$data->getAmountVouchersFromDB()"/>
+                       </Map>
+                       <Map property="amountitems">
+                               <Call lang="php" method="$data->getAmountItemsFromDB()"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="TicketUse">
+               <Doc>Objects of this class are sent back as response to UseTicket</Doc>
+               <Property name="ticket" type="Ticket">The ticket, if found.</Property>
+               <Enum name="TicketUseStatus">
+                       <Value name="Ok" value="1">The ticket was ok and has been marked as Used</Value>
+                       <Value name="NotFound">The ticket has not been found or the barcode belongs to a voucher</Value>
+                       <Value name="WrongEvent">The ticket belongs to the wrong event.</Value>
+                       <Value name="AlreadyUsed">The ticket has already been used.</Value>
+                       <Value name="NotUsable">The ticket is only reserved or has been given back, it cannot be used.</Value>
+                       <Value name="Unpaid">The order of this ticket has not been paid for yet.</Value>
+                       <Value name="InvalidEvent">The given event ID is invalid.</Value>
+               </Enum>
+               <Property name="usestatus" type="TicketUseStatus">The result of the UseTicket operation</Property>
+               <Property name="amounttickets" type="int">The amount of usable/used tickets in this event</Property>
+               <Property name="amountused" type="int">The amount of used tickets in the event (after the operation)</Property>
+               <Property name="amountopen" type="int">The amount of tickets for the event that have not been used yet.</Property>
+               <Property name="amountreserved" type="int">The amount of tickets for the event that could be used, but are only reserved until now.</Property>
+       </Class>
+</Wolf>
\ No newline at end of file
diff --git a/wob/classes/template.wolf b/wob/classes/template.wolf
new file mode 100644 (file)
index 0000000..a74c5fd
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Template MagicSmoke WOLF
+  - template tables
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Class name="Template">
+               <Abstract lang="php"/>
+               <Property name="filename" type="astring"/>
+               <Property name="description" type="string"/>
+               <Property name="content" type="blob"/>
+               <Property name="hash" type="astring"/> <!--md5-->
+               <Property name="dolog" type="bool"/>
+               <Property name="flags" type="string"/>
+               <Property name="canuse" type="bool"/>
+               <Mapping table="template">
+                       <Map column="filename"/>
+                       <Map column="description"/>
+                       <Map column="content"/>
+                       <Map column="hash"/>
+                       <Map column="dolog"/>
+                       <Map column="flags"/>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+       
+       <Class name="TemplateInfo">
+               <Property name="filename" type="astring"/>
+               <Property name="description" type="string"/>
+               <Property name="hash" type="astring"/> <!--md5-->
+               <Property name="flags" type="astring"/>
+               <Mapping table="template">
+                       <Map column="filename"/>
+                       <Map column="description"/>
+                       <Map column="hash"/>
+                       <Map column="flags"/>
+                       <Map property="canuse">
+                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+                       </Map>
+               </Mapping>
+       </Class>
+</Wolf>
diff --git a/wob/classes/user.wolf b/wob/classes/user.wolf
new file mode 100644 (file)
index 0000000..d2a0552
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- User MagicSmoke WOLF
+  - hmm, should this be merged with basics?
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Class name="User">
+               <Doc>This class represents the main information about users: login name plus description. Passwords are never carried towards the client, more detailed info is contained in other classes.</Doc>
+               <Property name="name" type="astring"/>
+               <Property name="description" type="string"/>
+               <Property name="flags" type="astring"/>
+               <Mapping table="user">
+                       <Map column="uname" property="name"/>
+                       <Map column="description"/>
+                       <Map column="flags"/>
+               </Mapping>
+       </Class>
+       
+       <Class name="Host">
+               <Property name="name" type="string"/>
+               <!-- if hostkey is NULL it is a special host (_any, _anon, _online) -->
+               <Property name="key" type="string" />
+               <Mapping table="host">
+                       <Map column="hostname" property="name"/>
+                       <Map column="hostkey" property="key"/>
+               </Mapping>
+       </Class>
+       
+       <Class name="Role" abstract="yes">
+               <Property name="name" type="string"/>
+               <Property name="description" type="string"/>
+               <Property name="flags" type="string"/>
+               <Property name="rights" type="List:string"/>
+               <Mapping table="role">
+                       <Map column="rolename" property="name"/>
+                       <Map column="description"/>
+                       <Map column="flags"/>
+                       <Map property="rights">
+                               <Call lang="php" method="$data->getRightsFromDB()"/>
+                       </Map>
+                       <!-- how about rights? -->
+               </Mapping>
+       </Class>
+</Wolf>
\ No newline at end of file
diff --git a/wob/customer.wolf b/wob/customer.wolf
deleted file mode 100644 (file)
index b82fda5..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Customer MagicSmoke WOLF
-  - customer management
-  -
-  - (c) Konrad Rosenbaum, 2009
-  - this file is protected under the GNU AGPLv3 or at your option any newer
-  - see COPYING.AGPL for details
-  -->
-<Wolf>
-       <Table name="country">
-               <Column name="countryid" type="string:3" primarykey="yes"/>
-               <Column name="countryname" type="string:64" notnull="yes"/>
-               <!-- TODO: add shipping info -->
-               <Preset><V col="countryid" val="de"/><V col="countryname" val="Germany"/></Preset>
-               <Preset><V col="countryid" val="at"/><V col="countryname" val="Austria"/></Preset>
-               <Preset><V col="countryid" val="ch"/><V col="countryname" val="Switzerland"/></Preset>
-       </Table>
-       <Table name="customer" backup="yes">
-               <Column name="customerid" type="seq32" primarykey="yes"/>
-               <!--main data-->
-               <Column name="title" type="string" notnull="yes"/>
-               <Column name="firstname" type="string" notnull="yes"/>
-               <Column name="name" type="string" notnull="yes"/>
-               <Column name="comments" type="text"/>
-               <!--online login data-->
-               <Column name="email" type="string" null="yes"/>
-               <Column name="passwd" type="string:64" null="yes"/> <!-- salted SHA-1 hash of passwd -->
-       </Table>
-       <Table name="address" backup="yes">
-               <Column name="addressid" type="seq64" primarykey="yes"/>
-               <Column name="customerid" type="int32" foreignkey="customer:customerid" notnull="yes"/>
-               <Column name="lastused" type="int64" null="yes"/>
-               <Column name="name" type="string" null="yes"/>
-               <Column name="addr1" type="string" null="yes"/>
-               <Column name="addr2" type="string" null="yes"/>
-               <Column name="city" type="string:64" null="yes"/>
-               <Column name="state" type="string:32" null="yes"/>
-               <Column name="zipcode" type="string:32" null="yes"/>
-               <Column name="countryid" type="string:16" null="yes" foreignkey="country:countryid"/>
-               <Column name="isdeleted" type="bool" notnull="yes" default="0"/>
-       </Table>
-       <Table name="contacttype" backup="yes">
-               <Column name="contacttypeid" type="seq32" primarykey="yes"/>
-               <Column name="contacttype" type="string:64" notnull="yes"/>
-               <Column name="uriprefix" type="string:10" null="yes"/>
-       </Table>
-       <Table name="contact" backup="yes">
-               <Column name="contactid" type="seq64" primarykey="yes"/>
-               <Column name="customerid" type="int32" foreignkey="customer:customerid" notnull="yes"/>
-               <Column name="contacttypeid" type="int32" notnull="yes" foreignkey="contacttype:contacttypeid"/>
-               <Column name="contact" type="string" notnull="yes"/>
-       </Table>
-       
-       <Class name="Country">
-               <Property name="id" type="astring"/>
-               <Property name="name" type="astring"/>
-               <Mapping table="country">
-                       <Map property="id" column="countryid"/>
-                       <Map property="name" column="countryname"/>
-               </Mapping>
-       </Class>
-       <Class name="Address">
-               <Abstract lang="qt"/><!-- eg. fullAddress() method -->
-               <Property name="addressid" type="int64"/>
-               <Property name="customerid" type="int32"/>
-               <Property name="lastused" type="int64"/>
-               <Property name="name" type="string"/>
-               <Property name="addr1" type="string"/>
-               <Property name="addr2" type="string"/>
-               <Property name="city" type="string"/>
-               <Property name="state" type="string"/>
-               <Property name="zipcode" type="string"/>
-               <Property name="countryid" type="astring"/>
-               <Property name="isdeleted" type="bool"/>
-               
-               <Property name="country" type="Country"/>
-               
-               <Mapping table="address">
-                       <Map column="addressid"/>
-                       <Map column="customerid"/>
-                       <Map column="lastused"/>
-                       <Map column="name"/>
-                       <Map column="addr1"/>
-                       <Map column="addr2"/>
-                       <Map column="city"/>
-                       <Map column="state"/>
-                       <Map column="zipcode"/>
-                       <Map column="countryid"/>
-                       <Map column="isdeleted"/>
-                       <Map property="country">
-                               <Call lang="php" method="WOCountry::fromTablecountry(WTcountry::getFromDB($table->countryid))"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       <Class name="ContactType">
-               <Property name="contacttypeid" type="int32"/>
-               <Property name="contacttype" type="string"/>
-               <Property name="uriprefix" type="string"/>
-               <Mapping table="contacttype">
-                       <Map column="contacttypeid"/>
-                       <Map column="contacttype"/>
-                       <Map column="uriprefix"/>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetAllContactTypes" updating="no">
-               <Input/>
-               <Call lang="php" method="$this->settypes(WOContactType::fromTableArraycontacttype(WTcontacttype::selectFromDB()));"/>
-               <Output>
-                       <Var name="types" type="List:ContactType"/>
-               </Output>
-       </Transaction>
-       <Transaction name="CreateContactType">
-               <Input>
-                       <Var name="typename" type="string"/>
-                       <Var name="uriprefix" type="astring"/>
-               </Input>
-               <Call lang="php" method="WOCustomer::createContactType($this);"/>
-               <Output>
-                       <Var name="contacttype" type="ContactType"/>
-               </Output>
-       </Transaction>
-       
-       <Class name="Contact">
-               <Property name="contactid" type="int64"/>
-               <Property name="customerid" type="int32"/>
-               <Property name="contacttypeid" type="int32"/>
-               <Property name="contact" type="string"/>
-               
-               <Property name="contacttype" type="ContactType"/>
-               
-               <Mapping table="contact">
-                       <Map column="contactid"/>
-                       <Map column="customerid"/>
-                       <Map column="contacttypeid"/>
-                       <Map column="contact"/>
-                       <Map property="contacttype">
-                               <Call lang="php" method="WOContactType::fromTablecontacttype(WTcontacttype::getFromDB($table->contacttypeid))"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       <Class name="Customer">
-               <Abstract lang="qt"/>
-               <Abstract lang="php"/>
-               <Property name="id" type="int"/>
-               <Property name="title" type="string"/>
-               <Property name="firstname" type="string"/>
-               <Property name="name" type="string"/>
-               <Property name="comments" type="string"/>
-               <!--online login data-->
-               <Property name="email" type="string"/>
-               <!-- password is never sent from server to client -->
-               
-               <Property name="addresses" type="List:Address"/>
-               <Property name="contacts" type="List:Contact"/>
-               
-               <Mapping table="customer">
-                       <Map column="customerid" property="id"/>
-                       <Map column="title"/>
-                       <Map column="firstname"/>
-                       <Map column="name"/>
-                       <Map column="comments"/>
-                       <Map column="email"/>
-                       <Map property="addresses">
-                               <Call lang="php" method="WOAddress::fromTableArrayaddress(WTaddress::selectFromDB('customerid='.$GLOBALS['db']->escapeInt($table->customerid)))"/>
-                       </Map>
-                       <Map property="contacts">
-                               <Call lang="php" method="WOContact::fromTableArraycontact(WTcontact::selectFromDB('customerid='.$GLOBALS['db']->escapeInt($table->customerid)))"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       <Class name="CustomerInfo">
-               <Abstract lang="qt"/><!-- abstract is needed on C++ side -->
-               <Doc>This class encapsulates the most basic information about a customer.</Doc>
-               <Doc>For more complex tasks the Customer class is used.</Doc>
-               <Property name="customerid" type="int"/>
-               <Property name="title" type="string"/>
-               <Property name="firstname" type="string"/>
-               <Property name="name" type="string"/>
-               <Mapping table="customer">
-                       <Map column="customerid"/>
-                       <Map column="title"/>
-                       <Map column="firstname"/>
-                       <Map column="name"/>
-               </Mapping>
-       </Class>
-       
-       
-       <Transaction name="GetCustomer" updating="no">
-               <Input>
-                       <Var name="customerid" type="int"/>
-               </Input>
-               <Call lang="php" method="$this->setcustomer(WOCustomer::fromTablecustomer(WTcustomer::getFromDB($this->getcustomerid())));"/>
-               <Output>
-                       <Var name="customer" type="Customer"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetAllCustomerNames" updating="no">
-               <Input/>
-               <Call lang="php" method="$this->setcustomers(WOCustomerInfo::fromTableArraycustomer(WTcustomer::selectFromDB()));"/>
-               <Output>
-                       <Var name="customers" type="List:CustomerInfo"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreateCustomer">
-               <Input>
-                       <Var name="customer" type="Customer"/>
-               </Input>
-               <Call lang="php" method="WOCustomer::createCustomer($this);"/>
-               <Output>
-                       <Var name="customer" type="Customer"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="ChangeCustomer">
-               <Input>
-                       <Var name="customer" type="Customer"/>
-               </Input>
-               <Call lang="php" method="WOCustomer::changeCustomer($this);"/>
-               <Output>
-                       <Var name="customer" type="Customer"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="DeleteCustomer">
-               <Input>
-                       <Var name="customerid" type="int"/>
-                       <Var name="mergewithid" type="int"/>
-               </Input>
-               <Call lang="php" method="WOCustomer::deleteCustomer($this);"/>
-               <Output>
-                       <Var name="customer" type="Customer"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetAddress" updating="no">
-               <Input>
-                       <Var name="addressid" type="int64"/>
-               </Input>
-               <Call lang="php" method="$this->setaddress(WOAddress::fromTableaddress(WTaddress::getFromDB($this->getaddressid())));"/>
-               <Output>
-                       <Var name="address" type="Address"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetAllCountries" updating="no">
-               <Input/>
-               <Call lang="php" method="$this->setcountries(WOCountry::fromTableArraycountry(WTcountry::selectFromDB()));"/>
-               <Output>
-                       <Var name="countries" type="List:Country"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreateCountry">
-               <Input>
-                       <Var name="abbrev" type="astring"/>
-                       <Var name="name" type="astring"/>
-               </Input>
-               <!-- implemented in customer, since it is the only main object using this -->
-               <Call lang="php" method="WOCustomer::createCountry($this);"/>
-               <Output>
-                       <Var name="country" type="Country"/>
-               </Output>
-       </Transaction>
-</Wolf>
\ No newline at end of file
similarity index 100%
rename from wob/audit.wolf
rename to wob/db/audit.wolf
diff --git a/wob/db/basics.wolf b/wob/db/basics.wolf
new file mode 100644 (file)
index 0000000..0f4e0a2
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Basic MagicSmoke WOLF
+  - base tables for login etc.
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Table name="config" backup="yes">
+               <Column name="ckey" type="string:32" primarykey="yes"/>
+               <Column name="cval" type="string"/>
+               
+               <Preset><V col="ckey" val="MagicSmokeVersion"/><V col="cval" code="$this->version()"/></Preset>
+               <Preset><V col="ckey" val="ValidVouchers"/><V col="cval" val="1000 2000 2500 5000"/></Preset>
+               <Preset><V col="ckey" val="OrderStop"/><V col="cval" val="24"/></Preset>
+               <Preset><V col="ckey" val="ReserveStop"/><V col="cval" val="48"/></Preset>
+               <Preset><V col="ckey" val="TicketIDChars"/><V col="cval" val="10"/></Preset>
+               <Preset><V col="ckey" val="VoucherIDChars"/><V col="cval" val="10"/></Preset>
+               <Preset><V col="ckey" val="Flag _admin"/><V col="cval" val="User is Admin"/></Preset>
+               <Preset><V col="ckey" val="Flag _web"/><V col="cval" val="User is Customer"/></Preset>
+       </Table>
+</Wolf>
diff --git a/wob/db/cart.wolf b/wob/db/cart.wolf
new file mode 100644 (file)
index 0000000..ec12584
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Cart MagicSmoke WOLF
+   - shopping cart management (web interface)
+   -
+   - (c) Konrad Rosenbaum, 2009
+   - this file is protected under the GNU AGPLv3 or at your option any newer
+   - see COPYING.AGPL for details
+   -->
+<Wolf>
+       <Table name="cart" backup="no">
+               <Column name="cartid" type="string:32" primarykey="yes">
+                       the cookie for this cart
+                       <Call lang="php" method="WebCart::getNewCartId()"/>
+               </Column>
+               <Column name="timeout" type="int64" notnull="yes">when the cart expires</Column>
+               <Column name="customerid" type="int32" foreignkey="customer:customerid" null="yes">
+                       ID of the customer connected to this cart.
+               </Column>
+               <Column name="invoiceaddress" type="int64" foreignkey="address:addressid" null="yes">
+                       If not null: the address the invoice goes to.
+               </Column>
+               <Column name="deliveryaddress" type="int64" foreignkey="address:addressid" null="yes">
+                       If not null: the address the delivery goes to.
+                       If null: assumed to be identical to invoiceaddress.
+               </Column>
+               <Column name="comment" type="text" null="yes">customer comments during order process</Column>
+               <Column name="shippingtype" type="int32" null="yes" foreignkey="shipping:shipid">
+               pointer to shipping type (none per default, programmatic default is in config)
+               </Column>
+       </Table>
+       <Table name="cartticket" backup="no">
+               <Column name="cartid" type="string:32" notnull="yes" foreignkey="cart:cartid" primarykey="yes"/>
+               <!--tickets in the cart-->
+               <Column name="eventid" type="int32" notnull="yes" foreignkey="event:eventid" primarykey="yes"/>
+               <Column name="pricecategoryid" type="int32" foreignkey="pricecategory:pricecategoryid" primarykey="yes"/>
+               <Column name="amount" type="int32" notnull="yes"/>
+               <!-- Column name="seating" type="string:32" null="yes"/ -->
+       </Table>
+       <Table name="cartvoucher" backup="no">
+               <Column name="cvid" type="seq64" primarykey="yes"/>
+               <Column name="cartid" type="string:32" notnull="yes" foreignkey="cart:cartid"/>
+               <Column name="value" type="int32" notnull="yes">voucher value in cents</Column>
+       </Table>
+       <Table name="cartitem" backup="no">
+               <Column name="ciid" type="seq64" primarykey="yes"/>
+               <Column name="cartid" type="string:32" notnull="yes" foreignkey="cart:cartid"/>
+               <Column name="productid" type="int32" foreignkey="product:productid" notnull="yes"/>
+               <Column name="amount" type="int32" notnull="yes"/>
+       </Table>
+       
+       <Table name="websession" backup="no">
+               <Column name="sessionid" type="string:64" primarykey="yes"/>
+               <!--/customer-->
+               <Column name="customerid" type="int32" notnull="yes" foreignkey="customer:customerid"/>
+               <!--unix timestamp at which to delete this session-->
+               <Column name="timeout" type="int64" notnull="yes"/>
+       </Table>
+</Wolf>
\ No newline at end of file
diff --git a/wob/db/customer.wolf b/wob/db/customer.wolf
new file mode 100644 (file)
index 0000000..2440826
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Customer MagicSmoke WOLF
+  - customer management
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Table name="country">
+               <Column name="countryid" type="string:3" primarykey="yes"/>
+               <Column name="countryname" type="string:64" notnull="yes"/>
+               <!-- TODO: add shipping info -->
+               <Preset><V col="countryid" val="de"/><V col="countryname" val="Germany"/></Preset>
+               <Preset><V col="countryid" val="at"/><V col="countryname" val="Austria"/></Preset>
+               <Preset><V col="countryid" val="ch"/><V col="countryname" val="Switzerland"/></Preset>
+       </Table>
+       <Table name="customer" backup="yes">
+               <Column name="customerid" type="seq32" primarykey="yes"/>
+               <!--main data-->
+               <Column name="title" type="string" notnull="yes"/>
+               <Column name="firstname" type="string" notnull="yes"/>
+               <Column name="name" type="string" notnull="yes"/>
+               <Column name="comments" type="text"/>
+               <!--online login data-->
+               <Column name="email" type="string" null="yes"/>
+               <Column name="passwd" type="string:64" null="yes"/> <!-- salted SHA-1 hash of passwd -->
+       </Table>
+       <Table name="address" backup="yes">
+               <Column name="addressid" type="seq64" primarykey="yes"/>
+               <Column name="customerid" type="int32" foreignkey="customer:customerid" notnull="yes"/>
+               <Column name="lastused" type="int64" null="yes"/>
+               <Column name="name" type="string" null="yes"/>
+               <Column name="addr1" type="string" null="yes"/>
+               <Column name="addr2" type="string" null="yes"/>
+               <Column name="city" type="string:64" null="yes"/>
+               <Column name="state" type="string:32" null="yes"/>
+               <Column name="zipcode" type="string:32" null="yes"/>
+               <Column name="countryid" type="string:16" null="yes" foreignkey="country:countryid"/>
+               <Column name="isdeleted" type="bool" notnull="yes" default="0"/>
+       </Table>
+       <Table name="contacttype" backup="yes">
+               <Column name="contacttypeid" type="seq32" primarykey="yes"/>
+               <Column name="contacttype" type="string:64" notnull="yes"/>
+               <Column name="uriprefix" type="string:10" null="yes"/>
+       </Table>
+       <Table name="contact" backup="yes">
+               <Column name="contactid" type="seq64" primarykey="yes"/>
+               <Column name="customerid" type="int32" foreignkey="customer:customerid" notnull="yes"/>
+               <Column name="contacttypeid" type="int32" notnull="yes" foreignkey="contacttype:contacttypeid"/>
+               <Column name="contact" type="string" notnull="yes"/>
+       </Table>
+</Wolf>
\ No newline at end of file
diff --git a/wob/db/db.wolf b/wob/db/db.wolf
new file mode 100644 (file)
index 0000000..9fe6e9e
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Main MagicSmoke DB Definition WOLF
+  -
+  - (c) Konrad Rosenbaum, 2009-2010
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <DataBase instance="db" schema="dbScheme" version="01.04" defaultUpdating="yes">
+               <AuditTables>
+                       <Column name="audittime" type="int64">Time at which the change was made.
+                               <Call lang="php" method="time()"/>
+                       </Column>
+                       <Column name="audituname" type="string:64">The user name of the user who made the change.
+                               <Call lang="php" method="Session::currentUserName()"/>
+                       </Column>
+                       <Column name="audittransaction" type="string:64">The transaction name under which the change was made.
+                               <Call lang="php" method="WobTransactionBase::getExecutingName()"/>
+                       </Column>
+               </AuditTables>
+       </DataBase>
+</Wolf>
\ No newline at end of file
diff --git a/wob/db/event.wolf b/wob/db/event.wolf
new file mode 100644 (file)
index 0000000..6efbe2e
--- /dev/null
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Event Definition MagicSmoke WOLF
+  - declares everything needed to define events
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Table name="room" backup="yes">
+               <Doc>Stores rooms that can be used for events.</Doc>
+               <Column name="roomid" type="string:64" primarykey="yes">Name of the room</Column>
+               <Column name="capacity" type="int32" notnull="yes">Amount of people fitting into the room, zero means unlimited, this can be overridden per event.</Column>
+               <Column name="description" type="text">A short description of the room to help users. Currently not used extensively.</Column>
+               <Column name="flags" type="string">filter flags: defines who can use this room for new events (ignored once it is attached to an event)</Column>
+       </Table>
+       
+       <Table name="seatplan" backup="yes">
+               <Doc>stores seating arrangements</Doc>
+               <Column name="seatplanid" type="seq32" primarykey="yes"/>
+               <Column name="roomid" type="string:64" foreignkey="room:roomid">the room this seating arrangement belongs to</Column>
+               <Column name="name" type="string">display name of the seating arrangement</Column>
+               <Column name="plan" type="text">XML representation of the seating arrangements</Column>
+               <Column name="flags" type="string">filter flags: defines who can use this arrangement for new events (ignored once it is attached to an event)</Column>
+       </Table>
+       
+       <Table name="pricecategory" backup="yes">
+               <Column name="pricecategoryid" type="seq32" primarykey="yes"/>
+               <Column name="name" type="string" notnull="yes"/>
+               <Column name="abbreviation" type="string:10" notnull="yes"/>
+               <Column name="formula" type="string"/>
+               <Column name="flags" type="string">filter flags: defines who can use the category to define a new event (ignored once it is attached to an event)</Column>
+               <Column name="tags" type="string">internal tags: can be used by ticket printing templates or macros to execute certain actions</Column>
+               
+               <Preset>
+                       <V col="pricecategoryid" val="1"/>
+                       <V col="name" val="normal"/>
+                       <V col="abbreviation" val="norm"/>
+                       <V col="formula" val=""/>
+                       <V col="flags" val=""/>
+                       <V col="tags" val=""/>
+               </Preset>
+       </Table>
+       
+       <Table name="artist" backup="yes">
+               <Column name="artistid" type="seq32" primarykey="yes"/>
+               <Column name="artistname" type="string" notnull="yes"/>
+               <Column name="description" type="text"/>
+               <Column name="comment" type="text"/>
+               <Column name="flags" type="string">filter flags: defines who can create events with this artist (ignored once it is attached to an event)</Column>
+               <Column name="tags" type="string">internal tags: can be used by macros and printer routines to change behavior or output</Column>
+       </Table>
+       
+       <Table name="event" backup="yes">
+               <Column name="eventid" type="seq32" primarykey="yes"/>
+               <!--display data-->
+               <Column name="title" type="string" notnull="yes"/>
+               <Column name="artistid" type="int32" foreignkey="artist:artistid"/>
+               <Column name="description" type="text"/><!-- web visible -->
+               <Column name="comment" type="text"/><!-- internal -->
+               <!--timing and location-->
+               <Column name="starttime" type="int64" notnull="yes"/>
+               <Column name="endtime" type="int64" notnull="yes"/>
+               <Column name="roomid" type="string:64" foreignkey="room:roomid"/>
+               <Column name="seatplanid" type="int32" foreignkey="seatplan:seatplanid" null="yes"/>
+               <!--initially a copy from room, can be adjusted-->
+               <Column name="capacity" type="int32" notnull="yes"/>
+               <!-- flags -->
+               <Column name="iscancelled" type="bool" default="0"/>
+               <Column name="flags" type="string">filter: who can sell tickets for this event</Column>
+               <Column name="tax" type="int32">taxes on this event in hundredth of a percent, this value is actually never used internall, but may be used by printing routines for calculations</Column>
+               <Column name="tags" type="string">internal tags: can be used by macros and printer routines to change behavior or output</Column>
+               <!-- reason the event has been cancelled-->
+               <Column name="cancelreason" type="string"/>
+       </Table>
+       
+       <Table name="eventprice" backup="yes">
+               <Column name="eventid" type="int32" primarykey="yes" foreignkey="event:eventid"/>
+               <Column name="pricecategoryid" type="int32" primarykey="yes" foreignkey="pricecategory:pricecategoryid"/>
+               <Column name="maxavailable" type="int32" notnull="yes"/>
+               <Column name="price" type="int32" notnull="yes"/>
+               <Column name="prio" type="int32" notnull="yes" default="10">order in which prices are listet, lowest prio first</Column>
+               <Column name="flags" type="string">filter: who can sell tickets in this category for this event</Column>
+               <Column name="tags" type="string">internal tags: can be used by macros and printer routines to change behavior or output</Column>
+       </Table>
+</Wolf>
\ No newline at end of file
diff --git a/wob/db/order.wolf b/wob/db/order.wolf
new file mode 100644 (file)
index 0000000..364f75c
--- /dev/null
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Order MagicSmoke WOLF
+  - Tables and Comm Objects for Orders, Tickets, Vouchers, etc.
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Table name="shipping" backup="yes">
+               <Doc>This table contains descriptions of shipping methods, the actual cost can be overridden in each order.</Doc>
+               <Column name="shipid" type="seq32" primarykey="yes"/>
+               <Column name="cost" type="int32" notnull="yes">default cost of this shipping type in cents</Column>
+               <Column name="flags" type="string">flags showing who can use this method</Column>
+               <Column name="description" type="string">description for the shipping type</Column>
+       </Table>
+       <Table name="paymenttype" backup="yes">
+               <Doc>This table contains acceptable payment methods. (Under construction.)</Doc>
+               <Column name="paytype" type="string:64" primarykey="yes"/>
+               <Column name="description" type="string"/>
+               <Column name="dataname" type="string:64" null="yes"/>
+               <Column name="flags" type="string">filter: who can log payments with this method</Column>
+               
+               <Preset><V col="paytype" val="cash"/><V col="description" val="default paytype: cash"/></Preset>
+       </Table>
+       <Table name="order" backup="yes" audit="yes">
+               <Doc>This table contains all orders and sales.</Doc>
+               <Column name="orderid" type="seq32" primarykey="yes"/>
+               <!--customer-->
+               <Column name="customerid" type="int32" foreignkey="customer:customerid">
+                       ID of the customer connected to this order.
+               </Column>
+               <!--seller (_online for web forms)-->
+               <Column name="soldby" type="string:64" foreignkey="user:uname">User name of the user who entered it into the system. "_web" for the online system.</Column>
+               <!--if not null/empty: this address for delivery, customer address for invoice-->
+               <Column name="invoiceaddress" type="int64" foreignkey="address:addressid" null="yes">
+                       If not null: the address the invoice goes to.
+               </Column>
+               <Column name="deliveryaddress" type="int64" foreignkey="address:addressid" null="yes">
+                       If not null: the address the delivery goes to.
+                       If null: assumed to be identical to invoiceaddress.
+               </Column>
+               <!--status, see ORDER_* constants-->
+               <Column name="status" type="enum32" notnull="yes">
+                       <Doc>Status the order is in right now.</Doc>
+                       <Value name="Placed" value="0">The order has been placed, but not acted upon yet.</Value>
+                       <Value name="Sent" value="1">The order has been sent out or handed to the customer.</Value>
+                       <Value name="Sold" value="1">Alias for Sent. Semantically: it is sold if it has been sent and paid.</Value>
+                       <Value name="Cancelled" value="2">The order has been cancelled, if anything has been paid, it must be paid back.</Value>
+                       <Value name="Reserved" value="4">The order is just a reservation for a limited time, application logic must determine the timeout.</Value>
+                       <Value name="Closed" value="0x80">The order is closed out of the system - the payment status is ignored from now on. Currently not used.</Value>
+               </Column>
+               <Column name="ordertime" type="int64" notnull="yes">When the order was created</Column>
+               <Column name="senttime" type="int64">When the order was sent to the customer</Column>
+               <Column name="comments" type="text">comments made on web form (eg. "urgently needed for dads birthday")</Column>
+               <Column name="amountpaid" type="int32">
+               how much has been paid already (including used vouchers);
+               this is for comparison with the price fields in ticket and voucher tables
+               </Column>
+               <Column name="shippingcosts" type="int32" default="0">shipping price; this is not re-imbursed for orders that have been sent and then cancelled</Column>
+               <Column name="shippingtype" type="int32" null="yes" foreignkey="shipping:shipid">
+               pointer to shipping type (none per default, programmatic default is in config)
+               </Column>
+               
+               <!-- in audit: monitor the type of payment -->
+               <AuditColumn name="paytype" type="string:64" foreignkey="paymenttype:paytype"/>
+               <AuditColumn name="paydata" type="string"/>
+               
+               <Foreign method="getTickets" via="ticket:orderid=orderid">Returns the tickets for this order</Foreign>
+               <Foreign method="getVouchers" via="voucher:orderid=orderid">Returns the vochers sold by this order</Foreign>
+               <Foreign method="getItems" via="item:orderid=orderid">Returns additional sold items for this order</Foreign>
+       </Table>
+       <Table name="ticket" backup="yes" base="BarcodeTable" audit="yes">
+               <Column name="ticketid" type="string:32" primarykey="yes">
+                       a 8-32 char code (code39: case-insensitive letters+digits) for the ticket;
+                       automatically generated
+                       <Call lang="php" method="BarcodeTable::getNewTicketId()"/>
+               </Column>
+               <Column name="eventid" type="int32" foreignkey="event:eventid"/>
+               <!--initially a copy from event, can be adjusted by seller-->
+               <Column name="price" type="int32" notnull="yes"/>
+               <Column name="pricecategoryid" type="int32" foreignkey="pricecategory:pricecategoryid"/>
+               <!--status of ticket (see TICKET_* constants)-->
+               <Column name="status" type="enum32" notnull="yes">
+                       <Value name="Reserved" value="0x311"> <!--dec: 785-->
+                       The ticket is reserved for a customer, it blocks the seat, but is not to be paid yet.</Value>
+                       <Value name="Ordered" value="0x312"> <!--dec: 786-->
+                       The ticket is ordered/sold and possibly paid for (payment is stored in its order).</Value>
+                       <Value name="Used" value="0x303"> <!--dec: 771-->
+                       The ticket has been used.</Value>
+                       <Value name="Cancelled" value="0x4"> <!--dec: 4-->
+                       The ticket has been given back for some reason and needs to be re-imbursed (if paid already).</Value>
+                       <Value name="Refund" value="0x4">Alias for Cancelled</Value>
+                       <Value name="MaskBlock" value="0x100"> <!--dec: 256-->
+                       Masking value: if this bit is set the ticket blocks a seat.</Value>
+                       <Value name="MaskPay" value="0x200"> <!--dec: 512-->
+                       Masking value: if this bit is set the ticket must be paid by the customer.</Value>
+                       <Value name="MaskUsable" value="0x300"> <!--dec: 768-->
+                       Masking value: combines Block+Pay - the ticket can be used to watch a show or is already being used.</Value>
+                       <Value name="MaskReturnable" value="0x10"> <!--dec: 16-->
+                       Masking value: if this bit is set the ticket can still be cancelled.</Value>
+                       <Value name="MaskChangeable" value="0x10"> <!--dec: 16-->
+                       Masking value: if this bit is set the ticket can still be changed (price, event, etc.). Currently an alias for MaskReturnable.</Value>
+               </Column>
+               <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/>
+               <Column name="seat" type="string:32" null="yes"/>
+               
+               <!-- TODO: add check constraint that eventid,pricecategoryid exist in eventprice-->
+       </Table>
+       <Table name="voucher" backup="yes" base="BarcodeTable" audit="yes">
+               <!--a 8-32 char code (code39: case-insensitive letters+digits) for the voucher-->
+               <Column name="voucherid" type="string:32" primarykey="yes">
+                       <Call lang="php" method="BarcodeTable::getNewVoucherId()"/>
+               </Column>
+               <!--price of the voucher (0 if cancelled)-->
+               <Column name="price" type="int32" notnull="yes"/>
+               <!--order this voucher belongs to-->
+               <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/>
+               <!--marker: voucher has been used to pay something-->
+               <Column name="isused" type="bool" default="false"/>
+               <!--remaining value in cents (0 for cancelled)-->
+               <Column name="value" type="int32" notnull="yes"/>
+       </Table>
+       
+       <Table name="product" backup="yes">
+               <Doc>A saleable product other than tickets or vouchers (eg. merchandizing).</Doc>
+               <Doc>This table represents stock. When a product is sold an entry is created in the table item.</Doc>
+               <Column name="productid" type="seq32" primarykey="yes"/>
+               <Column name="name" type="string" notnull="yes"/>
+               <Column name="description" type="text"/>
+               
+               <Column name="inventory" type="int32" notnull="yes">
+               amount that remains in the inventory, or -1 if it is unlimited
+               </Column>
+               <Column name="price" type="int32" notnull="yes"/>
+               <Column name="barcode" type="string" null="yes">usually the EAN code</Column>
+               <Column name="flags" type="string">filter: who can sell this product</Column>
+               <Column name="tax" type="int32"/>
+       </Table>
+       <Table name="item" backup="yes" audit="yes">
+               <Doc>A sold item other than a ticket or voucher.</Doc>
+               <Column name="itemid" type="seq64" primarykey="yes"/>
+               <Column name="productid" type="int32" foreignkey="product:productid" notnull="yes"/>
+               <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/>
+               <Column name="amount" type="int32" notnull="yes"/>
+               <Column name="totalprice" type="int32" notnull="yes"/>
+       </Table>
+</Wolf>
\ No newline at end of file
diff --git a/wob/db/template.wolf b/wob/db/template.wolf
new file mode 100644 (file)
index 0000000..2a1b5ee
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Template MagicSmoke WOLF
+  - template tables
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Table name="template" backup="yes">
+               <Column name="filename" type="string" primarykey="yes"/>
+               <Column name="description" type="string"/>
+               <Column name="content" type="blob"/>
+               <Column name="hash" type="string:32" notnull="yes"/> <!--md5-->
+               <Column name="dolog" type="bool" default="0"/>
+               <Column name="flags" type="string">filter: who can use this template</Column>
+       </Table>
+</Wolf>
diff --git a/wob/db/user.wolf b/wob/db/user.wolf
new file mode 100644 (file)
index 0000000..79b4284
--- /dev/null
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- User MagicSmoke WOLF
+  - hmm, should this be merged with basics?
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Table name="host" backup="yes">
+               <Column name="hostname" type="string:64" primarykey="yes"/>
+               <!-- if hostkey is NULL it is a special host (_any), otherwise the key is a sha1 hash of the real key -->
+               <Column name="hostkey" type="string" />
+               
+               <Preset><V col="hostname" code='translate("SpecialHost","_any")'/></Preset>
+       </Table>
+       
+       <Table name="user" backup="yes">
+               <Column name="uname" type="string:64" primarykey="yes"/>
+               <!-- passwd is a salted sha1 hash -->
+               <Column name="passwd" type="string" notnull="yes"/>
+               <!-- more detailed data that can be displayed to admins -->
+               <Column name="description" type="text"/>
+               <Column name="flags" type="string"/>
+       </Table>
+       
+       <Table name="role" backup="yes">
+               <Column name="rolename" type="string:64" primarykey="yes"/>
+               <Column name="description" type="text"/>
+               <Column name="flags" type="string"/>
+               
+               <Preset>
+                       <V col="rolename" val="_admin"/>
+                       <V col="description" val="Admin Users"/>
+                       <V col="flags" val="_admin"/>
+               </Preset>
+               <Preset>
+                       <V col="rolename" val="_web"/>
+                       <V col="description" val="Web Interface, Customers"/>
+                       <V col="flags" val="_web"/>
+               </Preset>
+       </Table>
+       
+       <Table name="roleright" backup="yes">
+               <Column name="rolename" type="string:64" primarykey="yes"/>
+               <Column name="rightname" type="string:64" primarykey="yes"/>
+               
+               <!-- TODO: assign default rights for _web -->
+       </Table>
+       
+       <Table name="userrole" backup="yes">
+               <Column name="uname" type="string:64" notnull="yes" foreignkey="user:uname" index="yes" primarykey="yes"/>
+               <Column name="role" type="string:64" notnull="yes" primarykey="yes" foreignkey="role:rolename"/>
+       </Table>
+       
+       <Table name="userhost" backup="yes">
+               <Column name="uname" type="string:64" notnull="yes" foreignkey="user:uname" index="yes" primarykey="yes"/>
+               <Column name="host" type="string:64" notnull="yes" foreignkey="host:hostname" primarykey="yes"/>
+       </Table>
+       
+       <Table name="session" backup="no">
+               <Column name="sessionid" type="string:64" primarykey="yes"/>
+               <Column name="uname" type="string:64" notnull="yes" foreignkey="user:uname"/>
+               <!-- unix timestamp at which to delete this session -->
+               <Column name="timeout" type="int64" notnull="yes"/>
+       </Table>
+</Wolf>
\ No newline at end of file
diff --git a/wob/event.wolf b/wob/event.wolf
deleted file mode 100644 (file)
index fe5ac04..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Event Definition MagicSmoke WOLF
-  - declares everything needed to define events
-  -
-  - (c) Konrad Rosenbaum, 2009
-  - this file is protected under the GNU AGPLv3 or at your option any newer
-  - see COPYING.AGPL for details
-  -->
-<Wolf>
-       <Table name="room" backup="yes">
-               <Doc>Stores rooms that can be used for events.</Doc>
-               <Column name="roomid" type="string:64" primarykey="yes">Name of the room</Column>
-               <Column name="capacity" type="int32" notnull="yes">Amount of people fitting into the room, zero means unlimited, this can be overridden per event.</Column>
-               <Column name="description" type="text">A short description of the room to help users. Currently not used extensively.</Column>
-               <Column name="flags" type="string">filter flags: defines who can use this room for new events (ignored once it is attached to an event)</Column>
-       </Table>
-       
-       <Table name="seatplan" backup="yes">
-               <Doc>stores seating arrangements</Doc>
-               <Column name="seatplanid" type="seq32" primarykey="yes"/>
-               <Column name="roomid" type="string:64" foreignkey="room:roomid">the room this seating arrangement belongs to</Column>
-               <Column name="name" type="string">display name of the seating arrangement</Column>
-               <Column name="plan" type="text">XML representation of the seating arrangements</Column>
-               <Column name="flags" type="string">filter flags: defines who can use this arrangement for new events (ignored once it is attached to an event)</Column>
-       </Table>
-       
-       <Table name="pricecategory" backup="yes">
-               <Column name="pricecategoryid" type="seq32" primarykey="yes"/>
-               <Column name="name" type="string" notnull="yes"/>
-               <Column name="abbreviation" type="string:10" notnull="yes"/>
-               <Column name="formula" type="string"/>
-               <Column name="flags" type="string">filter flags: defines who can use the category to define a new event (ignored once it is attached to an event)</Column>
-               <Column name="tags" type="string">internal tags: can be used by ticket printing templates or macros to execute certain actions</Column>
-               
-               <Preset>
-                       <V col="pricecategoryid" val="1"/>
-                       <V col="name" val="normal"/>
-                       <V col="abbreviation" val="norm"/>
-                       <V col="formula" val=""/>
-                       <V col="flags" val=""/>
-                       <V col="tags" val=""/>
-               </Preset>
-       </Table>
-       
-       <Table name="artist" backup="yes">
-               <Column name="artistid" type="seq32" primarykey="yes"/>
-               <Column name="artistname" type="string" notnull="yes"/>
-               <Column name="description" type="text"/>
-               <Column name="comment" type="text"/>
-               <Column name="flags" type="string">filter flags: defines who can create events with this artist (ignored once it is attached to an event)</Column>
-               <Column name="tags" type="string">internal tags: can be used by macros and printer routines to change behavior or output</Column>
-       </Table>
-       
-       <Table name="event" backup="yes">
-               <Column name="eventid" type="seq32" primarykey="yes"/>
-               <!--display data-->
-               <Column name="title" type="string" notnull="yes"/>
-               <Column name="artistid" type="int32" foreignkey="artist:artistid"/>
-               <Column name="description" type="text"/><!-- web visible -->
-               <Column name="comment" type="text"/><!-- internal -->
-               <!--timing and location-->
-               <Column name="starttime" type="int64" notnull="yes"/>
-               <Column name="endtime" type="int64" notnull="yes"/>
-               <Column name="roomid" type="string:64" foreignkey="room:roomid"/>
-               <Column name="seatplanid" type="int32" foreignkey="seatplan:seatplanid" null="yes"/>
-               <!--initially a copy from room, can be adjusted-->
-               <Column name="capacity" type="int32" notnull="yes"/>
-               <!-- flags -->
-               <Column name="iscancelled" type="bool" default="0"/>
-               <Column name="flags" type="string">filter: who can sell tickets for this event</Column>
-               <Column name="tax" type="int32">taxes on this event in hundredth of a percent, this value is actually never used internall, but may be used by printing routines for calculations</Column>
-               <Column name="tags" type="string">internal tags: can be used by macros and printer routines to change behavior or output</Column>
-               <!-- reason the event has been cancelled-->
-               <Column name="cancelreason" type="string"/>
-       </Table>
-       
-       <Table name="eventprice" backup="yes">
-               <Column name="eventid" type="int32" primarykey="yes" foreignkey="event:eventid"/>
-               <Column name="pricecategoryid" type="int32" primarykey="yes" foreignkey="pricecategory:pricecategoryid"/>
-               <Column name="maxavailable" type="int32" notnull="yes"/>
-               <Column name="price" type="int32" notnull="yes"/>
-               <Column name="prio" type="int32" notnull="yes" default="10">order in which prices are listet, lowest prio first</Column>
-               <Column name="flags" type="string">filter: who can sell tickets in this category for this event</Column>
-               <Column name="tags" type="string">internal tags: can be used by macros and printer routines to change behavior or output</Column>
-       </Table>
-       
-       <Class name="Artist">
-               <Abstract lang="php"/>
-               <Property name="id" type="int" id="yes"/>
-               <Property name="name" type="string"/>
-               <Property name="description" type="string"/>
-               <Property name="comment" type="string"/>
-               <Property name="flags" type="astring"/>
-               <Property name="canuse" type="bool"/>
-               <Property name="tags" type="astring"/>
-               
-               <Mapping table="artist">
-                       <Map column="artistid" property="id"/>
-                       <Map column="artistname" property="name"/>
-                       <Map column="description"/>
-                       <Map column="comment"/>
-                       <Map column="flags"/>
-                       <Map column="tags"/>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetAllArtists" updating="no">
-               <Call lang="php" method="$this->setartists(WOArtist::fromTableArrayartist(WTartist::selectFromDB('','ORDER BY artistname')));"/>
-               <Output>
-                       <Var name="artists" type="List:Artist"/>
-               </Output>
-       </Transaction>
-       <Transaction name="CreateArtist">
-               <Input>
-                       <Var name="name" type="string"/>
-                       <Var name="description" type="string"/>
-                       <Var name="comment" type="string"/>
-               </Input>
-               <Call lang="php" method="WOArtist::createArtist($this);"/>
-               <Output>
-                       <Var name="artist" type="Artist"/>
-               </Output>
-       </Transaction>
-       
-       <Class name="PriceCategory">
-               <Abstract lang="php"/>
-               <Property name="pricecategoryid" type="int"/>
-               <Property name="name" type="string"/>
-               <Property name="abbreviation" type="astring"/>
-               <Property name="formula" type="string"/>
-               <Property name="flags" type="string"/>
-               <Property name="tags" type="string"/>
-               <Property name="canuse" type="bool"/>
-               <Mapping table="pricecategory">
-                       <Map column="pricecategoryid"/>
-                       <Map column="name"/>
-                       <Map column="abbreviation"/>
-                       <Map column="formula"/>
-                       <Map column="flags"/>
-                       <Map column="tags"/>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetAllPriceCategories" updating="no">
-               <Call lang="php" method="$this->setpricecategories(WOPriceCategory::fromTableArraypricecategory(WTpricecategory::selectFromDB()));"/>
-               <Output>
-                       <Var name="pricecategories" type="List:PriceCategory"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreatePriceCategory">
-               <Input>
-                       <Var name="pricecategory" type="PriceCategory">properties as requested by user</Var>
-               </Input>
-               <Call lang="php" method="WOPriceCategory::createCategory($this);"/>
-               <Output>
-                       <Var name="pricecategory" type="PriceCategory">properties as actually stored</Var>
-               </Output>
-       </Transaction>
-       <Transaction name="ChangePriceCategory">
-               <Input>
-                       <Var name="pricecategory" type="PriceCategory">properties as requested by user</Var>
-               </Input>
-               <Call lang="php" method="WOPriceCategory::changeCategory($this);"/>
-               <Output>
-                       <Var name="pricecategory" type="PriceCategory">properties as actually stored</Var>
-               </Output>
-       </Transaction>
-       
-       <Class name="EventPrice">
-               <Abstract lang="php"/>
-               <Property name="eventid" type="int"/>
-               <Property name="pricecategoryid" type="int"/>
-               <Property name="pricecategory" type="PriceCategory"/>
-               <Property name="maxavailable" type="int32"/>
-               <Property name="price" type="int32"/>
-               <Property name="prio" type="int32"/>
-               <Property name="flags" type="string"/>
-               <Property name="tags" type="string"/>
-               <Property name="canuse" type="bool"/>
-               
-               <Property name="amounttickets" type="int">calculated property: contains the amount of tickets currently contained in this price, ignored if sent from client</Property>
-               <Property name="amountticketsblock" type="int">calculated property: contains the amount of tickets currently contained in this price that are actually usable or reserved, ignored if sent from client</Property>
-               
-               <Mapping table="eventprice">
-                       <Map column="eventid"/>
-                       <Map column="pricecategoryid"/>
-                       <Map column="maxavailable"/>
-                       <Map column="price"/>
-                       <Map column="flags"/>
-                       <Map column="tags"/>
-                       <Map column="prio"/>
-                       <Map property="pricecategory">
-                               <Call lang="php" method="WOPriceCategory::fromTablepricecategory(WTpricecategory::getFromDB($table->pricecategoryid))"/>
-                       </Map>
-                       <Map property="amounttickets">
-                               <Call lang="php" method="$data->getAmountTicketsFromDB()"/>
-                       </Map>
-                       <Map property="amountticketsblock">
-                               <Call lang="php" method="$data->getAmountTicketsBlockFromDB()"/>
-                       </Map>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Class name="Event">
-               <Abstract lang="qt"/>
-               <Abstract lang="php"/>
-               <Property name="id" type="int" id="yes"/>
-               <Property name="start" type="int64"/>
-               <Property name="end" type="int64"/>
-               <Property name="capacity" type="int"/>
-               <Property name="price" type="List:EventPrice"/>
-               <Property name="title" type="string"/>
-               <Property name="artistid" type="int"/>
-               <Property name="artist" type="Artist"/>
-               <Property name="room" type="string"/>
-               <Property name="seatplanid" type="int"/>
-               <Property name="iscancelled" type="bool"/>
-               <Property name="cancelreason" type="string"/>
-               <Property name="amountSold" type="int"/>
-               <Property name="amountReserved" type="int"/>
-               <Property name="amountFree" type="int"/>
-               <Property name="description" type="string"/>
-               <Property name="comment" type="string"/>
-               <Property name="tax" type="int"/>
-               <Property name="flags" type="string"/>
-               <Property name="tags" type="string"/>
-               <Property name="canuse" type="bool"/>
-               
-               <Mapping table="event">
-                       <Map column="eventid" property="id"/>
-                       <Map column="title"/>
-                       <Map column="artistid"/>
-                       <Map property="artist">
-                               <Call lang="php" method="WOArtist::fromTableartist(WTartist::getFromDB($table->artistid))"/>
-                       </Map>
-                       <Map column="description"/>
-                       <Map column="comment"/>
-                       <Map column="starttime" property="start"/>
-                       <Map column="endtime" property="end"/>
-                       <Map column="roomid" property="room"/>
-                       <Map column="seatplanid"/>
-                       <Map column="capacity"/>
-                       <Map column="iscancelled"/>
-                       <Map column="flags"/>
-                       <Map column="tags"/>
-                       <Map column="tax"/>
-                       <Map column="cancelreason"/>
-                       <Map property="price">
-                               <Call lang="php" method="WOEventPrice::fromTableArrayeventprice(WTeventprice::selectFromDB('eventid='.$GLOBALS['db']->escapeInt($table->eventid),'ORDER BY prio'))"/>
-                       </Map>
-                       <Map property="amountSold">
-                               <Call lang="php" method="$data->getAmountSoldFromDB()"/>
-                       </Map>
-                       <Map property="amountReserved">
-                               <Call lang="php" method="$data->getAmountReservedFromDB()"/>
-                       </Map>
-                       <Map property="amountFree">
-                               <Call lang="php" method="$data->getcapacity()-$data->getamountSold()-$data->getamountReserved()"/>
-                       </Map>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Class name="Room">
-               <Abstract lang="php"/>
-               <Property name="id" type="string"/>
-               <Property name="capacity" type="int"/>
-               <Property name="description" type="string"/>
-               
-               <Mapping table="room">
-                       <Map column="roomid" property="id"/>
-                       <Map column="capacity"/>
-                       <Map column="description"/>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetEvent" updating="no">
-               <Input>
-                       <Var name="eventid" type="int"/>
-               </Input>
-               <Call lang="php" method="$this->setevent(WOEvent::fromTableevent(WTevent::getFromDB($this->geteventid())));"/>
-               <Output>
-                       <Var name="event" type="Event"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetAllEvents" updating="no">
-               <Input/>
-               <Call lang="php" method="WOEvent::getAllEvents($this);"/>
-               <Output>
-                       <Var name="events" type="List:Event"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetEventList" updating="no">
-               <Input>
-                       <Var name="eventids" type="List:int"/>
-               </Input>
-               <Call lang="php" method="WOEvent::getEventList($this);"/>
-               <Output>
-                       <Var name="events" type="List:Event"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreateEvent">
-               <Input>
-                       <Var name="event" type="Event"/>
-               </Input>
-               <Call lang="php" method="WOEvent::createEvent($this);"/>
-               <Output>
-                       <Var name="event" type="Event"/>
-               </Output>
-       </Transaction>
-       <Transaction name="ChangeEvent">
-               <Privilege name="CancelEvent">users with this privilege are allowed to set the iscancelled property and hence cancel or uncancel events</Privilege>
-               <Input>
-                       <Var name="event" type="Event"/>
-               </Input>
-               <Call lang="php" method="WOEvent::changeEvent($this);"/>
-               <Output>
-                       <Var name="event" type="Event"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CancelEvent">
-               <Input>
-                       <Var name="eventid" type="int"/>
-                       <Var name="reason" type="string"/>
-               </Input>
-               <Call lang="php" method="WOEvent::cancelEvent($this);"/>
-               <Output/>
-       </Transaction>
-       
-       <Transaction name="GetAllRooms" updating="no">
-               <Input/>
-               <Call lang="php" method="$this->setrooms(WORoom::fromTableArrayroom(WTroom::selectFromDB('')));"/>
-               <Output>
-                       <Var name="rooms" type="List:Room"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreateRoom">
-               <Input>
-                       <Var name="roomid" type="string"/>
-                       <Var name="capacity" type="int"/>
-                       <Var name="description" type="string"/>
-               </Input>
-               <Call lang="php" method="WORoom::createRoom($this);"/>
-               <Output>
-                       <Var name="room" type="Room"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetEventSummary" updating="no">
-               <Doc>Returns the event plus all orders concerning it</Doc>
-               <Input>
-                       <Var name="eventid" type="int"/>
-               </Input>
-               <Call lang="php" method="WOEvent::getSummary($this);"/>
-               <Output>
-                       <Var name="event" type="Event"/>
-                       <Var name="orders" type="List:Order"/>
-               </Output>
-       </Transaction>
-</Wolf>
\ No newline at end of file
index e14b455..abff883 100644 (file)
        <!-- generic settings -->
        <Project baseDir=".." wobDir="wob" name="MagicSmoke"/>
        <Version comm="0100" needcomm="0100" humanReadable="1.91 alpha" svnTarget="."/>
-       <DataBase instance="db" schema="dbScheme" version="01.04" defaultUpdating="yes">
-               <AuditTables>
-                       <Column name="audittime" type="int64">Time at which the change was made.
-                               <Call lang="php" method="time()"/>
-                       </Column>
-                       <Column name="audituname" type="string:64">The user name of the user who made the change.
-                               <Call lang="php" method="Session::currentUserName()"/>
-                       </Column>
-                       <Column name="audittransaction" type="string:64">The transaction name under which the change was made.
-                               <Call lang="php" method="WobTransactionBase::getExecutingName()"/>
-                       </Column>
-               </AuditTables>
-       </DataBase>
+       <Include file="db/db.wolf"/>
        
        <!-- configure output -->
        <QtClientOutput sourceDir="src" subDir="wob" priInclude="wob.pri" classPrefix="M" clean="yes" transactionBase="MTransaction"/>
-       <PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes" transactionBase="MSmokeTransaction">
-       </PHPServerOutput>
+       <PHPServerOutput sourceDir="www" subDir="inc/wob" extension=".php" clean="yes" transactionBase="MSmokeTransaction"/>
        <HtmlOutput sourceDir="doc" subDir="wob" clean="yes"/>
        
+       <!-- load and parse database definitions -->
+       <Include file="db/basics.wolf"/>
+       <Include file="db/user.wolf"/>
+       <Include file="db/customer.wolf"/>
+       <Include file="db/event.wolf"/>
+       <Include file="db/order.wolf"/>
+       <Include file="db/cart.wolf"/>
+       <Include file="db/template.wolf"/>
+       <Include file="db/audit.wolf"/>
        <!-- load and parse class definitions -->
-       <Include file="basics.wolf"/>
-       <Include file="user.wolf"/>
-       <Include file="customer.wolf"/>
-       <Include file="event.wolf"/>
-       <Include file="order.wolf"/>
-       <Include file="cart.wolf"/>
-       <Include file="template.wolf"/>
-       <Include file="audit.wolf"/>
+       <Include file="classes/basics.wolf"/>
+       <Include file="classes/user.wolf"/>
+       <Include file="classes/customer.wolf"/>
+       <Include file="classes/event.wolf"/>
+       <Include file="classes/order.wolf"/>
+       <Include file="classes/cart.wolf"/>
+       <Include file="classes/template.wolf"/>
+       <!-- load and parse transaction definitions -->
+       <Include file="transact/basics.wolf"/>
+       <Include file="transact/user.wolf"/>
+       <Include file="transact/customer.wolf"/>
+       <Include file="transact/event.wolf"/>
+       <Include file="transact/order.wolf"/>
+       <Include file="transact/cart.wolf"/>
+       <Include file="transact/template.wolf"/>
 </Wolf>
\ No newline at end of file
diff --git a/wob/order.wolf b/wob/order.wolf
deleted file mode 100644 (file)
index 05ee7f2..0000000
+++ /dev/null
@@ -1,702 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Order MagicSmoke WOLF
-  - Tables and Comm Objects for Orders, Tickets, Vouchers, etc.
-  -
-  - (c) Konrad Rosenbaum, 2009
-  - this file is protected under the GNU AGPLv3 or at your option any newer
-  - see COPYING.AGPL for details
-  -->
-<Wolf>
-       <Table name="shipping" backup="yes">
-               <Doc>This table contains descriptions of shipping methods, the actual cost can be overridden in each order.</Doc>
-               <Column name="shipid" type="seq32" primarykey="yes"/>
-               <Column name="cost" type="int32" notnull="yes">default cost of this shipping type in cents</Column>
-               <Column name="flags" type="string">flags showing who can use this method</Column>
-               <Column name="description" type="string">description for the shipping type</Column>
-       </Table>
-       <Table name="paymenttype" backup="yes">
-               <Doc>This table contains acceptable payment methods. (Under construction.)</Doc>
-               <Column name="paytype" type="string:64" primarykey="yes"/>
-               <Column name="description" type="string"/>
-               <Column name="dataname" type="string:64" null="yes"/>
-               <Column name="flags" type="string">filter: who can log payments with this method</Column>
-               
-               <Preset><V col="paytype" val="cash"/><V col="description" val="default paytype: cash"/></Preset>
-       </Table>
-       <Table name="order" backup="yes" audit="yes">
-               <Doc>This table contains all orders and sales.</Doc>
-               <Column name="orderid" type="seq32" primarykey="yes"/>
-               <!--customer-->
-               <Column name="customerid" type="int32" foreignkey="customer:customerid">
-                       ID of the customer connected to this order.
-               </Column>
-               <!--seller (_online for web forms)-->
-               <Column name="soldby" type="string:64" foreignkey="user:uname">User name of the user who entered it into the system. "_web" for the online system.</Column>
-               <!--if not null/empty: this address for delivery, customer address for invoice-->
-               <Column name="invoiceaddress" type="int64" foreignkey="address:addressid" null="yes">
-                       If not null: the address the invoice goes to.
-               </Column>
-               <Column name="deliveryaddress" type="int64" foreignkey="address:addressid" null="yes">
-                       If not null: the address the delivery goes to.
-                       If null: assumed to be identical to invoiceaddress.
-               </Column>
-               <!--status, see ORDER_* constants-->
-               <Column name="status" type="enum32" notnull="yes">
-                       <Doc>Status the order is in right now.</Doc>
-                       <Value name="Placed" value="0">The order has been placed, but not acted upon yet.</Value>
-                       <Value name="Sent" value="1">The order has been sent out or handed to the customer.</Value>
-                       <Value name="Sold" value="1">Alias for Sent. Semantically: it is sold if it has been sent and paid.</Value>
-                       <Value name="Cancelled" value="2">The order has been cancelled, if anything has been paid, it must be paid back.</Value>
-                       <Value name="Reserved" value="4">The order is just a reservation for a limited time, application logic must determine the timeout.</Value>
-                       <Value name="Closed" value="0x80">The order is closed out of the system - the payment status is ignored from now on. Currently not used.</Value>
-               </Column>
-               <Column name="ordertime" type="int64" notnull="yes">When the order was created</Column>
-               <Column name="senttime" type="int64">When the order was sent to the customer</Column>
-               <Column name="comments" type="text">comments made on web form (eg. "urgently needed for dads birthday")</Column>
-               <Column name="amountpaid" type="int32">
-               how much has been paid already (including used vouchers);
-               this is for comparison with the price fields in ticket and voucher tables
-               </Column>
-               <Column name="shippingcosts" type="int32" default="0">shipping price; this is not re-imbursed for orders that have been sent and then cancelled</Column>
-               <Column name="shippingtype" type="int32" null="yes" foreignkey="shipping:shipid">
-               pointer to shipping type (none per default, programmatic default is in config)
-               </Column>
-               
-               <!-- in audit: monitor the type of payment -->
-               <AuditColumn name="paytype" type="string:64" foreignkey="paymenttype:paytype"/>
-               <AuditColumn name="paydata" type="string"/>
-               
-               <Foreign method="getTickets" via="ticket:orderid=orderid">Returns the tickets for this order</Foreign>
-               <Foreign method="getVouchers" via="voucher:orderid=orderid">Returns the vochers sold by this order</Foreign>
-               <Foreign method="getItems" via="item:orderid=orderid">Returns additional sold items for this order</Foreign>
-       </Table>
-       <Table name="ticket" backup="yes" base="BarcodeTable" audit="yes">
-               <Column name="ticketid" type="string:32" primarykey="yes">
-                       a 8-32 char code (code39: case-insensitive letters+digits) for the ticket;
-                       automatically generated
-                       <Call lang="php" method="BarcodeTable::getNewTicketId()"/>
-               </Column>
-               <Column name="eventid" type="int32" foreignkey="event:eventid"/>
-               <!--initially a copy from event, can be adjusted by seller-->
-               <Column name="price" type="int32" notnull="yes"/>
-               <Column name="pricecategoryid" type="int32" foreignkey="pricecategory:pricecategoryid"/>
-               <!--status of ticket (see TICKET_* constants)-->
-               <Column name="status" type="enum32" notnull="yes">
-                       <Value name="Reserved" value="0x311"> <!--dec: 785-->
-                       The ticket is reserved for a customer, it blocks the seat, but is not to be paid yet.</Value>
-                       <Value name="Ordered" value="0x312"> <!--dec: 786-->
-                       The ticket is ordered/sold and possibly paid for (payment is stored in its order).</Value>
-                       <Value name="Used" value="0x303"> <!--dec: 771-->
-                       The ticket has been used.</Value>
-                       <Value name="Cancelled" value="0x4"> <!--dec: 4-->
-                       The ticket has been given back for some reason and needs to be re-imbursed (if paid already).</Value>
-                       <Value name="Refund" value="0x4">Alias for Cancelled</Value>
-                       <Value name="MaskBlock" value="0x100"> <!--dec: 256-->
-                       Masking value: if this bit is set the ticket blocks a seat.</Value>
-                       <Value name="MaskPay" value="0x200"> <!--dec: 512-->
-                       Masking value: if this bit is set the ticket must be paid by the customer.</Value>
-                       <Value name="MaskUsable" value="0x300"> <!--dec: 768-->
-                       Masking value: combines Block+Pay - the ticket can be used to watch a show or is already being used.</Value>
-                       <Value name="MaskReturnable" value="0x10"> <!--dec: 16-->
-                       Masking value: if this bit is set the ticket can still be cancelled.</Value>
-                       <Value name="MaskChangeable" value="0x10"> <!--dec: 16-->
-                       Masking value: if this bit is set the ticket can still be changed (price, event, etc.). Currently an alias for MaskReturnable.</Value>
-               </Column>
-               <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/>
-               <Column name="seat" type="string:32" null="yes"/>
-               
-               <!-- TODO: add check constraint that eventid,pricecategoryid exist in eventprice-->
-       </Table>
-       <Table name="voucher" backup="yes" base="BarcodeTable" audit="yes">
-               <!--a 8-32 char code (code39: case-insensitive letters+digits) for the voucher-->
-               <Column name="voucherid" type="string:32" primarykey="yes">
-                       <Call lang="php" method="BarcodeTable::getNewVoucherId()"/>
-               </Column>
-               <!--price of the voucher (0 if cancelled)-->
-               <Column name="price" type="int32" notnull="yes"/>
-               <!--order this voucher belongs to-->
-               <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/>
-               <!--marker: voucher has been used to pay something-->
-               <Column name="isused" type="bool" default="false"/>
-               <!--remaining value in cents (0 for cancelled)-->
-               <Column name="value" type="int32" notnull="yes"/>
-       </Table>
-       
-       <Table name="product" backup="yes">
-               <Doc>A saleable product other than tickets or vouchers (eg. merchandizing).</Doc>
-               <Doc>This table represents stock. When a product is sold an entry is created in the table item.</Doc>
-               <Column name="productid" type="seq32" primarykey="yes"/>
-               <Column name="name" type="string" notnull="yes"/>
-               <Column name="description" type="text"/>
-               
-               <Column name="inventory" type="int32" notnull="yes">
-               amount that remains in the inventory, or -1 if it is unlimited
-               </Column>
-               <Column name="price" type="int32" notnull="yes"/>
-               <Column name="barcode" type="string" null="yes">usually the EAN code</Column>
-               <Column name="flags" type="string">filter: who can sell this product</Column>
-               <Column name="tax" type="int32"/>
-       </Table>
-       <Table name="item" backup="yes" audit="yes">
-               <Doc>A sold item other than a ticket or voucher.</Doc>
-               <Column name="itemid" type="seq64" primarykey="yes"/>
-               <Column name="productid" type="int32" foreignkey="product:productid" notnull="yes"/>
-               <Column name="orderid" type="int32" foreignkey="order:orderid" notnull="yes"/>
-               <Column name="amount" type="int32" notnull="yes"/>
-               <Column name="totalprice" type="int32" notnull="yes"/>
-       </Table>
-
-       
-       <Class name="Shipping">
-               <Doc>This class encapsulates shipping types.</Doc>
-               <Abstract lang="php"/>
-               <Property name="shipid" type="int"/>
-               <Property name="cost" type="int"/>
-               <Property name="flags" type="string"/>
-               <Property name="canuse" type="bool"/>
-               <Property name="description" type="string"/>
-               <Mapping table="shipping">
-                       <Map column="shipid"/>
-                       <Map column="cost"/>
-                       <Map column="flags"/>
-                       <Map column="description"/>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <!-- both sides implement some additional logic, hence abstract -->
-       <Class name="Ticket" abstract="yes">
-               <Doc>This class represents the data of a ticket as stored in the database.</Doc>
-               <Enum name="TicketState" refColumn="ticket:status"/>
-               <Property name="ticketid" type="astring" id="yes">uniquely identifies the ticket, this ID is automatically generated when the ticket is created  by the server</Property>
-               <Property name="eventid" type="int"/>
-               <Property name="price" type="int"/>
-               <Property name="status" type="TicketState"/>
-               <Property name="orderid" type="int"/>
-               <Property name="pricecategoryid" type="int"/>
-               <Property name="pricecategory" type="PriceCategory"/>
-               
-               <Mapping table="ticket">
-                       <Map column="ticketid"/>
-                       <Map column="price"/>
-                       <Map column="eventid"/>
-                       <Map column="status"/>
-                       <Map column="orderid" property="orderid"/>
-                       <Map column="pricecategoryid"/>
-                       <Map property="pricecategory">
-                               <Call lang="php" method="WOPriceCategory::fromTablepricecategory(WTpricecategory::getFromDB($table->pricecategoryid))"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetTicket" updating="no">
-               <Input>
-                       <Var name="ticketid" type="astring"/>
-               </Input>
-               <Call lang="php" method="$this->setticket(WOTicket::fromTableticket(WTticket::getFromDB($this->getticketid())));"/>
-               <Output>
-                       <Var name="ticket" type="Ticket"/>
-               </Output>
-       </Transaction>
-       
-       <Class name="Voucher">
-               <Abstract lang="qt"/>
-               <Enum name="VoucherState">
-                       <Value name="Ok"/>
-                       <Value name="InvalidValue"/>
-                       <Value name="InvalidPrice"/>
-               </Enum>
-               <Property name="voucherid" type="astring" id="yes"/>
-               <Property name="value" type="int"/>
-               <Property name="price" type="int" optional="1"/>
-               <Property name="status" type="VoucherState" optional="1"/>
-               <Property name="isused" type="bool"/>
-               <Property name="orderid" type="int"/>
-               <Mapping table="voucher">
-                       <Map column="voucherid"/>
-                       <Map column="value"/>
-                       <Map column="price"/>
-                       <Map column="orderid"/>
-                       <Map column="isused"/>
-                       <Map property="status">
-                               <!-- dummy, since this conversion is only used for existing valid vouchers -->
-                               <Call lang="php" method="self::Ok"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetVoucher" updating="no">
-               <Input>
-                       <Var name="voucherid" type="astring"/>
-               </Input>
-               <Call lang="php" method="$this->setvoucher(WOVoucher::fromTablevoucher(WTvoucher::getFromDB($this->getvoucherid())));"/>
-               <Output>
-                       <Var name="voucher" type="Voucher"/>
-               </Output>
-       </Transaction>
-       
-       <Class name="ItemInfo">
-               <Doc>used for basic info about items</Doc>
-               <Property name="itemid" type="int"/>
-               <Property name="productid" type="int"/>
-               <Property name="productname" type="string"/>
-               <Property name="orderid" type="int"/>
-               <Property name="amount" type="int"/>
-               <Property name="totalprice" type="int"/>
-               
-               <Mapping table="item">
-                       <Map column="itemid"/>
-                       <Map column="productid"/>
-                       <Map column="orderid"/>
-                       <Map column="amount"/>
-                       <Map column="totalprice"/>
-                       <Map property="productname">
-                               <Call lang="php" method="WTproduct::getFromDB($data->prop_productid)->name"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Class name="Order" abstract="yes">
-               <Doc>This class represents an order in its entirety, including any items sold in it.</Doc>
-               <Enum name="OrderState" refColumn="order:status" />
-               
-               <Property name="orderid" type="int"/>
-               <Property name="customerid" type="int"/>
-               <Property name="customer" type="CustomerInfo"/>
-               <Property name="invoiceaddressid" type="int64"/>
-               <Property name="invoiceaddress" type="Address"/>
-               <Property name="deliveryaddressid" type="int64"/>
-               <Property name="deliveryaddress" type="Address"/>
-               <Property name="soldby" type="astring"/>
-               
-               <Property name="tickets" type="List:Ticket"/>
-               <Property name="vouchers" type="List:Voucher"/>
-               <Property name="items" type="List:ItemInfo"/>
-               
-               <Property name="status" type="OrderState"/>
-               
-               <Property name="amountpaid" type="int">amount that has been paid for this order</Property>
-               <Property name="amountdue" type="int">amount that needs to be paid, negative if too much has been paid</Property>
-               <Property name="totalprice" type="int">total price for this order (including shipping and all items)</Property>
-               <Property name="shippingcosts" type="int">costs for shipping</Property>
-               
-               <Property name="shippingtypeid" type="int"/>
-               <Property name="shippingtype" type="Shipping"/>
-               
-               <Property name="ordertime" type="int64"/>
-               <Property name="senttime" type="int64"/>
-               
-               <Property name="comments" type="string"/>
-               <!-- etc.pp. -->
-               
-               <Mapping table="order">
-                       <Map column="orderid"/>
-                       <Map column="customerid"/>
-                       <Map property="customer"><Call lang="php" method="WOCustomerInfo::fromTablecustomer(WTcustomer::getFromDB($data->prop_customerid))"/></Map>
-                       <Map column="soldby"/>
-                       <Map column="invoiceaddress" property="invoiceaddressid"/>
-                       <Map column="deliveryaddress" property="deliveryaddressid"/>
-                       <Map property="invoiceaddress"><Call lang="php" method="WOAddress::fromTableaddress(WTaddress::getFromDB($table->invoiceaddress))"/></Map>
-                       <Map property="deliveryaddress"><Call lang="php" method="WOAddress::fromTableaddress(WTaddress::getFromDB($table->deliveryaddress))"/></Map>
-                       <Map column="amountpaid"/>
-                       <Map column="status"/>
-                       <Map column="shippingcosts"/>
-                       <Map column="shippingtype" property="shippingtypeid"/>
-                       <Map property="shippingtype"><Call lang="php" method="WOShipping::fromTableshipping(WTshipping::getFromDB($table->shippingtype))"/></Map>
-                       <Map column="ordertime"/>
-                       <Map column="senttime"/>
-                       <Map column="comments"/>
-                       
-                       <Map property="tickets"><Call lang="php" method="WOTicket::fromTableArrayticket(WTticket::selectFromDB('orderid='.$GLOBALS['db']->escapeInt($table->orderid)))"/></Map>
-                       <Map property="vouchers"><Call lang="php" method="WOVoucher::fromTableArrayvoucher(WTvoucher::selectFromDB('orderid='.$GLOBALS['db']->escapeInt($table->orderid)))"/></Map>
-                       <Map property="items"><Call lang="php" method="WOItemInfo::fromTableArrayitem(WTitem::selectFromDB('orderid='.$GLOBALS['db']->escapeInt($table->orderid)))"/></Map>
-                               
-                       <Map property="totalprice"><Call lang="php" method="$data->getTotalPrice()"/></Map>
-                       <Map property="amountdue"><Call lang="php" method="$data->prop_totalprice - $data->prop_amountpaid"/></Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetOrder" updating="no">
-               <Input>
-                       <Var name="orderid" type="int"/>
-               </Input>
-               <Call lang="php" method="$this->setorder(WOOrder::fromTableorder(WTorder::getFromDB($this->getorderid())));"/>
-               <Output>
-                       <Var name="order" type="Order"/>
-               </Output>
-       </Transaction>
-       
-       <Class name="OrderInfo" abstract="yes">
-               <Doc>This class represents the main information about an order as shown in lists.</Doc>
-               <Enum name="OrderState" refColumn="order:status" />
-               
-               <Property name="orderid" type="int"/>
-               <Property name="customerid" type="int"/>
-               <Property name="soldby" type="astring"/>
-               
-               <Property name="amounttickets" type="int"/>
-               <Property name="amountvouchers" type="int"/>
-               <Property name="amountitems" type="int"/>
-               
-               <Property name="status" type="OrderState"/>
-               
-               <Property name="amountpaid" type="int">amount that has been paid for this order</Property>
-               <Property name="amountdue" type="int">amount that needs to be paid, negative if too much has been paid</Property>
-               <Property name="totalprice" type="int">total price for this order (including shipping and all items)</Property>
-               <Property name="shippingcosts" type="int">costs for shipping</Property>
-               
-               <Property name="ordertime" type="int64"/>
-               <Property name="senttime" type="int64"/>
-               <!-- etc.pp. -->
-               <Mapping table="order">
-                       <Map column="orderid"/>
-                       <Map column="customerid"/>
-                       <Map column="soldby"/>
-                       <Map column="status"/>
-                       <Map column="ordertime"/>
-                       <Map column="senttime"/>
-                       <Map column="amountpaid"/>
-                       <Map column="shippingcosts"/>
-                       
-                       <Map property="totalprice">
-                               <Call lang="php" method="$data->getTotalPriceFromDB()"/>
-                       </Map>
-                       <Map property="amountdue">
-                               <Call lang="php" method="$data->prop_amountdue=$data->prop_totalprice - $data->prop_amountpaid"/>
-                       </Map>
-                       <Map property="amounttickets">
-                               <Call lang="php" method="$data->getAmountTicketsFromDB()"/>
-                       </Map>
-                       <Map property="amountvouchers">
-                               <Call lang="php" method="$data->getAmountVouchersFromDB()"/>
-                       </Map>
-                       <Map property="amountitems">
-                               <Call lang="php" method="$data->getAmountItemsFromDB()"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetOrderList" updating="no">
-               <Input>
-                       <Var name="oldest" type="int64">unix timestamp for the oldest order to be returned (compared with ordertime)</Var>
-               </Input>
-               <Call lang="php" method="WOOrderInfo::getAllOrders($this);"/>
-               <Output>
-                       <Var name="orders" type="List:OrderInfo"/>
-                       <Var name="customers" type="List:CustomerInfo"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetOrdersByEvents" updating="no">
-               <Input>
-                       <Var name="events" type="List:int32">list of event ids to select</Var>
-                       <Var name="oldest" type="int64">unix timestamp for the oldest order to be returned (compared with ordertime)</Var>
-               </Input>
-               <Call lang="php" method="WOOrderInfo::getOrdersByEvents($this);"/>
-               <Output>
-                       <Var name="orders" type="List:OrderInfo"/>
-                       <Var name="customers" type="List:CustomerInfo"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetOrdersByCustomer" updating="no">
-               <Input>
-                       <Var name="customerid" type="int32">customer to select</Var>
-                       <Var name="oldest" type="int64">unix timestamp for the oldest order to be returned (compared with ordertime)</Var>
-               </Input>
-               <Call lang="php" method="WOOrderInfo::getOrdersByCustomer($this);"/>
-               <Output>
-                       <Var name="orders" type="List:OrderInfo"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetOrderByBarcode" updating="no">
-               <Input>
-                       <Var name="barcode" type="string"/>
-               </Input>
-               <Call lang="php" method="WOOrder::getOrderByBarcode($this);"/>
-               <Output>
-                       <Var name="order" type="Order"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreateOrder">
-               <Doc>CreateOrder creates orders that are queued to be executed immediately or sales that are marked executed and paid for immediately; they may contain tickets, vouchers, or shopping items</Doc>
-               <Privilege name="AnyVoucherValue">users with this privilege can create vouchers with arbitrary value</Privilege>
-               <Privilege name="DiffVoucherValuePrice">users with this privilege can create vouchers with a price (what the customer pays) different from its value (what the customer can buy with it)</Privilege>
-               <Privilege name="LateSale">users with this privilege can sell/order tickets until the event is over, otherwise a configurable limit applies</Privilege>
-               <Privilege name="AfterTheFactSale">users with this privilege can sell tickets for past events - be careful to give this privilege only to very few special users, it is an invitation to mistakes!</Privilege>
-               <Privilege name="CanOrder">users with this privilege may use this transaction to create orders</Privilege>
-               <Privilege name="CanSell">users with this privilege may use this transaction to create sales</Privilege>
-               <Input>
-                       <Var name="cart" type="CartOrder">The cart contents</Var>
-                       <Var name="issale" type="bool">true if this is a sale, false if this is an order</Var>
-               </Input>
-               <Call lang="php" method="WOCartOrder::createOrder($this);"/>
-               <Output>
-                       <Var name="order" type="Order">If successful: the created order</Var>
-                       <Var name="cart" type="CartOrder">If unsuccessful: the cart with annotations</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="CreateReservation">
-               <Doc>Reservations are orders that are not executed right away. They may only contain tickets that block some seats for a limited time. They cannot contain any shopping items or vouchers.</Doc>
-               <Privilege name="LateReserve">users with this right can make reservations right up to the start of the event, otherwise a configured limit applies</Privilege>
-               <Input>
-                       <Var name="cart" type="CartOrder">The cart contents</Var>
-               </Input>
-               <!-- this call automatically realizes that it is executing a reservation-->
-               <Call lang="php" method="WOCartOrder::createOrder($this);"/>
-               <Output>
-                       <Var name="order" type="Order">If successful: the created order</Var>
-                       <Var name="cart" type="CartOrder">If unsuccessful: the cart with annotations</Var>
-               </Output>
-       </Transaction>
-       <Transaction name="ReservationToOrder">
-               <Doc>This transaction turns a reservation into a regular order</Doc>
-               <Input>
-                       <Var name="orderid" type="int"/>
-               </Input>
-               <Call lang="php" method="WOOrder::reservation2Order($this);"/>
-               <Output>
-                       <Var name="order" type="Order"/>
-               </Output>
-       </Transaction>
-       <Transaction name="CancelOrder">
-               <Privilege name="CancelSentOrder">Users with this privilege can also cancel orders that have already been shipped</Privilege>
-               <Privilege name="CancelPastTickets">Users with this privilege can cancel orders with tickets in the past (unless they have been used).</Privilege>
-               <Input>
-                       <Var name="orderid" type="int"/>
-               </Input>
-               <Call lang="php" method="WOOrder::cancelOrder($this);"/>
-               <Output>
-                       <Var name="order" type="Order"/>
-               </Output>
-       </Transaction>
-       <Transaction name="OrderPay">
-               <Input>
-                       <Var name="orderid" type="int">The order to be paid</Var>
-                       <Var name="amount" type="int">amount offered, it must be positive</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::payForOrder($this);"/>
-               <Output>
-                       <Var name="order" type="Order">fresh copy of the order</Var>
-                       <Var name="amount" type="int">the amount actually taken, it is between 0 and at maximum the amount due for the order, it is never above the offered amount</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="OrderRefund">
-               <Input>
-                       <Var name="orderid" type="int"/>
-                       <Var name="amount" type="int"/>
-               </Input>
-               <Call lang="php" method="WOOrder::refundOrder($this);"/>
-               <Output>
-                       <Var name="order" type="Order"/>
-                       <Var name="amount" type="int"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="UseVoucher">
-               <Doc>Use a voucher to pay for an order. The system automatically deducts as much as is due for the order or as much as is left on the voucher - whichever is lower. If the voucher is not paid for the transaction will fail. The transaction will never transfer money from an order back to the voucher.</Doc>
-               <Input>
-                       <Var name="orderid" type="int">ID of the order that is to be paid for</Var>
-                       <Var name="voucherid" type="astring">ID of the voucher that is to be used for payment</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::payForOrderVoucher($this);"/>
-               <Output>
-                       <Var name="order" type="Order">The full order object after the transaction</Var>
-                       <Var name="voucher" type="Voucher">The full voucher object after the transaction</Var>
-                       <Var name="amount" type="int">The amount that was deducted</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="DeductVoucher">
-               <Doc>Deducts an amount from a voucher - this can be used for items that are not in the MagicSmoke shop repository. Fails if the voucher is not paid for yet. Will not transfer anything if the voucher does not contain enough money.</Doc>
-               <Input>
-                       <Var name="voucherid" type="astring">ID of the voucher to be used</Var>
-                       <Var name="amount" type="int">Amount to be deducted. Must be positive.</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::deductVoucher($this);"/>
-               <Output>
-                       <Var name="voucher" type="Voucher">The full voucher object after the transaction</Var>
-                       <Var name="amount" type="int">The amount actually transferred. Can only be zero (not enough left on the voucher) or the same as above.</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="EmptyVoucher">
-               <Doc>Empties a voucher, makes it invalid for any further use, but also keeps the price tag.</Doc>
-               <Input>
-                       <Var name="voucherid" type="astring">ID of the voucher</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::emptyVoucher($this);"/>
-               <Output>
-                       <Var name="voucher" type="Voucher">The voucher as it is left after emptying</Var>
-               </Output>
-       </Transaction>
-       
-       
-       <Transaction name="OrderChangeShipping">
-               <Doc>Changes the shipping option and/or price of an order</Doc>
-               <Privilege name="ChangePrice">Users with this privilege can set arbitrary shipping prices, all others are limited to the default price of the shipping method.</Privilege>
-               <Input>
-                       <Var name="orderid" type="int">The order to be changed</Var>
-                       <Var name="shippingid" type="int">the new shipping option or -1 if shipping is to be deleted</Var>
-                       <Var name="shippingcosts" type="int">if the user has the privilege ChangePrice this field overrides the shipping costs, otherwise the default from the shipping table is used</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::changeShipping($this);"/>
-               <Output>
-                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="OrderMarkShipped">
-               <Privilege name="SetTime">Users with this privilege can set a time for when the order was shipped, for all others the current time is used.</Privilege>
-               <Input>
-                       <Var name="orderid" type="int">The order to be marked</Var>
-                       <Var name="shiptime" type="int64">The time when it was shipped. If the user does not have the SetTime privilege or if this property is &lt;=0 the current date/time is set instead.</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::markAsShipped($this);"/>
-               <Output>
-                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="OrderAddComment">
-               <Doc>Add a comment to the end of the comments field. Most users will only have this right.</Doc>
-               <Input>
-                       <Var name="orderid" type="int">the order to be commented upon</Var>
-                       <Var name="comment" type="string">the comment</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::addComment($this);"/>
-               <Output>
-                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
-               </Output>
-       </Transaction>
-       <Transaction name="OrderChangeComments">
-               <Doc>For privileged users: edit the complete comments field, overwrite it.</Doc>
-               <Input>
-                       <Var name="orderid" type="int">the order to be commented upon</Var>
-                       <Var name="comments" type="string">the comments</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::changeComments($this);"/>
-               <Output>
-                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="ReturnTicketVoucher">
-               <Privilege name="ReturnPastTicket">Users with this privilege can return tickets for events in the past (if they have not been used yet). All others can only return tickets in the future.</Privilege>
-               <Input>
-                       <Var name="barcode" type="astring">barcode of the ticket or voucher</Var>
-               </Input>
-               <Call lang="php" method="WOOrder::returnTicketVoucher($this);"/>
-               <Output>
-                       <Var name="order" type="Order">the order that owned the returned object, in case this is called from the order window</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="ChangeTicketPrice">
-               <Privilege name="ChangeUsedTicket">users with this privilege can change the price of used tickets - usually a ticket has to be changed before it is used</Privilege>
-               <Privilege name="ChangePastTicket">users with this privilege can change the price for tickets that are for past events</Privilege>
-               <Input>
-                       <Var name="barcode" type="astring"/>
-                       <Var name="price" type="int"/>
-               </Input>
-               <Call lang="php" method="WOOrder::changeTicketPrice($this);"/>
-               <Output>
-                       <Var name="order" type="Order">the order that ownes the changed ticket, in case this is called from the order window</Var>
-               </Output>
-       </Transaction>
-       <Transaction name="ChangeTicketPriceCategory">
-               <Privilege name="ChangeUsedTicket">users with this privilege can change the price of used tickets - usually a ticket has to be changed before it is used</Privilege>
-               <Privilege name="ChangePastTicket">users with this privilege can change the price for tickets that are for past events</Privilege>
-               <Input>
-                       <Var name="barcode" type="astring"/>
-                       <Var name="pricecategoryid" type="int"/>
-               </Input>
-               <Call lang="php" method="WOOrder::changeTicketPriceCategory($this);"/>
-               <Output>
-                       <Var name="order" type="Order">the order that ownes the changed ticket, in case this is called from the order window</Var>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetAllShipping" updating="no">
-               <Input/>
-               <Call lang="php" method="$this->setshipping(WOShipping::fromTableArrayshipping(WTshipping::selectFromDB()));"/>
-               <Output>
-                       <Var name="shipping" type="List:Shipping"/>
-               </Output>
-       </Transaction>
-       <Transaction name="ChangeShipping">
-               <Input>
-                       <Var name="shipping" type="Shipping"/>
-               </Input>
-               <Call lang="php" method="WOShipping::change($this);"/>
-               <Output>
-                       <Var name="shipping" type="Shipping"/>
-               </Output>
-       </Transaction>
-       <Transaction name="CreateShipping">
-               <Input>
-                       <Var name="shipping" type="Shipping"/>
-               </Input>
-               <Call lang="php" method="WOShipping::create($this);"/>
-               <Output>
-                       <Var name="shipping" type="Shipping"/>
-               </Output>
-       </Transaction>
-       <Transaction name="DeleteShipping">
-               <Input>
-                       <Var name="shipid" type="int"/>
-               </Input>
-               <Call lang="php" method="WOShipping::remove($this);"/>
-               <Output/>
-       </Transaction>
-       
-       <Transaction name="GetValidVoucherPrices" updating="no">
-               <Call lang="php" method="$this->setprices(explode(' ',$GLOBALS['db']->getConfig('ValidVouchers')));"/>
-               <Output>
-                       <Var name="prices" type="List:int"/>
-               </Output>
-       </Transaction>
-       
-       
-       <Class name="TicketUse">
-               <Doc>Objects of this class are sent back as response to UseTicket</Doc>
-               <Property name="ticket" type="Ticket">The ticket, if found.</Property>
-               <Enum name="TicketUseStatus">
-                       <Value name="Ok" value="1">The ticket was ok and has been marked as Used</Value>
-                       <Value name="NotFound">The ticket has not been found or the barcode belongs to a voucher</Value>
-                       <Value name="WrongEvent">The ticket belongs to the wrong event.</Value>
-                       <Value name="AlreadyUsed">The ticket has already been used.</Value>
-                       <Value name="NotUsable">The ticket is only reserved or has been given back, it cannot be used.</Value>
-                       <Value name="Unpaid">The order of this ticket has not been paid for yet.</Value>
-                       <Value name="InvalidEvent">The given event ID is invalid.</Value>
-               </Enum>
-               <Property name="usestatus" type="TicketUseStatus">The result of the UseTicket operation</Property>
-               <Property name="amounttickets" type="int">The amount of usable/used tickets in this event</Property>
-               <Property name="amountused" type="int">The amount of used tickets in the event (after the operation)</Property>
-               <Property name="amountopen" type="int">The amount of tickets for the event that have not been used yet.</Property>
-               <Property name="amountreserved" type="int">The amount of tickets for the event that could be used, but are only reserved until now.</Property>
-       </Class>
-       <Transaction name="UseTicket">
-               <Input>
-                       <Var name="ticketid" type="astring">The ticket to be used</Var>
-                       <Var name="eventid" type="int">The event to use it on</Var>
-               </Input>
-               <Call lang="php" method="WOTicket::useTicket($this);"/>
-               <Output>
-                       <Var name="ticketuse" type="TicketUse"/>
-               </Output>
-       </Transaction>
-       <Transaction name="GetEntranceEvents" updating="no">
-               <Doc>This is a convenience transaction: it returns all events that are likely to be chosen at an entrance barcode scanner; this includes all events starting at max. within the next 24 hours that and that have not ended yet</Doc>
-               <Call lang="php" method="WOEvent::getEntranceEvents($this);"/>
-               <Output>
-                       <Var name="events" type="List:Event"/>
-               </Output>
-       </Transaction>
-</Wolf>
\ No newline at end of file
diff --git a/wob/template.wolf b/wob/template.wolf
deleted file mode 100644 (file)
index d367a67..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Template MagicSmoke WOLF
-  - template tables
-  -
-  - (c) Konrad Rosenbaum, 2009
-  - this file is protected under the GNU AGPLv3 or at your option any newer
-  - see COPYING.AGPL for details
-  -->
-<Wolf>
-       <Table name="template" backup="yes">
-               <Column name="filename" type="string" primarykey="yes"/>
-               <Column name="description" type="string"/>
-               <Column name="content" type="blob"/>
-               <Column name="hash" type="string:32" notnull="yes"/> <!--md5-->
-               <Column name="dolog" type="bool" default="0"/>
-               <Column name="flags" type="string">filter: who can use this template</Column>
-       </Table>
-       
-       <Class name="Template">
-               <Abstract lang="php"/>
-               <Property name="filename" type="astring"/>
-               <Property name="description" type="string"/>
-               <Property name="content" type="blob"/>
-               <Property name="hash" type="astring"/> <!--md5-->
-               <Property name="dolog" type="bool"/>
-               <Property name="flags" type="string"/>
-               <Property name="canuse" type="bool"/>
-               <Mapping table="template">
-                       <Map column="filename"/>
-                       <Map column="description"/>
-                       <Map column="content"/>
-                       <Map column="hash"/>
-                       <Map column="dolog"/>
-                       <Map column="flags"/>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Class name="TemplateInfo">
-               <Property name="filename" type="astring"/>
-               <Property name="description" type="string"/>
-               <Property name="hash" type="astring"/> <!--md5-->
-               <Property name="flags" type="astring"/>
-               <Mapping table="template">
-                       <Map column="filename"/>
-                       <Map column="description"/>
-                       <Map column="hash"/>
-                       <Map column="flags"/>
-                       <Map property="canuse">
-                               <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
-                       </Map>
-               </Mapping>
-       </Class>
-       
-       <Transaction name="GetTemplateList" updating="no">
-               <Call lang="php" method="WOTemplate::getList($this);"/>
-               <Output>
-                       <Var name="templates" type="List:TemplateInfo"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="GetTemplate" updating="no">
-               <Input>
-                       <Var name="filename" type="astring"/>
-               </Input>
-               <Call lang="php" method="WOTemplate::getFile($this);"/>
-               <Output>
-                       <Var name="templatefile" type="Template"/>
-               </Output>
-       </Transaction>
-       
-       <Transaction name="SetTemplate">
-               <Input>
-                       <Var name="filename" type="astring"/>
-                       <Var name="templatedata" type="blob"/>
-                       <Var name="description" type="string"/>
-               </Input>
-               <Call lang="php" method="WOTemplate::setFile($this);"/>
-               <Output>
-                       <Var name="templatefile" type="Template"/>
-               </Output>
-       </Transaction>
-       <Transaction name="SetTemplateDescription">
-               <Input>
-                       <Var name="filename" type="astring"/>
-                       <Var name="description" type="string"/>
-               </Input>
-               <Call lang="php" method="WOTemplate::setTemplateDescription($this);"/>
-       </Transaction>
-       <Transaction name="DeleteTemplate">
-               <Input>
-                       <Var name="filename" type="astring"/>
-               </Input>
-               <Call lang="php" method="WOTemplate::deleteTemplate($this);"/>
-       </Transaction>
-</Wolf>
similarity index 52%
rename from wob/basics.wolf
rename to wob/transact/basics.wolf
index 37c05b0..c8eae21 100644 (file)
@@ -7,21 +7,6 @@
   - see COPYING.AGPL for details
   -->
 <Wolf>
-       <Table name="config" backup="yes">
-               <Column name="ckey" type="string:32" primarykey="yes"/>
-               <Column name="cval" type="string"/>
-               
-               <Preset><V col="ckey" val="MagicSmokeVersion"/><V col="cval" code="$this->version()"/></Preset>
-               <Preset><V col="ckey" val="ValidVouchers"/><V col="cval" val="1000 2000 2500 5000"/></Preset>
-               <Preset><V col="ckey" val="OrderStop"/><V col="cval" val="24"/></Preset>
-               <Preset><V col="ckey" val="ReserveStop"/><V col="cval" val="48"/></Preset>
-               <Preset><V col="ckey" val="TicketIDChars"/><V col="cval" val="10"/></Preset>
-               <Preset><V col="ckey" val="VoucherIDChars"/><V col="cval" val="10"/></Preset>
-               <Preset><V col="ckey" val="Flag _admin"/><V col="cval" val="User is Admin"/></Preset>
-               <Preset><V col="ckey" val="Flag _web"/><V col="cval" val="User is Customer"/></Preset>
-       </Table>
-       
-       
        <Transaction name="Backup" updating="no">
                <Doc>This transaction allows to make a complete database backup. The backup file is replayed into the database via the admin.php interface.</Doc>
                <Input/>
        </Transaction>
        
        <Transaction name="GetLanguage" updating="no">
+               <Doc>This transaction returns basic language and formatting settings from the server - it must be used before the client displays any times or monetary values, even if it does not indend to translate any strings.</Doc>
                <Input>
-                       <Var name="language" type="astring"/>
-                       <Var name="format" type="astring"/>
+                       <Var name="language" type="astring">The language that the client wants to use, use "C" for no translation.</Var>
+                       <Var name="format" type="astring">The translation file format that the client supports: either "ts" for Qt translation XML source files, or "qm" for translated binary Qt translation files.</Var>
                </Input>
                <Call lang="php" method="Translation::getFile($this);"/>
                <Output>
-                       <Var name="file" type="blob"/>
+                       <Var name="file" type="blob">The Qt translation file to translate string from the server. All strings are found in the virtual class "::php".</Var>
                </Output>
        </Transaction>
-       
-       <Class name="Flag">
-               <Doc>Transport class for flags and their descriptions. They are actually stored in the config table.</Doc>
-               <Abstract lang="php"/>
-               <Property name="flag" type="astring"/>
-               <Property name="description" type="string"/>
-       </Class>
+
        <Transaction name="GetValidFlags" updating="no">
                <Call lang="php" method="WOFlag::getAllTrn($this);"/>
                <Output>
diff --git a/wob/transact/cart.wolf b/wob/transact/cart.wolf
new file mode 100644 (file)
index 0000000..3dee685
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Cart MagicSmoke WOLF
+   - shopping cart management (web interface)
+   -
+   - (c) Konrad Rosenbaum, 2009
+   - this file is protected under the GNU AGPLv3 or at your option any newer
+   - see COPYING.AGPL for details
+   -->
+<Wolf>
+       <Transaction name="WebCartAddTicket">
+               <Doc>Called from the Web UI only: adds tickets to a specific event</Doc>
+               <Input>
+                       <Var name="cartid" type="astring">The cart to add into</Var>
+                       <Var name="eventid" type="int">The event to buy tickets for</Var>
+                       <Var name="pricecategoryid" type="int">Price category of that event</Var>
+                       <Var name="amount" type="int">amount of tickets</Var>
+               </Input>
+               <Call lang="php" method="WOWebCart::addTickets($this);"/>
+               <Output/>
+       </Transaction>
+</Wolf>
\ No newline at end of file
diff --git a/wob/transact/customer.wolf b/wob/transact/customer.wolf
new file mode 100644 (file)
index 0000000..28691aa
--- /dev/null
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Customer MagicSmoke WOLF
+  - customer management
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Transaction name="GetAllContactTypes" updating="no">
+               <Input/>
+               <Call lang="php" method="$this->settypes(WOContactType::fromTableArraycontacttype(WTcontacttype::selectFromDB()));"/>
+               <Output>
+                       <Var name="types" type="List:ContactType"/>
+               </Output>
+       </Transaction>
+       <Transaction name="CreateContactType">
+               <Input>
+                       <Var name="typename" type="string"/>
+                       <Var name="uriprefix" type="astring"/>
+               </Input>
+               <Call lang="php" method="WOCustomer::createContactType($this);"/>
+               <Output>
+                       <Var name="contacttype" type="ContactType"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetCustomer" updating="no">
+               <Input>
+                       <Var name="customerid" type="int"/>
+               </Input>
+               <Call lang="php" method="$this->setcustomer(WOCustomer::fromTablecustomer(WTcustomer::getFromDB($this->getcustomerid())));"/>
+               <Output>
+                       <Var name="customer" type="Customer"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetAllCustomerNames" updating="no">
+               <Input/>
+               <Call lang="php" method="$this->setcustomers(WOCustomerInfo::fromTableArraycustomer(WTcustomer::selectFromDB()));"/>
+               <Output>
+                       <Var name="customers" type="List:CustomerInfo"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreateCustomer">
+               <Input>
+                       <Var name="customer" type="Customer"/>
+               </Input>
+               <Call lang="php" method="WOCustomer::createCustomer($this);"/>
+               <Output>
+                       <Var name="customer" type="Customer"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="ChangeCustomer">
+               <Input>
+                       <Var name="customer" type="Customer"/>
+               </Input>
+               <Call lang="php" method="WOCustomer::changeCustomer($this);"/>
+               <Output>
+                       <Var name="customer" type="Customer"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="DeleteCustomer">
+               <Input>
+                       <Var name="customerid" type="int"/>
+                       <Var name="mergewithid" type="int"/>
+               </Input>
+               <Call lang="php" method="WOCustomer::deleteCustomer($this);"/>
+               <Output>
+                       <Var name="customer" type="Customer"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetAddress" updating="no">
+               <Input>
+                       <Var name="addressid" type="int64"/>
+               </Input>
+               <Call lang="php" method="$this->setaddress(WOAddress::fromTableaddress(WTaddress::getFromDB($this->getaddressid())));"/>
+               <Output>
+                       <Var name="address" type="Address"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetAllCountries" updating="no">
+               <Input/>
+               <Call lang="php" method="$this->setcountries(WOCountry::fromTableArraycountry(WTcountry::selectFromDB()));"/>
+               <Output>
+                       <Var name="countries" type="List:Country"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreateCountry">
+               <Input>
+                       <Var name="abbrev" type="astring"/>
+                       <Var name="name" type="astring"/>
+               </Input>
+               <!-- implemented in customer, since it is the only main object using this -->
+               <Call lang="php" method="WOCustomer::createCountry($this);"/>
+               <Output>
+                       <Var name="country" type="Country"/>
+               </Output>
+       </Transaction>
+</Wolf>
\ No newline at end of file
diff --git a/wob/transact/event.wolf b/wob/transact/event.wolf
new file mode 100644 (file)
index 0000000..da6d42c
--- /dev/null
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Event Definition MagicSmoke WOLF
+  - declares everything needed to define events
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Transaction name="GetAllArtists" updating="no">
+               <Call lang="php" method="$this->setartists(WOArtist::fromTableArrayartist(WTartist::selectFromDB('','ORDER BY artistname')));"/>
+               <Output>
+                       <Var name="artists" type="List:Artist"/>
+               </Output>
+       </Transaction>
+       <Transaction name="CreateArtist">
+               <Input>
+                       <Var name="name" type="string"/>
+                       <Var name="description" type="string"/>
+                       <Var name="comment" type="string"/>
+               </Input>
+               <Call lang="php" method="WOArtist::createArtist($this);"/>
+               <Output>
+                       <Var name="artist" type="Artist"/>
+               </Output>
+       </Transaction>
+
+       <Transaction name="GetAllPriceCategories" updating="no">
+               <Call lang="php" method="$this->setpricecategories(WOPriceCategory::fromTableArraypricecategory(WTpricecategory::selectFromDB()));"/>
+               <Output>
+                       <Var name="pricecategories" type="List:PriceCategory"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreatePriceCategory">
+               <Input>
+                       <Var name="pricecategory" type="PriceCategory">properties as requested by user</Var>
+               </Input>
+               <Call lang="php" method="WOPriceCategory::createCategory($this);"/>
+               <Output>
+                       <Var name="pricecategory" type="PriceCategory">properties as actually stored</Var>
+               </Output>
+       </Transaction>
+       <Transaction name="ChangePriceCategory">
+               <Input>
+                       <Var name="pricecategory" type="PriceCategory">properties as requested by user</Var>
+               </Input>
+               <Call lang="php" method="WOPriceCategory::changeCategory($this);"/>
+               <Output>
+                       <Var name="pricecategory" type="PriceCategory">properties as actually stored</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetEvent" updating="no">
+               <Input>
+                       <Var name="eventid" type="int"/>
+               </Input>
+               <Call lang="php" method="$this->setevent(WOEvent::fromTableevent(WTevent::getFromDB($this->geteventid())));"/>
+               <Output>
+                       <Var name="event" type="Event"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetAllEvents" updating="no">
+               <Input/>
+               <Call lang="php" method="WOEvent::getAllEvents($this);"/>
+               <Output>
+                       <Var name="events" type="List:Event"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetEventList" updating="no">
+               <Input>
+                       <Var name="eventids" type="List:int"/>
+               </Input>
+               <Call lang="php" method="WOEvent::getEventList($this);"/>
+               <Output>
+                       <Var name="events" type="List:Event"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreateEvent">
+               <Input>
+                       <Var name="event" type="Event"/>
+               </Input>
+               <Call lang="php" method="WOEvent::createEvent($this);"/>
+               <Output>
+                       <Var name="event" type="Event"/>
+               </Output>
+       </Transaction>
+       <Transaction name="ChangeEvent">
+               <Privilege name="CancelEvent">users with this privilege are allowed to set the iscancelled property and hence cancel or uncancel events</Privilege>
+               <Input>
+                       <Var name="event" type="Event"/>
+               </Input>
+               <Call lang="php" method="WOEvent::changeEvent($this);"/>
+               <Output>
+                       <Var name="event" type="Event"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CancelEvent">
+               <Input>
+                       <Var name="eventid" type="int"/>
+                       <Var name="reason" type="string"/>
+               </Input>
+               <Call lang="php" method="WOEvent::cancelEvent($this);"/>
+               <Output/>
+       </Transaction>
+       
+       <Transaction name="GetAllRooms" updating="no">
+               <Input/>
+               <Call lang="php" method="$this->setrooms(WORoom::fromTableArrayroom(WTroom::selectFromDB('')));"/>
+               <Output>
+                       <Var name="rooms" type="List:Room"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreateRoom">
+               <Input>
+                       <Var name="roomid" type="string"/>
+                       <Var name="capacity" type="int"/>
+                       <Var name="description" type="string"/>
+               </Input>
+               <Call lang="php" method="WORoom::createRoom($this);"/>
+               <Output>
+                       <Var name="room" type="Room"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetEventSummary" updating="no">
+               <Doc>Returns the event plus all orders concerning it</Doc>
+               <Input>
+                       <Var name="eventid" type="int"/>
+               </Input>
+               <Call lang="php" method="WOEvent::getSummary($this);"/>
+               <Output>
+                       <Var name="event" type="Event"/>
+                       <Var name="orders" type="List:Order"/>
+               </Output>
+       </Transaction>
+</Wolf>
\ No newline at end of file
diff --git a/wob/transact/order.wolf b/wob/transact/order.wolf
new file mode 100644 (file)
index 0000000..888df3a
--- /dev/null
@@ -0,0 +1,342 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Order MagicSmoke WOLF
+  - Tables and Comm Objects for Orders, Tickets, Vouchers, etc.
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Transaction name="GetTicket" updating="no">
+               <Input>
+                       <Var name="ticketid" type="astring"/>
+               </Input>
+               <Call lang="php" method="$this->setticket(WOTicket::fromTableticket(WTticket::getFromDB($this->getticketid())));"/>
+               <Output>
+                       <Var name="ticket" type="Ticket"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetVoucher" updating="no">
+               <Input>
+                       <Var name="voucherid" type="astring"/>
+               </Input>
+               <Call lang="php" method="$this->setvoucher(WOVoucher::fromTablevoucher(WTvoucher::getFromDB($this->getvoucherid())));"/>
+               <Output>
+                       <Var name="voucher" type="Voucher"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetOrder" updating="no">
+               <Input>
+                       <Var name="orderid" type="int"/>
+               </Input>
+               <Call lang="php" method="$this->setorder(WOOrder::fromTableorder(WTorder::getFromDB($this->getorderid())));"/>
+               <Output>
+                       <Var name="order" type="Order"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetOrderList" updating="no">
+               <Input>
+                       <Var name="oldest" type="int64">unix timestamp for the oldest order to be returned (compared with ordertime)</Var>
+               </Input>
+               <Call lang="php" method="WOOrderInfo::getAllOrders($this);"/>
+               <Output>
+                       <Var name="orders" type="List:OrderInfo"/>
+                       <Var name="customers" type="List:CustomerInfo"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetOrdersByEvents" updating="no">
+               <Input>
+                       <Var name="events" type="List:int32">list of event ids to select</Var>
+                       <Var name="oldest" type="int64">unix timestamp for the oldest order to be returned (compared with ordertime)</Var>
+               </Input>
+               <Call lang="php" method="WOOrderInfo::getOrdersByEvents($this);"/>
+               <Output>
+                       <Var name="orders" type="List:OrderInfo"/>
+                       <Var name="customers" type="List:CustomerInfo"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetOrdersByCustomer" updating="no">
+               <Input>
+                       <Var name="customerid" type="int32">customer to select</Var>
+                       <Var name="oldest" type="int64">unix timestamp for the oldest order to be returned (compared with ordertime)</Var>
+               </Input>
+               <Call lang="php" method="WOOrderInfo::getOrdersByCustomer($this);"/>
+               <Output>
+                       <Var name="orders" type="List:OrderInfo"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetOrderByBarcode" updating="no">
+               <Input>
+                       <Var name="barcode" type="string"/>
+               </Input>
+               <Call lang="php" method="WOOrder::getOrderByBarcode($this);"/>
+               <Output>
+                       <Var name="order" type="Order"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreateOrder">
+               <Doc>CreateOrder creates orders that are queued to be executed immediately or sales that are marked executed and paid for immediately; they may contain tickets, vouchers, or shopping items</Doc>
+               <Privilege name="AnyVoucherValue">users with this privilege can create vouchers with arbitrary value</Privilege>
+               <Privilege name="DiffVoucherValuePrice">users with this privilege can create vouchers with a price (what the customer pays) different from its value (what the customer can buy with it)</Privilege>
+               <Privilege name="LateSale">users with this privilege can sell/order tickets until the event is over, otherwise a configurable limit applies</Privilege>
+               <Privilege name="AfterTheFactSale">users with this privilege can sell tickets for past events - be careful to give this privilege only to very few special users, it is an invitation to mistakes!</Privilege>
+               <Privilege name="CanOrder">users with this privilege may use this transaction to create orders</Privilege>
+               <Privilege name="CanSell">users with this privilege may use this transaction to create sales</Privilege>
+               <Input>
+                       <Var name="cart" type="CartOrder">The cart contents</Var>
+                       <Var name="issale" type="bool">true if this is a sale, false if this is an order</Var>
+               </Input>
+               <Call lang="php" method="WOCartOrder::createOrder($this);"/>
+               <Output>
+                       <Var name="order" type="Order">If successful: the created order</Var>
+                       <Var name="cart" type="CartOrder">If unsuccessful: the cart with annotations</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="CreateReservation">
+               <Doc>Reservations are orders that are not executed right away. They may only contain tickets that block some seats for a limited time. They cannot contain any shopping items or vouchers.</Doc>
+               <Privilege name="LateReserve">users with this right can make reservations right up to the start of the event, otherwise a configured limit applies</Privilege>
+               <Input>
+                       <Var name="cart" type="CartOrder">The cart contents</Var>
+               </Input>
+               <!-- this call automatically realizes that it is executing a reservation-->
+               <Call lang="php" method="WOCartOrder::createOrder($this);"/>
+               <Output>
+                       <Var name="order" type="Order">If successful: the created order</Var>
+                       <Var name="cart" type="CartOrder">If unsuccessful: the cart with annotations</Var>
+               </Output>
+       </Transaction>
+       <Transaction name="ReservationToOrder">
+               <Doc>This transaction turns a reservation into a regular order</Doc>
+               <Input>
+                       <Var name="orderid" type="int"/>
+               </Input>
+               <Call lang="php" method="WOOrder::reservation2Order($this);"/>
+               <Output>
+                       <Var name="order" type="Order"/>
+               </Output>
+       </Transaction>
+       <Transaction name="CancelOrder">
+               <Privilege name="CancelSentOrder">Users with this privilege can also cancel orders that have already been shipped</Privilege>
+               <Privilege name="CancelPastTickets">Users with this privilege can cancel orders with tickets in the past (unless they have been used).</Privilege>
+               <Input>
+                       <Var name="orderid" type="int"/>
+               </Input>
+               <Call lang="php" method="WOOrder::cancelOrder($this);"/>
+               <Output>
+                       <Var name="order" type="Order"/>
+               </Output>
+       </Transaction>
+       <Transaction name="OrderPay">
+               <Input>
+                       <Var name="orderid" type="int">The order to be paid</Var>
+                       <Var name="amount" type="int">amount offered, it must be positive</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::payForOrder($this);"/>
+               <Output>
+                       <Var name="order" type="Order">fresh copy of the order</Var>
+                       <Var name="amount" type="int">the amount actually taken, it is between 0 and at maximum the amount due for the order, it is never above the offered amount</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="OrderRefund">
+               <Input>
+                       <Var name="orderid" type="int"/>
+                       <Var name="amount" type="int"/>
+               </Input>
+               <Call lang="php" method="WOOrder::refundOrder($this);"/>
+               <Output>
+                       <Var name="order" type="Order"/>
+                       <Var name="amount" type="int"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="UseVoucher">
+               <Doc>Use a voucher to pay for an order. The system automatically deducts as much as is due for the order or as much as is left on the voucher - whichever is lower. If the voucher is not paid for the transaction will fail. The transaction will never transfer money from an order back to the voucher.</Doc>
+               <Input>
+                       <Var name="orderid" type="int">ID of the order that is to be paid for</Var>
+                       <Var name="voucherid" type="astring">ID of the voucher that is to be used for payment</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::payForOrderVoucher($this);"/>
+               <Output>
+                       <Var name="order" type="Order">The full order object after the transaction</Var>
+                       <Var name="voucher" type="Voucher">The full voucher object after the transaction</Var>
+                       <Var name="amount" type="int">The amount that was deducted</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="DeductVoucher">
+               <Doc>Deducts an amount from a voucher - this can be used for items that are not in the MagicSmoke shop repository. Fails if the voucher is not paid for yet. Will not transfer anything if the voucher does not contain enough money.</Doc>
+               <Input>
+                       <Var name="voucherid" type="astring">ID of the voucher to be used</Var>
+                       <Var name="amount" type="int">Amount to be deducted. Must be positive.</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::deductVoucher($this);"/>
+               <Output>
+                       <Var name="voucher" type="Voucher">The full voucher object after the transaction</Var>
+                       <Var name="amount" type="int">The amount actually transferred. Can only be zero (not enough left on the voucher) or the same as above.</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="EmptyVoucher">
+               <Doc>Empties a voucher, makes it invalid for any further use, but also keeps the price tag.</Doc>
+               <Input>
+                       <Var name="voucherid" type="astring">ID of the voucher</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::emptyVoucher($this);"/>
+               <Output>
+                       <Var name="voucher" type="Voucher">The voucher as it is left after emptying</Var>
+               </Output>
+       </Transaction>
+       
+       
+       <Transaction name="OrderChangeShipping">
+               <Doc>Changes the shipping option and/or price of an order</Doc>
+               <Privilege name="ChangePrice">Users with this privilege can set arbitrary shipping prices, all others are limited to the default price of the shipping method.</Privilege>
+               <Input>
+                       <Var name="orderid" type="int">The order to be changed</Var>
+                       <Var name="shippingid" type="int">the new shipping option or -1 if shipping is to be deleted</Var>
+                       <Var name="shippingcosts" type="int">if the user has the privilege ChangePrice this field overrides the shipping costs, otherwise the default from the shipping table is used</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::changeShipping($this);"/>
+               <Output>
+                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="OrderMarkShipped">
+               <Privilege name="SetTime">Users with this privilege can set a time for when the order was shipped, for all others the current time is used.</Privilege>
+               <Input>
+                       <Var name="orderid" type="int">The order to be marked</Var>
+                       <Var name="shiptime" type="int64">The time when it was shipped. If the user does not have the SetTime privilege or if this property is &lt;=0 the current date/time is set instead.</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::markAsShipped($this);"/>
+               <Output>
+                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="OrderAddComment">
+               <Doc>Add a comment to the end of the comments field. Most users will only have this right.</Doc>
+               <Input>
+                       <Var name="orderid" type="int">the order to be commented upon</Var>
+                       <Var name="comment" type="string">the comment</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::addComment($this);"/>
+               <Output>
+                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
+               </Output>
+       </Transaction>
+       <Transaction name="OrderChangeComments">
+               <Doc>For privileged users: edit the complete comments field, overwrite it.</Doc>
+               <Input>
+                       <Var name="orderid" type="int">the order to be commented upon</Var>
+                       <Var name="comments" type="string">the comments</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::changeComments($this);"/>
+               <Output>
+                       <Var name="order" type="Order">a fresh copy of the changed order</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="ReturnTicketVoucher">
+               <Privilege name="ReturnPastTicket">Users with this privilege can return tickets for events in the past (if they have not been used yet). All others can only return tickets in the future.</Privilege>
+               <Input>
+                       <Var name="barcode" type="astring">barcode of the ticket or voucher</Var>
+               </Input>
+               <Call lang="php" method="WOOrder::returnTicketVoucher($this);"/>
+               <Output>
+                       <Var name="order" type="Order">the order that owned the returned object, in case this is called from the order window</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="ChangeTicketPrice">
+               <Privilege name="ChangeUsedTicket">users with this privilege can change the price of used tickets - usually a ticket has to be changed before it is used</Privilege>
+               <Privilege name="ChangePastTicket">users with this privilege can change the price for tickets that are for past events</Privilege>
+               <Input>
+                       <Var name="barcode" type="astring"/>
+                       <Var name="price" type="int"/>
+               </Input>
+               <Call lang="php" method="WOOrder::changeTicketPrice($this);"/>
+               <Output>
+                       <Var name="order" type="Order">the order that ownes the changed ticket, in case this is called from the order window</Var>
+               </Output>
+       </Transaction>
+       <Transaction name="ChangeTicketPriceCategory">
+               <Privilege name="ChangeUsedTicket">users with this privilege can change the price of used tickets - usually a ticket has to be changed before it is used</Privilege>
+               <Privilege name="ChangePastTicket">users with this privilege can change the price for tickets that are for past events</Privilege>
+               <Input>
+                       <Var name="barcode" type="astring"/>
+                       <Var name="pricecategoryid" type="int"/>
+               </Input>
+               <Call lang="php" method="WOOrder::changeTicketPriceCategory($this);"/>
+               <Output>
+                       <Var name="order" type="Order">the order that ownes the changed ticket, in case this is called from the order window</Var>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetAllShipping" updating="no">
+               <Input/>
+               <Call lang="php" method="$this->setshipping(WOShipping::fromTableArrayshipping(WTshipping::selectFromDB()));"/>
+               <Output>
+                       <Var name="shipping" type="List:Shipping"/>
+               </Output>
+       </Transaction>
+       <Transaction name="ChangeShipping">
+               <Input>
+                       <Var name="shipping" type="Shipping"/>
+               </Input>
+               <Call lang="php" method="WOShipping::change($this);"/>
+               <Output>
+                       <Var name="shipping" type="Shipping"/>
+               </Output>
+       </Transaction>
+       <Transaction name="CreateShipping">
+               <Input>
+                       <Var name="shipping" type="Shipping"/>
+               </Input>
+               <Call lang="php" method="WOShipping::create($this);"/>
+               <Output>
+                       <Var name="shipping" type="Shipping"/>
+               </Output>
+       </Transaction>
+       <Transaction name="DeleteShipping">
+               <Input>
+                       <Var name="shipid" type="int"/>
+               </Input>
+               <Call lang="php" method="WOShipping::remove($this);"/>
+               <Output/>
+       </Transaction>
+       
+       <Transaction name="GetValidVoucherPrices" updating="no">
+               <Call lang="php" method="$this->setprices(explode(' ',$GLOBALS['db']->getConfig('ValidVouchers')));"/>
+               <Output>
+                       <Var name="prices" type="List:int"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="UseTicket">
+               <Input>
+                       <Var name="ticketid" type="astring">The ticket to be used</Var>
+                       <Var name="eventid" type="int">The event to use it on</Var>
+               </Input>
+               <Call lang="php" method="WOTicket::useTicket($this);"/>
+               <Output>
+                       <Var name="ticketuse" type="TicketUse"/>
+               </Output>
+       </Transaction>
+       <Transaction name="GetEntranceEvents" updating="no">
+               <Doc>This is a convenience transaction: it returns all events that are likely to be chosen at an entrance barcode scanner; this includes all events starting at max. within the next 24 hours that and that have not ended yet</Doc>
+               <Call lang="php" method="WOEvent::getEntranceEvents($this);"/>
+               <Output>
+                       <Var name="events" type="List:Event"/>
+               </Output>
+       </Transaction>
+</Wolf>
\ No newline at end of file
diff --git a/wob/transact/template.wolf b/wob/transact/template.wolf
new file mode 100644 (file)
index 0000000..04d83ff
--- /dev/null
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Template MagicSmoke WOLF
+  - template tables
+  -
+  - (c) Konrad Rosenbaum, 2009
+  - this file is protected under the GNU AGPLv3 or at your option any newer
+  - see COPYING.AGPL for details
+  -->
+<Wolf>
+       <Transaction name="GetTemplateList" updating="no">
+               <Call lang="php" method="WOTemplate::getList($this);"/>
+               <Output>
+                       <Var name="templates" type="List:TemplateInfo"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="GetTemplate" updating="no">
+               <Input>
+                       <Var name="filename" type="astring"/>
+               </Input>
+               <Call lang="php" method="WOTemplate::getFile($this);"/>
+               <Output>
+                       <Var name="templatefile" type="Template"/>
+               </Output>
+       </Transaction>
+       
+       <Transaction name="SetTemplate">
+               <Input>
+                       <Var name="filename" type="astring"/>
+                       <Var name="templatedata" type="blob"/>
+                       <Var name="description" type="string"/>
+               </Input>
+               <Call lang="php" method="WOTemplate::setFile($this);"/>
+               <Output>
+                       <Var name="templatefile" type="Template"/>
+               </Output>
+       </Transaction>
+       <Transaction name="SetTemplateDescription">
+               <Input>
+                       <Var name="filename" type="astring"/>
+                       <Var name="description" type="string"/>
+               </Input>
+               <Call lang="php" method="WOTemplate::setTemplateDescription($this);"/>
+       </Transaction>
+       <Transaction name="DeleteTemplate">
+               <Input>
+                       <Var name="filename" type="astring"/>
+               </Input>
+               <Call lang="php" method="WOTemplate::deleteTemplate($this);"/>
+       </Transaction>
+</Wolf>
similarity index 67%
rename from wob/user.wolf
rename to wob/transact/user.wolf
index 5f0971d..3507064 100644 (file)
@@ -7,64 +7,6 @@
   - see COPYING.AGPL for details
   -->
 <Wolf>
-       <Table name="host" backup="yes">
-               <Column name="hostname" type="string:64" primarykey="yes"/>
-               <!-- if hostkey is NULL it is a special host (_any), otherwise the key is a sha1 hash of the real key -->
-               <Column name="hostkey" type="string" />
-               
-               <Preset><V col="hostname" code='translate("SpecialHost","_any")'/></Preset>
-       </Table>
-       
-       <Table name="user" backup="yes">
-               <Column name="uname" type="string:64" primarykey="yes"/>
-               <!-- passwd is a salted sha1 hash -->
-               <Column name="passwd" type="string" notnull="yes"/>
-               <!-- more detailed data that can be displayed to admins -->
-               <Column name="description" type="text"/>
-               <Column name="flags" type="string"/>
-       </Table>
-       
-       <Table name="role" backup="yes">
-               <Column name="rolename" type="string:64" primarykey="yes"/>
-               <Column name="description" type="text"/>
-               <Column name="flags" type="string"/>
-               
-               <Preset>
-                       <V col="rolename" val="_admin"/>
-                       <V col="description" val="Admin Users"/>
-                       <V col="flags" val="_admin"/>
-               </Preset>
-               <Preset>
-                       <V col="rolename" val="_web"/>
-                       <V col="description" val="Web Interface, Customers"/>
-                       <V col="flags" val="_web"/>
-               </Preset>
-       </Table>
-       
-       <Table name="roleright" backup="yes">
-               <Column name="rolename" type="string:64" primarykey="yes"/>
-               <Column name="rightname" type="string:64" primarykey="yes"/>
-               
-               <!-- TODO: assign default rights for _web -->
-       </Table>
-       
-       <Table name="userrole" backup="yes">
-               <Column name="uname" type="string:64" notnull="yes" foreignkey="user:uname" index="yes" primarykey="yes"/>
-               <Column name="role" type="string:64" notnull="yes" primarykey="yes" foreignkey="role:rolename"/>
-       </Table>
-       
-       <Table name="userhost" backup="yes">
-               <Column name="uname" type="string:64" notnull="yes" foreignkey="user:uname" index="yes" primarykey="yes"/>
-               <Column name="host" type="string:64" notnull="yes" foreignkey="host:hostname" primarykey="yes"/>
-       </Table>
-       
-       <Table name="session" backup="no">
-               <Column name="sessionid" type="string:64" primarykey="yes"/>
-               <Column name="uname" type="string:64" notnull="yes" foreignkey="user:uname"/>
-               <!-- unix timestamp at which to delete this session -->
-               <Column name="timeout" type="int64" notnull="yes"/>
-       </Table>
-       
        <Transaction name="ServerInfo" mode="open" updating="no">
                <Input/>
                <Call lang="php" method="Version::serverInfoXml($this);"/>
                <Call lang="php" method="Session::instance()->setMyPasswd($this);"/>
                <Output/>
        </Transaction>
-       
-       <Class name="User">
-               <Doc>This class represents the main information about users: login name plus description. Passwords are never carried towards the client, more detailed info is contained in other classes.</Doc>
-               <Property name="name" type="astring"/>
-               <Property name="description" type="string"/>
-               <Property name="flags" type="astring"/>
-               <Mapping table="user">
-                       <Map column="uname" property="name"/>
-                       <Map column="description"/>
-                       <Map column="flags"/>
-               </Mapping>
-       </Class>
-       
-       <Class name="Host">
-               <Property name="name" type="string"/>
-               <!-- if hostkey is NULL it is a special host (_any, _anon, _online) -->
-               <Property name="key" type="string" />
-               <Mapping table="host">
-                       <Map column="hostname" property="name"/>
-                       <Map column="hostkey" property="key"/>
-               </Mapping>
-       </Class>
-       
+
        <Transaction name="GetAllUsers" updating="no">
                <Input/>
                <Call lang="php" method="$this->setusers(WOUser::fromTableArrayuser(WTuser::selectFromDB()));"/>
                <Call lang="php" method="MachineUser::setUserFlags($this);"/>
        </Transaction>
        
-       <Class name="Role" abstract="yes">
-               <Property name="name" type="string"/>
-               <Property name="description" type="string"/>
-               <Property name="flags" type="string"/>
-               <Property name="rights" type="List:string"/>
-               <Mapping table="role">
-                       <Map column="rolename" property="name"/>
-                       <Map column="description"/>
-                       <Map column="flags"/>
-                       <Map property="rights">
-                               <Call lang="php" method="$data->getRightsFromDB()"/>
-                       </Map>
-                       <!-- how about rights? -->
-               </Mapping>
-       </Class>
-       
        <Transaction name="GetAllRoles" updating="no">
                <Input/>
                <Call lang="php" method="$this->setroles(WORole::fromTableArrayrole(WTrole::selectFromDB()));"/>