From 4de76bf567a88296a96401168516f6fc2e90996e Mon Sep 17 00:00:00 2001 From: tetragon Date: Mon, 9 Jul 2007 22:18:22 +0000 Subject: Fixing 1750802 git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1359 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/admin.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/admin.pl b/bin/admin.pl index ea0eebd4..42022d36 100755 --- a/bin/admin.pl +++ b/bin/admin.pl @@ -918,14 +918,16 @@ sub delete { ( $form->{templates} ) ? "${LedgerSMB::Sysconfig::templates}/$form->{templates}" : "$templates/$form->{login}"; + + my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; - # scan %user for $templatedir - foreach $login ( keys %user ) { - last if ( $found = ( $form->{templates} eq $user{$login} ) ); - } + my $found = $dbh->selectall_arrayref(qq|SELECT c.templates + FROM users_conf c INNER JOIN users u ON (c.id = u.id) + WHERE c.templates = ? AND u.username <> ?|, + undef, $form->{templates}, $form->{login}); # if found keep directory otherwise delete - if ( !$found ) { + if ( !@$found ) { # delete it if there is a template directory $dir = "$form->{templates}"; @@ -935,8 +937,6 @@ sub delete { } } - my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; - #users_conf my $deleteUser = $dbh->prepare( -- cgit v1.2.3