summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-01-18 18:13:16 -0800
committerIvan Kohler <ivan@freeside.biz>2015-01-18 18:13:16 -0800
commit03c12b4dabfcaabc218f39ee13557edebc13931d (patch)
tree0d915cf9e2bbf278a48500b5d125206ab78477a2 /httemplate/misc
parent0b6bd6405107c1abf8f2c5e2bc1b569870a02309 (diff)
email quotations, RT#22232, RT#20688
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/email-quotation.html71
-rwxr-xr-xhttemplate/misc/process/email-quotation.html20
2 files changed, 91 insertions, 0 deletions
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') %>
+
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="process/email-quotation.html" onSubmit="document.OneTrueForm.submit.disabled=true; document.OneTrueForm.submit.style.display='none'; document.getElementById('emailingwait').style.display='';">
+<INPUT TYPE="hidden" NAME="quotationnum" VALUE="<% $quotationnum %>">
+
+<% 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;
+% }
+ <TR>
+ <TD><INPUT TYPE="checkbox" NAME="emailaddress" VALUE="<% $email |h %>"></TD>
+ <TD><% $name |h %></TD>
+ </TR>
+</%def>
+
+</TABLE>
+
+<BR>
+
+<CENTER>
+% if ( $emails ) {
+ <BUTTON TYPE="submit" NAME="submit" ID="submit">Email quotation</BUTTON>
+ <DIV ID="emailingwait" STYLE="display:none">
+ <IMG SRC="<%$p%>images/wait-orange.gif"> <B>Sending...</B>
+ </DIV>
+% } else {
+ <FONT SIZE="+1" COLOR="#ff0000"><% mt('Add a contact email address first') |h %></FONT>
+% }
+</CENTER>
+
+</FORM>
+
+<& /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";
+
+</%init>
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') &>
+<SCRIPT TYPE="text/javascript">
+ setTimeout("parent.cClick()", 3000);
+</SCRIPT>
+<& /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') ] });
+
+</%init>