summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/misc/delete-quotation_pkg.html21
-rwxr-xr-xhttemplate/view/quotation.html21
2 files changed, 41 insertions, 1 deletions
diff --git a/httemplate/misc/delete-quotation_pkg.html b/httemplate/misc/delete-quotation_pkg.html
new file mode 100644
index 000000000..5a44d3728
--- /dev/null
+++ b/httemplate/misc/delete-quotation_pkg.html
@@ -0,0 +1,21 @@
+% if ( $error ) {
+% errorpage($error);
+% } else {
+<% $cgi->redirect($p. "view/quotation.html?". $quotationnum) %>
+% }
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation'); #separate ACL for editing it later? too silly for us yet
+
+#untaint quotationpkgnum
+my($query) = $cgi->keywords;
+$query =~ /^(\d+)$/ or die "Illegal quotationpkgnum";
+my $quotationpkgnum = $1;
+
+my $quotation_pkg = qsearchs('quotation_pkg',{'quotationpkgnum'=>$quotationpkgnum});
+my $quotationnum = $quotation_pkg->quotationnum;
+
+my $error = $quotation_pkg->delete;
+
+</%init>
diff --git a/httemplate/view/quotation.html b/httemplate/view/quotation.html
index a88acf82b..ae9c4aa8c 100755
--- a/httemplate/view/quotation.html
+++ b/httemplate/view/quotation.html
@@ -1,5 +1,12 @@
<& /elements/header.html, mt('Quotation View'), $menubar &>
+<SCRIPT TYPE="text/javascript">
+function areyousure(href, message) {
+ if (confirm(message) == true)
+ window.location.href = href;
+}
+</SCRIPT>
+
%#XXX link to order...
<%doc>
@@ -38,7 +45,7 @@ XXX resending quotations
% }
% if ( $conf->exists('quotation_html') ) {
- <% join('', $quotation->print_html() ) %>
+ <% join('', $quotation->print_html( preref_callback=>$preref_callback )) %>
% } else {
% die "quotation_html config missing";
% }
@@ -87,5 +94,17 @@ my $link = "quotationnum=$quotationnum";
#$link .= ';template='. uri_escape($template) if $template;
#$link .= ';notice_name='. $notice_name if $notice_name;
+my $preref_callback = sub {
+ areyousure_link("${p}misc/delete-quotation_pkg.html?". shift->quotationpkgnum,
+ emt('Are you sure you want to remove this package from the quotation?'),
+ emt('Remove this package'), #tooltip
+ qq(<img src="${p}images/cross.png">), #link
+ );
+};
+
+sub areyousure_link {
+ my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
+ '<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>';
+}
</%init>