From 03c12b4dabfcaabc218f39ee13557edebc13931d Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 18 Jan 2015 18:13:16 -0800 Subject: email quotations, RT#22232, RT#20688 --- httemplate/elements/footer-popup.html | 2 + httemplate/misc/email-quotation.html | 71 ++++++++++++++++++++++++++++ httemplate/misc/process/email-quotation.html | 20 ++++++++ httemplate/view/quotation.html | 13 +++-- 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 httemplate/elements/footer-popup.html create mode 100644 httemplate/misc/email-quotation.html create mode 100755 httemplate/misc/process/email-quotation.html (limited to 'httemplate') diff --git a/httemplate/elements/footer-popup.html b/httemplate/elements/footer-popup.html new file mode 100644 index 000000000..6029d7637 --- /dev/null +++ b/httemplate/elements/footer-popup.html @@ -0,0 +1,2 @@ + + diff --git a/httemplate/misc/email-quotation.html b/httemplate/misc/email-quotation.html new file mode 100644 index 000000000..b93b80bb7 --- /dev/null +++ b/httemplate/misc/email-quotation.html @@ -0,0 +1,71 @@ +<& /elements/header-popup.html, mt('Select recipients') &> + +<% include('/elements/error.html') %> + +
+ + +<% ntable("#cccccc", 2) %> + +% my $emails = 0; + +% if ( my $cust_main = $quotation->cust_main ) { +% foreach my $email ( $cust_main->invoicing_list_emailonly ) { +% $emails++; + <& .emailrow, $email &> +% } +% } + +% my @contact = $quotation->custnum ? $quotation->cust_main->cust_contact +% : $quotation->prospect_main->contact; +% foreach my $contact ( @contact ) { +% foreach my $contact_email ( $contact->contact_email ) { +% $emails++; + <& .emailrow, $contact_email->emailaddress, $contact->firstlast &> +% } +% } + +<%def .emailrow> +% my( $email, $name ) = @_; +% if ( $name ) { +% $name = "$name <$email>"; +% } else { +% $name = $email; +% } + + + <% $name |h %> + + + + + +
+ +
+% if ( $emails ) { + + +% } else { + <% mt('Add a contact email address first') |h %> +% } +
+ +
+ +<& /elements/footer-popup.html &> +<%init> + +#die "access denied" +# unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation'); #separate rights to generate vs send/email? + +$cgi->param('quotationnum') =~ /^(\d+)$/ or die "Illegal quotationnum"; +my $quotationnum = $1; + +#XXX agent-virt +my $quotation = qsearchs('quotation', { 'quotationnum'=>$quotationnum }) + or die "Unknown quotationnum"; + + diff --git a/httemplate/misc/process/email-quotation.html b/httemplate/misc/process/email-quotation.html new file mode 100755 index 000000000..e7fef4a85 --- /dev/null +++ b/httemplate/misc/process/email-quotation.html @@ -0,0 +1,20 @@ +<& /elements/header-popup.html, mt('Email sent') &> + +<& /elements/footer-popup.html &> +<%init> + +#die "access denied" +# unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation'); #separate rights to generate vs send/email? + +$cgi->param('quotationnum') =~ /^(\d+)$/ or die "Illegal quotationnum"; +my $quotationnum = $1; + +#XXX agent-virt +my $quotation = qsearchs('quotation', { 'quotationnum'=>$quotationnum }) + or die "Unknown quotationnum"; + +$quotation->email({ 'to' => [ $cgi->param('emailaddress') ] }); + + diff --git a/httemplate/view/quotation.html b/httemplate/view/quotation.html index b8dc1d1f9..81c7cdd7b 100755 --- a/httemplate/view/quotation.html +++ b/httemplate/view/quotation.html @@ -1,5 +1,7 @@ <& /elements/header.html, mt('Quotation View'), $menubar &> +<& /elements/init_overlib.html &> +