diff --git a/admin/award_download.php b/admin/award_download.php index 6161903..1a31125 100644 --- a/admin/award_download.php +++ b/admin/award_download.php @@ -193,6 +193,8 @@ case 'check': unset($existingprizes[$ep['prize']]); } + if(!array_key_exists('identifier', $prize)) $prize['identifier'] = $prize['prize_en']; + mysql_query("UPDATE award_prizes SET cash='".intval($prize['cash'])."', scholarship='".intval($prize['scholarship'])."', @@ -200,6 +202,7 @@ case 'check': prize='".mysql_escape_string($prize['prize_en'])."', number='".intval($prize['number'])."', `order`='".intval($prize['ord'])."', + external_identifier='".mysql_real_escape_string(stripslashes($prize['identifier']))."', trophystudentkeeper='".intval($prize['trophystudentkeeper'])."', trophystudentreturn='".intval($prize['trophystudentreturn'])."', trophyschoolkeeper='".intval($prize['trophyschoolkeeper '])."', diff --git a/admin/award_upload.php b/admin/award_upload.php index df27ff7..1e882bf 100644 --- a/admin/award_upload.php +++ b/admin/award_upload.php @@ -83,7 +83,7 @@ function get_winners($awardid) $winners=array( 'prizes' => array(), 'award_name' => $award['name'], 'external_identifier' => $award['external_identifier'], - 'postback' => $award['external_postback']); + 'external_postback' => $award['external_postback']); /* Get the prizes */ $q=mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='{$award['id']}'"); @@ -139,7 +139,7 @@ function get_winners($awardid) /* Save the prize info => projects */ $winners['prizes'][$prize['prize']] = array( 'xml_type'=>'prize', /* For ysc compatability */ - 'identifier'=>$prize['prize'], /* for ysc compatability */ + 'identifier'=>$prize['external_identifier'], /* for ysc compatability */ 'projects'=>$prizewinners); } return $winners; @@ -161,11 +161,15 @@ case 'award_upload': echo notice(i18n('No winners selected for this award')); } else { if($fair['type'] == 'ysc') { + $w = array(); + foreach($winners['prizes'] as $prize_name=>$prize) { + $w[] = $prize; + } $req=array("awardwinners"=>array( "username"=>$fair['username'], "password"=>$fair['password'], "identifier"=>$winners['external_identifier'], - "prizes"=>$winners, + "prizes"=>$w, ) ); $url = $winners['external_postback']; @@ -181,9 +185,14 @@ case 'award_upload': $data = curl_query($fair, $req, $url); if($data['error'] != 0) { - echo error("Server said: $data"); + echo error("Server said: ".htmlspecialchars(print_r($data,true))); } else { - echo notice("{$fair['name']} server said:
".join("\n", $data['notice'])."
"); + if(is_array($data['notice'])) + echo notice("{$fair['name']} server said:
".join("\n", $data['notice'])."
"); + else if(is_array($data['message'])) + echo notice("{$fair['name']} server said:
".join("\n", $data['message'])."
"); + else + echo notice("{$fair['name']} server said:
".htmlspecialchars(print_r($data,true))."
"); echo happy(i18n("Upload completed successfully")); } } diff --git a/admin/curl.inc.php b/admin/curl.inc.php index 49be053..4903242 100644 --- a/admin/curl.inc.php +++ b/admin/curl.inc.php @@ -86,7 +86,7 @@ break; } -// debug_("Curl Send: (type:{$fair['type']}=>$url) $str"); +// debug_("Curl Send: (type:{$fair['type']}=>$url ysc_url=>$ysc_url) $str"); $ch = curl_init(); /// initialize a cURL session curl_setopt ($ch, CURLOPT_URL, $url);