[if cgi showactive] [value name=showinactive set=""] [/if] [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->{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->{message} = "Wanted to view customer."; $Scratch->{ui_location} = $Tag->area( { href => '__UI_BASE__/customer_view', form => "customer=$custnum", } ); } else { $Scratch->{message} = "No next customer."; } } return; [/perl] [if scratch ui_location] [bounce href=`delete $Scratch->{ui_location}`] [/if] [set icon_name]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 message]
[scratchd message]
[/if]
[if value showinactive] [else] [value name=showinactive set=""] [/else] [/if]
[button name="showactive" text="Show active customers"][/button] [set active_sense]eq[/set]
[set active_sense]ne[/set]
[button name="viewcustomer" text="View customer"][/button]
[if value showinactive] [if-mm advanced userdb=u] [button name="activate" value="Activate customer"][/button]
[/if-mm] [else] [if-mm advanced userdb=a] [button name="deactivate" text="Deactivate customer"][/button]
[/if-mm] [/else] [/if] [if-mm advanced userdb=i] [button text="Enter new order"] [calc] $CGI->{customer} =~ s/^[\0\s]+//s; $CGI->{customer} =~ s/\0.*//s; return; [/calc] mv_nextpage=__UI_BASE__/entry mv_todo=return [/button]
[/if-mm]
[if-mm advanced userdb=d] [button name="deletecustomer" text="Delete customer" confirm='Are you sure you want to delete this customer?' ][/button] [/if-mm]
[comment] [/comment]
Specific customer [button text="Start list here"] [calc] $CGI->{customer} =~ s/^\0+//s; $CGI->{customer} =~ s/\0.*//s; $Scratch->{start_at} = "sm=$CGI->{customer}"; return; [/calc] mv_nextpage=@@MV_PAGE@@ [/button] [loop more=1 search=" fi=userdb ml=__UI_SZ_LIST_CUSTOMER__ md=1 st=db co=yes sf=inactive se=1 op=[scratch active_sense] tf=username [scratch start_at][set start_at][/set] rf=username,lname,fname "]

[more-list]
Customers [matches] of [value mv_search_match_count]: [more][/more-list] [/loop]

@_UI_STD_FOOTER_@