summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/admin.pl14
1 files 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(