0.14_24 commit
[bse.git] / site / cgi-bin / modules / BSE / TB / Order.pm
CommitLineData
0ec4ac8a
TC
1package BSE::TB::Order;
2use strict;
3# represents an order from the database
4use Squirrel::Row;
5use vars qw/@ISA/;
6@ISA = qw/Squirrel::Row/;
7
8sub columns {
9 return qw/id
10 delivFirstName delivLastName delivStreet delivSuburb delivState
11 delivPostCode delivCountry
12 billFirstName billLastName billStreet billSuburb billState
13 billPostCode billCountry
14 telephone facsimile emailAddress
15 total wholesaleTotal gst orderDate
16 ccNumberHash ccName ccExpiryHash ccType
17 filled whenFilled whoFilled paidFor paymentReceipt
18 randomId cancelled userId paymentType
19 customInt1 customInt2 customInt3 customInt4 customInt5
20 customStr1 customStr2 customStr3 customStr4 customStr5
21 instructions billTelephone billFacsimile billEmail
22 siteuser_id affiliate_code shipping_cost/;
23}
24
25=item siteuser
26
27returns the SiteUser object of the user who made this order.
28
29=cut
30
31sub siteuser {
32 my ($self) = @_;
33
34 $self->{userId} or return;
35
36 require SiteUsers;
37
38 return ( SiteUsers->getBy(userId=>$self->{userId}) )[0];
39}
40
41sub items {
42 my ($self) = @_;
43
44 require BSE::TB::OrderItems;
45 return BSE::TB::OrderItems->getBy(orderId => $self->{id});
46}
47
481;