<%args> $c => 'main' <&$c&> <%def main>
Organization Order form



How many order lines?

Take me back to my saved order.
<%def set_order> <%init> $m->session->{email_sent} = 0; if ($m->request_args->{f_order_lines} eq '') { $m->session->{num_orders} = 20; } elsif ( $m->request_args->{f_order_lines} < 2){ $m->session->{num_orders} = 2; } else { $m->session->{num_orders} = $m->request_args->{f_order_lines}; } <%def Clear> <%init> $m->session->{email_sent} =0; $m->session->{sales_header} = ''; $m->session->{seller} = ''; $m->session->{order_num} = ''; $m->session->{phone_num} = ''; $m->session->{contact_name} = ''; $m->session->{chaliceart_customer} = []; $m->session->{chaliceart_model} = []; $m->session->{chaliceart_chain} = []; $m->session->{chaliceart_price} = []; $m->session->{chaliceart_paid} = []; $m->redirect("?c=order"); <%def order> <%init>
Group Order form

% foreach (1..$m->session->{num_orders}) { % }
ChaliceArt Jewelry Sale Date:
Church or Group: (Week # )
Contact Phone Number:
Contact Name:

Customer Style Chain Length or Ring Size Price Paid/Delivered
#<%$_%>
<%def Save> <%init> $m->comp('stuff_info_in_session'); $m->session->{email_sent} = 0; $m->redirect("?c=order"); <%def stuff_info_in_session> <%init> foreach my $key (keys %{$m->request_args}) { if ($key =~ /f_/) { my $temp_key = $key; $temp_key =~ s/f_//; # print $temp_key; $m->session->{$temp_key} = [ @{$m->request_args->{$key}} ]; } if ($key =~ /h_/) { my $temp_key = $key; $temp_key =~ s/h_//; # print $temp_key; $m->session->{$temp_key} = $m->request_args->{$key}; } } <%def Send> <%init> $m->comp('stuff_info_in_session'); $m->comp('send_email') if ($m->session->{email_sent} eq 0);
Your order has been sent.

Return to ChaliceArt.
<%def Add_Line> <%init> $m->comp('stuff_info_in_session'); $m->session->{num_orders}++; $m->redirect("?c=order"); <%def Remove_Line> <%init> $m->comp('stuff_info_in_session'); $m->session->{num_orders}--; $m->redirect("?c=order"); <%def send_email> <%init> use MIME::Lite; my $data = ''; $data .= 'ChaliceArt Jewelry Sale: '.$m->session->{sales_header}."\n"; $data .= 'Seller '.$m->session->{seller}.' (Order #'.$m->session->{order_num}.")\n"; $data .= 'Contact Name: '.$m->session->{contact_name}."\n"; $data .= 'Contact Phone: '.$m->session->{phone_num}."\n\n"; foreach my $index (0..$m->session->{num_orders} - 1) { if ($m->session->{chaliceart_customer}[$index] ne '') { $data .= '----Line # '.($index + 1) ."----\n". ' Customer: '.$m->session->{chaliceart_customer}[$index]."\n". ' Style: '.$m->session->{chaliceart_model}[$index]."\n". 'Chain/Ring: '.$m->session->{chaliceart_chain}[$index]."\n". ' Price: '.$m->session->{chaliceart_price}[$index]."\n". ' Paid: '.$m->session->{chaliceart_paid}[$index]."\n\n"; } } my $email = MIME::Lite->new( To => 'chaliceart@yahoo.com, c.dewolf@virtualtoolsets.com', Subject => '*ChaliceArt Jewelry Sale: '.$m->session->{sales_header}.' #'.$m->session->{order_num}.'*', From => 'ChaliceArt Website ', Type => 'TEXT', Data => $data); $email->send; $m->session->{email_sent} = 1;