enable CardFortress in test database, #71513
[freeside.git] / httemplate / elements / popup_link-cust_main.html
1 <%doc>
2
3 Example:
4
5   include('/elements/init_overlib.html')
6
7   include( '/elements/popup_link-cust_main.html', { #hashref or a list, either way
8
9     #required
10     'action'         => 'content.html', # uri for content of popup which should
11                                         #   be suitable for appending keywords
12     'label'          => 'click me',     # text of <A> tag
13     'cust_main'      => $cust_main      # a FS::cust_main object
14    
15     #strongly recommended (you want a title, right?)
16     'actionlabel     => 'You clicked',  # popup title
17    
18     #opt
19     'width'          => '540',
20     'color'          => '#ff0000',
21     'closetext'      => 'Go Away',      # the value '' removes the link
22   )
23
24 </%doc>
25 % if ( $custnum || $prospectnum ) {
26 <% include('/elements/popup_link.html', $params ) %>\
27 % }
28 <%init>
29
30 my $params = { 'closetext' => emt('Close') };
31
32 if (ref($_[0]) eq 'HASH') {
33   $params = { %$params, %{ $_[0] } };
34 } else {
35   $params = { %$params, @_ };
36 }
37
38 my $custnum = $params->{'cust_main'}
39                 ? $params->{'cust_main'}->custnum
40                 : $params->{'custnum'};
41
42 $params->{'action'} .= ( $params->{'action'} =~ /\?/ ? ';' : '?' ).
43                        "custnum=$custnum"
44   if $custnum;
45
46 #(maybe i should be called popup_link-cust_or_prospect_main.html now)
47 my $prospectnum = $params->{'prospect_main'}
48                     ? $params->{'prospect_main'}->prospectnum
49                     : $params->{'prospectnum'};
50  
51 $params->{'action'} .= ( $params->{'action'} =~ /\?/ ? ';' : '?' ).
52                        "prospectnum=$prospectnum"
53   if $prospectnum;
54
55 $params->{'action'} .= ";$_=".$params->{$_}
56   foreach grep $params->{$_},
57     qw( lock_pkgpart lock_locationnum qualnum quotationnum svcpart );
58
59 </%init>