jsonBadResult(t('Student application period is not currently open'));
 } else {
     $id = altSubValue($_POST, 'id', '');
     $project_id = altSubValue($_POST, 'project_id', '');
     $project = Project::getProjectById($project_id);
     $properties = Proposal::filterPost($_POST);
     if (isset($is_public) && $is_public) {
         $properties['state'] = 'open';
         $is_final = false;
     }
     if (isset($is_final) && $is_final) {
         $properties['state'] = 'published';
     }
     if (!$id) {
         $new = TRUE;
         $id = $result = Proposal::insertProposal($properties, $project_id);
     } else {
         $new = FALSE;
         if (!Groups::isOwner(_PROPOSAL_OBJ, $id)) {
             drupal_set_message(t('You are not the owner of this proposal'), 'error');
             $result = null;
         } else {
             //If there was no supervisor chosen, at least maintain the orginal one, rather than leave it orphaned
             if ($properties['supervisor_id'] == 0) {
                 if ($original_supervisor = altSubValue($_POST, 'original_supervisor_id', '')) {
                     $properties['supervisor_id'] = $original_supervisor;
                 }
             }
             $result = Proposal::updateProposal($properties, $id);
         }
     }