make the billing address the primary address for orders, checkout
authorTony Cook <tony@develop-help.com>
Tue, 6 Dec 2011 23:52:01 +0000 (10:52 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 6 Dec 2011 23:52:01 +0000 (10:52 +1100)
site/cgi-bin/modules/BSE/CustomBase.pm
site/cgi-bin/modules/BSE/TB/Order.pm
site/cgi-bin/modules/BSE/UI/Shop.pm
site/docs/config.pod
site/templates/admin/order_detail.tmpl
site/templates/admin/order_list.tmpl
site/templates/admin/order_list_filled.tmpl
site/templates/admin/order_list_unfilled.tmpl
site/templates/admin/users/edit_orders.tmpl
site/templates/checkoutnew_base.tmpl
site/templates/user/options_base.tmpl

index 66a31eb..fc85a5e 100644 (file)
@@ -1,7 +1,7 @@
 package BSE::CustomBase;
 use strict;
 
-our $VERSION = "1.000";
+our $VERSION = "1.001";
 
 sub new {
   my ($class, %params) = @_;
@@ -52,7 +52,16 @@ sub recalc {
 sub required_fields {
   my ($class, $q, $state, $cfg) = @_;
 
-  qw(name1 name2 address city postcode country telephone email);
+  my @fields = qw(name1 name2 address city postcode country billTelephone email);
+  push @fields, split /,/, $cfg->entry("shop", "require_fields", "");
+  if ($q->param("need_delivery")) {
+    if ($cfg->entry("shop", "require_delivery", 1)) {
+      push @fields, qw(delivFirstName delivLastName delivStreet delivSuburb delivState delivPostCode delivCountry);
+    }
+    push @fields, split /,/, $cfg->entry("shop", "require_delivery_fields", "");
+  }
+
+  return @fields;
 }
 
 sub purchase_actions {
index 3fed6d1..f26971d 100644 (file)
@@ -6,7 +6,7 @@ use vars qw/@ISA/;
 @ISA = qw/Squirrel::Row/;
 use Carp 'confess';
 
-our $VERSION = "1.009";
+our $VERSION = "1.010";
 
 sub columns {
   return qw/id
@@ -122,6 +122,35 @@ sub payment_columns {
            ccStatus2 ccTranId/;
 }
 
+=item billing_to_delivery_map
+
+Return a hashref where the key is a billing field and the value is the
+corresponding delivery field.
+
+=cut
+
+{
+  my %billing_to_delivery =
+    (
+     billEmail => "emailAddress",
+     billFirstName => "delivFirstName",
+     billLastName => "delivLastName",
+     billStreet => "delivStreet",
+     billStreet2 => "delivStreet2",
+     billSuburb => "delivSuburb",
+     billState => "delivState",
+     billPostCode => "delivPostCode",
+     billCountry => "delivCountry",
+     billTelephone => "telephone",
+     billFacsimile => "facsimile",
+     billOrganization => "delivOrganization",
+    );
+
+  sub billing_to_delivery_map {
+    return \%billing_to_delivery;
+  }
+}
+
 =item siteuser
 
 returns the SiteUser object of the user who made this order.
@@ -221,14 +250,14 @@ sub valid_fields {
      facsimile => { description => 'Facsimile Number',
                    rules => 'phone' },
      emailAddress => { description => 'Email Address',
-                      rules=>'email;required' },
+                      rules=>'email' },
      instructions => { description => 'Instructions' },
      billTelephone => { description => 'Billing Telephone Number', 
                        rules=>'phone' },
      billFacsimile => { description => 'Billing Facsimile Number',
                        rules=>'phone' },
      billEmail => { description => 'Billing Email Address',
-                   rules => 'email' },
+                   rules => 'email;required' },
      delivMobile => { description => 'Delivery Mobile Number',
                      rules => 'phone' },
      billMobile => { description => 'Billing Mobile Number',
@@ -387,22 +416,24 @@ sub stage_description_id {
   return BSE::TB::Orders->stage_label_id($self->stage);
 }
 
-=item mail_recipient
+=item delivery_mail_recipient
 
-Return a value suitable for BSE::ComposeMail's to parameter.
+Return a value suitable for BSE::ComposeMail's to parameter for the
+shipping email address.
 
 =cut
 
-sub mail_recipient {
+sub delivery_mail_recipient {
   my ($self) = @_;
 
   my $user = $self->siteuser;
+  my $email = $self->emailAddress || $self->billEmail;
 
-  if ($user && $user->email eq $self->emailAddress) {
+  if ($user && $user->email eq $email) {
     return $user;
   }
 
-  return $self->emailAddress;
+  return $email;
 }
 
 =item _tags
@@ -556,7 +587,7 @@ sub tags {
 sub send_shipped_email {
   my ($self) = @_;
 
-  my $to = $self->mail_recipient;
+  my $to = $self->delivery_mail_recipient;
   require BSE::ComposeMail;
   my $mailer = BSE::ComposeMail->new(cfg => BSE::Cfg->single);
   require BSE::Util::Tags;
@@ -565,8 +596,7 @@ sub send_shipped_email {
      BSE::Util::Tags->mail_tags(),
      $self->mail_tags,
     );
-
-  $mailer->send
+  my %opts =
     (
      to => $to,
      subject => "Your order has shipped",
@@ -576,6 +606,12 @@ sub send_shipped_email {
      log_object => $self,
      log_component => "shopadmin:orders:saveorder",
     );
+  if ($self->emailAddress && $self->billEmail
+      && lc $self->emailAddress ne $self->billEmail) {
+    $opts{cc} = $self->billEmail;
+  }
+
+  $mailer->send(%opts);
 }
 
 sub new_stage {
index bf9d4a5..e458dfc 100644 (file)
@@ -17,7 +17,7 @@ use BSE::Shipping;
 use BSE::Countries qw(bse_country_code);
 use BSE::Util::Secure qw(make_secret);
 
-our $VERSION = "1.018";
+our $VERSION = "1.019";
 
 use constant MSG_SHOP_CART_FULL => 'Your shopping cart is full, please remove an item and try adding an item again';
 
@@ -43,17 +43,18 @@ my %actions =
    emptycart => 1,
   );
 
+# map of SiteUser field names to order field names - mostly
 my %field_map = 
   (
-   name1 => 'delivFirstName',
-   name2 => 'delivLastName',
-   address => 'delivStreet',
-   organization => 'delivOrganization',
-   city => 'delivSuburb',
-   postcode => 'delivPostCode',
-   state => 'delivState',
-   country => 'delivCountry',
-   email => 'emailAddress',
+   name1 => 'billFirstName',
+   name2 => 'billLastName',
+   address => 'billStreet',
+   organization => 'billOrganization',
+   city => 'billSuburb',
+   postcode => 'billPostCode',
+   state => 'billState',
+   country => 'billCountry',
+   email => 'billEmail',
    cardHolder => 'ccName',
    cardType => 'ccType',
   );
@@ -525,10 +526,8 @@ sub req_checkout {
     # Get a list of couriers
     my $sel_cn = $old->("shipping_name") || "";
     my %fake_order;
-    my %fields = BSE::TB::Order->valid_fields($cfg);
-    for my $name (keys %fields) {
-      $fake_order{$name} = $old->($name);
-    }
+    my %fields = $class->_order_fields($req);
+    $class->_order_hash($req, \%fake_order, \%fields);
     my $country = $fake_order{delivCountry} || bse_default_country($cfg);
     my $country_code = bse_country_code($country);
     my $suburb = $fake_order{delivSuburb};
@@ -660,6 +659,42 @@ sub req_remove_item {
   return BSE::Template->get_refresh($req->user_url(shop => 'cart'), $req->cfg);
 }
 
+sub _order_fields {
+  my ($self, $req) = @_;
+
+  my %fields = BSE::TB::Order->valid_fields($req->cfg);
+  my $cust_class = custom_class($req->cfg);
+  my @required = 
+    $cust_class->required_fields($req->cgi, $req->session->{custom}, $req->cfg);
+
+  for my $name (@required) {
+    $field_map{$name} and $name = $field_map{$name};
+
+    $fields{$name}{required} = 1;
+  }
+
+  return %fields;
+}
+
+sub _order_hash {
+  my ($self, $req, $values, $fields) = @_;
+
+  my $cgi = $req->cgi;
+  for my $name (keys %$fields) {
+    my ($value) = $cgi->param($name);
+    defined $value or $value = "";
+    $values->{$name} = $value;
+  }
+
+  unless ($cgi->param("need_delivery")) {
+    my $map = BSE::TB::Order->billing_to_delivery_map;
+    keys %$map; # reset iterator
+    while (my ($billing, $delivery) = each %$map) {
+      $values->{$delivery} = $values->{$billing};
+    }
+  }
+}
+
 # saves order and refresh to payment page
 sub req_order {
   my ($class, $req) = @_;
@@ -682,28 +717,12 @@ sub req_order {
     return $class->_refresh_logon($req, $msg, $id);
   }
 
-  # some basic validation, in case the user switched off javascript
-  my $cust_class = custom_class($cfg);
-
-  my %fields = BSE::TB::Order->valid_fields($cfg);
+  my %fields = $class->_order_fields($req);
   my %rules = BSE::TB::Order->valid_rules($cfg);
   
   my %errors;
   my %values;
-  for my $name (keys %fields) {
-    my ($value) = $cgi->param($name);
-    defined $value or $value = "";
-    $values{$name} = $value;
-  }
-
-  my @required = 
-    $cust_class->required_fields($cgi, $req->session->{custom}, $cfg);
-
-  for my $name (@required) {
-    $field_map{$name} and $name = $field_map{$name};
-
-    $fields{$name}{required} = 1;
-  }
+  $class->_order_hash($req, \%values, \%fields);
 
   dh_validate_hash(\%values, \%errors, { rules=>\%rules, fields=>\%fields },
                   $cfg, 'Shop Order Validation');
@@ -1456,9 +1475,10 @@ sub _send_order {
 
     delete @acts{qw/cardNumber cardExpiry cardVerify/};
   }
-  my $to = $order->emailAddress;
+  my $to_email = $order->billEmail;
   my $user = $req->siteuser;
-  if ($user && $user->email eq $to) {
+  my $to = $to_email;
+  if ($user && $user->email eq $to_email) {
     $to = $user;
   }
   my $mailer = BSE::ComposeMail->new(cfg => $cfg);
@@ -1471,7 +1491,7 @@ sub _send_order {
      acts => \%acts,
      log_component => "shop:sendorder:mailbuyer",
      log_object => $order,
-     log_msg => "Order $order->{id} sent to purchaser ".$order->emailAddress,
+     log_msg => "Order $order->{id} sent to purchaser $to_email",
     );
   my $bcc_order = $cfg->entry("shop", "bcc_email");
   if ($bcc_order) {
index 83903ab..d40ca2c 100644 (file)
@@ -953,6 +953,25 @@ field.  If this is set then the delivCountry is supplied as is to
 various parts of the system, otherwise it is translated from a country
 name to a country code.  Default: 0.
 
+=item require_fields
+
+A comma separated list of extra fields to require during checkout.
+This is in addition to the usual fields required during checkout.
+Default: none.
+
+=item require_delivery
+
+If true, and the C<need_delivery> CGI parameter is true, treat the
+following delivery fields as required during checkout: delivFirstName
+delivLastName delivStreet delivSuburb delivState delivPostCode
+delivCountry.  Default: true.
+
+=item require_delivery_fields
+
+If C<require_delivery> is true, and the C<need_delivery> CGI parameter
+is true, add the comma separated fields listed here to the required
+checkout fields list.  Default: none.
+
 =back
 
 =head2 [shipping]
index 2e078e5..64ba314 100644 (file)
@@ -1,6 +1,6 @@
-<:wrap admin/base.tmpl title => [concatenate "Order " [order id] " details"]:> 
+<:wrap admin/base.tmpl title => [concatenate "Order " [order id] " details"] bodyid => bse-order-detail :> 
 <h1>Shop Administration</h1>
-<p>| <a href="/cgi-bin/admin/menu.pl">Admin menu</a> |
+<p>| <a href="<:adminurl menu:>">Admin menu</a> |
 <a href="<:adminurl shopadmin:>">Manage catalogs</a> |
 <a href="<:adminurl shopadmin order_list 1:>">Manage orders</a> |
 <a href="<:adminurl shopadmin order_list 1 template order_list_unfilled:>">Unfilled 
@@ -8,43 +8,69 @@
 <a href="<:adminurl shopadmin order_list 1 template order_list_filled:>">Filled 
   orders</a> |
 <:ifSiteuser id:><a href="<:adminurl siteusers a_edit 1 id [siteuser id]:>">Edit Member</a> |
-<a href="<:adminurl siteusers a_edit=1 id [siteuser id] _t orders:>">Other member orders</a> |<:or:><:eif:>
+<a href="<:adminurl siteusers a_edit 1 id [siteuser id] _t orders:>">Other member orders</a> |<:or:><:eif:>
 </p>
 <:ifMessage:><div class="message"><:message:></div><:or:><:eif:>
 <h2>Order details - No: #<:order id:></h2>
+<h3>Received: <span class="date order-date" data-datetime="<:date "%y-%m-%dT%H:%M:%S" order orderDate:>"><:date "%d/%m/%Y %I:%M%P" order orderDate:></span></h3>
+<:ifOrder purchase_order:>
+<h3 class="purchase-order">Purchase Order: <span class="purchase-order"><:order purchase_order:></span></h3>
+<:or:><:eif:>
 <:ifOrder complete:><:or:><p>This order is incomplete and should not be filled.</p><:eif:>
 <table class="editform orderdetail_head">
+  <tr>
+    <th colspan="2" class="col_typehead">Billing</th>
+    <td rowspan="6">&nbsp;</td>
+    <th colspan="2" class="col_typehead">Delivery</th>
+  </tr>
   <tr> 
     <th class="col_head">E-mail:</th>
+    <td class="col_value"><a href="mailto:<:order billEmail:>"><:order billEmail:></a></td>
+    <th class="col_head">Email:</th>
     <td class="col_value"><a href="mailto:<:order emailAddress:>"><:order emailAddress:></a></td>
-    <td rowspan="3">&nbsp;</td>
+  </tr>
+  <tr> 
+    <th class="col_head">Phone:</th>
+    <td class="col_value"><a href="tel:<:order billTelephone:>"><:order billTelephone:></a></td>
     <th class="col_head">Phone:</th>
-    <td class="col_value"><:order telephone:></td>
+    <td class="col_value"><a href="tel:<:order telephone:>"><:order telephone:></a></td>
   </tr>
   <tr> 
-    <th class="col_head">Date:</th>
-    <td class="col_value"><:date order orderDate:></td>
     <th class="col_head">Mobile:</th>
-    <td class="col_value"><:order delivMobile:></td>
+    <td class="col_value"><a href="tel:<:order billMobile:>"><:order billMobile:></a></td>
+    <th class="col_head">Mobile:</th>
+    <td class="col_value"><a href="tel:<:order delivMobile:>"><:order delivMobile:></a></td>
   </tr>
   <tr> 
-    <th class="col_head">Delivery:</th>
-    <td class="col_value"><:order delivFirstName:> <:order delivLastName:>
-      <:ifOrder delivOrganization:><br /><:order delivOrganization:><:or:><:eif:>
-      <br /><:order delivStreet:>
-      <:ifOrder delivStreet2:><br /><:order delivStreet2:><:or:><:eif:>
-      <br /><:order delivSuburb:> <:order delivState:> <:order delivPostCode:>
-      <br /><:order delivCountry:></td>
-    <th class="col_head">Billing:</th>
+    <th class="col_head">Facsimile:</th>
+    <td class="col_value"><a href="fax:<:order billFacsimile:>"><:order billFacsimile:></a></td>
+    <th class="col_head">Facsimile:</th>
+    <td class="col_value"><a href="fax:<:order facsimile:>"><:order facsimile:></a></td>
+  </tr>
+  <tr> 
+    <th class="col_head">Address:</th>
     <td class="col_value">
       <:order billFirstName:> <:order billLastName:>
-      <:ifOrder billOrganization:><br /><:order billOrganization:><:eif:>
+      <:ifOrder billOrganization:><br /><:order billOrganization:><:or:><:eif:>
       <br /><:order billStreet:>
       <:ifOrder billStreet2:><br /><:order billStreet2:><:or:><:eif:>
       <br /><:order billSuburb:> <:order billState:> <:order billPostCode:>
       <br /><:order billCountry:>
     </td>
+    <th class="col_head">Address:</th>
+    <td class="col_value"><:order delivFirstName:> <:order delivLastName:>
+      <:ifOrder delivOrganization:><br /><:order delivOrganization:><:or:><:eif:>
+      <br /><:order delivStreet:>
+      <:ifOrder delivStreet2:><br /><:order delivStreet2:><:or:><:eif:>
+      <br /><:order delivSuburb:> <:order delivState:> <:order delivPostCode:>
+      <br /><:order delivCountry:></td>
   </tr>
+<:ifOrder instructions:>
+  <tr>
+    <th>Special Instructions:</th>
+    <td colspan="4" class="col_instructions"><:order instructions:></td>
+  </tr>
+<:or:><:eif:>
   <:include custom/order_detail.include optional:><:include admin/include/custom/order_detail_custom.tmpl optional:><:include admin/include/order_detail_custom.tmpl optional:>
 </table>
 
index 6f8b74f..9c84ccf 100644 (file)
@@ -1,8 +1,8 @@
 <:wrap admin/base.tmpl title => "Order list - Shop administration":>
 <h1>Shop Administration</h1>
-<p>| <a href="/cgi-bin/admin/menu.pl">Admin menu</a> | <a href="<:script:>">Manage catalogs</a> 
-  | <a href="<:script:>?order_list=1&amp;template=order_list_unfilled">Unfilled orders</a>  [ <:order_count filter= filled==0 :> ]
-  | <a href="<:script:>?order_list=1&amp;template=order_list_filled">Filled orders</a>   [ <:order_count filter= filled!=0 :> ]
+<p>| <a href="<:adminurl menu:>">Admin menu</a> | <a href="<:adminurl shopadmin:>">Manage catalogs</a> 
+  | <a href="<:adminurl shopadmin order_list 1 template order_list_unfilled:>">Unfilled orders</a>  [ <:order_count filter= filled==0 :> ]
+  | <a href="<:adminurl shopadmin order_list 1 template order_list_filled:>">Filled orders</a>   [ <:order_count filter= filled!=0 :> ]
   |</p>
 <h2>Order list</h2>
 
         </tr>
         <:iterator begin orders:> 
         <tr> 
-          <td class="col_id"><a href="<:script:>?id=<:order id:>&amp;order_detail=1"><:order 
+          <td class="col_id"><a href="<:adminurl shopadmin order_detail 1 id [order id]:>"><:order 
             id:></a></td>
-          <td class="col_name"><:order delivFirstName:> <:order delivLastName:> <:ifOrder 
+          <td class="col_name"><:ifOrder billFirstName:><:order billFirstName:> <:order billLastName:><:or:><:order delivFirstName:> <:order delivLastName:><:eif:> <:ifOrder 
             userId:><font color="#CCCCCC">&#8212; (logged in)</font><:or:><:eif:></td>
           <td class="col_status <:ifOrder filled:>filled<:or:>unfilled<:eif:>"><:ifOrder 
             filled:>Completed<:or:>Processing<:eif:></td>
           <td class="col_date"><:date order orderDate:></td>
           <td class="col_total">$<:money order total:></td>
           <td class="col_gst">$<:money order gst:></td>
-          <td class="col_tools"> <a href="<:script:>?id=<:order id:>&amp;order_detail=1">Order 
+          <td class="col_tools"> <a href="<:adminurl shopadmin id [order id] order_detail 1:>">Order 
             details </a> </td>
         </tr>
         <:iterator end orders:> 
index 979703c..83d48da 100644 (file)
@@ -1,8 +1,8 @@
 <:wrap admin/base.tmpl title => "Order list - Shop administration":>
 <h1>Shop Administration</h1>
-<p>| <a href="/cgi-bin/admin/menu.pl">Admin menu</a> | <a href="<:script:>">Manage catalogs</a> 
-  | <a href="<:script:>?order_list=1&amp;template=order_list_unfilled">Unfilled orders</a>  [ <:order_count filter= filled==0:> ]
-  | <a href="<:script:>?order_list=1">All orders</a>  [ <:order_count filter= id!=0:> ] |</p>
+<p>| <a href="<:adminurl menu:>">Admin menu</a> | <a href="<:adminurl shopadmin:>">Manage catalogs</a> 
+  | <a href="<:adminurl shopadmin order_list 1 template order_list_unfilled:>">Unfilled orders</a>  [ <:order_count filter= filled==0:> ]
+  | <a href="<:adminurl shopadmin order_list 1:>">All orders</a>  [ <:order_count filter= id!=0:> ] |</p>
 <h2>Order list - Filled orders</h2>
 
       <table class="editform orderlist">
         </tr>
         <:iterator begin orders filter= filled!=0 :> 
         <tr> 
-          <td class="col_id"><a href="<:script:>?id=<:order id:>&amp;order_detail=1"><:order 
+          <td class="col_id"><a href="<:adminurl shopadmin id [order id] order_detail 1:>"><:order 
             id:></a></td>
-          <td class="col_title"><:order delivFirstName:> <:order delivLastName:> <:ifOrder 
+          <td class="col_title"><:ifOrder billFirstName:><:order billFirstName:> <:order billLastName:><:or:><:order delivFirstName:> <:order delivLastName:><:eif:> <:ifOrder 
             userId:><font color="#CCCCCC">&#8212; (logged in)</font><:or:><:eif:></td>
           <td class="col_date"><:date order orderDate:></td>
           <td class="col_total">$<:money order total:></td>
           <td class="col_total">$<:money order gst:></td>
-          <td class="col_tools"> <a href="<:script:>?id=<:order id:>&amp;order_detail=1">Order 
+          <td class="col_tools"> <a href="<:adminurl shopadmin id [order id] order_detail 1:>">Order 
             details </a> </td>
         </tr>
         <:iterator end orders:> 
index af21bf0..d465922 100644 (file)
@@ -1,8 +1,8 @@
 <:wrap admin/base.tmpl title => "Order list - Shop administration":>
 <h1>Shop Administration</h1>
-<p>| <a href="/cgi-bin/admin/menu.pl">Admin menu</a> | <a href="<:script:>">Manage catalogs</a> 
-  | <a href="<:script:>?order_list=1&amp;template=order_list_filled">Filled orders</a> [ <:order_count filter= filled!=0:> ]
-  | <a href="<:script:>?order_list=1">All orders</a>  [ <:order_count filter= id!=0:> ] |</p>
+<p>| <a href="<:adminurl menu:>">Admin menu</a> | <a href="<:adminurl shopadmin:>">Manage catalogs</a> 
+  | <a href="<:adminurl shopadmin order_list 1 template order_list_filled:>">Filled orders</a> [ <:order_count filter= filled!=0:> ]
+  | <a href="<:adminurl shopadmin order_list 1:>">All orders</a>  [ <:order_count filter= id!=0:> ] |</p>
 <h2>Order list - Unfilled orders</h2>
 
       <table class="editform orderlist">
         </tr>
         <:iterator begin orders filter= filled==0 :> 
         <tr> 
-          <td class="col_id"><a href="<:script:>?id=<:order id:>&amp;order_detail=1"><:order 
+          <td class="col_id"><a href="<:adminurl shopadmin id [order id] order_detail 1:>"><:order 
             id:></a></td>
-          <td class="col_name"><:order delivFirstName:> <:order delivLastName:> <:ifOrder 
+          <td class="col_name"><:ifOrder billFirstName:><:order billFirstName:> <:order billLastName:><:or:><:order delivFirstName:> <:order delivLastName:><:eif:> <:ifOrder 
             userId:><font color="#CCCCCC">&#8212; (logged in)</font><:or:><:eif:></td>
           <td class="col_date"><:date order orderDate:></td>
           <td class="col_total">$<:money order total:></td>
           <td class="col_total">$<:money order gst:></td>
-          <td class="col_tools"> <a href="<:script:>?id=<:order id:>&amp;order_detail=1">Order 
+          <td class="col_tools"> <a href="<:adminurl shopadmin id [order id] order_detail 1:>">Order 
             details </a></td>
         </tr>
         <:iterator end orders:> 
index 709905d..172145e 100644 (file)
@@ -1,45 +1,39 @@
 <:wrap admin/base.tmpl title=>"Site Member Orders":>
 <h1>Site Member Orders</h1>
 <p>
-| <a href="/cgi-bin/admin/menu.pl">Admin menu</a> |
-<a href="/cgi-bin/admin/siteusers.pl">Site Members</a> |
+| <a href="<:adminurl menu:>">Admin menu</a> |
+<a href="<:adminurl siteusers:>">Site Members</a> |
 <a href="mailto:<:siteuser email:>">Email</a> |
-<:ifUserCan bse_members_user_edit:><a href="/cgi-bin/admin/siteusers.pl?a_edit=1&amp;id=<:siteuser id:>">Edit User</a> |<:or:><:eif:>
-<a href="/cgi-bin/admin/siteusers.pl?a_view=1&amp;id=<:siteuser id:>">User Details</a> |</p>
+<:ifUserCan bse_members_user_edit:><a href="<:adminurl siteusers a_edit 1 id [siteuser id]:>">Edit User</a> |<:or:><:eif:>
+<a href="<:adminurl siteusers a_view 1 id [siteuser id]:>">User Details</a> |</p>
 
 <:ifMessage:>
 <p><b><:message:></b></p>
 <:or:><:eif:> 
 
-<table bgcolor="#000000" cellpadding="0" cellspacing="0" border="0" width="100%" class="table">
-  <tr>
-<td>
-      <table border=0 cellpadding="6" cellspacing="1" width="100%">
-        <tr bgcolor="#FFFFFF"> 
-          <th>Id</th>
-          <th width="100%">Name</th>
-          <th>Status</th>
-          <th>Date</th>
-          <th>Total</th>
-          <th>GST</th>
-          <th>Details</th>
+      <table class="editform orderlist">
+        <tr> 
+          <th class="col_id">Id</th>
+          <th class="col_name">Name</th>
+          <th class="col_status">Status</th>
+          <th class="col_date">Date</th>
+          <th class="col_total">Total</th>
+          <th class="col_gst">GST</th>
+          <th class="col_details">Details</th>
         </tr>
         <:iterator begin userorders:> 
-        <tr bgcolor="#FFFFFF"
-          <td align="center" nowrap><a href="<:script:>?id=<:userorder id:>&order_detail=1"><:userorder 
+        <tr> 
+          <td class="col_id"><a href="<:adminurl shopadmin order_detail 1 id [userorder id]:>"><:userorder 
             id:></a></td>
-          <td width="100%"><:userorder delivFirstName:> <:userorder delivLastName:> <:ifUserorder 
+          <td class="col_name"><:ifUserorder billFirstName:><:userorder billFirstName:> <:userorder billLastName:><:or:><:userorder delivFirstName:> <:userorder delivLastName:><:eif:> <:ifUserorder 
             userId:><font color="#CCCCCC">&#8212; (logged in)</font><:or:><:eif:></td>
           <td nowrap bgcolor="<:ifUserorder filled:>#CC0033<:or:>#66CC00<:eif:>"><:ifUserorder 
             filled:><font color="#999999">Completed</font><:or:><font color="#FFFFFF">Processing</font><:eif:></td>
-          <td nowrap><:date userorder orderDate:></td>
-          <td align=right nowrap>$<:money userorder total:></td>
-          <td align=right nowrap>$<:money userorder gst:></td>
-          <td nowrap> <a href="/cgi-bin/admin/shopadmin.pl?id=<:userorder id:>&order_detail=1">Order 
+          <td class="col_date"><:date userorder orderDate:></td>
+          <td class="col_total">$<:money userorder total:></td>
+          <td class="col_gst">$<:money userorder gst:></td>
+          <td class="col_tools"> <a href="<:adminurl shopadmin id [userorder id] order_detail 1:>">Order 
             details </a> </td>
         </tr>
         <:iterator end userorders:> 
       </table>
-</td>
-</tr>
-</table>
index f38b858..63ad14d 100644 (file)
@@ -150,7 +150,7 @@ function BSE_validateForm {
     <br>
 <:eif User:>
 <form action="<:dyntarget shop:>" method="POST" onSubmit="BSE_validateForm();return document.MM_returnValue">
-  <font face="Verdana, Arial, Helvetica, sans-serif" size="3"> <b>Shipping Details:</b></font> 
+  <font face="Verdana, Arial, Helvetica, sans-serif" size="3"> <b>Billing Details:</b></font> 
   <hr noshade size="1">
   <table border="0" cellspacing="0" cellpadding="0">
     <:if Message:> 
@@ -164,79 +164,79 @@ function BSE_validateForm {
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> First 
         Name:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivFirstName" size=34 value="<:old delivFirstName:>"><:error_img delivFirstName:>
+        <input type="Text" name="billFirstName" size=34 value="<:old billFirstName:>"><:error_img billFirstName:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Last Name:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivLastName" size=34 value="<:old delivLastName:>"><:error_img delivLastName:>
+        <input type="Text" name="billLastName" size=34 value="<:old billLastName:>"><:error_img billLastName:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Organization:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivOrganization" size=34 value="<:old delivOrganization:>" /><:error_img delivOrganization:>
+        <input type="Text" name="billOrganization" size=34 value="<:old billOrganization:>"><:error_img billOrganization:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Address:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivStreet" size=34 value="<:old delivStreet:>" /><:error_img delivStreet:>
+        <input type="Text" name="billStreet" size=34 value="<:old billStreet:>"><:error_img billStreet:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> </font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivStreet2" size=34 value="<:old delivStreet2:>" /><:error_img delivStreet2:>
+        <input type="Text" name="billStreet2" size=34 value="<:old billStreet2:>"><:error_img billStreet2:>
         </font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> City:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivSuburb" size=34 value="<:old delivSuburb:>" /><:error_img delivSuburb:>
+        <input type="Text" name="billSuburb" size=34 value="<:old billSuburb:>"><:error_img billSuburb:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Postcode:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivPostCode" size=10 value="<:old delivPostCode:>" /><:error_img delivPostCode:>
+        <input type="Text" name="billPostCode" size=10 value="<:old billPostCode:>"><:error_img billPostCode:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> State:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivState" size=10 value="<:old delivState:>" /><:error_img delivState:>
+        <input type="Text" name="billState" size=10 value="<:old billState:>"><:error_img billState:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Country:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivCountry" size=20 value="<:old delivCountry:>" /><:error_img delivCountry:>
+        <input type="Text" name="billCountry" size=20 value="<:old billCountry:>"><:error_img billCountry:>
         *</font></td>
     </tr>
     <tr> 
-      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Telephone:</font></td>
+      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Email:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="telephone" size=20 value="<:old telephone:>" /><:error_img telephone:>
+        <input type="Text" name="billEmail" size=20 value="<:old billEmail:>"><:error_img billEmail:>
         *</font></td>
     </tr>
     <tr> 
-      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Mobile:</font></td>
+      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Telephone:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="delivMobile" size=20 value="<:old delivMobile:>" /><:error_img delivMobile:>
-        </font></td>
+        <input type="Text" name="billTelephone" size=20 value="<:old billTelephone:>"><:error_img billTelephone:>
+        *</font></td>
     </tr>
     <tr> 
-      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Facsimile:</font></td>
+      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Mobile:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="facsimile" size=20 value="<:old facsimile:>" /><:error_img facsimile:>
+        <input type="Text" name="billMobile" size=20 value="<:old billMobile:>"><:error_img billMobile:>
         </font></td>
     </tr>
     <tr> 
-      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> E-mail:</font></td>
+      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Facsimile:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="emailAddress" size=34 value="<:old emailAddress:>"><:error_img emailAddress:>
+        <input type="Text" name="billFacsimile" size=20 value="<:old billFacsimile:>" /><:error_img billFacsimile:>
         *</font></td>
     </tr>
     <tr> 
@@ -262,8 +262,8 @@ function BSE_validateForm {
     </tr>
   </table>
   <p>&nbsp; </p>
- <:if Cgi need_billing:>
-  <font face="Verdana, Arial, Helvetica, sans-serif" size="3"><input type="checkbox" name="need_billing" checked="checked" onClick="this.form.checkupdate.click()" /> <b>Billing Details:</b></font> 
+ <:if Cgi need_delivery:>
+  <font face="Verdana, Arial, Helvetica, sans-serif" size="3"><input type="checkbox" name="need_delivery" checked="checked" onClick="this.form.checkupdate.click()" /> <b>Shipping Details:</b></font> 
    
   <hr size="1" noshade>
   <table border="0" cellspacing="0" cellpadding="0">
@@ -271,85 +271,85 @@ function BSE_validateForm {
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> First 
         Name:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billFirstName" size=34 value="<:old billFirstName:>"><:error_img billFirstName:>
+        <input type="Text" name="delivFirstName" size=34 value="<:old delivFirstName:>"><:error_img delivFirstName:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Last Name:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billLastName" size=34 value="<:old billLastName:>"><:error_img billLastName:>
+        <input type="Text" name="delivLastName" size=34 value="<:old delivLastName:>"><:error_img delivLastName:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Organization:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billOrganization" size=34 value="<:old billOrganization:>"><:error_img billOrganization:>
+        <input type="Text" name="delivOrganization" size=34 value="<:old delivOrganization:>" /><:error_img delivOrganization:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Address:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billStreet" size=34 value="<:old billStreet:>"><:error_img billStreet:>
+        <input type="Text" name="delivStreet" size=34 value="<:old delivStreet:>" /><:error_img delivStreet:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> </font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billStreet2" size=34 value="<:old billStreet2:>"><:error_img billStreet2:>
+        <input type="Text" name="delivStreet2" size=34 value="<:old delivStreet2:>" /><:error_img delivStreet2:>
         </font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> City:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billSuburb" size=34 value="<:old billSuburb:>"><:error_img billSuburb:>
+        <input type="Text" name="delivSuburb" size=34 value="<:old delivSuburb:>" /><:error_img delivSuburb:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Postcode:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billPostCode" size=10 value="<:old billPostCode:>"><:error_img billPostCode:>
+        <input type="Text" name="delivPostCode" size=10 value="<:old delivPostCode:>" /><:error_img delivPostCode:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> State:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billState" size=10 value="<:old billState:>"><:error_img billState:>
+        <input type="Text" name="delivState" size=10 value="<:old delivState:>" /><:error_img delivState:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Country:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billCountry" size=20 value="<:old billCountry:>"><:error_img billCountry:>
-        *</font></td>
-    </tr>
-    <tr> 
-      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Email:</font></td>
-      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billEmail" size=20 value="<:old billEmail:>"><:error_img billEmail:>
+        <input type="Text" name="delivCountry" size=20 value="<:old delivCountry:>" /><:error_img delivCountry:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Telephone:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billTelephone" size=20 value="<:old billTelephone:>"><:error_img billTelephone:>
+        <input type="Text" name="telephone" size=20 value="<:old telephone:>" /><:error_img telephone:>
         *</font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Mobile:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billMobile" size=20 value="<:old billMobile:>"><:error_img billMobile:>
+        <input type="Text" name="delivMobile" size=20 value="<:old delivMobile:>" /><:error_img delivMobile:>
         </font></td>
     </tr>
     <tr> 
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Facsimile:</font></td>
       <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
-        <input type="Text" name="billFacsimile" size=20 value="<:old billFacsimile:>" /><:error_img billFacsimile:>
+        <input type="Text" name="facsimile" size=20 value="<:old facsimile:>" /><:error_img facsimile:>
+        </font></td>
+    </tr>
+    <tr> 
+      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> E-mail:</font></td>
+      <td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
+        <input type="Text" name="emailAddress" size=34 value="<:old emailAddress:>"><:error_img emailAddress:>
         *</font></td>
     </tr>
   </table>
   <p>&nbsp; </p>
  <:or Cgi:>
-   <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <input type="checkbox" name="need_billing" onClick="this.form.checkupdate.click()" /> Billing details different to shipping</font></p>
+   <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <input type="checkbox" name="need_delivery" onClick="this.form.checkupdate.click()" /> Delivery details different to billing</font></p>
  <:eif Cgi:>
 <:include custom/checkout.include optional:>
   <p>
index bfbe58e..a4a1cf5 100644 (file)
         </td>
       </tr>
 <:or Cfg:>
-      <tr> 
+      <!-- tr> 
         <td colspan="2" height="20" align="center"><br>
           <br>
           <a href="<:script:>?show_opts=1&_t=billing">Manage Billing Contact Information</a></td>
-      </tr>
+      </tr -->
 <:eif Cfg:>
 <:if Cfg "site users" nopassword:><:or Cfg:>
       <tr>