--- ../ltp/admin/ltp	Sat May 11 20:17:43 2002
+++ ltp	Sat May 11 21:42:20 2002
@@ -18,6 +18,9 @@
 my $dbh = DBI->connect($engine,"","",{'PrintError' =>0}) or die "Can't connect to $dbname: $DBI::errstr\n";
 
 
+#This sub exits and returns an ascii list of all sleepingplaces
+#call with () or (sleepingplace)
+
 sub night
 {
     my $loc = shift;
@@ -47,6 +50,10 @@
 
 }
 
+#This sub returns a hash with the bootnumbers of all projectt
+#keys: project.name->project.boothnr
+#Used in: supplies
+
 sub get_projects
 {
     my $query = "SELECT name,boothnr FROM project";
@@ -57,15 +64,18 @@
 
     $query .= " WHERE boothnr <> ''" if ($opt_onlybooth);
     $query .= " ORDER BY name";
-    $sth = $dbh->prepare($query);
-    if ($sth && ($rc = $sth->execute) > 0) {
-        while (@row = $sth->fetchrow_array) {
+    $sth = $dbh->prepare($query) or die "Cannot prepare Query: $DBI::errstr\n";
+    
+    $sth->execute or die "Cannot execute Query: $DBI::errstr\n";
+        
+	while (@row = $sth->fetchrow_array) {
 	    $projects{$row[0]} = $row[1];
         }
-    }
+    
     return %projects;
 }
 
+# This sub lists all suplies for 
 sub supplies
 {
     my $query;
@@ -80,14 +90,15 @@
     foreach $project (keys %projects) {
 	$text = '';
 	$booth = '';
-
+	#Added missing table project in from clause
 	$query = sprintf ("SELECT supplies.amount,supplylist.name,supplylist.id"
-			  ." FROM supplylist,supplies "
+			  ." FROM supplylist,supplies,project "
 			  ."WHERE supplylist.id = supplies.supply AND project.name = project AND project='%s'"
 			  ." ORDER by supplylist.name",
 			  $project);
 
-	$sth = $dbh->prepare($query);
+	$sth = $dbh->prepare($query) or die "Cannot prepare Query: $DBI::errstr\n";
+	
 	if ($sth && ($rc = $sth->execute) > 0) {
 	    while (@row = $sth->fetchrow_array) {
 		$booth = $row[3] if (!$booth);

