- Properly copy the config type in the config editor when copying -1 config values into

the current year
- Add 2 new config options.  
	- 'participant_student_tshirt_cost' allows the cost of each fair tshirt
	  to be set (vancouver charges $10 for tshirts, because not all
	  students want them), this also adds a 'none' option to the tshirt
	  selection box, and a note indicating the tshirt cost if the costs is
	  nonzero.
	- 'regfee_show_info' adds a "Registration Fee Information" to the main
	  student registration page, showing a breakdown of the registration
	  fee computation (including tshirts, per_student and per_project
	  registration, and indicates the total.
- Convert the tshirt field to VARCHAR(32) instead of enum so the "none" option
  described above works, also, some fairs may want to add more optoins, like
  female/male sizes.. so turn this into a text field for those fairs.  The next
  step would be to make a config option for the tshirt options. :)
This commit is contained in:
dave 2007-01-21 01:40:46 +00:00
parent 018725aebf
commit 5ca11ae362
6 changed files with 69 additions and 9 deletions

View File

@ -31,10 +31,12 @@
$q=mysql_query("SELECT * FROM config WHERE year='-1'");
while($r=mysql_fetch_object($q))
{
mysql_query("INSERT INTO config (var,val,category,ord,description,year) VALUES (
mysql_query("INSERT INTO config (var,val,category,type,type_values,ord,description,year) VALUES (
'".mysql_escape_string($r->var)."',
'".mysql_escape_string($r->val)."',
'".mysql_escape_string($r->category)."',
'".mysql_escape_string($r->type)."',
'".mysql_escape_string($r->type_values)."',
'".mysql_escape_string($r->ord)."',
'".mysql_escape_string($r->description)."',
'".$config['FAIRYEAR']."')");

View File

@ -65,15 +65,16 @@ function config_editor_require_vars($category, $year, $varlist)
if(mysql_num_rows($q) != 1) {
/* Insert a dummy */
mysql_query("INSERT INTO `config` (`var`, `val`,
`description`, `category`, `year`, `ord`)
VALUES ('$v', '', '',
'$category', $year, 99999)");
`description`, `category`, `type`, `type_values`,
`year`, `ord`) VALUES ('$v', '', '',
'$category', 'text', '', $year, 99999)");
} else {
$r = mysql_fetch_object($q);
mysql_query("INSERT INTO `config` (`var`, `val`,
`description`, `category`, `year`, `ord`)
VALUES ('$v', '{$r->val}', '{$r->description}',
'$category', '$year', {$r->ord})");
`description`, `category`, `type`, `type_values`,
`year`, `ord`) VALUES ('$v', '{$r->val}',
'{$r->description}', '{$r->category}', '{$r->type}',
'{$r->type_values}', '$year', {$r->ord})");
}
}
}

View File

@ -1 +1 @@
37
38

6
db/db.update.38.sql Normal file
View File

@ -0,0 +1,6 @@
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) VALUES ( 'participant_student_tshirt_cost', '0.00', 'Participant Registration', 'number', '', '1310', 'The cost of each T-Shirt. If this is non-zero, a "None" option is added to the T-Shirt size selection box, and a note is added indicating the cost of each T-Shirt', '-1');
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) VALUES ( 'regfee_show_info', 'no', 'Participant Registration', 'yesno', '', '410', 'Show a breakdown of the total Registration Fee calculation on the main student registration page', '-1');
ALTER TABLE `students` CHANGE `tshirt` `tshirt` VARCHAR( 32 ) NOT NULL DEFAULT 'medium';

View File

@ -292,6 +292,48 @@ echo "<table><tr><td>";
echo "</table>";
echo "<br /><br />";
function regfee_line($item, $unit, $qty, $tot)
{
echo "<tr><td>".i18n($item)."</td>";
echo "<td>($".sprintf("%.02f", $unit)."</td>";
echo "<td>* $qty)</td>";
echo "<td>$".sprintf("%.02f", $tot)."</td>";
echo "</tr>";
}
if($config['regfee_show_info']) {
echo "<h3>".i18n("Registration Fee Information")."</h3>";
$regfee = 0;
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$n_students = mysql_num_rows($q);
$n_tshirts = 0;
while($s = mysql_fetch_object($q)) {
if($s->tshirt != 'none') $n_tshirts++;
}
echo "<table>";
if($config['regfee_per'] == 'student') {
$f = $config['regfee'] * $n_students;
regfee_line("Fair Registration (per student)", $config['regfee'], $n_students, $f);
$regfee += $f;
} else {
regfee_line("Fair Registration (per project)", $config['regfee'], 1, $config['regfee']);
$regfee += $config['regfee'];
}
if($config['participant_student_tshirt'] == 'yes') {
$tsc = floatval($config['participant_student_tshirt_cost']);
if($tsc != 0.0) {
$f = $n_tshirts * $tsc;
$regfee += $f;
regfee_line("T-Shirts", $tsc, $n_tshirts, $f);
}
}
echo "<tr><td align=right colspan=3>".i18n("Total (inlcuding all taxes)")."</td><td><b>$".sprintf("%.02f", $regfee)."</b></td></tr>";
echo "</table><br />";
}
echo "<h3>".i18n("Registration Instructions")."</h3>";
//now get the text of special instructions for the bottom of this page:

View File

@ -345,9 +345,15 @@ else
if($config['participant_student_tshirt']=="yes")
{
$tshirt_cost = floatval($config['participant_student_tshirt_cost']);
echo "<tr>\n";
echo " <td>".i18n("T-Shirt Size")."</td><td>";
echo " <td>".i18n("T-Shirt Size")."</td><td colspan=3>";
echo " <select name=\"tshirt[$x]\">\n";
if($tshirt_cost != 0.0) {
if($studentinfo->tshirt=="none") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"none\">".i18n("None")."</option>";
}
if($studentinfo->tshirt=="small") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"small\">".i18n("Small")."</option>";
if($studentinfo->tshirt=="medium") $sel="selected=\"selected\""; else $sel="";
@ -357,6 +363,9 @@ else
if($studentinfo->tshirt=="xlarge") $sel="selected=\"selected\""; else $sel="";
echo " <option $sel value=\"xlarge\">".i18n("X-Large")."</option>";
echo " </select>";
if($tshirt_cost != 0.0) {
printf(" The cost of each T-Shirt is $%.2f", $tshirt_cost);
}
echo "</td>\n";
echo "</tr>";
}