diff --git a/output/export.output.php b/output/export.output.php
index 35aa40f8..26f9310a 100644
--- a/output/export.output.php
+++ b/output/export.output.php
@@ -14,6 +14,8 @@
if ((($go == "judging_scores_bos") || ($go == "judging_scores")) && (($view == "html") || ($view == "pdf"))) $authorized = TRUE;
}
+ if ($section == "export-personal-results") $authorized = TRUE;
+
if (!$authorized) {
$redirect = "../../403.php";
$redirect_go_to = sprintf("Location: %s", $redirect);
@@ -65,6 +67,10 @@
* info from BJCP XML output.
*/
+// Run the integrity function.
+// This will make sure that user ids line up with brewer uids, etc.
+if ($authorized) data_integrity_check();
+
// Queries for current data
if ($filter == "default") {
$winner_method = $_SESSION['prefsWinnerMethod'];
@@ -3308,7 +3314,7 @@ function mysqli_field_name($result, $field_offset) {
if ((isset($_SESSION['loginUsername'])) && ($section == "export-personal-results") && ($id != "default")) {
- $query_brewer = sprintf("SELECT DISTINCT a.brewCategory, a.brewSubCategory, a.id AS eid, a.brewStyle, a.brewInfo, a.brewInfoOptional, a.brewComments, b.scoreEntry, b.scorePlace, c.brewerFirstName, c.brewerLastName, c.brewerClubs, c.brewerEmail, c.brewerMHP FROM %s a, %s b, %s c WHERE a.brewBrewerID = '%s' AND b.bid = '%s' AND c.uid = '%s' AND a.id = b.eid", $prefix."brewing", $prefix."judging_scores", $prefix."brewer", $id, $id, $id);
+ $query_brewer = sprintf("SELECT DISTINCT a.brewCategory, a.brewSubCategory, a.id AS eid, a.brewStyle, a.brewInfo, a.brewInfoOptional, a.brewComments, b.scoreEntry, b.scorePlace, c.brewerFirstName, c.brewerLastName, c.brewerClubs, c.brewerEmail, c.brewerMHP, c.brewerBreweryName FROM %s a, %s b, %s c WHERE a.brewBrewerID = '%s' AND b.bid = '%s' AND c.uid = '%s' AND a.id = b.eid", $prefix."brewing", $prefix."judging_scores", $prefix."brewer", $id, $id, $id);
$brewer = mysqli_query($connection,$query_brewer);
$row_brewer = mysqli_fetch_assoc($brewer);
$totalRows_brewer = mysqli_num_rows($brewer);
@@ -3327,7 +3333,7 @@ function mysqli_field_name($result, $field_offset) {
// Results data headers
$results[] = array("Category", "Category Name", "Required Info", "Official Score", "Highest Score", "Place");
- if ($row_brewer) {
+ if (($row_brewer) && ($totalRows_brewer > 0)) {
do {
@@ -3396,6 +3402,7 @@ function mysqli_field_name($result, $field_offset) {
if ($results_count == $totalRows_brewer) {
$first_name = convert_to_entities($row_brewer['brewerFirstName']);
$last_name = convert_to_entities($row_brewer['brewerLastName']);
+ $org_name = convert_to_entities($row_brewer['brewerBreweryName']);
$club = convert_to_entities($row_brewer['brewerClubs']);
$email = convert_to_entities($row_brewer['brewerEmail']);
if ($filter == "MHP") $mhp = convert_to_entities($row_brewer['brewerMHP']);
@@ -3418,8 +3425,17 @@ function mysqli_field_name($result, $field_offset) {
}
else {
- $personal[] = array("Last Name", "First Name", "Club", "Email");
- $personal[] = array($last_name,$first_name,$club,$email);
+
+ if ($_SESSION['prefsProEdition'] == 1) {
+ $personal[] = array("Organization Name", "Contact Email");
+ $personal[] = array($org_name,$email);
+ }
+
+ else {
+ $personal[] = array("Last Name", "First Name", "Club", "Email");
+ $personal[] = array($last_name,$first_name,$club,$email);
+ }
+
}
// Spacer
@@ -3437,7 +3453,8 @@ function mysqli_field_name($result, $field_offset) {
$separator = ",";
$extension = ".csv";
$date = date("m-d-Y");
- $filename = $first_name."_".$last_name."_Personal_Results_".$_SESSION['contestName']."_";
+ if ($_SESSION['prefsProEdition'] == 1) $filename = $org_name."_Organization_Results_".$_SESSION['contestName']."_";
+ else $filename = $first_name."_".$last_name."_Personal_Results_".$_SESSION['contestName']."_";
if ($filter == "MHP") $filename .= "MHP_";
$filename .= $date.$extension;
$filename = filename($filename);
diff --git a/sections/brewer_entries.sec.php b/sections/brewer_entries.sec.php
index 950adf8f..39fbb06e 100644
--- a/sections/brewer_entries.sec.php
+++ b/sections/brewer_entries.sec.php
@@ -59,8 +59,11 @@
if (($totalRows_log > 0) && ($show_scores)) {
+ if ($_SESSION['prefsProEdition'] == 1) $pay_button_label = $label_results_export;
+ else $pay_button_label = $label_results_export_personal;
+
$link_results_export = $base_url."includes/output.inc.php?section=export-personal-results&id=".$_SESSION['brewerID'];
- $pay_button .= sprintf("%s",$link_results_export, $label_results_export_personal);
+ $pay_button .= sprintf("%s",$link_results_export, $pay_button_label);
}