0 or $force==1) { # This block is run if we have found a license for our goal or # If we did not find a license for our goal and are installing # something else or forcing the install. In the later 2 cases # $gID is defined (from the form generated below) while in the # first case $gID is not defined and should be our $sID. if (! $gID) { $gID = $sID; }; $query = "INSERT INTO inst_software VALUES (NULL, $cID,$sID,$lID,$gID)"; $count = $adb->dbh_do($query); if ( $force==1 ) { header("Location: $ORIG_REFERER"); } else { header("Location: $HTTP_REFERER"); } } else { commonHeader("Searching for Licenses"); # We couldn't find any direct licenses for the product so # lets check for any software bundles that contain the product. $query = "SELECT software.name FROM software WHERE ID=$sID"; $sth = $adb->prepare($query); if ($sth) { $res = $sth->execute(); $result = $sth->fetchrow_hash(); $sname = $result[name]; } $sth->finish(); $query = "SELECT software_bundles.bID, software.name FROM software_bundles LEFT JOIN software ON software.ID=software_bundles.bID WHERE software_bundles.sID='$sID' ORDER BY software_bundles.bID"; $sth = $adb->prepare($query); if ($sth) { $res = $sth->execute(); $numRows = $sth->rows(); print "I found the following ($numRows) Software bundles that contain the program you were looking for. You can either select the software you were trying to install or you can select a bundle. Please note that this will force an installation even if there is no available license. This will also use goals to allow going back to see what license you wanted as opposed to which one you installed."; $installs = Count_installations($sID); $licenses = Count_licenses($sID); $available = $licenses - $installs; print "\n
"; for ($i=0;$i<$numRows;$i++) { $result = $sth->fetchrow_hash(); $name = $result[name]; $bID = $result[bID]; print "\n"; $installs = Count_installations($bID); $licenses = Count_licenses($bID); $available = $licenses - $installs; print ""; } print "
 Software Licenses Available Installed/Licenses
$sname $available ($installs/$licenses)
$name ($bID)$available ($installs/$licenses)
\n\n"; } else { print "Could not prepare query $sth->errstr $query "; } } ?>