[calc]
if ( $CGI->{showarchive} ) {
delete $Values->{showpending};
$Values->{showarchive} = 1;
$Scratch->{archive_sense} = 'eq';
$Scratch->{archive_img} = 'admin/left.gif';
$Scratch->{archive_nm} = 'unarchive';
$Scratch->{archive_label} = 'archived';
}
elsif($CGI->{showpending}) {
delete $Values->{showarchive};
$Values->{showpending} = 1;
$Scratch->{archive_sense} = 'ne';
$Scratch->{archive_img} = 'admin/right.gif';
$Scratch->{archive_nm} = 'archive';
$Scratch->{archive_label} = 'pending';
}
elsif(! $Values->{showarchive} and ! $Values->{showpending}) {
delete $Values->{showarchive};
$Values->{showpending} = 1;
$Scratch->{archive_sense} = 'ne';
$Scratch->{archive_img} = 'admin/right.gif';
$Scratch->{archive_nm} = 'archive';
$Scratch->{archive_label} = 'pending';
}
return;
[/calc]
[value name=mv_data_table set=transactions hide=1]
[if-mm !tables]
[set ui_error]
Not authorized for order administration. Contact administrator?
[/set]
[bounce page="__UI_BASE__/error"]
[/if-mm]
[set ui_class]Orders[/set]
[tmp page_perm]order[/tmp]
[tmp meta_header]
[/tmp]
[tag flag write]transactions[/tag]
[perl tables=transactions]
delete $Scratch->{ui_location};
my $db = $Db{transactions};
if(! $db) {
$Scratch->{ui_error} = "Error: no transactions database.
";
$Scratch->{ui_location} = "__UI_BASE__/error";
return;
}
my ($value, $action_col);
if($CGI->{archiveorder}) {
$value = 1;
$action_col = 'archived';
}
elsif($CGI->{unarchiveorder}) {
$value = 0;
$action_col = 'archived';
}
elsif($CGI->{deleteorder}) {
$value = 1;
$action_col = 'deleted';
}
elsif($CGI->{vieworder} and ! $CGI->{viewnext}) {
$CGI->{order} =~ s/^\0+//;
$CGI->{order} =~ s/\0+$//;
$Scratch->{ui_location} = $Tag->area('__UI_BASE__/order_view', $CGI->{order});
}
elsif($CGI->{xload}) {
$Scratch->{ui_location} = $Tag->area('__UI_BASE__/dbdownload');
}
else {
$CGI->{order} =~ s/^\0+//;
$CGI->{order} =~ s/\0.*//s;
$Scratch->{start_at} = "sm=$CGI->{order}";
}
if($action_col) {
for(grep $_, @{$CGI_array->{order}}) {
$db->set_field($_, $action_col, $value);
}
}
if(@errors) {
my $plural = @errors > 1 ? 's' : '';
return "Error$plural:
";
}
if($CGI->{viewnext}) {
my $ordnum = $CGI->{order};
$ordnum =~ s/[\0,\s].*//;
return if ! $ordnum;
$ordnum++;
CHECKNEXT: {
if (! $db->record_exists($ordnum) ) {
undef $ordnum;
last CHECKNEXT;
}
if ($db->field($ordnum, 'deleted') ) {
$ordnum++;
next CHECKNEXT;
}
if ($Values->{showarchive} and ! $db->field($ordnum, 'archived') ) {
undef $ordnum;
last CHECKNEXT;
}
else {
last CHECKNEXT;
}
}
if ($ordnum) {
$Scratch->{ui_location} = $Tag->area(
{
href => '__UI_BASE__/order_view',
form => "order=$ordnum",
}
);
}
else {
$Scratch->{message} = "[L]No next order.[/L]";
}
}
return;
[/perl]
[if scratch ui_location]
[bounce href=`delete $Scratch->{ui_location}`]
[/if]
[set icon_name]admin/icon_orders.gif[/set]
[seti page_title]
[if value showarchive]
Orders: archived orders
[set help_name]order.main.archived[/set]
[else]
Orders: pending orders
[set help_name]order.main.pending[/set]
[/else]
[/if]
[/seti]
[update values]
@_UI_STD_HEAD_@
[if scratch message]
[scratch message][set message][/set] [/if] [if scratch ui_message]
[scratch ui_message] [set ui_message][/set]
[/if]
or |