break; case 'save_public': // no break so that the request filters down to 'save' $is_public = true; case 'submit': // no break so that the request filters down to 'save' $is_final = true; $target = altSubValue($_POST, 'target', ''); case 'save': if (!$apply_proposals) { 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;