@_UI_STD_INIT_@[calc] if ( $CGI->{showactive} ) { delete $Values->{showinactive}; $Values->{showactive} = 1; $Scratch->{active_sense} = 'ne'; $Scratch->{active_img} = 'right.gif'; $Scratch->{active_nm} = 'deactivate'; } elsif($CGI->{showinactive}) { delete $Values->{showactive}; $Values->{showinactive} = 1; $Scratch->{active_sense} = 'eq'; $Scratch->{active_img} = 'left.gif'; $Scratch->{active_nm} = 'activate'; } elsif(! $Values->{showactive} and ! $Values->{showinactive}) { delete $Values->{showinactive}; $Values->{showactive} = 1; $Scratch->{active_sense} = 'ne'; $Scratch->{active_img} = 'right.gif'; $Scratch->{active_nm} = 'deactivate'; } return; [/calc] [value name=mv_data_table set=userdb hide=1] [if-mm !tables] [set ui_error] [L]Not authorized for customer administration. Contact administrator?[/L] [/set] [bounce page="__UI_BASE__/error"] [/if-mm] [tmp can_delete][if-mm advanced userdb=d]1[/if-mm][/tmp] [set ui_class]Customers[/set] [set page_perm]userdb[/set] [tag flag write]userdb[/tag] [perl tables=userdb] delete $Scratch->{ui_location}; $Config->{NoSearch} = ''; my $db = $Db{userdb}; if(! $db) { $Scratch->{ui_error} = errmsg('no %s database', 'userdb'); $Scratch->{ui_location} = $Tag->area("__UI_BASE__/error"); return; } my ($value, $action_col, $delete); if($CGI->{activate}) { $value = 0; $action_col = 'inactive'; } elsif($CGI->{deactivate}) { $value = 1; $action_col = 'inactive'; } elsif($CGI->{deletecustomer} and $Scratch->{can_delete}) { $delete = 1; } elsif($CGI->{viewcustomer} and ! $CGI->{viewnext}) { #Log("viewcustomer and !viewnext"); $CGI->{customer} =~ s/^\0+//; $CGI->{customer} =~ s/\0+$//; $Scratch->{ui_location} = $Tag->area('__UI_BASE__/customer_view', $CGI->{customer}); } elsif($CGI->{xload}) { $Scratch->{ui_location} = $Tag->area('__UI_BASE__/dbdownload'); } else { $CGI->{customer} =~ s/^\0+//; $CGI->{customer} =~ s/\0.*//s; $Scratch->{start_at} = "sm=$CGI->{customer}"; } if($action_col) { for(grep $_, @{$CGI_array->{customer}}) { $db->set_field($_, $action_col, $value); } } elsif ($delete) { for(grep $_, @{$CGI_array->{customer}}) { $db->delete_record($_); } } if(@errors) { my $plural = @errors > 1 ? 's' : ''; return "Error$plural:

- " . join ("
- ", @errors) . "

"; } if($CGI->{viewnext}) { #Log("viewnext"); $Scratch->{ui_message} = "Wanted to view next."; my $custnum = $CGI->{customer}; $custnum =~ s/[\0,\s].*//; return if ! $custnum; $custnum++; CHECKNEXT: { if (! $db->record_exists($custnum) ) { undef $custnum; last CHECKNEXT; } if ($db->field($custnum, 'deleted') ) { $custnum++; next CHECKNEXT; } if ($Values->{showinactive} and ! $db->field($custnum, 'active') ) { undef $custnum; last CHECKNEXT; } else { last CHECKNEXT; } } if ($custnum) { $Scratch->{ui_message} = "Wanted to view customer."; $Scratch->{ui_location} = $Tag->area( { href => '__UI_BASE__/customer_view', form => "customer=$custnum", } ); } else { $Scratch->{ui_message} = "No next customer."; } } return; [/perl] [calc] if ($CGI->{mv_like_spec}) { my @f = split /\0/, $CGI->{mv_like_field}; my @s = split /\0/, $CGI->{mv_like_spec}; my @q = 'ra=yes'; my $found; for(my $i = 0; $i < @f; $i++) { next unless length $s[$i]; $found++; push @q, "lf=$f[$i]"; push @q, "ls=$s[$i]"; } if($found) { $CGI->{ui_text_qualification} = join "\n", @q; } else { $CGI->{ui_text_qualification} = "" } } return if $CGI->{ui_text_qualification}; return unless $Variable->{CUSTOMER_VIEW_LARGE} or $Config->{Database}{userdb}{LARGE}; $Scratch->{ui_location} = $Tag->area( { href => '__UI_BASE__/flex_select', form => q( mv_data_table=userdb page_title=Customer select page_banner=Customer select ui_searchpage=__UI_BASE__/customer ), }, ); return; [/calc] [if scratch ui_location] [bounce href=`delete $Scratch->{ui_location}`] [/if] [set icon_name]icon_people.gif[/set] [seti page_title] [if value showinactive] [L]Customers[/L]: [L]Inactive Customers[/L] [else] [L]Customers[/L]: [L]Active Customers[/L] [/else] [/if] [/seti] [set help_name]customer[/set] [update values] @_UI_STD_HEAD_@ [output name=search_box] [form-session-id] [output name=""] [if cgi ui_text_qualification] [calc] return if $CGI->{mv_like_spec}; $Scratch->{page_banner} ||= $Scratch->{page_title}; my $val = $Tag->filter('encode_entities', $CGI->{ui_text_qualification}); $Scratch->{page_banner} .= ' -- ' . errmsg( 'entries containing "%s"', $val); return; [/calc] [/if] [form-session-id] [search-region more=1 search=" fi=userdb ml=__UI_SZ_LIST_CUSTOMER__ md=1 st=db [if cgi mv_like_spec] [cgi ui_text_qualification] [elsif cgi ui_text_qualification] se=[cgi ui_text_qualification] [/elsif] [else] co=yes sf=inactive se=1 op=[scratch active_sense] [/else] [/if] [if cgi ui_sort_field] tf=[cgi ui_sort_field] to=[cgi ui_sort_option] [else] tf=0 [/else] [/if] [scratch start_at][set start_at][/set] rf=username,company,lname,fname,city,state,country "] [calc] my $so = $CGI->{ui_sort_option}; my $fld = $CGI->{ui_sort_field}; $fld =~ s/[\s,\0].*//; sub sortrev { my ($f, $n) = @_; my $out = 'ui_sort_option='; $out .= 'n' if $n; return $out unless ($fld eq $f) || ($f eq 'username'); return $out if $so =~ /r/; return $out . 'r'; } return; [/calc]

actions | [page extra=rhead href=@@MV_PAGE@@ form=` $qual = ''; if($CGI->{ui_text_qualification}) { $qual .= "ui_text_qualification=$CGI->{ui_text_qualification}"; } return "ui_sort_field=username\n" . sortrev('username'); `][L]ID[/L] | [page extra=rhead href=@@MV_PAGE@@ form=` return "$qual\nui_sort_field=lname,fname\n" . sortrev('lname'); `][L]Name[/L] | [page extra=rhead href=@@MV_PAGE@@ form=` return "$qual\nui_sort_field=company,lname\n" . sortrev('company'); `][meta-info table=transactions col=company key=label localize=1] | [page href=@@MV_PAGE@@ extra=rhead form=` return "$qual\nui_sort_field=country,state,city\n" . sortrev('country'); `][L]Location[/L]
[search-list]
[page href="@@MV_PAGE@@" extra="title=[scratch active_nm]" form=" [scratch active_nm]=1 customer=[item-code] "] [if scratch can_delete] [/if] | [page href=__UI_BASE__/customer_view form=" customer=[item-code] "][item-code] [comment] These non-breaking spaces make sure the table background color appears so there's a full line across the page even if table cells are blank. [/comment] | [item-param lname], [item-param fname] | [item-param company] | [item-param city] [item-param state] [item-param country]
[/search-list] [no-match]
[if value showinactive] [L]No inactive customers.[/L] [else] [L]No active customers.[/L] [/else] [/if]
[/no-match] [more-list]
[msg arg.0="[matches]" arg.1="[value mv_search_match_count]"]Customers %s of %s[/msg]: [more]
[/more-list]

[on-match] [output name=bottom_buttons] [if-mm advanced merge_users] [button form=batch no-src="[scratch archive_img]" extra="class=s3" link-text-too=1 text="[L]Merge checked users to one user[/L]" confirm="Are you sure you want to merge checked users to one user?" ] [user-merge from="[cgi customer]" to="[cgi item_radio]" from-user=1] [/button] [/if-mm] [if scratch can_delete] [button extra="class=s3" form=batch text="[L]Delete checked customers[/L]" confirm='[L]Are you sure you want to delete the checked customers?[/L]']deletecustomer=1 [/button] [/if] [button form=batch extra="class=s3" text=` my $tmp = errmsg("$Scratch->{active_nm} checked customers"); return "\u$tmp"; `] [scratch active_nm]=1[/button] [output name=""] [/on-match] [if-mm advanced userdb=e] [output name=top_buttons] [form-session-id] Switch to a user:
[output name=""] [/if-mm] [/search-region] [output name=bottom_of_form] [output name=""] @_UI_STD_FOOTER_@