0.15_04 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
e3d242f7
TC
22 siteuser_id affiliate_code shipping_cost
23 delivMobile billMobile/;
0ec4ac8a
TC
24}
25
26=item siteuser
27
28returns the SiteUser object of the user who made this order.
29
30=cut
31
32sub siteuser {
33 my ($self) = @_;
34
35 $self->{userId} or return;
36
37 require SiteUsers;
38
39 return ( SiteUsers->getBy(userId=>$self->{userId}) )[0];
40}
41
42sub items {
43 my ($self) = @_;
44
45 require BSE::TB::OrderItems;
46 return BSE::TB::OrderItems->getBy(orderId => $self->{id});
47}
48
ab2cd916
TC
49sub files {
50 my ($self) = @_;
51
52 BSE::DB->query(orderFiles=>$self->{id});
53}
54
55sub products {
56 my ($self) = @_;
57
58 require Products;
59 Products->getSpecial(orderProducts=>$self->{id});
60}
61
0ec4ac8a 621;