From: mark Date: Tue, 17 Nov 2009 00:06:25 +0000 (+0000) Subject: cust_attachment improvement, RT#4964 and #6225 X-Git-Tag: root_of_svc_elec_features~680 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=e5e706ef5cebf3db8754801a9bedf90e9a796ef9 cust_attachment improvement, RT#4964 and #6225 --- diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi index 43d2e2928..5e9b16c99 100755 --- a/httemplate/edit/cust_main_attach.cgi +++ b/httemplate/edit/cust_main_attach.cgi @@ -2,31 +2,39 @@ <% include('/elements/error.html') %> -
+

+<% include('/elements/table.html') %> % if(defined $attach) { -Filename
-MIME type -Size: <% $attach->size %>
- +% if($curuser->access_right("Download attachment")) { +Download this file
+% } + Filename +> + Description + + MIME type + + Size <% $attach->size %> % } % else { # !defined $attach - -Filename
- + Filename + Description % } - +
+% if(! $disabled) { "> - +% } % if(defined $attach and $curuser->access_right('Delete attachment')) {
- + % }
@@ -47,13 +55,15 @@ if ( $cgi->param('error') ) { die "no such attachment: ". $attachnum unless $attach; } -$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; -my $custnum = $1; - my $action = $attachnum ? 'Edit' : 'Add'; -die "access denied" - unless $curuser->access_right("$action attachment"); +my $disabled=''; +if(! $curuser->access_right("$action attachment")) { + $disabled = ' disabled="disabled"'; +} + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1; diff --git a/httemplate/edit/process/cust_main_attach.cgi b/httemplate/edit/process/cust_main_attach.cgi index 98f4d0912..092714122 100644 --- a/httemplate/edit/process/cust_main_attach.cgi +++ b/httemplate/edit/process/cust_main_attach.cgi @@ -53,6 +53,7 @@ if($attachnum) { ('_date', 'otaker', 'body', 'disabled'); $new->filename($cgi->param('filename') || $old->filename); $new->mime_type($cgi->param('mime_type') || $old->mime_type); + $new->title($cgi->param('title')); if($delete and not $old->disabled) { $new->disabled(time); } @@ -67,6 +68,7 @@ else { # This is a new attachment, so require a file. if($filename) { $new->filename($filename); $new->mime_type($cgi->uploadInfo($filename)->{'Content-Type'}); + $new->title($cgi->param('title')); local $/; my $fh = $cgi->upload('file'); diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index cd546618b..5329350dc 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -321,6 +321,8 @@ $tools_menu{'Ticketing'} = [ \%tools_ticketing, 'Ticketing tools' ] if $conf->config('ticket_system'); $tools_menu{'Time Queue'} = [ $fsurl.'search/timeworked.html', 'View pending support time' ] if $curuser->access_right('Time queue'); +$tools_menu{'Attachments'} = [ $fsurl.'browse/cust_attachment.html', 'View customer attachments' ] + if !$conf->config('disable_cust_attachment'); $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ] if $curuser->access_right('Import'); $tools_menu{'Exporting'} = [ \%tools_exporting, 'Export tools' ] diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html index 297774dfd..c0bb721f7 100644 --- a/httemplate/search/elements/search-html.html +++ b/httemplate/search/elements/search-html.html @@ -346,7 +346,9 @@ % } % $a = qq(); % } -% +% elsif ( $onclick ) { +% $a = qq(); +% } % } % % } diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 314207bb0..08d99d8e8 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -148,8 +148,8 @@ Comments 'action' => $p.'edit/cust_main_attach.cgi', 'actionlabel' => 'Upload file', 'cust_main' => $cust_main, - 'width' => 616, - 'height' => 408, + 'width' => 480, + 'height' => 296, ) %> % } diff --git a/httemplate/view/cust_main/attachments.html b/httemplate/view/cust_main/attachments.html index 53635fd62..dbb29a7c0 100755 --- a/httemplate/view/cust_main/attachments.html +++ b/httemplate/view/cust_main/attachments.html @@ -11,6 +11,7 @@ % } Person Filename + Description Type Size @@ -54,7 +55,8 @@ % my $clickjs = popup('edit/process/cust_main_attach.cgi?'. % "custnum=$custnum;attachnum=$attachnum;". % "purge=1", -% 'Purge attachment'); +% 'Purge attachment', +% 'Permanently remove this file?'); % $edit .= qq!  (purge)!; % } % } @@ -67,9 +69,9 @@ % } % if($curuser->access_right('Delete attachment') ) { % my $clickjs = popup('edit/process/cust_main_attach.cgi?'. -% "custnum=$custnum;attachnum=$attachnum;". -% "delete=1", -% 'Delete attachment'); +% "custnum=$custnum;attachnum=$attachnum;delete=1", +% 'Delete attachment', +% 'Delete this file?'); % $edit .= qq!  (delete)!; % } % if ($curuser->access_right('Download attachment') ) { @@ -86,6 +88,8 @@  <% $attach->filename %> +  <% $attach->title %> +  <% $attach->mime_type %> @@ -135,15 +139,16 @@ sub size_units { } sub popup { - my ($url, $label) = @_; + my ($url, $label, $confirm) = @_; my $onclick = include('/elements/popup_link_onclick.html', 'action' => popurl(2).$url, 'actionlabel' => $label, - 'width' => 616, - 'height' => 408, + 'width' => 510, + 'height' => 315, 'frame' => 'top', ); + $onclick = qq!if(confirm('$confirm')) { $onclick }! if $confirm; return qq!onclick="$onclick"!; }