forked from science-ation/science-ation
Add copyoriginal, copyparent, and notes(currently unused) to conferences table
Add code in create conference and copy conference to set copyoriginal and copyparent Add missing json_decode to API (we expect ALL arrays being POSTED to be json encoded)
This commit is contained in:
parent
e9f46edb0e
commit
46b39f81e0
2
api.php
2
api.php
@ -732,7 +732,7 @@ switch($request[0]) {
|
|||||||
return(fields array)
|
return(fields array)
|
||||||
*/
|
*/
|
||||||
case 'fields':
|
case 'fields':
|
||||||
$reqroles=$_POST['roles'];
|
$reqroles=json_decode($_POST['roles'],true);
|
||||||
if(is_array($reqroles)) {
|
if(is_array($reqroles)) {
|
||||||
for($x=0;$x<count($reqroles);$x++) {
|
for($x=0;$x<count($reqroles);$x++) {
|
||||||
if(is_numeric($reqroles[$x]))
|
if(is_numeric($reqroles[$x]))
|
||||||
|
@ -1 +1 @@
|
|||||||
223
|
225
|
||||||
|
@ -1,6 +1,2 @@
|
|||||||
INSERT INTO `rolestasks` (`id`, `pid`, `roles_id`, `level`, `task`, `ord`, `link`, `navident`, `conferencetype`) VALUES
|
|
||||||
(128, 89, 10, 2, 'School Information', 1, '/schoolinfo.php', '', 'scienceolympics'),
|
|
||||||
(129, 90, 10, 2, 'School Feedback', 1, '/schoolfeedback.php', '', 'scienceolympics');
|
|
||||||
|
|
||||||
ALTER TABLE `pagetext` DROP INDEX `textname` , ADD UNIQUE `textname` ( `textname` , `conferences_id` , `lang` );
|
ALTER TABLE `pagetext` DROP INDEX `textname` , ADD UNIQUE `textname` ( `textname` , `conferences_id` , `lang` );
|
||||||
UPDATE roles SET `type` = 'participant', `name` = 'Participant' WHERE type = 'student';
|
UPDATE roles SET `type` = 'participant', `name` = 'Participant' WHERE type = 'student';
|
||||||
|
6
db/db.update.225.sql
Normal file
6
db/db.update.225.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
ALTER TABLE `conferences`
|
||||||
|
ADD `copyoriginal` INT NOT NULL AFTER `status` ,
|
||||||
|
ADD `copyparent` INT NOT NULL AFTER `copyoriginal` ,
|
||||||
|
ADD `notes` TEXT NOT NULL AFTER `copyparent`;
|
||||||
|
|
||||||
|
UPDATE `conferences` SET copyoriginal=id, copyparent=id;
|
@ -629,6 +629,11 @@ function create_conference($params){
|
|||||||
$cname = mysql_real_escape_string($params['name']);
|
$cname = mysql_real_escape_string($params['name']);
|
||||||
$ctype = $params['type'];
|
$ctype = $params['type'];
|
||||||
mysql_query("INSERT INTO conferences (oid, name, type, status) VALUES (1, '" . mysql_real_escape_string($cname) . "', '$ctype', 'pending')");
|
mysql_query("INSERT INTO conferences (oid, name, type, status) VALUES (1, '" . mysql_real_escape_string($cname) . "', '$ctype', 'pending')");
|
||||||
|
|
||||||
|
//if its created brand spanking new, we set the copyoriginal and copyparent to be the same as the id
|
||||||
|
$id=mysql_insert_id();
|
||||||
|
mysql_query("UPDATE conferences SET copyoriginal='$id', copyparent='$id' WHERE id='$id'");
|
||||||
|
|
||||||
$errorMessage = mysql_error();
|
$errorMessage = mysql_error();
|
||||||
if($errorMessage){
|
if($errorMessage){
|
||||||
return "SQL Error:<br/>$errorMessage";
|
return "SQL Error:<br/>$errorMessage";
|
||||||
@ -726,7 +731,7 @@ function copy_conference($params){
|
|||||||
$oldConfId = $params['mastercopy'];
|
$oldConfId = $params['mastercopy'];
|
||||||
$oldConf = mysql_fetch_assoc(mysql_query("SELECT * FROM conferences WHERE id = {$oldConfId}"));
|
$oldConf = mysql_fetch_assoc(mysql_query("SELECT * FROM conferences WHERE id = {$oldConfId}"));
|
||||||
|
|
||||||
mysql_query("INSERT INTO conferences (oid, name, type, status) VALUES (1, '" . mysql_real_escape_string($params['name']) . "', '{$oldConf['type']}', 'pending')");
|
mysql_query("INSERT INTO conferences (oid, name, type, status, copyoriginal, copyparent) VALUES (1, '" . mysql_real_escape_string($params['name']) . "', '{$oldConf['type']}', 'pending','{$oldConf['copyoriginal']}','{$oldConf['id']}')");
|
||||||
if(mysql_error() != ''){ wizard_draw_step('error', 'SQL error on line #' . (__LINE__ - 1) . ': <br/>' . mysql_error()); return false; }
|
if(mysql_error() != ''){ wizard_draw_step('error', 'SQL error on line #' . (__LINE__ - 1) . ': <br/>' . mysql_error()); return false; }
|
||||||
$newConfId = mysql_insert_id();
|
$newConfId = mysql_insert_id();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user