A few more tweaks to the date config - if we have a conference year should be 0, if we dont have a conference, conference should be 0 and year should be set.

This commit is contained in:
james 2010-06-04 17:09:35 +00:00
parent b47b88ab9b
commit cf05b063c1

View File

@ -54,7 +54,7 @@ $error_ids = array();
$d = mysql_escape_string(stripslashes($val));
$t =mysql_escape_string(stripslashes($_POST['savetimes'][$key]));
$v="$d $t";
mysql_query("UPDATE dates SET date='$v' WHERE year='".$config['FAIRYEAR']."' AND conferences_id='".$conference['id']."' AND id='$key'");
mysql_query("UPDATE dates SET date='$v' WHERE id='$key'");
}
}
echo happy(i18n("Dates successfully saved"));
@ -142,13 +142,25 @@ foreach($dates as $dn=>$d) {
if(!$d['id']) {
$def=$defaultdates[$dn];
//hmm if we dont have a record for this date this year, INSERT the sql from the default
mysql_query("INSERT INTO dates (date,name,description,year,conferences_id) VALUES (
'".mysql_real_escape_string($def->date)."',
'".mysql_real_escape_string($dn)."',
'".mysql_real_escape_string($def->description)."',
'".$config['FAIRYEAR']."',
'".$conference['id']."'
)");
if($conference['id']>0) {
mysql_query("INSERT INTO dates (date,name,description,year,conferences_id) VALUES (
'".mysql_real_escape_string($def->date)."',
'".mysql_real_escape_string($dn)."',
'".mysql_real_escape_string($def->description)."',
0,
'".$conference['id']."'
)");
echo mysql_error();
}
else {
mysql_query("INSERT INTO dates (date,name,description,year,conferences_id) VALUES (
'".mysql_real_escape_string($def->date)."',
'".mysql_real_escape_string($dn)."',
'".mysql_real_escape_string($def->description)."',
'".$config['FAIRYEAR']."',
0
)");
}
$d['id']=mysql_insert_id();
$d['description']=$def->description;
$d['date']=$def->date;