[calc] if ( $CGI->{showactive} ) { delete $Values->{showinactive}; $Values->{showactive} = 1; $Scratch->{active_sense} = 'ne'; $Scratch->{active_img} = 'admin/right.gif'; $Scratch->{active_nm} = 'deactivate'; } elsif($CGI->{showinactive}) { delete $Values->{showactive}; $Values->{showinactive} = 1; $Scratch->{active_sense} = 'eq'; $Scratch->{active_img} = 'admin/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} = 'admin/right.gif'; $Scratch->{active_nm} = 'deactivate'; } return; [/calc] [value name=mv_data_table set=userdb hide=1] [if-mm !tables] [set ui_error] Not authorized for customer administration. Contact administrator? [/set] [bounce page="__UI_BASE__/error"] [/if-mm] [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->{error_message} = "Error: no userdb database.
"; $Scratch->{ui_location} = "__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}) { $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:
"; } 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] [if scratch ui_location] [bounce href=`delete $Scratch->{ui_location}`] [/if] [set icon_name]admin/icon_people.gif[/set] [seti page_title] [if value showinactive] Customers: Inactive customers [else] Customers: Active customers [/else] [/if] [/seti] [set help_name]customer[/set] [update values] @_UI_STD_HEAD_@ [if scratch ui_message]
[scratch ui_message]
[set ui_message][/set] [/if]
[button text="Search for customer"] mv_nextpage=@@MV_PAGE@@ [/button]
[if cgi ui_text_qualification]

Entries containing "[cgi ui_text_qualification]"

[/if]
[search-region more=1 search=" fi=userdb ml=__UI_SZ_LIST_CUSTOMER__ md=1 st=db [if cgi ui_text_qualification] se=[cgi ui_text_qualification] [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; return $out if $so =~ /r/; return $out . 'r'; } return; [/calc] [search-list] [/search-list] [no-match] [/no-match] [more-list] [/more-list]
  [page 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'); `]ID [page href=@@MV_PAGE@@ form=` return "$qual\nui_sort_field=lname,fname\n" . sortrev('lname'); `]Name [page href=@@MV_PAGE@@ form=` return "$qual\nui_sort_field=company,lname\n" . sortrev('company'); `]Company [page href=@@MV_PAGE@@ form=` return "$qual\nui_sort_field=country,state,city\n" . sortrev('country'); `]Location
[page href="@@MV_PAGE@@" form=" [scratch active_nm]=1 customer=[item-code] "][scratch active_nm] [item-code] DELETE [item-code] [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] 
No [if value showinactive]in[/if]active customers.
Customers [matches] of [value mv_search_match_count]: [more]
[if-mm advanced userdb=d] [button form=batch text="Delete checked customers" confirm='Are you sure you want to delete the checked customers?']deletecustomer=1 [/button] [/if-mm]    [button form=batch text=` my $tmp = "$Scratch->{active_nm} checked customers"; return "\u$tmp"; `] [scratch active_nm]=1[/button]
[/search-region] @_UI_STD_FOOTER_@