diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/elements/footer-popup.html | 2 | ||||
-rw-r--r-- | httemplate/misc/email-quotation.html | 71 | ||||
-rwxr-xr-x | httemplate/misc/process/email-quotation.html | 20 | ||||
-rwxr-xr-x | httemplate/view/quotation.html | 84 |
4 files changed, 139 insertions, 38 deletions
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 @@ + </BODY> +</HTML> 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> diff --git a/httemplate/view/quotation.html b/httemplate/view/quotation.html index 4c913257e..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 &> + <SCRIPT TYPE="text/javascript"> function areyousure(href, message) { if (confirm(message) == true) @@ -7,47 +9,63 @@ function areyousure(href, message) { } </SCRIPT> -%#XXX link to order... - -<%doc> +% unless ( $quotation->disabled eq 'Y' ) { -XXX resending quotations +% if ( $curuser->access_right('Order customer package') ) { + <& /elements/order_pkg_link.html, + 'label' => emt('Add package'), + 'actionlabel' => emt('Add package'), + map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum ) + &> + <BR><BR> +% } -% if ( $curuser->access_right('Resend invoices') ) { +% if ( 1 ) { #if ( $curuser->access_right('Send quotations') ) - <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A> + <& /elements/popup_link.html, + 'action' => "${p}misc/email-quotation.html". + "?quotationnum=$quotationnum", + 'label' => emt('Email this quotation'), + 'actionlabel' => emt('Select recipients'), + #'width' => 540, + #'height' => 336, + &> -% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { - | <A HREF="<% $p %>misc/send-invoice.cgi?method=email;<% $link %>"><% mt('Re-email this invoice') |h %></A> -% } +%# <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A> -% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { - | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A> -% } +%#% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { +%# | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A> +%#% } - <BR><BR> +% } -% } +% if ( $conf->exists('quotation_latex') ) { + | <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A> +% } -</%doc> + <BR><BR> -% if ( $curuser->access_right('Order customer package') ) { - <& /elements/order_pkg_link.html, - 'label' => emt('Add package'), - 'actionlabel' => emt('Add package'), - map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum ) - &> -% } +% if ( $curuser->access_right('New customer') && $quotation->quotation_pkg ) { + <A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>">Place order</A> + <BR><BR> +% } -% if ( $conf->exists('quotation_latex') ) { - | <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A> % } -% if ( $curuser->access_right('New customer') && $quotation->quotation_pkg ) { - | <A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>">Place order</A> +% if ( $curuser->access_right('Disable quotation') ) { +% if ( $quotation->disabled eq 'Y' ) { + <A HREF="<%$p%>misc/enable-quotation.html?quotationnum=<% $quotation->quotationnum %>" TITLE="<% emt('Enable this quotation') %>"><% emt('Enable this quotation') %></A> +% } else { + <% areyousure_link( + "${p}misc/disable-quotation.html?quotationnum=". $quotation->quotationnum, + emt('Are you sure you want to disable this quotation?'), + emt('Disable this quotation'), #tooltip + emt('Disable this quotation'), #link + ) %> +% } + <BR><BR> % } -<BR><BR> % if ( $conf->exists('quotation_html') ) { <% join('', $quotation->print_html( preref_callback=>$preref_callback )) %> @@ -83,17 +101,7 @@ my $quotation = qsearchs({ }); die "Quotation #$quotationnum not found!" unless $quotation; -my $menubar; -if ( my $custnum = $quotation->custnum ) { - my $display_custnum = $quotation->cust_main->display_custnum; - $menubar = menubar( - emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum", - ); -} elsif ( my $prospectnum = $quotation->prospectnum ) { - $menubar = menubar( - emt("View this prospect (#[_1])",$prospectnum) => "${p}view/prospect_main.html?$prospectnum", - ); -} +my $menubar = menubar( $quotation->cust_or_prospect_label_link($p) ); my $link = "quotationnum=$quotationnum"; #$link .= ';template='. uri_escape($template) if $template; |