Fix a bug when adding new entries (subject was lost).
authorMartin Blumenthal <tinu@humbapa.ch>
Thu, 4 Jun 2009 15:03:14 +0000 (17:03 +0200)
committerMartin Blumenthal <tinu@humbapa.ch>
Thu, 4 Jun 2009 15:03:14 +0000 (17:03 +0200)
skoli/entry.php
skoli/lib/Driver.php
skoli/lib/Forms/Entry.php
skoli/lib/School.php

index 780bae8..3d971de 100644 (file)
@@ -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');
index bbd3013..6c536cc 100644 (file)
@@ -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;
         }
index 6cc1f4d..9943738 100644 (file)
@@ -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));
index 0f82ea9..d72d83e 100644 (file)
@@ -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;