5438ed2668898bea2e7a3b0eb92539f83d847426
[freeside.git] / httemplate / view / elements / svc_edit_link.html
1 % if ( $cancel_date ) {
2 <I><% mt("Canceled [_1]", time2str('%b %o %Y', $cancel_date) ) |h %></I>
3 % } else {
4 <SCRIPT>
5 function areyousure_delete() {
6   if (confirm(<% mt('Permanently delete this service?') |js_string %>) == true)
7     window.location.href = '<% $cancel_url %>';
8 }
9 </SCRIPT>
10 %   if ( $curuser->access_right('Provision customer service') ) {
11 | <A HREF="<% $edit_url %>"><% mt("Edit this [_1]", $label) |h %></A>
12 %   }
13 %   if ( $curuser->access_right('Unprovision customer service') ) {
14 | <A HREF="javascript:areyousure_delete()"><% mt('Unprovision this Service') |h %></A>
15 %   }
16 % }
17 <%init>
18 my %opt = @_;
19 my $svc_x = $opt{'svc'} or die "'svc' required";
20 my $svcdb = $opt{'table'} || $svc_x->table;
21 my $edit_url = ($opt{'edit_url'} || 
22                $p . 'edit/' . $svcdb . '.cgi?' ). $svc_x->svcnum;
23 my $cancel_url = $p . 'misc/unprovision.cgi?' . $svc_x->svcnum;
24 my $cust_svc = $svc_x->cust_svc; # always exists
25 my $cancel_date = $cust_svc->pkg_cancel_date;
26 my ($label) = $cust_svc->label;
27 my $curuser = $FS::CurrentUser::CurrentUser;
28 </%init>