[ic] admin ui problems (Unable to archive/delete) customer or order

Mike Heins interchange-users@interchange.redhat.com
Thu Aug 9 20:20:00 2001


--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Quoting Brian Kosick (briank@nacs.net):
> Hello all, I have a problem with being able to archive/unarchive orders, 
> and ativate/deactivate customers through the admin UI.
> 
> Users
> If you click on the arrow to deactivate, or click the checkbox, then click 
> deactivate, the UI doesn't reflect the changes.  It's updates in the DB (IE 
> inactive in the userdb gets changed from 0 to 1) The UI will always show 
> that its an active customer.
> 
> Orders
> Either way you try to archive an order, it doesn't do it, it doesn't change 
> archive value  in (transactions)to 1 from 0.  If you change it manually, 
> (psql ) Then the UI reflects the change, but you cannot un-archive it 
> without changing it manually either.
> 
> There aren't any errors being reported in catalogdir/error.log, or 
> /path/to/interchange/error.log
> 
> I'm using Redhat 7.1, postgres 7.1.2, IC 4.8.1, latest Bundle::Interchange.

Ooops. I just made a wrong post.

Thanks for catching this prior to 4.8.1 release -- you are missing a
file, lib/UI/pages/include/order_delete_archive. It is now in CVS, but
is attached to this email also.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer

--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Description: lib/UI/pages/include/order_delete_archive
Content-Disposition: attachment; filename=order_delete_archive


[tag flag write]transactions[/tag]
[perl tables=transactions]
	delete $Scratch->{ui_location};
	my $db = $Db{transactions};
	if(! $db) {
		$Scratch->{ui_error} = "<FONT CLASS=error>Error: no transactions database.</FONT><BR>";
		$Scratch->{ui_location} = $Tag->area("__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 "<FONT CLASS=error>Error$plural:<UL><LI>" .
				join ("<LI>", @errors)                    .
				"</UL></FONT><BR>";
	}
	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]


--HcAYCG3uE/tztfnV--