Commit f2c8b2a4 authored by David Findlay's avatar David Findlay

Bug fixes related to people being able to create an entry without a club selected.

parent 9be4493d
......@@ -3,4 +3,5 @@ includes/config.php
includes/aws
.settings
.idea
config.php
\ No newline at end of file
config.php
node_modules
\ No newline at end of file
<?php
require("includes/setup.php");
require("includes/classes/Member.php");
require("includes/classes/Meet.php");
require("includes/classes/Club.php");
require("includes/classes/MeetEvent.php");
require("includes/classes/MeetEntry.php");
require("includes/classes/MeetEntryEvent.php");
require("includes/classes/TMEntryFile.php");
require_once("includes/setup.php");
require_once("includes/classes/Member.php");
require_once("includes/classes/Meet.php");
require_once("includes/classes/Club.php");
require_once("includes/classes/MeetEvent.php");
require_once("includes/classes/MeetEntry.php");
require_once("includes/classes/MeetEntryEvent.php");
require_once("includes/classes/TMEntryFile.php");
// Get TM Entries
......
This diff is collapsed.
<?php
//require_once("phpqrcode/qrlib.php");
require_once($_SERVER['DOCUMENT_ROOT'] . '/swimman/includes/classes/SlackNotification.php');
class Member {
......@@ -45,6 +46,7 @@ class Member {
$memberClubs = $GLOBALS['db']->getAll("SELECT * FROM member_memberships
WHERE member_id = ?
AND startdate <= CURDATE() AND enddate >= CURDATE()
GROUP BY club_id;", array($this->id));
db_checkerrors($memberClubs);
......@@ -790,6 +792,12 @@ class Member {
$this->addEmail(1, $jUserEmail);
$jdb->disconnect();
$message = "Member " . $this->getFullname() . " linked to Joomla user " . $jUser . "("
. $juserId . ")";
$slack = new SlackNotification();
$slack->setMessage($message);
$slack->send();
return;
......@@ -852,8 +860,13 @@ class Member {
db_checkerrors($delete3);
addlog("Joomla", "Member $this->id removed from Joomla MSQ Members groups");
$message = "Member " . $this->getFullname() . " unlinked from Joomla user "
. $juserId;
$slack = new SlackNotification();
$slack->setMessage($message);
$slack->send();
//$jdb->disconnect();
}
......
......@@ -66,6 +66,9 @@ function sidebarMenu() {
echo "<li>\n";
echo "<a href=\"memberlist.php\">Member List</a>\n";
echo "</li>\n";
echo "<li>\n";
echo "<a href=\"membercreate.php\">Create Member</a>\n";
echo "</li>\n";
echo "<li>\n";
echo "<a href=\"memberbulk.php\">Bulk Member Check</a>\n";
echo "</li>\n";
......
......@@ -158,8 +158,18 @@ class EntryManagerController extends JController {
if ($chosenClub != "") {
$sess->set('emClubId', $chosenClub);
$sess->clear('emClubError');
JRequest::setVar('view', 'step2', 'method', true);
}
} else {
$sess->set('emClubError', 'You must choose a club for this entry!');
// No event entries
JRequest::setVar('view', 'step1', 'method', true);
}
// Check if member has already entered this meet
......@@ -193,7 +203,7 @@ class EntryManagerController extends JController {
}
JRequest::setVar('view', 'step2', 'method', true);
// JRequest::setVar('view', 'step2', 'method', true);
......@@ -491,99 +501,111 @@ class EntryManagerController extends JController {
$entryDetails->setStatus(5); // Awaiting Payment
$entryDetails->setEventStatuses(5); // Pending
// Create entry
$entryDetails->create();
$entryId = $entryDetails->getId();
$entryMember = $entryDetails->getMemberId();
$sess->set('emEntryId', $entryId);
// Email the club captain
// Email entry submission
// $mail = new PHPMailer();
// $mail->setFrom('recorder@mastersswimmingqld.org.au','MSQ Branch Recorder');
$meetDetails = new Meet();
$meetId = $sess->get('emMeetId');
$meetDetails->loadMeet($meetId);
$meetName = $meetDetails->getName();
$clubDetails = new Club();
$clubId = $sess->get('emClubId');
$clubDetails->load($clubId);
$clubName = $clubDetails->getName();
$clubCode = $clubDetails->getCode();
$submitterId = $entryDetails->getMemberId();
$subDetails = new Member();
$subDetails->loadId($submitterId);
$submitterName = $subDetails->getFullname();
$clubCaptainEmail = $GLOBALS['db']->getOne("SELECT address FROM emails WHERE id =
$entryCreated = $entryDetails->create();
if ($entryCreated) {
$entryId = $entryDetails->getId();
$entryMember = $entryDetails->getMemberId();
$sess->set('emEntryId', $entryId);
// Email the club captain
// Email entry submission
// $mail = new PHPMailer();
// $mail->setFrom('recorder@mastersswimmingqld.org.au','MSQ Branch Recorder');
$meetDetails = new Meet();
$meetId = $sess->get('emMeetId');
$meetDetails->loadMeet($meetId);
$meetName = $meetDetails->getName();
$clubDetails = new Club();
$clubId = $sess->get('emClubId');
$clubDetails->load($clubId);
$clubName = $clubDetails->getName();
$clubCode = $clubDetails->getCode();
$submitterId = $entryDetails->getMemberId();
$subDetails = new Member();
$subDetails->loadId($submitterId);
$submitterName = $subDetails->getFullname();
$clubCaptainEmail = $GLOBALS['db']->getOne("SELECT address FROM emails WHERE id =
(SELECT email_id FROM clubs_captains WHERE club_id = '$clubId');");
db_checkerrors($clubCaptainEmail);
// $mail->addAddress($clubCaptainEmail);
// $mail->Subject = "$clubCode Member Entry";
// $mail->Body = "Hi,\n\nAn entry for $meetName has been submitted by $submitterName. You can access the details of this entry from the Club Entries page of the Entry Manager on the MSQ Members Community site. If you have any problems please reply to this email.\n\nThanks,\n\nDavid Findlay\nDirector of Recording\nMasters Swimming QLD\n\nEmail: recorder@mastersswimmingqld.org.au\nPhone: 0428 874 874\nPostal: PO Box 282, Woody Point, QLD, 4019, Australia";
// if (!$mail->send()) {
//exit("Could not send email: " . $mail->ErrorInfo . "\n");
// }
db_checkerrors($clubCaptainEmail);
$meetPaymentDetails = $GLOBALS['db']->getAll("SELECT * FROM meet_payment_methods WHERE
// $mail->addAddress($clubCaptainEmail);
// $mail->Subject = "$clubCode Member Entry";
// $mail->Body = "Hi,\n\nAn entry for $meetName has been submitted by $submitterName. You can access the details of this entry from the Club Entries page of the Entry Manager on the MSQ Members Community site. If you have any problems please reply to this email.\n\nThanks,\n\nDavid Findlay\nDirector of Recording\nMasters Swimming QLD\n\nEmail: recorder@mastersswimmingqld.org.au\nPhone: 0428 874 874\nPostal: PO Box 282, Woody Point, QLD, 4019, Australia";
// if (!$mail->send()) {
//exit("Could not send email: " . $mail->ErrorInfo . "\n");
// }
$meetPaymentDetails = $GLOBALS['db']->getAll("SELECT * FROM meet_payment_methods WHERE
meet_id = ?;", array($meetId));
db_checkerrors($meetPaymentDetails);
db_checkerrors($meetPaymentDetails);
// Update the entry data
$sEntryData = serialize($entryData);
$sess->set('emEntryData', $sEntryData);
// Update the entry data
$sEntryData = serialize($entryData);
$sess->set('emEntryData', $sEntryData);
// Check if only paypal payment available
if ($meetPaymentDetails[0][3] == 1) {
// Check if only paypal payment available
if ($meetPaymentDetails[0][3] == 1) {
$eventFee = 9; // TODO: get proper details
$eventFee = 9; // TODO: get proper details
$pp = new PayPalEntryPayment();
$pp->setMeetName($meetName);
$pp->setEntryId($entryId);
$pp->addItem("Meet Entry", 1, $meetDetails->getMeetFee());
$pp = new PayPalEntryPayment();
$pp->setMeetName($meetName);
$pp->setEntryId($entryId);
$pp->addItem("Meet Entry", 1, $meetDetails->getMeetFee());
if ($entryDetails->getNumEntries() > 0) {
$pp->addItem("Individual Entries", $entryDetails->getNumEntries(), $eventFee);
}
if ($entryDetails->getNumEntries() > 0) {
$pp->addItem("Individual Entries", $entryDetails->getNumEntries(), $eventFee);
}
if ($entryDetails->getNumMeals() > 0) {
$pp->addItem("Presentation Dinner", $entryDetails->getNumMeals(), $meetDetails->getMealFee());
}
if ($entryDetails->getNumMeals() > 0) {
$pp->addItem("Presentation Dinner", $entryDetails->getNumMeals(), $meetDetails->getMealFee());
}
if ($entryDetails->getMassages() > 0) {
$pp->addItem("Massages", $entryDetails->getMassages(), $meetDetails->getMassageFee());
}
if ($entryDetails->getMassages() > 0) {
$pp->addItem("Massages", $entryDetails->getMassages(), $meetDetails->getMassageFee());
}
if ($entryDetails->getPrograms() > 0) {
$pp->addItem("Programmes", $entryDetails->getPrograms(), $meetDetails->getProgramFee());
}
if ($entryDetails->getPrograms() > 0) {
$pp->addItem("Programmes", $entryDetails->getPrograms(), $meetDetails->getProgramFee());
}
$approvalUrl = $pp->processPayment();
$app = JFactory::getApplication();
$app->redirect($approvalUrl, "Redirecting to PayPal", $msgType = 'message');
$approvalUrl = $pp->processPayment();
} else {
// Unset session
unset($entryDetails);
$sess->clear('emEntryData');
$sess->clear('emMemberId');
$sess->clear('emEntrant');
$sess->clear('emMeetId');
$sess->clear('emClubId');
$sess->clear('emEntryEdit');
$sess->clear('emEntryId');
// Return to Entry List
JRequest::setVar('view', 'entrymanager', 'method', true);
$app = JFactory::getApplication();
$app->redirect($approvalUrl, "Redirecting to PayPal", $msgType = 'message');
}
} else {
// Unset session
unset($entryDetails);
$sess->clear('emEntryData');
$sess->clear('emMemberId');
$sess->clear('emEntrant');
$sess->clear('emMeetId');
$sess->clear('emClubId');
$sess->clear('emEntryEdit');
$sess->clear('emEntryId');
addlog("Entry Manager", "Unable to create entry", $entryD);
// Return to Entry List
JRequest::setVar('view', 'entrymanager', 'method', true);
JRequest::setVar('view', 'step3', 'method', true);
}
......
......@@ -49,18 +49,18 @@ echo "}\n";
echo "</style>\n";
echo "<p>\n";
echo "This page shows your MSX program results for 2015. Any award you have one is displayed \n";
echo "This page shows your MSX program results for 2016. Any award you have one is displayed \n";
echo "below. The qualifying swims are also shown. \n";
echo "</p>\n";
echo "<p>\n";
echo "<strong>2015 MSX Results are currently at draft stage only.</strong> ";
echo "<strong>2016 MSX Results are currently at draft stage only.</strong> ";
echo "If you believe some qualifying swims are missing, please contact the <a href=\"mailto:recorder@mastersswimmingqld.org.au\">State Recorder</a>. \n";
echo "</p>\n";
echo "<h2>2015 MSX Program</h2>\n";
echo "<h2>2016 MSX Program</h2>\n";
$perf_prog_id = 3;
$perf_prog_id = 4;
$award = $GLOBALS['db']->getOne("SELECT l.levelname FROM performance_programs_awards as a,
performance_programs_levels as l
......
......@@ -76,6 +76,15 @@ if (isset($entrantId)) {
$entrantClubs = $entrantDetails->getClubIds();
if ($sess->get('emClubError') != "") {
echo "<p style='color: red; font-weight: bold;'>\n";
echo $sess->get('emClubError');
echo "</p>\n";
}
// Club information
echo "<p>\n";
echo "<label for=\"clubSelector\" >Swimming for Club:";
......@@ -105,10 +114,12 @@ if (count($entrantClubs) > 1) {
} elseif (count($entrantClubs) == 1) {
$clubDetails = new Club;
$clubDetails->load($entrantClubs[0]);
echo $clubDetails->getName();
$sess->set('emClubId', $entrantClubs[0]);
$cId = $entrantClubs[0];
$clubDetails->load($cId);
$clubName = $clubDetails->getName();
echo "<input type=\"radio\" name=\"emClubId\" id=\"emClubId\" value=\"$cId\" checked=\"checked\" />";
echo $clubName . "<br />";
} else {
......
......@@ -10,8 +10,9 @@ require_once("../includes/classes/Meet.php");
$GLOBALS['db']->setFetchMode(DB_FETCHMODE_ASSOC);
// Define request
$sql = "SELECT *
FROM meet
$sql = "SELECT meet.id, meetname, startdate, enddate, deadline, contactname, address, phonenumber, meetfee, mealfee, location, maxevents, mealsincluded, mealname, massagefee, programfee FROM meet, emails, phones
WHERE meet.contactemail = emails.id
AND meet.contactphone = phones.id
ORDER BY startdate DESC;";
// Make request and check for errors
......
......@@ -334,6 +334,10 @@ if (isset($jUsers)) {
db_checkerrors($jClub);
$jDob = trim($jDob, '"');
// Process DOB
$jDob = date('d/m/Y', strtotime($jDob));
$jMSA = trim($jMSA, '"');
$jClub = trim($jClub, '"');
......@@ -446,7 +450,9 @@ echo "</div>\n"; // Main div
$(document).ready(function() {
$('#jusertable').DataTable();
$('#jusertable').DataTable( {
"order": [[5, "desc"]]
});
});
......
......@@ -245,7 +245,7 @@ foreach ($meetList as $m) {
echo "<td class=\"short\" width=\"10%\">\n";
echo "<a href=\"meetbuilder.php?meetId=$meetId\" class=\"tooltip\" data-tip=\"Edit this meet\"><img src=\"images/edit.png\" alt=\"Edit\" /></a>";
echo "<a href=\"meetbuilder.php?meetId=$meetId\" ><img src=\"images/edit.png\" alt=\"Edit\" /></a>";
// If eProgram exists show link
$eProgramExists = $GLOBALS['db']->getRow("SELECT * FROM meet_programs WHERE meet_id = '$meetId';");
......@@ -253,28 +253,26 @@ foreach ($meetList as $m) {
if (isset($eProgramExists)) {
echo "<a href=\"eprogram.php?id=$meetId\" class=\"tooltip\" data-tip=\"View the eProgram for this meet\"><img src=\"images/eprogram.png\" alt=\"eProgram\" /></a>";
echo "<a href=\"eprogram.php?id=$meetId\"><img src=\"images/eprogram.png\" alt=\"eProgram\" /></a>";
}
// If no events yet, display TM Import link
if ($meetNumEvents == 0) {
echo "<a href=\"importmeet.php?meet=$meetId\" class=\"tooltip\" data-tip=\"Import TM Event File\"><img src=\"images/import.png\" alt=\"Import TM Events\" /></a>";
echo "<a href=\"importmeet.php?meet=$meetId\"><img src=\"images/import.png\" alt=\"Import TM Events\" /></a>";
}
// Meet Access
echo "<a href=\"meetaccess.php?id=$meetId\" class=\"tooltip\" data-tip=\"Meet Access\">";
echo "<a href=\"meetaccess.php?id=$meetId\">";
echo "<img src=\"images/admin.png\" alt=\"Meet Access\" />";
echo "</a>\n";
echo "<a href=\"meetfiles.php?id=$meetId\" class=\"tooltip\" data-tip=\"Meet Files\">\n";
echo "<a href=\"meetfiles.php?id=$meetId\">\n";
echo "<img src=\"images/folder.png\" alt=\"Meet Files\" />";
echo "</a>\n";
echo "<a href=\"meets.php?deleteMeet=$meetId\" class=\"tooltip\" data-tip=\"Delete this meet\"><img src=\"images/delete.png\" alt=\"Delete\" /></a>";
echo "</td>\n";
echo "</tr>\n";
......
......@@ -405,6 +405,16 @@ class plgUserMSAMember extends JPlugin
}
// Refresh the permissions
$user = JFactory::getUser();
$session = JFactory::getSession();
$session->set('user', new JUser($user->id));
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('Tried to refresh permissions ' . $user->id), 'error');
$menu = $app->getMenu();
$menu->load();
}
return true;
......
......@@ -297,6 +297,7 @@ body.loading .modal {
.custom-combobox {
position: relative;
display: inline-block;
background-color: white;
}
.custom-combobox-toggle {
position: absolute;
......@@ -304,8 +305,10 @@ body.loading .modal {
bottom: 0;
margin-left: -1px;
padding: 0;
z-index: 30;
}
.custom-combobox-input {
margin: 0;
padding: 5px 10px;
background-color: white;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test rewriteTime function</title>
<script src="entrymanager.js"></script>
</head>
<body>
<h1>rewriteTime Function Tests</h1>
<h2>Test 1 - Correct Format</h2>
<p><strong>Input: </strong> 2:19.20</p>
<p><strong>Correct: </strong> 2:19.20</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("2:19.20"));
</script>
</p>
<h2>Test 2 - No separators</h2>
<p><strong>Input: </strong> 11900</p>
<p><strong>Correct: </strong> 1:19.00</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("11900"));
</script>
</p>
<h2>Test 3 - Dots as separators</h2>
<p><strong>Input: </strong> 1.19.63</p>
<p><strong>Correct: </strong> 1:19.63</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("1.19.63"));
</script>
</p>
<h2>Test 4 - Time over an hour</h2>
<p><strong>Input: </strong> 1:10:04.11</p>
<p><strong>Correct: </strong> 1:10:04.11</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("1:10:04.11"));
</script>
</p>
<h2>Test 5 - Dots as separators over 1 hour</h2>
<p><strong>Input: </strong> 1.01.19.63</p>
<p><strong>Correct: </strong> 1:01:19.63</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("1.01.19.63"));
</script>
</p>
<h2>Test 6 - Less than 60 seconds</h2>
<p><strong>Input: </strong> 12</p>
<p><strong>Correct: </strong> 0:12.00</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("12"));
</script>
</p>
<h2>Test 7 - Less than 60 seconds with decimal</h2>
<p><strong>Input: </strong> 8.2</p>
<p><strong>Correct: </strong> 0:08.20</p>
<p><strong>Output: </strong>
<script>
document.write(rewriteTime("8.2"));
</script>
</p>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment