Skip to content
Snippets Groups Projects
Commit dadc2b18 authored by Tim Steiner's avatar Tim Steiner
Browse files

Fix editting of existing Four-Year Plans. @0h15

parent 6307d7d9
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ class FourYearPlans_NewController extends Creq_Controller_Action
$request->setOwner($user);
$request->setJustification('--None Required--');
$fourYearPlan = FourYearPlans_FourYearPlanModel::findByMajor($in['major']);
$fourYearPlan = FourYearPlans_FourYearPlanModel::findByMajorId($in['major']);
if (!$fourYearPlan) {
$fourYearPlan = FourYearPlans_FourYearPlanModel::fetchNew();
$fourYearPlan->setMajorId($in['major']);
......
......@@ -278,15 +278,14 @@ class FourYearPlans_FourYearPlanModel extends Unl_Model
return self::find($generationIds);
}
static public function findByMajor($major)
static public function findByMajorId($majorId)
{
$db = Zend_Registry::get('db');
$select = new Zend_Db_Select($db);
$select->from(array('g' => 'creqFourYearPlanGenerations'), array('fourYearPlanGenerationId'));
$select->join(array('m' => 'creqMajors'), 'g.majorId = m.majorId', array('major' => 'name'));
$select->join(array('f' => 'creqFourYearPlans'), 'g.fourYearPlanGenerationId = f.currentGeneration', array());
$select->where('m.name = ?', $major);
$select->where('g.majorId = ?', $majorId);
$records = $select->query()->fetchAll();
if (count($records) == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment