X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fpopup_link-cust_svc.html;h=39c0d3181fda3177b174c0650e1a771129b711b2;hp=decb82d97e4ffd806ead067f227f672117b6088c;hb=7b0bbc4117a7959b9f7b7b2cf999b8188ba34160;hpb=5ea49c83c4a5b71a1e7baf2b6a75fe50816fdce5 diff --git a/httemplate/elements/popup_link-cust_svc.html b/httemplate/elements/popup_link-cust_svc.html index decb82d97..39c0d3181 100644 --- a/httemplate/elements/popup_link-cust_svc.html +++ b/httemplate/elements/popup_link-cust_svc.html @@ -2,19 +2,18 @@ Example: - - + include('/elements/init_overlib.html') - include( '/elements/svc_popup_link.html', { + include('/elements/popup_link-cust_svc.html', { #hashref or a list, either way #required 'action' => 'content.html', # uri for content of popup which should # be suitable for appending '?svcnum=' 'label' => 'click me', # text of tag - 'cust_svc' => $cust_svc # a FS::cust_svc object + 'cust_svc' => $cust_svc # a FS::cust_svc object or FS::svc_* object #strongly recommended (you want a title, right?) - 'actionlabel => 'You clicked', # popup title + 'actionlabel' => 'You clicked', # popup title #opt 'width' => '540', @@ -23,37 +22,26 @@ Example: ) +% if ( $params->{'cust_svc'} ) { +<% include( '/elements/popup_link.html', $params ) %>\ +% } <%init> -my($params, $action, $label, $actionlabel, $cust_svc, $color, $width); -my $closetext = 'Close'; -if (ref(@_[0]) eq 'HASH') { - $params = shift; - foreach (qw(action label actionlabel width color)) { - $action = $params->{'action'} if exists $params->{'action'}; - $label = $params->{'label'} if exists $params->{'label'}; - $actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'}; - $width = $params->{'width'} if exists $params->{'width'}; - $color = $params->{'color'} if exists $params->{'color'}; - $closetext = $params->{'closetext'} if exists $params->{'closetext'}; - $cust_svc = $params->{'cust_svc'} if exists $params->{'cust_svc'}; - } -}else{ # deprecated - ($action, $label, $actionlabel, $cust_svc) = @_; + +my $params = { 'closetext' => 'Close', + 'width' => 392, + }; + +if (ref($_[0]) eq 'HASH') { + $params = { %$params, %{ $_[0] } }; +} else { + $params = { %$params, @_ }; } -$action .= '?svcnum='. $cust_svc->svcnum; -$actionlabel .= ' service '. $cust_svc->svcnum; -$width ||= 392; +$params->{'action'} .= + ( $params->{'action'} =~ /\?/ ? ';' : '?' ). + 'svcnum='. $params->{'cust_svc'}->svcnum; + +$params->{'actionlabel'} .= + ' service '. $params->{'cust_svc'}->svcnum; #XXX svcnum? really? -<% $cust_svc - ? include('/elements/popup_link.html', { 'action' => $action, - 'label' => $label, - 'actionlabel' => $actionlabel, - 'color' => $color, - 'width' => $width, - 'closetext' => $closetext, - } - ) - : '' -%>