site/templates/common/rssbase.tmpl
site/templates/common/sidebar.tmpl
site/templates/common/sidebar_section.tmpl
+site/templates/custom/checkout.include
+site/templates/custom/order_detail.include
+site/templates/custom/order_detail_payment.include
+site/templates/custom/payment_type.include
+site/templates/custom/payment_type_email.include
site/templates/error.tmpl
site/templates/extras.txt
site/templates/htmlemail/basic.tmpl
-VERSION=0.14_04
+VERSION=0.14_05
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
-- options (if any) specified on this item in the order
options varchar(255) not null,
+ customInt1 integer null,
+ customInt2 integer null,
+ customInt3 integer null,
+
+ customStr1 varchar(255) null,
+ customStr2 varchar(255) null,
+ customStr3 varchar(255) null,
+
primary key (id),
index order_item_order(orderId, id)
);
else {
if (keys %$errors) {
my %work = %$errors;
- my @msgs = delete @work{$cgi->param()};
+ my @msgs = grep defined, delete @work{$cgi->param()};
push @msgs, values %work;
$msg = join "<br />", map escape_html($_), @msgs;
}
else {
if (keys %$errors) {
my %work = %$errors;
- my @msgs = delete @work{$cgi->param()};
+ my @msgs = grep defined, delete @work{$cgi->param()};
push @msgs, values %work;
$msg = join "<br />", map escape_html($_), grep $_, @msgs;
}
}
sub order_save {
- my ($class, $cgi, $order, $items, $cfg) = @_;
+ my ($class, $cgi, $order, $items, $products, $custom, $cfg) = @_;
return 1;
}
This is called by the checkupdate target of shop.pl, which does
nothing else.
-=item order_save($cgi, $order, $items)
+=item order_save($cgi, $order, $items, $products, $custom, $cfg)
Called immediately before the order is saved. You can perform extra
validation and die() with an error message describing the problem, or
getOrderItemByOrderId => 'select * from order_item where orderId = ?',
addOrder => 'insert orders values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
replaceOrder => 'replace orders values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
- addOrderItem => 'insert order_item values(null,?,?,?,?,?,?,?)',
+ addOrderItem => 'insert order_item values(null,?,?,?,?,?,?,?,?,?,?,?,?,?)',
getOrderByUserId => 'select * from orders where userId = ?',
getOrderItemByProductId => 'select * from order_item where productId = ?',
unless ($sessionid) {
# save the new sessionid
my $domain = $ENV{HTTP_HOST};
+ $domain =~ s/:\d+$//;
my $cookie = CGI::Cookie->new(-name=>'sessionid', -value=>$session->{_session_id},
-expires=>$lifetime, -path=>"/",
-domain=>$domain);
use vars qw(@ISA @EXPORT_OK);
@ISA = qw/Exporter/;
@EXPORT_OK = qw/shop_cart_tags cart_item_opts nice_options shop_nice_options
- total shop_total load_order_fields basic_tags need_logon/;
+ total shop_total load_order_fields basic_tags need_logon
+ get_siteuser payment_types/;
use Constants qw/:shop/;
use BSE::Util::SQL qw(now_sqldate);
use BSE::Util::Tags;
$order->{total} += $cust_class->total_extras(\@cart, \@products,
$session->{custom});
- if (need_logon($cfg, \@cart, \@products, $session)) {
+ if (need_logon($cfg, \@cart, \@products, $session, $q)) {
$$error = "Your cart contains some file-based products. Please register or logon";
return 0;
}
}
sub need_logon {
- my ($cfg, $cart, $cart_prods, $session) = @_;
+ my ($cfg, $cart, $cart_prods, $session, $cgi) = @_;
+ defined $cgi or confess "No cgi parameter supplied";
+
my $reg_if_files = $cfg->entryBool('shop', 'register_if_files', 1);
- if (!$session->{userid} && $reg_if_files) {
+
+ my $user = get_siteuser($session, $cfg, $cgi);
+
+ if (!$user && $reg_if_files) {
require 'ArticleFiles.pm';
# scan to see if any of the products have files
for my $prod (@$cart_prods) {
}
my $require_logon = $cfg->entryBool('shop', 'require_logon', 0);
- if (!$session->{userid} && $require_logon) {
+ if (!$user && $require_logon) {
return ("register before checkout", "shop/logonrequired");
}
return;
}
+sub get_siteuser {
+ my ($session, $cfg, $cgi) = @_;
+
+ require SiteUsers;
+ if ($cfg->entryBool('custom', 'user_auth')) {
+ my $custom = Util::custom_class($cfg);
+
+ return $custom->siteuser_auth($session, $cgi, $cfg);
+ }
+ else {
+ my $userid = $session->{userid}
+ or return;
+ my $user = SiteUsers->getBy(userId=>$userid)
+ or return;
+
+ return $user;
+ }
+}
+
+=item payment_types($cfg)
+
+Returns payment type ids, and hashes describing each of the configured
+payment types.
+
+These are used to generate the tags used for testing whether payment
+types are available. Also used for validating payment type
+information.
+
+=cut
+
+sub payment_types {
+ my ($cfg) = @_;
+
+ my %types =
+ (
+ 0 => {
+ id => 0,
+ name => 'CC',
+ desc => 'Credit Card',
+ require => [ qw/cardNumber cardExpiry/ ],
+ },
+ 1 => {
+ id => 1,
+ name => 'Cheque',
+ desc => 'Cheque',
+ require => [],
+ },
+ 2 => {
+ id => 2,
+ name => 'CallMe',
+ desc => 'Call customer for payment',
+ require => [],
+ },
+ );
+
+ my @payment_types = split /,/, $cfg->entry('shop', 'payment_types', '0');
+
+ for my $type (@payment_types) {
+ my $hash = $types{$type}; # avoid autovivification
+ my $name = $cfg->entry('payment type names', $type, $hash->{name});
+ my $desc = $cfg->entry('payment type descs', $type,
+ $hash->{desc} || $name);
+ my @require = $hash->{require} ? @{$hash->{require}} : ();
+ @require = split /,/, $cfg->entry('payment type required', $type,
+ join ",", @require);
+ if ($name && $desc) {
+ $types{$type} =
+ {
+ id => $type,
+ name => $name,
+ desc => $desc,
+ require => \@require,
+ };
+ }
+ }
+
+ for my $type (@payment_types) {
+ unless ($types{$type}) {
+ print STDERR "** payment type $type doesn't have a name defined\n";
+ next;
+ }
+ $types{$type}{enabled} = 1;
+ }
+
+ use Data::Dumper;
+ print STDERR Dumper \%types;
+
+ return values %types;
+}
+
+
1;
my $uid = $cgi->param('u');
defined $uid && $uid =~ /^\d+$/ && defined $password
or do { refresh_to($ENV{SCRIPT}."?nopassword=1"); return };
-
+
my $user = SiteUsers->getByPkey($uid)
or do { refresh_to($ENV{SCRIPT}."?nopassword=1"); return };
+
+ $user->{password} eq $password
+ or do { refresh_to($ENV{SCRIPT}."?nopassword=1"); return };
return $user;
}
@ISA = qw/Squirrel::Row/;
sub columns {
- return qw/id productId orderId units price wholesalePrice gst options/;
+ return qw/id productId orderId units price wholesalePrice gst options
+ customInt1 customInt2 customInt3 customStr1 customStr2 customStr3/;
}
1;
$result = $self->replace_template($result, $acts);
}
- return $code->(@args, $result, $sep, $acts, $name, $self);
+ return $code->(@args, $args, $result, $sep, $acts, $name, $self);
}
else {
return $orig;
use Util qw(refresh_to);
use BSE::Mail;
use BSE::Shop::Util qw/shop_cart_tags cart_item_opts nice_options total
- basic_tags load_order_fields need_logon/;
+ basic_tags load_order_fields need_logon get_siteuser
+ payment_types/;
use BSE::Session;
use BSE::Cfg;
use Util qw/refresh_to/;
+use BSE::Util::Tags qw(tag_hash);
+
my $cfg = BSE::Cfg->new();
use constant PAYMENT_CC => 0;
use constant PAYMENT_CHEQUE => 1;
use constant PAYMENT_CALLME => 2;
-my %valid_payment_types =
- (
- PAYMENT_CC() =>1,
- PAYMENT_CHEQUE() =>1,
- PAYMENT_CALLME() =>1
- );
-my %payment_names = qw(CC 0 Cheque 1 CallMe 2);
+# my %valid_payment_types =
+# (
+# PAYMENT_CC() =>1,
+# PAYMENT_CHEQUE() =>1,
+# PAYMENT_CALLME() =>1
+# );
+# my %payment_names = ;
my $urlbase = $cfg->entryVar('site', 'url');
my $securlbase = $cfg->entryVar('site', 'secureurl');
my @cart_prods = map { Products->getByPkey($_->{productId}) } @cart;
- if (my ($msg, $id) = need_logon($cfg, \@cart, \@cart_prods, \%session)) {
+ if (my ($msg, $id) = need_logon($cfg, \@cart, \@cart_prods, \%session, $CGI::Q)) {
refresh_logon($msg, $id);
return;
}
- my $user;
- if ($session{userid}) {
- require 'SiteUsers.pm';
- $user = SiteUsers->getBy(userId=>$session{userid});
- }
+ my $user = get_siteuser(\%session, $cfg, $CGI::Q);
$session{custom} ||= {};
my %custom_state = %{$session{custom}};
my $noencrypt = $cfg->entryBool('shop', 'noencrypt', 0);
- my @payment_types = split /,/, $cfg->entry('shop', 'payment_types', '0');
- @payment_types = grep $valid_payment_types{$_}, @payment_types;
+ my @pay_types = payment_types($cfg);
+ my @payment_types = map $_->{id}, grep $_->{enabled}, @pay_types;
if ($noencrypt) {
@payment_types = grep $_ ne PAYMENT_CC, @payment_types;
@payment_types or @payment_types = ( PAYMENT_CALLME );
$cust_class->checkout_actions(\%acts, \@cart, \@cart_prods,
\%custom_state, $CGI::Q, $cfg),
ifMultPaymentTypes => @payment_types > 1,
+ ifUser => defined $user,
+ user => $user ? [ \&tag_hash, $user ] : '',
);
- for my $name (keys %payment_names) {
- my $id = $payment_names{$name};
+ my $payment;
+ $olddata and $payment = param('paymentType');
+ defined $payment or $payment = $payment_types[0];
+ for my $type (@pay_types) {
+ my $id = $type->{id};
+ my $name = $type->{name};
$acts{"if${name}Payments"} = exists $payment_types{$id};
$acts{"if${name}FirstPayment"} = $payment_types[0] == $id;
$acts{"checkedIfFirst$name"} = $payment_types[0] == $id ? "checked " : "";
+ $acts{"checkedPayment$name"} = $payment == $id ? 'checked="checked" ' : "";
}
$session{custom} = \%custom_state;
use BSE::Util::SQL qw(now_sqldatetime);
$order{orderDate} = now_sqldatetime();
- if (my ($msg, $id) = need_logon($cfg, \@cart, \@products, \%session)) {
+ if (my ($msg, $id) = need_logon($cfg, \@cart, \@products, \%session, $CGI::Q)) {
refresh_logon($msg, $id);
return;
}
my $noencrypt = $cfg->entryBool('shop', 'noencrypt', 0);
- my @payment_types = split /,/, $cfg->entry('shop', 'payment_types', '0');
- @payment_types = grep $valid_payment_types{$_}, @payment_types;
+ my @pay_types = payment_types($cfg);
+ my %pay_types = map { $_->{id} => $_ } @pay_types;
+ use Data::Dumper;
+ print STDERR Dumper \%pay_types;
+ my @payment_types = map $_->{id}, grep $_->{enabled}, @pay_types;
if ($noencrypt) {
@payment_types = grep $_ ne PAYMENT_CC, @payment_types;
@payment_types or @payment_types = ( PAYMENT_CALLME );
$payment_types{$paymentType}
or return checkout("Invalid payment type");
- push @required, qw(cardHolder cardExpiry)
- if $paymentType == PAYMENT_CC;
+ push @required, @{$pay_types{$paymentType}{require}};
for my $field (@required) {
defined(param($field)) && length(param($field))
$order{gst} += $item->{gst} * $item->{units};
}
- if (my ($msg, $id) = need_logon($cfg, \@cart, \@products, \%session)) {
+ if (my ($msg, $id) = need_logon($cfg, \@cart, \@products, \%session, $CGI::Q)) {
refresh_logon($msg, $id);
return;
}
$order{filled} = 0;
$order{paidFor} = 0;
- if ($session{userid}) {
- $order{userId} = $session{userid};
+ my $user = get_siteuser(\%session, $cfg, $CGI::Q);
+ if ($user) {
+ $order{userId} = $user->{userId};
}
else {
$order{userId} = '';
ifOptions => sub { @options },
options => sub { nice_options(@options) },
);
- for my $name (keys %payment_names) {
- my $id = $payment_names{$name};
+ for my $type (@pay_types) {
+ my $id = $type->{id};
+ my $name = $type->{name};
$acts{"if${name}Payment"} = $order->{paymentType} == $id;
}
send_order($order, \@items, \@products, $noencrypt);
}
sub tag_with_wrap {
-
+ my ($args, $text) = @_;
+
+ my $margin = $args =~ /^\d+$/ && $args > 30 ? $args : 70;
+
+ require Text::Wrap;
+ $Text::Wrap::columns = $margin;
+
+ return Text::Wrap::fill('', '', split /\n/, $text);
}
# sends the email order confirmation and the PGP encrypted
my $item_index = -1;
my @options;
my $option_index;
- require BSE::Util::Tags;
my %acts;
%acts =
(
=head1 CHANGES
+=head2 0.14_05
+
+This is still a development release.
+
+There have been database changes in this release. You will need to
+run upgrade_mysql.pl.
+
+=over
+
+=item *
+
+CRITICAL: nopassword wasn't checking the password at all. If you
+don't want to upgrade completely you can include just the three line
+change that checks the password.
+
+=item *
+
+blank lines are no longer included in the error messages on add/edit
+site user validation errors
+
+=item *
+
+the shop now uses the site user authentication hook
+
+=item *
+
+the domain value sent to the browser in cookies now has the port
+number stripped.
+
+=item *
+
+you can now configure new payment types through the [payment type
+names], [payment type descs] and [payment type required] sections of
+the configuration file.
+
+=item *
+
+various templates include custom sub-templates which can be used to
+add custom payment types.
+
+=item *
+
+new <:checkedPaymentI<payment-type-name> :> tag on the checkout form
+to make retaining the selected payment type easier.
+
+=item *
+
+new basic template facility, C<with> allows sections of text to be
+processed by a tag:
+
+ <:with begin I<tagname> :>
+ I<some text>
+ <:with end I<tagname :>
+
+=item *
+
+<:with ... wrap:> tag added to order email tag sets:
+
+ <:with begin wrap:>Special Instructions: <:order instructions:><:with end wrap:>
+
+=item *
+
+the site user editor would include empty lines for valid fields in
+error messages
+
+=item *
+
+cookies were being generated with the port numbers included in the
+domain value.
+
+=item *
+
+billing address fields are now included in the default checkout form,
+optionally
+
+=back
+
=head2 0.14_04
This is a development release and is not suitable for production use.
=back
+Other types can be added by adding entries to the [payment type names]
+and [payment type descs] sections.
+
=item address1
=item address2
=back
+=head2 [payment type names]
+
+This section and [payment type descs] are used to configure new
+paymeny type ids.
+
+The key is the integer representing the payment type. The value is
+the name used in tags for checking the payment type.
+
+You can also add a description (currently unused) to [payment type
+descs].
+
+You should use numbers starting from 10 to avoid conflicts with future
+BSE payment types.
+
+=head2 [payment type descs]
+
+See [payment type names].
+
+=head2 [payment type required]
+
+Set the key given by the payment type id to a value of a
+comma-separated list of fields required for that payment type.
+
=head1 AUTHOR
Tony Cook <tony@develop-help.com>
leadTime:></td>
</tr>
<tr>
- <th align="left" bgcolor="#FFFFFF">Retail price:</th>
+ <th align="left" bgcolor="#FFFFFF"><:cfg "product fields" retailPrice "Retail price":>:</th>
<td bgcolor="#FFFFFF">$
<:ifFieldPerm retailPrice:><input type="text" name="retailPrice" value="<:old retailPrice money product retailPrice:>" size=7>
(0.00)<:or:><:money product retailPrice:><:eif:> </td>
<td><:order delivCountry:></td>
<td><:order billCountry:></td>
</tr>
+ <:include custom/order_detail.include:>
</table>
<br>
<:ifEq [order paymentType] "0":><p>Payment made by credit card.</p><:or:><:eif:>
<:ifEq [order paymentType] "1":><p>Payment will be made by cheque.</p><:or:><:eif:>
<:ifEq [order paymentType] "2":><p>Contact the customer to arrange for payment.</p><:or:><:eif:>
-
+<:include custom/order_detail_payment.include:>
<:if Order filled:>
<p>This order was filled on <:date order whenFilled:> by <:order whoFilled:>.</p>
<:or Order:>
</tr>
</table>
<p> </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>
+
+ <hr size="1" noshade>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <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:>">
+ *</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:>">
+ *</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:>">
+ *</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:>">
+ *</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:>">
+ *</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:>">
+ *</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:>">
+ *</font></td>
+ </tr>
+ </table>
+ <p> </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>
+ <:eif Cgi:>
+<:include custom/checkout.include:>
<font face="Verdana, Arial, Helvetica, sans-serif" size="3"> <b>Payment Details:</b></font>
<hr size="1" noshade>
<:if CCPayments :>
- <:if MultPaymentTypes:><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><input type=radio name=paymentType value=0 <:checkedIfFirstCC:>> Credit Card</font></p><:or MultPaymentTypes:><input type=hidden name=paymentType value=0><:eif MultPaymentTypes:>
+ <:if MultPaymentTypes:><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><input type=radio name=paymentType value=0 <:checkedPaymentCC:>> Credit Card</font></p><:or MultPaymentTypes:><input type=hidden name=paymentType value=0><:eif MultPaymentTypes:>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Name on
</table>
<:or CCPayments:><:eif CCPayments:>
<:if ChequePayments:>
- <:if MultPaymentTypes:><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <input type=radio name=paymentType value=1 <:checkedIfFirstCheque:>/>
+ <:if MultPaymentTypes:><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <input type=radio name=paymentType value=1 <:checkedPaymentCheque:>/>
Cheque</font></p><:or MultPaymentTypes:><input type=hidden name=paymentType value=1><:eif MultPaymentTypes:>
<p> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Please send your cheque to:</font></p>
<ul> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <:cfg shop address1:><br />
<:cfg shop address3:></font></ul>
<:or ChequePayments:><:eif ChequePayments:>
<:if CallMePayments:>
- <:if MultPaymentTypes:><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><input type=radio name=paymentType value=2 <:checkedIfFirstCallMe:>/> Contact me for billing details</font></p>
+ <:if MultPaymentTypes:><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><input type=radio name=paymentType value=2 <:checkedPaymentCallMe:>/> Contact me for billing details</font></p>
<:or MultPaymentTypes:>
<input type=hidden name=paymentType value=2>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We will call you to arrange for payment.</font></p>
<:or CallMePayments:>
<:eif CallMePayments:>
+ <:include custom/payment_type.include:>
<p> </p>
<font face="Verdana, Arial, Helvetica, sans-serif" size="3"> <b>Tax Invoice
/ Receipt & Delivery Costs:</b></font>
</tr>
</table>
<p>
+ <input type="submit" value="Update" name="checkupdate" />
<input type="submit" value="Purchase Now" name="purchase">
<input type="reset" value="Reset Form" name="reset">
</p>
--- /dev/null
+<:if Eq 0 1:>
+<!-- replace this with any extra fields you need -->
+<:or Eq:><:eif Eq:>
\ No newline at end of file
--- /dev/null
+<!-- custom/order_detail.include -->
\ No newline at end of file
--- /dev/null
+<!-- custom/order_detail_payment.include -->
\ No newline at end of file
--- /dev/null
+<:if Eq 0 1:>
+<!-- use this file to add extra custom payment types -->
+<:or Eq:><:eif Eq:>
\ No newline at end of file
--- /dev/null
+<:if Eq 0 1:>
+<!-- use this file to add extra custom payment types to the emails -->
+<:or Eq:><:eif Eq:>
\ No newline at end of file
<:ifEq [order paymentType] "0" :>Paid by credit card.<:or:><:eif
:><:ifEq [order paymentType] "1" :>Will be paid by cheque<:or
:><:eif:><:ifEq [order paymentType] "2"
-:>We will call you to arrange for payment<:or:><:eif:>
+:>We will call you to arrange for payment<:or:><:eif:><:
+include custom/payment_type_email.include:>
+<:if Order instructions:>
+<:with begin wrap:>Special Instructions: <:order instructions:><:with end wrap:>
+<:or Order:><:eif Order:>
Card Type : <:order ccType :><:or:><:eif
:><:ifEq [order paymentType] "1" :>Will be paid by cheque<:or
:><:eif:><:ifEq [order paymentType] "2"
-:>Please call the customer to arrange for payment<:or:><:eif:>
+:>Please call the customer to arrange for payment<:or:><:eif:><:
+include custom/payment_type_email.include:>
+<:if Order instructions:>
+<:with begin wrap:>Special Instruction: <:order instructions:><:with end wrap:>
+<:or Order:><:eif Order:>
#!perl -w
# Basic tests for Squirrel::Template
use strict;
-use Test::More tests => 12;
+use Test::More tests => 13;
sub template_test($$$$;$);
repeat => \$repeat_value,
strref => \$str,
str => $str,
+ with_upper => \&tag_with_upper,
);
template_test("<:str:>", "ABC", "simple", \%acts);
template_test("<:strref:>", "ABC", "scalar ref", \%acts);
template_test($switch, "TWO", "switch2", \%acts, "both");
$str = "DEF";
template_test($switch, "DEF", "switch def", \%acts, "both");
-
+
+ template_test("<:with begin upper:>Alpha<:with end upper:>", "ALPHA", "with", \%acts);
}
sub template_test ($$$$;$) {
@values;
}
+
+sub tag_with_upper {
+ my ($args, $text) = @_;
+
+ return uc($text);
+}
paths.libraries=/home/tony/dev/bse/tandb_dealer/cvs/modules
paths.siteuser_passwd=/home/httpd/bsetest/data/supasswd
custom.user_auth=1
+product fields.retailPrice=Dealer Price Inc GST
+paths.local_templates=/home/tony/dev/bse/tandb_dealer/cvs/templates
+shop.payment_types=1,2,10,11,12
+payment type names.10=DirectDeposit
+payment type names.11=FaxProForma
+payment type names.12=EmailProForma
+payment type required.11=facsimile
+
+dealer.bsb=999999
+dealer.accountno=77777777