From 98a521f51c50c64b2398695c2d4a2030c32de2f9 Mon Sep 17 00:00:00 2001 From: Martin Blumenthal Date: Thu, 4 Jun 2009 17:03:14 +0200 Subject: [PATCH] Fix a bug when adding new entries (subject was lost). --- skoli/entry.php | 2 +- skoli/lib/Driver.php | 2 +- skoli/lib/Forms/Entry.php | 2 +- skoli/lib/School.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/skoli/entry.php b/skoli/entry.php index 780bae8c0..3d971ded5 100644 --- a/skoli/entry.php +++ b/skoli/entry.php @@ -22,7 +22,7 @@ if (!Auth::getAuth()) { } $vars = Variables::getDefaultVariables(); -$driver = &Skoli_Driver::singleton(''); +$driver = &Skoli_Driver::singleton(); $entry = $driver->getEntry($vars->get('entry')); if (is_a($entry, 'PEAR_Error') || !count($entry)) { $notification->push(_("Entry not found."), 'horde.error'); diff --git a/skoli/lib/Driver.php b/skoli/lib/Driver.php index bbd30132f..6c536cc60 100644 --- a/skoli/lib/Driver.php +++ b/skoli/lib/Driver.php @@ -64,7 +64,7 @@ class Skoli_Driver { if (!is_array($classes)) { $classes = Skoli::listClasses(); } - if (!isset($classes[$class])) { + if ($class != '' && !isset($classes[$class])) { $class = &new Skoli_Driver(sprintf(_("Access for class \"%s\" is denied"), $class)); return $class; } diff --git a/skoli/lib/Forms/Entry.php b/skoli/lib/Forms/Entry.php index 6cc1f4d3a..994373830 100644 --- a/skoli/lib/Forms/Entry.php +++ b/skoli/lib/Forms/Entry.php @@ -83,7 +83,7 @@ class Skoli_EntryForm extends Horde_Form { $addresses = array(); } - $this->addVariable(_("Date"), 'object_time', 'monthdayyear', true, false, null, array()); + $this->addVariable(_("Date"), 'object_time', 'monthdayyear', true, false, null, array(date('Y') - 10)); if (!$this->_vars->exists('object_time')) { $date = new Horde_Date(time()); $this->_vars->set('object_time', array('month' => $date->month, 'day' => $date->mday, 'year' => $date->year)); diff --git a/skoli/lib/School.php b/skoli/lib/School.php index 0f82ea9e7..d72d83e65 100644 --- a/skoli/lib/School.php +++ b/skoli/lib/School.php @@ -129,7 +129,7 @@ class Skoli_School { $form->addVariable(_(ucfirst($property)), 'attribute_subject', 'enum', $obligatory, false, null, array($values, _("Choose:"))); } } else { - $form->addVariable(_(ucfirst($property)), $property, 'text', $obligatory, false); + $form->addVariable(_(ucfirst($property)), 'attribute_subject', 'text', $obligatory, false); } break; -- 2.11.0