Merge branch '2013.10'
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 6 Dec 2013 11:01:20 +0000 (12:01 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 6 Dec 2013 11:01:20 +0000 (12:01 +0100)
Conflicts:
tests/tine20/Calendar/TestCase.php

89 files changed:
bin/tn.php
docs/ext-doc.xml
tests/tine20/Calendar/Backend/SqlTest.php
tests/tine20/Calendar/Controller/EventGrantsTests.php
tests/tine20/Calendar/Controller/EventNotificationsTests.php
tests/tine20/Calendar/Controller/EventTests.php
tests/tine20/Calendar/Controller/MSEventFacadeTest.php
tests/tine20/Calendar/Controller/RecurTest.php
tests/tine20/Calendar/Controller/ResourceTest.php
tests/tine20/Calendar/Frontend/WebDAV/EventTest.php
tests/tine20/Calendar/Import/ICalTest.php
tests/tine20/Calendar/JsonTests.php
tests/tine20/Calendar/Model/AttenderFilterTests.php
tests/tine20/Calendar/Model/AttenderTests.php
tests/tine20/Calendar/TestCase.php
tests/tine20/Courses/JsonTest.php
tests/tine20/Felamimail/Controller/AccountTest.php
tests/tine20/Sales/ControllerTest.php
tests/tine20/Sales/JsonTest.php
tests/tine20/Tasks/Convert/Task/VCalendar/EMClientTest.php
tine20/ActiveSync/Setup/setup.xml
tine20/Addressbook/Import/definitions/adb_tine_import_csv.xml
tine20/Addressbook/css/Addressbook.css
tine20/Admin/css/Admin.css
tine20/Calendar/Setup/setup.xml
tine20/Calendar/css/Calendar.css
tine20/Calendar/css/daysviewpanel.css
tine20/Calendar/css/monthviewpanel.css
tine20/Calendar/css/print.css
tine20/Felamimail/Controller.php
tine20/Felamimail/css/Felamimail.css
tine20/HumanResources/Config.php
tine20/HumanResources/Frontend/WebDAV.php [new file with mode: 0644]
tine20/HumanResources/Frontend/WebDAV/Container.php [new file with mode: 0644]
tine20/HumanResources/Frontend/WebDAV/Directory.php [new file with mode: 0644]
tine20/HumanResources/Frontend/WebDAV/File.php [new file with mode: 0644]
tine20/HumanResources/Setup/Initialize.php
tine20/HumanResources/Setup/Update/Release8.php
tine20/HumanResources/Setup/setup.xml
tine20/Phone/Setup/setup.xml
tine20/Projects/Model/Project.php
tine20/RequestTracker/css/RequestTracker.css
tine20/Sales/Acl/Rights.php
tine20/Sales/Controller/CostCenter.php
tine20/Sales/Frontend/Json.php
tine20/Sales/Model/CostCenter.php
tine20/Sales/Sales.jsb2
tine20/Sales/Setup/Update/Release8.php
tine20/Sales/Setup/setup.xml
tine20/Sales/js/CostCenterEditDialog.js [new file with mode: 0644]
tine20/Sales/js/CostCenterGridPanel.js [new file with mode: 0644]
tine20/Sales/js/Models.js
tine20/Sales/js/Sales.js
tine20/Sales/translations/de.po
tine20/Sales/translations/template.pot
tine20/SimpleFAQ/Model/Faq.php
tine20/Sipgate/Model/Line.php
tine20/Tasks/Convert/Task/VCalendar/EMClient.php
tine20/Tasks/Frontend/WebDAV/Container.php
tine20/Tasks/css/Tasks.css
tine20/Timetracker/Setup/setup.xml
tine20/Tinebase/Auth/ModSsl/Certificate/X509.php
tine20/Tinebase/Container.php
tine20/Tinebase/EmailUser/Sql.php
tine20/Tinebase/Frontend/Json/Abstract.php
tine20/Tinebase/ImportExportDefinition.php
tine20/Tinebase/css/SmallForms.css
tine20/Tinebase/css/Tinebase.css
tine20/Tinebase/css/ux/ArrowCollapse.css
tine20/Tinebase/css/ux/DatePickerWeekPlugin.css
tine20/Tinebase/css/ux/SubFormPanel.css
tine20/Tinebase/css/ux/display/DisplayPanel.css
tine20/Tinebase/css/ux/form/HtmlEditor.css
tine20/Tinebase/css/ux/form/Spinner.css
tine20/Tinebase/css/widgets/EditRecord.css
tine20/Tinebase/css/widgets/FilterToolbar.css
tine20/Tinebase/css/widgets/TagsPanel.css
tine20/Tinebase/js/data/MemoryBackend.js
tine20/Tinebase/js/ux/Printer/print.css
tine20/Voipmanager/Setup/setup.xml
tine20/build.xml
tine20/config.inc.php.dist
tine20/images/scalable/call-forward.svg
tine20/images/scalable/call-incoming.svg
tine20/images/scalable/call-missed.svg
tine20/images/scalable/call-outgoing.svg
tine20/library/jsb2tk/tests/core/core.jsb2
tine20/library/jsb2tk/tests/modul/modul.jsb2
tine20/themes/tine20/resources/css/layout.css

index b03c5c5..11be706 100644 (file)
@@ -15,28 +15,28 @@ main();
 
 function main()
 {
-       prepareEnvironment();
-       
-       try {
-               $opts = new Zend_Console_Getopt(array(
-                               'create application|a=s'=>'create application option with required string parameter',
-                               'help'=>'help option with no required parameter'
-               )
-               );
-               $opts->parse();
-       } catch (Zend_Console_Getopt_Exception $e) {
-               echo $e->getUsageMessage();
-               exit;
-       }
+    prepareEnvironment();
 
-       if ($applicationName = $opts->getOption('a'))
-       {
-               create(APPLICATION, array($applicationName));
-               echo "Application $applicationName was created successfully into tine20 folder! \n";
-               exit;
-       }
-       echo $e->getUsageMessage();
-       exit;
+    try {
+        $opts = new Zend_Console_Getopt(array(
+                'create application|a=s'=>'create application option with required string parameter',
+                'help'=>'help option with no required parameter'
+        )
+        );
+        $opts->parse();
+    } catch (Zend_Console_Getopt_Exception $e) {
+        echo $e->getUsageMessage();
+        exit;
+    }
+
+    if ($applicationName = $opts->getOption('a'))
+    {
+        create(APPLICATION, array($applicationName));
+        echo "Application $applicationName was created successfully into tine20 folder! \n";
+        exit;
+    }
+    echo $e->getUsageMessage();
+    exit;
 }
 
 /**
@@ -44,17 +44,17 @@ function main()
  */
 function prepareEnvironment()
 {
-       $paths = array(
-                       realpath(dirname(__FILE__) . '/../tine20'),
-                       realpath(dirname(__FILE__) . '/../tine20/library'),
-                       get_include_path()
-       );
-       set_include_path(implode(PATH_SEPARATOR, $paths));
+    $paths = array(
+            realpath(dirname(__FILE__) . '/../tine20'),
+            realpath(dirname(__FILE__) . '/../tine20/library'),
+            get_include_path()
+    );
+    set_include_path(implode(PATH_SEPARATOR, $paths));
 
-       require_once 'Zend/Loader/Autoloader.php';
-       $autoloader = Zend_Loader_Autoloader::getInstance();
-       $autoloader->setFallbackAutoloader(true);
-       Tinebase_Autoloader::initialize($autoloader);
+    require_once 'Zend/Loader/Autoloader.php';
+    $autoloader = Zend_Loader_Autoloader::getInstance();
+    $autoloader->setFallbackAutoloader(true);
+    Tinebase_Autoloader::initialize($autoloader);
 }
 
 /**
@@ -62,11 +62,11 @@ function prepareEnvironment()
  * @param string $builder
  */
 function create($builder, array $args)
-{      
-       // last argument is path of Tine 2.0
-       $args[] = realpath(dirname(__FILE__) . '/../tine20');
+{
+    // last argument is path of Tine 2.0
+    $args[] = realpath(dirname(__FILE__) . '/../tine20');
 
-       $className = 'Tool_CodeGenerator_' . $builder;
-       $tcg = new $className();
-       $tcg->build($args);
-}
\ No newline at end of file
+    $className = 'Tool_CodeGenerator_' . $builder;
+    $tcg = new $className();
+    $tcg->build($args);
+}
index 8f70a4d..a3003ae 100644 (file)
@@ -1,48 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<doc>\r
-    <sources>\r
-        <!-- <source src="../tine20/library/ExtJS/src" match="*.js"/> -->\r
-\r
-\r
-               <source src="../tine20/Tinebase/js/" match="*.js"/>\r
-\r
-\r
-        <source src="../tine20/Addressbook/js/ContactGrid.js"/>\r
-        <source src="../tine20/Addressbook/js/SearchCombo.js"/>\r
-        <!-- <source src="../tine20/Admin/js/UserEditDialog.js"/> -->\r
-        <!-- <source src="../tine20/Calendar/js" match="*.js"/> -->\r
-        <source src="../tine20/Calendar/js/AttendeeGridPanel.js"/>\r
-        <source src="../tine20/Calendar/js/Calendar.js"/>\r
-        <source src="../tine20/Calendar/js/CalendarPanel.js"/>\r
-        <source src="../tine20/Calendar/js/CalendarSelectWidget.js"/>\r
-        <source src="../tine20/Calendar/js/ColorManager.js"/>\r
-        <source src="../tine20/Calendar/js/DaysView.js"/>\r
-        <source src="../tine20/Calendar/js/EventEditDialog.js"/> \r
-        <!-- <source src="../tine20/Calendar/js/EventSelectionModel.js"/> \r
-        <source src="../tine20/Calendar/js/EventUI.js"/> \r
-        <source src="../tine20/Calendar/js/MainScreenCenterPanel.js"/> -->\r
-        <source src="../tine20/Calendar/js/Model.js"/>\r
-        <!-- <source src="../tine20/Calendar/js/MonthView.js"/> \r
-        <source src="../tine20/Calendar/js/PagingToolbar.js"/> \r
-        <source src="../tine20/Calendar/js/ParallelEventsRegistry.js"/> \r
-        <source src="../tine20/Calendar/js/RrulePanel.js"/> -->\r
-        <source src="../tine20/Crm/js" match="*.js"/>\r
-        <source src="../tine20/ExampleApplication/js/ExampleRecordGridPanel.js"/>\r
-        <source src="../tine20/ExampleApplication/js/ExampleRecordEditDialog.js"/>\r
-        <source src="../tine20/Felamimail/js" match="*.js"/>\r
-        <source src="../tine20/Sales/js" match="*.js"/>\r
-               <!-- <source src="../tine20/Setup/js" match="*.js"/> -->\r
-        <!-- <source src="../tine20/Tasks/js/EditDialog.js"/> -->\r
-        <source src="../tine20/Tasks/js/GridPanel.js"/>\r
-        <source src="../tine20/Timetracker/js/TimesheetGridPanel.js"/>\r
-        <source src="../tine20/Timetracker/js/TimeaccountGridPanel.js"/>\r
-    </sources>\r
-    <tags>\r
-        <tag name="author" title="Author"/>\r
-        <tag name="copyright" title="Copyright"/>\r
-        <tag name="license" title="License"/>\r
-        <tag name="version" title="Version"/>\r
-        <tag name="note" format="&lt;i&gt;NOTE: {0}&lt;/i&gt;"/>\r
-        <tag name="demo" title="Demo" format="&lt;a href=&quot;{0}&quot;&gt;{0}&lt;/a&gt;" />   \r
-       </tags>\r
-</doc>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<doc>
+    <sources>
+        <!-- <source src="../tine20/library/ExtJS/src" match="*.js"/> -->
+
+        <source src="../tine20/Tinebase/js/" match="*.js"/>
+
+        <source src="../tine20/Addressbook/js/ContactGrid.js"/>
+        <source src="../tine20/Addressbook/js/SearchCombo.js"/>
+        <!-- <source src="../tine20/Admin/js/UserEditDialog.js"/> -->
+        <!-- <source src="../tine20/Calendar/js" match="*.js"/> -->
+        <source src="../tine20/Calendar/js/AttendeeGridPanel.js"/>
+        <source src="../tine20/Calendar/js/Calendar.js"/>
+        <source src="../tine20/Calendar/js/CalendarPanel.js"/>
+        <source src="../tine20/Calendar/js/CalendarSelectWidget.js"/>
+        <source src="../tine20/Calendar/js/ColorManager.js"/>
+        <source src="../tine20/Calendar/js/DaysView.js"/>
+        <source src="../tine20/Calendar/js/EventEditDialog.js"/> 
+        <!-- <source src="../tine20/Calendar/js/EventSelectionModel.js"/> 
+        <source src="../tine20/Calendar/js/EventUI.js"/> 
+        <source src="../tine20/Calendar/js/MainScreenCenterPanel.js"/> -->
+        <source src="../tine20/Calendar/js/Model.js"/>
+        <!-- <source src="../tine20/Calendar/js/MonthView.js"/> 
+        <source src="../tine20/Calendar/js/PagingToolbar.js"/> 
+        <source src="../tine20/Calendar/js/ParallelEventsRegistry.js"/> 
+        <source src="../tine20/Calendar/js/RrulePanel.js"/> -->
+        <source src="../tine20/Crm/js" match="*.js"/>
+        <source src="../tine20/ExampleApplication/js/ExampleRecordGridPanel.js"/>
+        <source src="../tine20/ExampleApplication/js/ExampleRecordEditDialog.js"/>
+        <source src="../tine20/Felamimail/js" match="*.js"/>
+        <source src="../tine20/Sales/js" match="*.js"/>
+        <!-- <source src="../tine20/Setup/js" match="*.js"/> -->
+        <!-- <source src="../tine20/Tasks/js/EditDialog.js"/> -->
+        <source src="../tine20/Tasks/js/GridPanel.js"/>
+        <source src="../tine20/Timetracker/js/TimesheetGridPanel.js"/>
+        <source src="../tine20/Timetracker/js/TimeaccountGridPanel.js"/>
+    </sources>
+    <tags>
+        <tag name="author" title="Author"/>
+        <tag name="copyright" title="Copyright"/>
+        <tag name="license" title="License"/>
+        <tag name="version" title="Version"/>
+        <tag name="note" format="&lt;i&gt;NOTE: {0}&lt;/i&gt;"/>
+        <tag name="demo" title="Demo" format="&lt;a href=&quot;{0}&quot;&gt;{0}&lt;/a&gt;" />   
+    </tags>
+</doc>
index 7884d66..f4d4eef 100644 (file)
@@ -102,7 +102,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-02 23:59:59',
                 'summary'      => 'non recur event ending before search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -112,7 +112,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-03 00:30:00',
                 'summary'      => 'non recur event ending within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -122,7 +122,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-07 12:00:00',
                 'summary'      => 'non recur event completly within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -132,7 +132,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-11 00:30:00',
                 'summary'      => 'non recur event starting within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -142,7 +142,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-11 02:00:00',
                 'summary'      => 'non recur event starting after search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -153,7 +153,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-02 23:59:59',
                 'summary'      => 'recur event ending before search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-02 23:59:59',
@@ -165,7 +165,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-05 23:59:59',
                 'summary'      => 'recur event ending within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-05 23:59:59',
@@ -177,7 +177,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-06 23:59:59',
                 'summary'      => 'recur event completly within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-06 23:59:59',
@@ -189,7 +189,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-12 23:59:59',
                 'summary'      => 'recur event starting within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-12 23:59:59',
@@ -201,7 +201,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-15 02:00:00',
                 'summary'      => 'recur event starting after search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-15 02:00:00',
@@ -218,7 +218,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
         }
         
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period'      , 'operator' => 'within', 'value' => array(
                 'from'  => $from,
                 'until' => $until
index 8527c2f..95a766a 100644 (file)
@@ -61,7 +61,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
      */
     public function testAddPersonalCalendarGrants()
     {
-        $grants = Tinebase_Container::getInstance()->getGrantsOfContainer($this->_testCalendar->getId(), TRUE);
+        $grants = Tinebase_Container::getInstance()->getGrantsOfContainer($this->_getTestCalendar()->getId(), TRUE);
         $anyoneIdx = array_search(Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE, $grants->account_type);
         $this->assertTrue($anyoneIdx !== false, 'anyone has no grant entry');
         $this->assertTrue($grants[$anyoneIdx]->{Tinebase_Model_Grants::GRANT_FREEBUSY}, 'anyone has not freebusy grant');
@@ -185,7 +185,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $persistentEvent = $this->_createEventInPersonasCalendar('rwright', 'rwright', 'sclever');
         
         $loadedEvent = $this->_uit->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => "/personal/{$this->_personas['sclever']->getId()}"),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => "/personal/{$this->_getPersona('sclever')->getId()}"),
             array('field' => 'id', 'operator' => 'equals', 'value' => $persistentEvent->getId())
         )))->getFirstRecord();
         
@@ -341,8 +341,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
     public function testFreeBusyViaAttendee()
     {
         // whipe grants from jmcblack
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['jmcblack'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['jmcblack']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('jmcblack'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('jmcblack')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -362,7 +362,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
                         array('field' => 'id', 'operator' => 'equals', 'value' => $persistentEvent->getId()),
                         array('field' => 'attender', 'operator' => 'in', 'value' => array(array(
                             'user_type' => 'user',
-                            'user_id'   => $this->_personas['rwright']->contact_id,
+                            'user_id'   => $this->_getPersona('rwright')->contact_id,
                         ))),
                     )
                 )
@@ -386,7 +386,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
 //            array('field' => 'attender', 'operator' => 'in', 'value' => array(
 //                array(
 //                    'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-//                    'user_id'   => $this->_personasContacts['rwright']->getId()
+//                    'user_id'   => $this->_getPersonasContacts('rwright')->getId()
 //                )
 //            ))
 //        )), NULL, FALSE, FALSE);
@@ -425,7 +425,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $persistentEvent = $this->_createEventInPersonasCalendar('rwright', 'rwright');
         
         // for shure, this is esoteric, but it enshures that record GRANTS are in charge
-        Tinebase_Container::getInstance()->setGrants($this->_testCalendar, new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+        Tinebase_Container::getInstance()->setGrants($this->_getTestCalendar(), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
             'account_id'    => Tinebase_Core::getUser()->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_FREEBUSY => FALSE,
@@ -470,8 +470,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $this->markTestIncomplete('temporarily disabled until fixed');
         
         // set testuser to have editgrant for sclever
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['sclever'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('sclever'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -514,9 +514,9 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
     
     protected function _createEventInPersonasCalendar($_calendarPersona, $_organizerPersona = NULL, $_attenderPersona = NULL, $_classification = Calendar_Model_Event::CLASS_PUBLIC)
     {
-        $calendarId  = $this->_personasDefaultCals[$_calendarPersona]->getId();
-        $organizerId = $_organizerPersona ? $this->_personasContacts[$_organizerPersona]->getId() : $this->_testUserContact->getId();
-        $attenderId  = $_attenderPersona ? $this->_personasContacts[$_attenderPersona]->getId() : $this->_testUserContact->getId();
+        $calendarId  = $this->_getPersonasDefaultCals($_calendarPersona)->getId();
+        $organizerId = $_organizerPersona ? $this->_getPersonasContacts($_organizerPersona)->getId() : $this->_getTestUserContact()->getId();
+        $attenderId  = $_attenderPersona ? $this->_getPersonasContacts($_attenderPersona)->getId() : $this->_getTestUserContact()->getId();
         
         $event = $this->_getEvent();
         $event->class = $_classification;
@@ -549,8 +549,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
     protected function _setupTestCalendars()
     {
         // jsmith:     anyone freebusyGrant, readGrant, addGrant, editGrant, deleteGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['jsmith'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['jsmith']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('jsmith'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('jsmith')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -571,8 +571,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // pwulf:      anyone readGrant, sclever addGrant, readGrant, editGrant, deleteGrant, privateGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['pwulf'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['pwulf']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('pwulf'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('pwulf')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -590,7 +590,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
             Tinebase_Model_Grants::GRANT_DELETE   => false,
             Tinebase_Model_Grants::GRANT_ADMIN    => false,
         ), array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -601,8 +601,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // sclever:   testuser addGrant, readGrant, editGrant, deleteGrant, privateGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['sclever'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('sclever'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -623,8 +623,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // jmacblack: prim group of testuser readGrant, testuser privateGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['jmcblack'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['jmcblack']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('jmcblack'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('jmcblack')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -653,8 +653,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // rwright:   testuser freebusyGrant, sclever has readGrant and editGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['rwright'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['rwright']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('rwright'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('rwright')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -674,7 +674,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
             Tinebase_Model_Grants::GRANT_ADMIN    => false,
             Tinebase_Model_Grants::GRANT_FREEBUSY => true,
         ), array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => false,
@@ -689,9 +689,9 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
      */
     protected function cleanupTestCalendars()
     {
-        foreach ($this->_personasDefaultCals as $loginName => $calendar) {
+        foreach ($this->_getAllPersonasDefaultCals() as $loginName => $calendar) {
             Tinebase_Container::getInstance()->setGrants($calendar, new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-                'account_id'    => $this->_personas[$loginName]->getId(),
+                'account_id'    => $this->_getPersona($loginName)->getId(),
                 'account_type'  => 'user',
                 Tinebase_Model_Grants::GRANT_READ     => true,
                 Tinebase_Model_Grants::GRANT_ADD      => true,
index 78b03b9..bc6574e 100644 (file)
@@ -37,8 +37,8 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     
     /**
      * @var Tinebase_Model_Container
-     */
-    protected $_testCalendar;
+     *
+    protected $_testCalendar;*/
     
    /**
     * email test class
@@ -164,11 +164,11 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         
         $persistentEvent->attendee->merge($this->_getPersonaAttendee('jsmith, sclever'));
         $persistentEvent->attendee->removeRecord(
-            $persistentEvent->attendee->find('user_id', $this->_personasContacts['pwulf']->getId())
+            $persistentEvent->attendee->find('user_id', $this->_getPersonasContacts('pwulf')->getId())
         );
-        $persistentEvent->attendee->find('user_id', $this->_personasContacts['rwright']->getId())->status =
+        $persistentEvent->attendee->find('user_id', $this->_getPersonasContacts('rwright')->getId())->status =
             Calendar_Model_Attender::STATUS_ACCEPTED;
-        $persistentEvent->attendee->find('user_id', $this->_personasContacts['jmcblack']->getId())->status =
+        $persistentEvent->attendee->find('user_id', $this->_getPersonasContacts('jmcblack')->getId())->status =
             Calendar_Model_Attender::STATUS_DECLINED;
             
         self::flushMailer();
@@ -241,7 +241,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('jsmith, pwulf');
-        $event->organizer = $this->_personasContacts['jsmith']->getId();
+        $event->organizer = $this->_getPersonasContacts('jsmith')->getId();
         $persistentEvent = $this->_eventController->create($event);
         
         $persistentEvent->attendee[1]->status = Calendar_Model_Attender::STATUS_DECLINED;
@@ -258,7 +258,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent(TRUE);
         $event->attendee = $this->_getPersonaAttendee('jsmith, pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         $persistentEvent = $this->_eventController->create($event);
         
         $persistentEvent->attendee[1]->status = Calendar_Model_Attender::STATUS_DECLINED;
@@ -276,7 +276,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent(TRUE);
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         // add nonaccount attender
         $nonAccountEmail = 'externer@example.org';
@@ -313,7 +313,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
             if (in_array($nonAccountEmail, $message->getRecipients())) {
                 $foundNonAccountMessage = TRUE;
             }
-            if (in_array($this->_personas['pwulf']->accountEmailAddress, $message->getRecipients())) {
+            if (in_array($this->_getPersona('pwulf')->accountEmailAddress, $message->getRecipients())) {
                 $foundPWulfMessage = TRUE;
             }
         }
@@ -335,7 +335,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
                 'dtstart'       => '2012-03-14 09:00:00',
                 'dtend'         => '2012-03-14 10:00:00',
                 'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
                 'attendee'      => $this->_getPersonaAttendee('jmcblack'),
         ));
         
@@ -388,7 +388,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('sclever, pwulf');
-        $event->organizer = $this->_personasContacts['sclever']->getId();
+        $event->organizer = $this->_getPersonasContacts('sclever')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addMinute(25);
         $event->dtend = clone $event->dtstart;
@@ -403,7 +403,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         $event->alarms->setOption('skip', array(
             array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_personasContacts['pwulf']->getId(),
+                'user_id'   => $this->_getPersonasContacts('pwulf')->getId(),
             )
         ));
         
@@ -420,7 +420,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('sclever, pwulf');
-        $event->organizer = $this->_personasContacts['sclever']->getId();
+        $event->organizer = $this->_getPersonasContacts('sclever')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addMinute(25);
         $event->dtend = clone $event->dtstart;
@@ -432,7 +432,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         ));
         $event->alarms->setOption('attendee', array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId()
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
         ));
         
         Tinebase_Alarm::getInstance()->sendPendingAlarms("Tinebase_Event_Async_Minutely");
@@ -565,7 +565,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         // lets flush mailer so next flushing ist faster!
         Tinebase_Alarm::getInstance()->sendPendingAlarms("Tinebase_Event_Async_Minutely");
@@ -615,7 +615,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->subDay(1)->addMinute(15);
         $event->dtend = clone $event->dtstart;
@@ -664,7 +664,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addWeek(1)->addMinute(15);
         $event->dtend = clone $event->dtstart;
@@ -736,7 +736,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
             'summary'      => 'Cleanup',
             'dtstart'      => '2012-01-31 07:30:00',
             'dtend'        => '2012-01-31 10:30:00',
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             'uid'          => Calendar_Model_Event::generateUID(),
             'rrule'        => 'FREQ=WEEKLY;INTERVAL=1;WKST=MO;BYDAY=TU',
             'originator_tz'=> 'Europe/Berlin',
@@ -758,7 +758,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('sclever, pwulf');
-        $event->organizer = $this->_personasContacts['sclever']->getId();
+        $event->organizer = $this->_getPersonasContacts('sclever')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addMinute(25);
         $event->dtend = clone $event->dtstart;
@@ -1066,7 +1066,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         
         foreach (explode(',', $_personas) as $personaName) {
             $mailsForPersona = array();
-            $personaEmail = $this->_personas[trim($personaName)]->accountEmailAddress;
+            $personaEmail = $this->_getPersona(trim($personaName))->accountEmailAddress;
             
             foreach ($messages as $message) {
                 if (array_value(0, $message->getRecipients()) == $personaEmail) {
@@ -1122,7 +1122,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender');
         foreach (explode(',', $_personas) as $personaName) {
-            $attendee->addRecord($this->_createAttender($this->_personasContacts[trim($personaName)]->getId()));
+            $attendee->addRecord($this->_createAttender($this->_getPersonasContacts(trim($personaName))->getId()));
         }
         
         return $attendee;
@@ -1162,32 +1162,32 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_NONE,
-            $this->_personas['jsmith']->getId(), TRUE
+            $this->_getPersona('jsmith')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_INVITE_CANCEL,
-            $this->_personas['pwulf']->getId(), TRUE
+            $this->_getPersona('pwulf')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE,
-            $this->_personas['sclever']->getId(), TRUE
+            $this->_getPersona('sclever')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_UPDATE,
-            $this->_personas['jmcblack']->getId(), TRUE
+            $this->_getPersona('jmcblack')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_ATTENDEE_STATUS_UPDATE,
-            $this->_personas['rwright']->getId(), TRUE
+            $this->_getPersona('rwright')->getId(), TRUE
         );
         
         // set all languages to en
         $preferences = Tinebase_Core::getPreference('Tinebase');
-        foreach ($this->_personas as $name => $account) {
+        foreach ($this->_getPersonas() as $name => $account) {
             $preferences->setValueForUser(Tinebase_Preference::LOCALE, 'en', $account->getId(), TRUE);
         }
     }
index 5230e0c..d629798 100644 (file)
@@ -27,8 +27,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
     
     /**
      * @var Tinebase_Model_Container
-     */
-    protected $_testCalendar;
+     *
+    protected $_testCalendar; */
     
     /**
      * (non-PHPdoc)
@@ -149,7 +149,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event->attendee = $this->_getAttendee();
         $event->attendee[1] = new Calendar_Model_Attender(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId(),
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -177,7 +177,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             
         $pwulf = $updatedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_USER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId())
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId())
             ->getFirstRecord();
 
         $this->assertEquals(Calendar_Model_Attender::STATUS_DECLINED, $currentUser->status, 'current users status must not be touched');
@@ -208,7 +208,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event->attendee = $this->_getAttendee();
         $event->attendee[1] = new Calendar_Model_Attender(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId()
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
         ));
         
         $persistendEvent = $this->_controller->create($event);
@@ -232,30 +232,30 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event1 = $this->_getEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $persistentEvent1 = $this->_controller->create($event1);
         
         $event2 = $this->_getEvent();
         $event2->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['sclever']->getId()),
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId()),
         ));
         $persistentEvent2 = $this->_controller->create($event2);
         
         $event3 = $this->_getEvent();
         $event3->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['sclever']->getId()),
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId()),
         ));
         $persistentEvent3 = $this->_controller->create($event3);
         
         // test sclever
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'equals', 'value' => array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_personasContacts['sclever']->getId()
+                'user_id'   => $this->_getPersonasContacts('sclever')->getId()
             )),
         ));
         $eventsFound = $this->_controller->search($filter, new Tinebase_Model_Pagination());
@@ -263,10 +263,10 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         // test pwulf
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'equals', 'value' => array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_personasContacts['pwulf']->getId()
+                'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
             )),
         ));
         $eventsFound = $this->_controller->search($filter, new Tinebase_Model_Pagination());
@@ -274,15 +274,15 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         // test sclever OR pwulf
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'in',     'value' => array(
                 array(
                     'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                    'user_id'   => $this->_personasContacts['sclever']->getId()
+                    'user_id'   => $this->_getPersonasContacts('sclever')->getId()
                 ),
                 array (
                     'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                    'user_id'   => $this->_personasContacts['pwulf']->getId()
+                    'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
                 )
             )),
         ));
@@ -295,16 +295,16 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event = $this->_getEvent();
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['sclever']->getId())
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId())
         ));
         $persistentEvent = $this->_controller->create($event);
         
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'in',     'value' => array(
                 array(
                     'user_type' => Calendar_Model_AttenderFilter::USERTYPE_MEMBEROF,
-                    'user_id'   => $this->_personas['sclever']->accountPrimaryGroup
+                    'user_id'   => $this->_getPersona('sclever')->accountPrimaryGroup
                 )
             )),
         ));
@@ -316,8 +316,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $persistentEvent = $this->_controller->create($event);
         
@@ -346,7 +346,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId()
         ), true));
         
-        $this->_testCalendars->addRecord($testCal);
+        $this->_getTestCalendars()->addRecord($testCal);
         
         // create event in testcal
         $event = $this->_getEvent();
@@ -361,7 +361,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
             array('field' => 'attender', 'operator' => 'equals', 'value' => array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_testUserContact->getId()
+                'user_id'   => $this->_getTestUserContact()->getId()
             ))
         )), NULL, FALSE, FALSE);
         
@@ -374,15 +374,15 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $event = $this->_getEvent();
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $persistentEvent = $this->_controller->create($event);
         
         $conflictEvent = $this->_getEvent();
         $conflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         try {
@@ -409,8 +409,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $conflictEvent = $this->_getEvent();
         $conflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         try {
@@ -434,8 +434,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $nonConflictEvent = $this->_getEvent();
         $nonConflictEvent->transp = Calendar_Model_Event::TRANSP_TRANSP;
         $nonConflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->_controller->create($nonConflictEvent, TRUE);
@@ -450,8 +450,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $nonConflictEvent = $this->_getEvent();
         $nonConflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->_controller->create($nonConflictEvent, TRUE);
@@ -647,10 +647,10 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         // assert test condition
         $pwulf = $persistentEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(0, count($pwulf), 'invalid test condition, pwulf should not be member or admin group');
         
-        Admin_Controller_Group::getInstance()->addGroupMember($defaultAdminGroup->getId(), $this->_personasContacts['pwulf']->account_id);
+        Admin_Controller_Group::getInstance()->addGroupMember($defaultAdminGroup->getId(), $this->_getPersonasContacts('pwulf')->account_id);
         if (isset(Tinebase_Core::getConfig()->actionqueue)) {
             Tinebase_ActionQueue::getInstance()->processQueue(10000);
         }
@@ -659,11 +659,11 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         // assert pwulf is in
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(1, count($pwulf), 'pwulf is not attender of event, but should be');
         
         
-        Admin_Controller_Group::getInstance()->removeGroupMember($defaultAdminGroup->getId(), $this->_personasContacts['pwulf']->account_id);
+        Admin_Controller_Group::getInstance()->removeGroupMember($defaultAdminGroup->getId(), $this->_getPersonasContacts('pwulf')->account_id);
         if (isset(Tinebase_Core::getConfig()->actionqueue)) {
             Tinebase_ActionQueue::getInstance()->processQueue(10000);
         }
@@ -672,7 +672,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         // assert pwulf is missing
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(0, count($pwulf), 'pwulf is attender of event, but not should be');
         
         // Test the same with update
@@ -687,7 +687,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $loadedEvent = $this->_controller->get($persistentEvent->getId());
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(1, count($pwulf), 'pwulf is not attender of event, but should be (via update)');
         
         $group->members = array_diff(Admin_Controller_Group::getInstance()->getGroupMembers($defaultAdminGroup->getId()), array(array_value('pwulf', Zend_Registry::get('personas'))->getId()));
@@ -699,7 +699,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $loadedEvent = $this->_controller->get($persistentEvent->getId());
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(0, count($pwulf), 'pwulf is attender of event, but not should be');
     }
     
@@ -813,7 +813,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         }
         
         $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )), new Tinebase_Model_Pagination(array()));
         
         $oldSeries = $events->filter('rrule_until', '/.+/', TRUE)->getFirstRecord();
@@ -838,7 +838,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         }
         
         $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )), new Tinebase_Model_Pagination(array()));
         
         $newSeries = $events->filter('rrule_until', '/^$/', TRUE)->getFirstRecord();
@@ -917,7 +917,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-02 21:59:59',
             'exdate'        => '2009-03-27 18:00:00,2009-03-31 17:00:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
@@ -996,7 +996,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $this->_controller->delete($persistentEvent->getId());
         
-        $contentSeq = Tinebase_Container::getInstance()->getContentSequence($this->_testCalendar);
+        $contentSeq = Tinebase_Container::getInstance()->getContentSequence($this->_getTestCalendar());
         $this->assertEquals(2, $contentSeq, 'container content seq should be increased 2 times!');
         
         $this->setExpectedException('Tinebase_Exception_NotFound');
@@ -1206,7 +1206,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $persistentEvent = $this->testCreateEvent();
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array(
                 'from'  => '2009-04-07',
                 'until' => '2010-04-07'
@@ -1229,7 +1229,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'dtend'       => '2009-04-06 13:30:00',
             'description' => 'Wieslaw Brudzinski: Das Gesetz garantiert zwar die Mittagspause, aber nicht das Mittagessen...',
         
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT    => true,
         ));
         
index 119458d..1ba613d 100644 (file)
@@ -53,22 +53,22 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         ), TRUE);
         $event->alarms[0]->setOption('skip', array(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_testUserContact->getId(),
+            'user_id'   => $this->_getTestUserContact()->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         )));
         $event->alarms[1]->setOption('attendee', array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_testUserContact->getId(),
+            'user_id'   => $this->_getTestUserContact()->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         ));
         $event->alarms[2]->setOption('skip', array(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId(),
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         )));
         $event->alarms[3]->setOption('attendee', array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId(),
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         ));
         
@@ -125,7 +125,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $this->testCreate();
         
         $events = $this->_uit->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )));
         
         $this->assertEquals(1, $events->count());
@@ -141,7 +141,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $cbe->delete($event->getId());
         
         $events = $this->_uit->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )));
         
         $this->assertEquals(1, $events->count());
@@ -167,7 +167,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $this->_assertTestEvent($event);
         
         $sclever = new Calendar_Model_Attender(array(
-            'user_id'        => $this->_personasContacts['sclever']->getId(),
+            'user_id'        => $this->_getPersonasContacts('sclever')->getId(),
             'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
         ));
         
@@ -200,7 +200,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $event = $this->testCreate();
         
         $sclever = new Calendar_Model_Attender(array(
-            'user_id'        => $this->_personasContacts['sclever']->getId(),
+            'user_id'        => $this->_getPersonasContacts('sclever')->getId(),
             'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
         ));
         $currUser = $this->_uit->setCalendarUser($sclever);
@@ -368,7 +368,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $persistentException = $event->exdate->filter('is_deleted', 0)->getFirstRecord();
         
         $sclever = new Calendar_Model_Attender(array(
-            'user_id'        => $this->_personasContacts['sclever']->getId(),
+            'user_id'        => $this->_getPersonasContacts('sclever')->getId(),
             'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
         ));
         
@@ -379,7 +379,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $this->_uit->setEventFilter(new Calendar_Model_EventFilter(array(
             array('field' => 'attender', 'operator' => 'equals', 'value' => array(
                 'user_type'    => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'      => $this->_personasContacts['sclever']->getId(),
+                'user_id'      => $this->_getPersonasContacts('sclever')->getId(),
             )),
             array(
                 'field' => 'attender_status', 'operator' => 'notin', 'value' => array(
index 05fa78c..3863bfa 100644 (file)
@@ -40,7 +40,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-06-01 18:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-05-31 17:30:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $this->setExpectedException('Tinebase_Exception_Record_Validation');
@@ -59,7 +59,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-20 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=3;WKST=SU;BYDAY=TU,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
@@ -72,7 +72,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $persistentEventException = $this->_controller->createRecurException($eventException);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -143,14 +143,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
                 'dtend'         => '2012-02-22 15:30:00',
                 'originator_tz' => 'Europe/Berlin',
                 'rrule'         => 'FREQ=DAILY;COUNT=3',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         // create exception
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents[2]->dtstart->subHour(5);
@@ -159,7 +159,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         // load series
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents->sort('dtstart', 'ASC');
@@ -184,14 +184,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'is_all_day_event'  => true,
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -202,7 +202,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $persistentEventException = $this->_controller->createRecurException($exception, TRUE);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -223,7 +223,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-03-31 17:30:00',
             'exdate'        => '2009-03-27 18:00:00,2009-03-29 17:00:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         $event->attendee = $this->_getAttendee();
@@ -266,7 +266,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-20 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=3;WKST=SU;BYDAY=TU,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         $event->attendee = $this->_getAttendee();
@@ -279,7 +279,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->_controller->attenderStatusCreateRecurException(clone $persistentEvent, $attendee, $attendee->status_authkey);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -297,15 +297,15 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event->dtstart = '2010-05-20 06:00:00';
         $event->dtend = '2010-05-20 06:15:00';
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $this->_controller->create($event);
 
         $event1 = $this->_getRecurEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->setExpectedException('Calendar_Exception_AttendeeBusy');
@@ -321,15 +321,15 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event->dtstart = '2010-05-20 06:00:00';
         $event->dtend = '2010-05-20 06:15:00';
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $this->_controller->create($event);
 
         $event1 = $this->_getRecurEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $event1 = $this->_controller->create($event1);
@@ -351,8 +351,8 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event = $this->_getRecurEvent();
         $event->rrule = "FREQ=MONTHLY;INTERVAL=1;BYDAY=3TH";
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $persistentRecurEvent = $this->_controller->create($event);
@@ -393,7 +393,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
                 'dtstart'       => '2012-03-13 09:00:00',
                 'dtend'         => '2012-03-13 10:00:00',
                 'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
                 'attendee'      => $this->_getAttendee(),
         ));
         
@@ -439,7 +439,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-21 12:00:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-04-27 21:59:59',
-            'container_id'  => $this->_testCalendar->getId()
+            'container_id'  => $this->_getTestCalendar()->getId()
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -476,7 +476,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $newBaseEvent = $this->_controller->createRecurException($recurSet[3], FALSE, TRUE);
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array('from' => $from, 'until' => $until),
         ))));
         
@@ -535,7 +535,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => '2012-02-03 09:00:00',
             'dtend'         => '2012-02-03 10:00:00',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         
@@ -573,7 +573,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-06-01 12:00:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId()
+            'container_id'  => $this->_getTestCalendar()->getId()
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -606,7 +606,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => '2012-02-03 09:00:00',
             'dtend'         => '2012-02-03 10:00:00',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         
@@ -622,7 +622,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->_controller->attenderStatusCreateRecurException($start, $sclever, $sclever->status_authkey, TRUE);
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )))->sort('dtstart', 'ASC');
         
         // assert two baseEvents
@@ -652,7 +652,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         $recurSet[5]->attendee->addRecord(new Calendar_Model_Attender(array(
             'user_type'   => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'     => $this->_personasContacts['pwulf']->getId()
+            'user_id'     => $this->_getPersonasContacts('pwulf')->getId()
         )));
         
         $updatedPersistentEvent = $this->_controller->createRecurException($recurSet[5], FALSE, TRUE);
@@ -673,7 +673,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => $dtstart->toString(),
             'dtend'         => $dtstart->addHour(1)->toString(),
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         return $this->_controller->create($event);
@@ -694,14 +694,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-02-21 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;COUNT=5',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         // create exception
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents[2]->dtstart->subHour(5);
@@ -710,7 +710,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         // load events
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents->sort('dtstart', 'ASC');
@@ -761,7 +761,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'       => '2010-05-20 06:15:00',
             'description' => 'Breakfast',
             'rrule'       => 'FREQ=DAILY;INTERVAL=1',    
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT    => true,
         ));
     }
index 33f2f28..8cdc642 100644 (file)
@@ -71,8 +71,8 @@ class Calendar_Controller_ResourceTest extends Calendar_TestCase
         $persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
         
         // we need to adopt conainer through backend, to bypass rights control
-        $persistentEvent->container_id = $this->_personasDefaultCals['rwright']->getId();
-        $persistentEvent->organizer = $this->_personasContacts['rwright']->getId();
+        $persistentEvent->container_id = $this->_getPersonasDefaultCals('rwright')->getId();
+        $persistentEvent->organizer = $this->_getPersonasContacts('rwright')->getId();
         $this->_backend->update($persistentEvent);
 
         
index 7cf8ce3..716a7d6 100644 (file)
@@ -70,7 +70,7 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
     {
         parent::tearDown();
         
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
+        Tinebase_Core::set(Tinebase_Core::USER, $this->_getTestUser());
     }
     
     /**
@@ -253,15 +253,15 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $vcalendar = self::getVCalendar(dirname(__FILE__) . '/../../Import/files/event_with_persona_attendee.ics');
         
 //         $prefs = new Calendar_Preference();
-//         $prefs->setValueForUser(Calendar_Preference::DEFAULTCALENDAR, '', $this->_personas['pwulf']->getId());
+//         $prefs->setValueForUser(Calendar_Preference::DEFAULTCALENDAR, '', $this->_getPersona('pwulf')->getId());
         
         $id = Tinebase_Record_Abstract::generateUID();
         $event = Calendar_Frontend_WebDAV_Event::create($this->objects['initialContainer'], "$id.ics", $vcalendar);
         
         $event = Calendar_Controller_Event::getInstance()->get($id);
-        $pwulf = $event->attendee->filter('user_id', $this->_personasContacts['pwulf']->getId())->getFirstRecord();
+        $pwulf = $event->attendee->filter('user_id', $this->_getPersonasContacts('pwulf')->getId())->getFirstRecord();
         
-        $this->assertEquals($this->_personasDefaultCals['pwulf']->getId(), $pwulf->displaycontainer_id, 'event not in pwulfs personal calendar');
+        $this->assertEquals($this->_getPersonasDefaultCals('pwulf')->getId(), $pwulf->displaycontainer_id, 'event not in pwulfs personal calendar');
     }
     
     public function testCreateEventMissingOwnAttendee()
@@ -751,7 +751,7 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $exception = Calendar_Model_Rrule::computeNextOccurrence($persistentEvent, $exceptions, new Tinebase_DateTime('20131017T140000'));
         $exception->attendee->addRecord(new Calendar_Model_Attender(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId(),
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId(),
         )));
         $persistentException = Calendar_Controller_Event::getInstance()->createRecurException($exception);
         $persistentEvent = Calendar_Controller_Event::getInstance()->get($persistentEvent->getId());
index f4e1592..4285dfe 100644 (file)
@@ -22,14 +22,14 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportSimpleFromString()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
 
         $icalData = file_get_contents(dirname(__FILE__) . '/files/simple.ics');
         $importer->importData($icalData);
         
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals(6, $events->count(), 'events was not imported');
@@ -42,12 +42,12 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportSimpleFromFile()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/simple.ics');
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals(6, $events->count(), 'events where not imported');
@@ -60,13 +60,13 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportRecur()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/XMAS_DE.ics');
         
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array(
                 'from'  => '2015-12-23 22:00:00',
                 'until' => '2015-12-26 22:00:00'
@@ -79,7 +79,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportHorde()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/horde.ics');
@@ -95,7 +95,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     protected function _checkImport($failMessage = '', $assertNumber = 1)
     {
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals($assertNumber, $events->count(), 'events where not imported ' . $failMessage);
@@ -107,7 +107,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportHordeBroken()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         try {
@@ -121,12 +121,12 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportOutlook12()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/outlook12.ics');
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals(1, $events->count(), 'events where not imported');
@@ -142,7 +142,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
         $this->_testNeedsTransaction();
         
         $cmd = realpath(__DIR__ . "/../../../../tine20/tine20.php") . ' --method Calendar.import ' .
-            'plugin=Calendar_Import_Ical importContainerId=' . $this->_testCalendar->getId() .
+            'plugin=Calendar_Import_Ical importContainerId=' . $this->_getTestCalendar()->getId() .
             ' ' . dirname(__FILE__) . '/files/horde.ics';
         
         $cmd = TestServer::assembleCliCommand($cmd, TRUE);
@@ -162,7 +162,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
         $this->_testNeedsTransaction();
         
         $cmd = realpath(__DIR__ . "/../../../../tine20/tine20.php") . ' --method Calendar.import ' .
-            'plugin=Calendar_Import_Ical forceUpdateExisting=1 importContainerId=' . $this->_testCalendar->getId() .
+            'plugin=Calendar_Import_Ical forceUpdateExisting=1 importContainerId=' . $this->_getTestCalendar()->getId() .
             ' ' . dirname(__FILE__) . '/files/termine.ics';
         
         $cmd = TestServer::assembleCliCommand($cmd, TRUE);
index 7a9c136..6177240 100644 (file)
@@ -54,7 +54,7 @@ class Calendar_JsonTests extends Calendar_TestCase
      */
     public function testCreateEvent($now = FALSE)
     {
-        $scleverDisplayContainerId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $this->_personas['sclever']->getId());
+        $scleverDisplayContainerId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $this->_getPersona('sclever')->getId());
         $contentSeqBefore = Tinebase_Container::getInstance()->getContentSequence($scleverDisplayContainerId);
         
         $eventData = $this->_getEvent($now)->toArray();
@@ -188,7 +188,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         
         $eventData = $event->toArray();
         foreach ($eventData['attendee'] as $key => $attenderData) {
-            if ($eventData['attendee'][$key]['user_id'] != $this->_testUserContact->getId()) {
+            if ($eventData['attendee'][$key]['user_id'] != $this->_getTestUserContact()->getId()) {
                 unset($eventData['attendee'][$key]);
             }
         }
@@ -237,7 +237,7 @@ class Calendar_JsonTests extends Calendar_TestCase
      */
     protected function _getEventFilterArray($containerId = NULL)
     {
-        $containerId = ($containerId) ? $containerId : $this->_testCalendar->getId();
+        $containerId = ($containerId) ? $containerId : $this->_getTestCalendar()->getId();
         return array(
             array('field' => 'container_id', 'operator' => 'equals', 'value' => $containerId),
             array('field' => 'period', 'operator' => 'within', 'value' =>
@@ -261,7 +261,7 @@ class Calendar_JsonTests extends Calendar_TestCase
                 'from'  => '2009-03-25 00:00:00',
                 'until' => '2009-03-25 23:59:59',
             )),
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         );
         
         $searchResultData = $this->_uit->searchEvents($filter, array());
@@ -280,7 +280,7 @@ class Calendar_JsonTests extends Calendar_TestCase
     public function testSearchEventsWithOutPeriodFilter()
     {
         $eventData = $this->testCreateRecurEvent();
-        $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()));
+        $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()));
         
         $searchResultData = $this->_uit->searchEvents($filter, array());
         $returnedFilter = $searchResultData['filter'];
@@ -334,7 +334,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $eventData = $this->testCreateEvent();
         $numAttendee = count($eventData['attendee']);
         $eventData['attendee'][$numAttendee] = array(
-            'user_id' => $this->_personasContacts['pwulf']->getId(),
+            'user_id' => $this->_getPersonasContacts('pwulf')->getId(),
         );
         
         $updatedEventData = $this->_uit->saveEvent($eventData);
@@ -417,7 +417,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $until = $until->get(Tinebase_Record_Abstract::ISO8601LONG);
     
         $filter = array(
-        array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+        array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         array('field' => 'period',       'operator' => 'within', 'value' => array('from' => $from, 'until' => $until)),
         );
     
@@ -444,7 +444,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $until = $until->get(Tinebase_Record_Abstract::ISO8601LONG);
         
         $filter = array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period',       'operator' => 'within', 'value' => array('from' => $from, 'until' => $until)),
         );
         
@@ -486,7 +486,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $until = $until->get(Tinebase_Record_Abstract::ISO8601LONG);
         
         $filter = array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period',       'operator' => 'within', 'value' => array('from' => $from, 'until' => $until)),
         );
         
@@ -529,8 +529,8 @@ class Calendar_JsonTests extends Calendar_TestCase
         }
         
         // sclever has only READ grant
-        Tinebase_Container::getInstance()->setGrants($this->_testCalendar, new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_testUser->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getTestCalendar(), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getTestUser()->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -540,24 +540,25 @@ class Calendar_JsonTests extends Calendar_TestCase
             Tinebase_Model_Grants::GRANT_ADMIN    => true,
             Tinebase_Model_Grants::GRANT_FREEBUSY => true,
         ), array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_FREEBUSY => true,
         ))), TRUE);
         
         $unittestUser = Tinebase_Core::getUser();
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_personas['sclever']);
+        Tinebase_Core::set(Tinebase_Core::USER, $this->_getPersona('sclever'));
         
         // create persistent exception
         $createdException = $this->_uit->createRecurException($persistentException, FALSE, FALSE);
         Tinebase_Core::set(Tinebase_Core::USER, $unittestUser);
         
         $sclever = $this->_findAttender($createdException['attendee'], 'sclever');
+        $defaultCal = $this->_getPersonasDefaultCals('sclever');
         $this->assertEquals('Susan Clever', $sclever['user_id']['n_fn']);
         $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $sclever['status'], 'status mismatch: ' . print_r($sclever, TRUE));
         $this->assertTrue(is_array($sclever['displaycontainer_id']));
-        $this->assertEquals($this->_personasDefaultCals['sclever']['id'], $sclever['displaycontainer_id']['id']);
+        $this->assertEquals($defaultCal['id'], $sclever['displaycontainer_id']['id']);
     }
     
     /**
@@ -616,7 +617,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $until = $until->get(Tinebase_Record_Abstract::ISO8601LONG);
         
         $filter = array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period',       'operator' => 'within', 'value' => array('from' => $from, 'until' => $until)),
         );
         
@@ -661,7 +662,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $until = $until->get(Tinebase_Record_Abstract::ISO8601LONG);
         
         $filter = array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period',       'operator' => 'within', 'value' => array('from' => $from, 'until' => $until)),
         );
         
@@ -696,9 +697,9 @@ class Calendar_JsonTests extends Calendar_TestCase
     public function testFreeBusyCleanup()
     {
         // give fb grants from sclever
-        $scleverCal = Tinebase_Container::getInstance()->getContainerById($this->_personasDefaultCals['sclever']);
+        $scleverCal = Tinebase_Container::getInstance()->getContainerById($this->_getPersonasDefaultCals('sclever'));
         Tinebase_Container::getInstance()->setGrants($scleverCal->getId(), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -708,27 +709,27 @@ class Calendar_JsonTests extends Calendar_TestCase
             Tinebase_Model_Grants::GRANT_ADMIN    => true,
             Tinebase_Model_Grants::GRANT_FREEBUSY => true,
         ), array(
-            'account_id'    => $this->_testUser->getId(),
+            'account_id'    => $this->_getTestUser()->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_FREEBUSY => true,
         ))), TRUE);
         
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_personas['sclever']);
+        Tinebase_Core::set(Tinebase_Core::USER, $this->_getPersona('sclever'));
         $eventData = $this->_getEvent()->toArray();
         unset($eventData['organizer']);
         $eventData['container_id'] = $scleverCal->getId();
         $eventData['attendee'] = array(array(
-            'user_id' => $this->_personasContacts['sclever']->getId()
+            'user_id' => $this->_getPersonasContacts('sclever')->getId()
         ));
-        $eventData['organizer'] = $this->_personasContacts['sclever']->getId();
+        $eventData['organizer'] = $this->_getPersonasContacts('sclever')->getId();
         $eventData = $this->_uit->saveEvent($eventData);
-        $filter = $this->_getEventFilterArray($this->_personasDefaultCals['sclever']->getId());
+        $filter = $this->_getEventFilterArray($this->_getPersonasDefaultCals('sclever')->getId());
         $filter[] = array('field' => 'summary', 'operator' => 'equals', 'value' => 'Wakeup');
         $searchResultData = $this->_uit->searchEvents($filter, array());
         $this->assertTrue(! empty($searchResultData['results']), 'expected event in search result (search by sclever): ' 
             . print_r($eventData, TRUE) . 'search filter: ' . print_r($filter, TRUE));
         
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
+        Tinebase_Core::set(Tinebase_Core::USER, $this->_getTestUser());
         $searchResultData = $this->_uit->searchEvents($filter, array());
         $this->assertTrue(! empty($searchResultData['results']), 'expected (freebusy cleanup) event in search result: ' 
             . print_r($eventData, TRUE) . 'search filter: ' . print_r($filter, TRUE));
@@ -830,7 +831,7 @@ class Calendar_JsonTests extends Calendar_TestCase
      */
     protected function _findAttender($attendeeData, $name) {
         $attenderData = false;
-        $searchedId = $this->_personasContacts[$name]->getId();
+        $searchedId = $this->_getPersonasContacts($name)->getId();
         
         foreach ($attendeeData as $key => $attender) {
             if ($attender['user_type'] == Calendar_Model_Attender::USERTYPE_USER) {
@@ -978,7 +979,12 @@ class Calendar_JsonTests extends Calendar_TestCase
         $this->assertEquals(2, count($searchResultManager['results']), 'with manage grants all records should be found');
         
         // steal manage right and reactivate container checks
-        Tinebase_Acl_Roles::getInstance()->deleteAllRoles();
+        $roleManager = Tinebase_Acl_Roles::getInstance();
+        $roleManager->deleteRoles(array(
+                $roleManager->getRoleByName('manager role')->getId(),
+                $roleManager->getRoleByName('admin role')->getId()
+                ));
+        
         Calendar_Controller_Resource::getInstance()->doContainerACLChecks(TRUE);
         
         $searchResult = $this->_uit->searchResources($filer, array());
@@ -1290,12 +1296,12 @@ class Calendar_JsonTests extends Calendar_TestCase
         $eventData = $this->testCreateEvent();
         $numAttendee = count($eventData['attendee']);
         $eventData['attendee'][$numAttendee] = array(
-            'user_id' => $this->_personasContacts['pwulf']->getId(),
+            'user_id' => $this->_getPersonasContacts('pwulf')->getId(),
         );
         $this->_uit->saveEvent($eventData);
         
         $eventData['attendee'][$numAttendee] = array(
-            'user_id' => $this->_personasContacts['jsmith']->getId(),
+            'user_id' => $this->_getPersonasContacts('jsmith')->getId(),
         );
         $event = $this->_uit->saveEvent($eventData);
         
@@ -1317,7 +1323,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $eventData['attendee'] = $currentAttendee;
         $numAttendee = count($eventData['attendee']);
         $eventData['attendee'][$numAttendee] = array(
-            'user_id' => $this->_personasContacts['pwulf']->getId(),
+            'user_id' => $this->_getPersonasContacts('pwulf')->getId(),
         );
         $event = $this->_uit->saveEvent($eventData);
         
index 1f7d0c0..176745b 100644 (file)
@@ -28,7 +28,7 @@ class Calendar_Model_AttenderFilterTests extends Calendar_TestCase
     {
         $filterArray = array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId()
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId()
         );
         
         $filterModel = new Calendar_Model_AttenderFilter('attendee', 'equals', $filterArray);
@@ -43,7 +43,7 @@ class Calendar_Model_AttenderFilterTests extends Calendar_TestCase
     {
         $filterArray = array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->toArray()
+            'user_id'   => $this->_getPersonasContacts('sclever')->toArray()
         );
         
         $filterModel = new Calendar_Model_AttenderFilter('attendee', 'equals', $filterArray);
@@ -51,17 +51,17 @@ class Calendar_Model_AttenderFilterTests extends Calendar_TestCase
         $tvalue = $filterModel->getValue();
         $this->assertEquals(1, count($tvalue), 'only one attender should be set');
         $this->assertEquals($filterArray['user_type'], $tvalue[0]['user_type']);
-        $this->assertEquals($this->_personasContacts['sclever']->getId(), $tvalue[0]['user_id']);
+        $this->assertEquals($this->_getPersonasContacts('sclever')->getId(), $tvalue[0]['user_id']);
     }
     
     public function testSetFromMultipleResolvedArray()
     {
         $filterArray = array(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->toArray()
+            'user_id'   => $this->_getPersonasContacts('sclever')->toArray()
         ), array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->toArray()
+            'user_id'   => $this->_getPersonasContacts('pwulf')->toArray()
         ));
         
         $filterModel = new Calendar_Model_AttenderFilter('attendee', 'in', $filterArray);
@@ -70,15 +70,15 @@ class Calendar_Model_AttenderFilterTests extends Calendar_TestCase
         $this->assertEquals(2, count($tvalue), 'only one attender should be set');
         $this->assertEquals($filterArray[0]['user_type'], $tvalue[0]['user_type']);
         $this->assertEquals($filterArray[1]['user_type'], $tvalue[1]['user_type']);
-        $this->assertEquals($this->_personasContacts['sclever']->getId(), $tvalue[0]['user_id']);
-        $this->assertEquals($this->_personasContacts['pwulf']->getId(), $tvalue[1]['user_id']);
+        $this->assertEquals($this->_getPersonasContacts('sclever')->getId(), $tvalue[0]['user_id']);
+        $this->assertEquals($this->_getPersonasContacts('pwulf')->getId(), $tvalue[1]['user_id']);
     }
     
     public function testToSimpleArray()
     {
         $filterArray = array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId()
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId()
         );
         
         $filterModel = new Calendar_Model_AttenderFilter('attendee', 'equals', $filterArray);
@@ -95,7 +95,7 @@ class Calendar_Model_AttenderFilterTests extends Calendar_TestCase
     {
         $filterArray = array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId()
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId()
         );
         
         $filterModel = new Calendar_Model_AttenderFilter('attendee', 'equals', $filterArray);
index eb6909a..3781583 100644 (file)
@@ -58,11 +58,11 @@ class Calendar_Model_AttenderTests extends Calendar_TestCase
         $newAttendees = array(
             array(
                 'userType'    => Calendar_Model_Attender::USERTYPE_USER,
-                'firstName'   => $this->_testUser->accountFirstName,
-                'lastName'    => $this->_testUser->accountLastName,
+                'firstName'   => $this->_getTestUser()->accountFirstName,
+                'lastName'    => $this->_getTestUser()->accountLastName,
                 'partStat'    => Calendar_Model_Attender::STATUS_ACCEPTED,
                 'role'        => Calendar_Model_Attender::ROLE_REQUIRED,
-                'email'       => $this->_testUser->accountEmailAddress
+                'email'       => $this->_getTestUser()->accountEmailAddress
             ),
             array(
                 'userType'    => Calendar_Model_Attender::USERTYPE_USER,
@@ -103,11 +103,11 @@ class Calendar_Model_AttenderTests extends Calendar_TestCase
         $newAttendees = array(
             array(
                 'userType'    => Calendar_Model_Attender::USERTYPE_USER,
-                'firstName'   => $this->_testUser->accountFirstName,
-                'lastName'    => $this->_testUser->accountLastName,
+                'firstName'   => $this->_getTestUser()->accountFirstName,
+                'lastName'    => $this->_getTestUser()->accountLastName,
                 'partStat'    => Calendar_Model_Attender::STATUS_TENTATIVE,
                 'role'        => Calendar_Model_Attender::ROLE_REQUIRED,
-                'email'       => $this->_testUser->accountEmailAddress
+                'email'       => $this->_getTestUser()->accountEmailAddress
             ),
             array(
                 'userType'    => Calendar_Model_Attender::USERTYPE_GROUP,
@@ -150,7 +150,7 @@ class Calendar_Model_AttenderTests extends Calendar_TestCase
         // current account must not be a groupmember
         $this->assertFalse(!! Calendar_Model_Attender::getAttendee($persistentEvent->attendee, new Calendar_Model_Attender(array(
             'user_type'    => Calendar_Model_Attender::USERTYPE_GROUPMEMBER,
-            'user_id'      => $this->_testUser->contact_id
+            'user_id'      => $this->_getTestUser()->contact_id
         ))), 'found user as groupmember');
         
         $this->assertEquals(Calendar_Model_Attender::STATUS_TENTATIVE, Calendar_Model_Attender::getOwnAttender($persistentEvent->attendee)->status);
@@ -192,8 +192,8 @@ class Calendar_Model_AttenderTests extends Calendar_TestCase
             }
         }
         $this->assertEquals(3, count($userIds));
-        $this->assertTrue(in_array($this->_testUserContact->getId(), $userIds), 'testaccount missing');
-        $this->assertTrue(in_array($this->_personasContacts['sclever']->getId(), $userIds), 'sclever missing');
+        $this->assertTrue(in_array($this->_getTestUserContact()->getId(), $userIds), 'testaccount missing');
+        $this->assertTrue(in_array($this->_getPersonasContacts('sclever')->getId(), $userIds), 'sclever missing');
         $this->assertTrue(in_array($persistentContact->getId(), $userIds), 'unittestorg missing');
     }
     
index 9106b47..721afeb 100644 (file)
@@ -28,35 +28,35 @@ abstract class Calendar_TestCase extends TestCase
     /**
      * @var Tinebase_Model_Container
      */
-    protected $_testCalendar;
+    protected $_testCalendar = NULL;
     
     /**
      * @var Tinebase_Record_RecordSet test calendars to be deleted on tearDown
      */
-    protected $_testCalendars;
+    protected $_testCalendars = NULL;
     
     /**
      * @var Tinebase_Model_FullUser
      */
-    protected $_testUser;
+    protected $_testUser = NULL;
     
     /**
      * @var Addressbook_Model_Contact
      */
-    protected $_testUserContact;
+    protected $_testUserContact = NULL;
     
     /**
      * personas
      *
      * @var array
      */
-    protected $_personas;
+    protected $_personas = NULL;
     
     /**
      * personas contacts
      * @var array
      */
-    protected $_personasContacts;
+    protected $_personasContacts = array();
     
     /**
      * persona calendars
@@ -73,26 +73,7 @@ abstract class Calendar_TestCase extends TestCase
         parent::setUp();
         
         $this->_backend = new Calendar_Backend_Sql();
-        
-        $this->_personas = Zend_Registry::get('personas');
-        foreach ($this->_personas as $loginName => $user) {
-            $defaultCalendarId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $user->getId());
-            $this->_personasContacts[$loginName] = Addressbook_Controller_Contact::getInstance()->getContactByUserId($user->getId());
-            $this->_personasDefaultCals[$loginName] = Tinebase_Container::getInstance()->getContainerById($defaultCalendarId);
-        }
-        
         $this->_testUser = Tinebase_Core::getUser();
-        $this->_testUserContact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($this->_testUser->getId());
-        $this->_testCalendar = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
-            'name'           => 'PHPUnit test calendar',
-            'type'           => Tinebase_Model_Container::TYPE_PERSONAL,
-            'owner_id'       => Tinebase_Core::getUser(),
-            'backend'        => $this->_backend->getType(),
-            'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId()
-        ), true));
-        
-        $this->_testCalendars = new Tinebase_Record_RecordSet('Tinebase_Model_Container');
-        $this->_testCalendars->addRecord($this->_testCalendar);
     }
     
     /**
@@ -104,7 +85,7 @@ abstract class Calendar_TestCase extends TestCase
         
         Calendar_Controller_Event::getInstance()->sendNotifications(false);
         
-        if (! $this->_transactionId) {
+        if (! $this->_transactionId && $this->_testCalendar !== NULL) {
             $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
                 array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
             )), new Tinebase_Model_Pagination(array()));
@@ -120,6 +101,138 @@ abstract class Calendar_TestCase extends TestCase
                 Tinebase_Container::getInstance()->deleteContainer($cal, true);
             }
         }
+        // do NOT unset _testUser,the tear down of Calendar_Frontend_WebDAV_EventTest still requires _testUser
+        $this->_testUserContact = NULL;
+        $this->_testCalendar = NULL;
+        $this->_testCalendars = NULL;
+        $this->_personas = NULL;
+        $this->_personasContacts = array();
+        $this->_personasDefaultCals = array();
+    }
+    
+    /**
+     * returns test persons contacts
+     * 
+     * @param string $loginName
+     * @return Addressbook_Model_Contact
+     */
+    protected function _getPersonasContacts($loginName)
+    {
+        if (!isset($this->_personasContacts[$loginName])) {
+            $user = $this->_getPersona($loginName);
+            $this->_personasContacts[$loginName] = Addressbook_Controller_Contact::getInstance()->getContactByUserId($user->getId());
+        }
+        return $this->_personasContacts[$loginName];
+    }
+    
+    /**
+     * returns test persons default calendar
+     * 
+     * @param string $loginName
+     * @return Tinebase_Model_Container
+     */
+    protected function _getPersonasDefaultCals($loginName)
+    {
+        if (!isset($this->_personasDefaultCals[$loginName])) {
+            $user = $this->_getPersona($loginName);
+            $defaultCalendarId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $user->getId());
+            $this->_personasDefaultCals[$loginName] = Tinebase_Container::getInstance()->getContainerById($defaultCalendarId);
+        }
+        return $this->_personasDefaultCals[$loginName];
+    }
+    
+    /**
+     * returns all test persons default calendar
+     * 
+     * @return array
+     */
+    protected function _getAllPersonasDefaultCals()
+    {
+        foreach ($this->_getPersonas() as $loginName => $user)
+        {
+            $this->_getPersonasDefaultCals($loginName);
+        }
+        return $this->_personasDefaultCals;
+    }
+    
+    /** return a test person
+     * @return 
+     */
+    protected function _getPersona($loginName)
+    {
+        if ($this->_personas === NULL) {
+            $this->_getPersonas();
+        }
+        return $this->_personas[$loginName];
+    }
+    
+    /**
+     * returns an array of test persons
+     * 
+     * @return array
+     */
+    protected function _getPersonas()
+    {
+        if ($this->_personas === NULL) {
+            $this->_personas = Zend_Registry::get('personas');
+        }
+        return $this->_personas;
+    }
+    
+    /**
+     * returns a test user
+     * 
+     * @return Tinebase_Model_FullUser
+     */
+    protected function _getTestUser()
+    {
+        return $this->_testUser;
+    }
+    
+    /**
+     * returns the test users contact
+     * 
+     * @return
+     */
+    protected function _getTestUserContact()
+    {
+        if ($this->_testUserContact === NULL) {
+            $this->_testUserContact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($this->_getTestUser()->getId());
+        }
+        return $this->_testUserContact;
+    }
+    /**
+     * returns a test calendar set
+     * 
+     * @return Tinebase_Record_RecordSet\r
+     */
+    protected function _getTestCalendars()
+    {
+        if ($this->_testCalendars === NULL) {
+            $this->_getTestCalendar();
+        }
+        return $this->_testCalendars;
+    }
+    /**
+     * returns a test calendar
+     * 
+     * @return Tinebase_Model_Container
+     */
+    protected function _getTestCalendar()
+    {
+        if ($this->_testCalendar === NULL) {
+            $this->_testCalendar = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
+                    'name'           => 'PHPUnit test calendar',
+                    'type'           => Tinebase_Model_Container::TYPE_PERSONAL,
+                    'owner_id'       => Tinebase_Core::getUser(),
+                    'backend'        => $this->_backend->getType(),
+                    'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId()
+            ), true));
+            
+            $this->_testCalendars = new Tinebase_Record_RecordSet('Tinebase_Model_Container');
+            $this->_testCalendars->addRecord($this->_testCalendar);
+        }
+        return $this->_testCalendar;
     }
     
     /**
@@ -137,8 +250,8 @@ abstract class Calendar_TestCase extends TestCase
             'description' => 'Early to bed and early to rise, makes a men healthy, wealthy and wise',
             'attendee'    => $this->_getAttendee(),
         
-            'container_id' => $this->_testCalendar->getId(),
-            'organizer'    => $this->_testUserContact->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
+            'organizer'    => $this->_getTestUserContact()->getId(),
             'uid'          => Calendar_Model_Event::generateUID(),
         
             Tinebase_Model_Grants::GRANT_READ    => true,
@@ -181,13 +294,13 @@ abstract class Calendar_TestCase extends TestCase
     {
         return new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array(
-                'user_id'        => $this->_testUserContact->getId(),
+                'user_id'        => $this->_getTestUserContact()->getId(),
                 'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
                 'role'           => Calendar_Model_Attender::ROLE_REQUIRED,
                 'status_authkey' => Tinebase_Record_Abstract::generateUID(),
             ),
             array(
-                'user_id'        => $this->_personasContacts['sclever']->getId(),
+                'user_id'        => $this->_GetPersonasContacts('sclever')->getId(),
                 'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
                 'role'           => Calendar_Model_Attender::ROLE_REQUIRED,
                 'status_authkey' => Tinebase_Record_Abstract::generateUID(),
index f22d168..d37d898 100644 (file)
@@ -557,7 +557,7 @@ class Courses_JsonTest extends TestCase
         return $definition;
     }
     
-       /**
+     /**
      * returns course import definition
      * 
      * @return Tinebase_Model_ImportExportDefinition
index 45a8584..5e8d4e7 100644 (file)
@@ -37,6 +37,13 @@ class Felamimail_Controller_AccountTest extends PHPUnit_Framework_TestCase
     protected $_foldersToDelete = array();
     
     /**
+     * was the pw changed during tests? if yes, revert.
+     * 
+     * @var boolean
+     */
+    protected $_pwChanged = false;
+    
+    /**
      * Runs the test methods of this class.
      *
      * @access public
@@ -79,6 +86,11 @@ class Felamimail_Controller_AccountTest extends PHPUnit_Framework_TestCase
         }
         
         Tinebase_TransactionManager::getInstance()->rollBack();
+        
+        if ($this->_pwChanged) {
+            $testConfig = Zend_Registry::get('testConfig');
+            $this->_setCredentials($testConfig->username, $testConfig->password);
+        }
     }
     
     /**
@@ -98,6 +110,8 @@ class Felamimail_Controller_AccountTest extends PHPUnit_Framework_TestCase
         Tinebase_Core::set(Tinebase_Core::USERCREDENTIALCACHE, $credentialCache);
         $event = new Tinebase_Event_User_ChangeCredentialCache($oldCredentialCache);
         Tinebase_Event::fireEvent($event);
+        
+        $this->_pwChanged = true;
     }
 
     /**
index 8176fc7..21bc1eb 100644 (file)
@@ -352,15 +352,9 @@ class Sales_ControllerTest extends PHPUnit_Framework_TestCase
         // check uniquity
         $cc1 = $this->_getCostCenter();
         
-        try {
-            Sales_Controller_CostCenter::getInstance()->create($cc1);
-            $this->fail('A duplicate exception should have been thrown!');
-        } catch (Zend_Db_Statement_Exception $e) {
-            $this->assertEquals(0, $e->getCode());
-            // MySQL: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '217fcc5beddf1744c20d572d7e740a8bf88bf8a1' for key 'number'
-            // PGSQL: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "tine20_sales_cost_centers_number_key"
-            $this->assertContains("SQLSTATE[23", $e->getMessage());
-        }
+        $this->setExpectedException('Tinebase_Exception_Duplicate');
+
+        Sales_Controller_CostCenter::getInstance()->create($cc1);
     }
     
     /**
index 40e5d0e..c4b742a 100644 (file)
@@ -481,4 +481,55 @@ class Sales_JsonTest extends PHPUnit_Framework_TestCase
             array('field' => 'query',           'operator' => 'contains',       'value' => 'PHPUnit'),
         );
     }
+    
+    /**
+     * tests CostCenter CRUD Methods
+     */
+    public function testAllCostCenterMethods()
+    {
+        $remark = Tinebase_Record_Abstract::generateUID(10);
+        $number = Tinebase_DateTime::now()->getTimestamp();
+        
+        $cc = $this->_instance->saveCostCenter(
+            array('number' => $number, 'remark' => $remark)
+        );
+        
+        $this->assertEquals(40, strlen($cc['id']));
+        
+        $cc = $this->_instance->getCostCenter($cc['id']);
+        
+        $this->assertEquals($number, $cc['number']);
+        $this->assertEquals($remark, $cc['remark']);
+        
+        $cc['remark'] = $cc['remark'] . '_unittest';
+        $cc['number'] = $number - 5000;
+        
+        $cc = $this->_instance->saveCostCenter($cc);
+        
+        $this->assertEquals($remark . '_unittest', $cc['remark']);
+        $this->assertEquals($number - 5000, $cc['number']);
+        
+        $accountId = Tinebase_Core::getUser()->getId();
+        
+        $this->assertEquals($accountId, $cc['created_by']);
+        $this->assertEquals($accountId, $cc['last_modified_by']);
+        $this->assertEquals(NULL, $cc['deleted_by']);
+        $this->assertEquals(NULL, $cc['deleted_time']);
+        $this->assertEquals(1, $cc['seq']);
+        $this->assertEquals(0, $cc['is_deleted']);
+        
+        $ccs = $this->_instance->searchCostCenters(array(array('field' => 'remark', 'operator' => 'equals', 'value' => $remark . '_unittest')), array());
+        
+        $this->assertEquals(1, $ccs['totalcount']);
+        $this->assertEquals($remark . '_unittest', $ccs['results'][0]['remark']);
+        
+        $this->_instance->deleteCostCenters($cc['id']);
+        
+        $ccs = $this->_instance->searchCostCenters(array(array('field' => 'number', 'operator' => 'equals', 'value' => $number - 5000)), array());
+        
+        $this->assertEquals(1, $ccs['totalcount']);
+        $this->assertEquals(1, $ccs['results'][0]['is_deleted']);
+        
+        
+    }
 }
index dcfa627..4a5ce92 100644 (file)
@@ -74,7 +74,6 @@ class Tasks_Convert_Task_VCalendar_EMClientTest extends PHPUnit_Framework_TestCa
         $this->assertEquals("2013-10-15 10:00:00",               (string)$task->dtstart);
         $this->assertEquals("Beschreibung\nmit\nUmbruch", $task->description);
 
-        
         return $task;
     }
     
@@ -130,11 +129,11 @@ class Tasks_Convert_Task_VCalendar_EMClientTest extends PHPUnit_Framework_TestCa
         #var_dump($task->toArray());
     
         $this->assertEquals(Tasks_Model_Task::CLASS_PRIVATE, $task->class);
-        $this->assertEquals('Ort',                                  $task->location);
+        $this->assertEquals('Ort',                               $task->location);
         $this->assertEquals('Europe/Berlin',                     $task->originator_tz);
         $this->assertEquals("2011-10-04 10:00:00",               (string)$task->dtend);
         $this->assertEquals("2011-10-04 08:00:00",               (string)$task->dtstart);
-   
+
         return $task;
     }
     
@@ -170,7 +169,4 @@ class Tasks_Convert_Task_VCalendar_EMClientTest extends PHPUnit_Framework_TestCa
         $this->assertContains('TZOFFSETTO:+0100',    $vcalendar, $vcalendar);
         $this->assertContains('TZNAME:CET',          $vcalendar, $vcalendar);
     }
-   
-
-   
 }
\ No newline at end of file
index 92cd64c..b1b2f7a 100644 (file)
@@ -78,8 +78,8 @@
                 </field>
                 <field>
                     <name>owner_id</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                     <notnull>false</notnull>
                 </field>
                 <field>
             </field>
         </record>
     </defaultRecords>
-</application>
\ No newline at end of file
+</application>
index 8e2fc2d..f323f3b 100644 (file)
             <source>tel_fax</source>
             <destination>tel_fax</destination>
         </field>
-        <field>                
+        <field>
             <source>tel_fax_home</source>
             <destination>tel_fax_home</destination>
         </field>
         </field>
     </mapping>
 </config>
+
index de09a2f..6eab058 100644 (file)
@@ -1,5 +1,5 @@
 .action_addList {
-       background-image:url(../../images/oxygen/16x16/actions/users.png) !important;
+    background-image:url(../../images/oxygen/16x16/actions/users.png) !important;
 }
 .x-btn-medium .action_addList {
     background-image:url(../../images/oxygen/22x22/actions/users.png) !important;
@@ -8,7 +8,6 @@
     background-image:url(../../images/oxygen/32x32/actions/users.png) !important;
 }
 
-
 .AddressbookIconCls, .AddressbookContact {
     background-image:url(../../images/oxygen/16x16/apps/kaddressbook.png) !important;
 }
@@ -23,7 +22,6 @@
     background-image:url(../../images/oxygen/16x16/actions/contact-new.png) !important;
 }
 
-
 .x-form-item-float-left {
     float: left;
     margin-right: 5px;
index b08ae22..4826bf3 100644 (file)
@@ -8,7 +8,6 @@
     background-image:url(../../images/oxygen/32x32/actions/dialog-apply.png) !important;
 }
 
-
 .action_disable {
     background-image:url(../../images/oxygen/16x16/actions/dialog-cancel.png) !important;
 }
@@ -19,7 +18,6 @@
     background-image:url(../../images/oxygen/32x32/actions/dialog-cancel.png) !important;
 }
 
-
 .action_settings {
     background-image:url(../../images/oxygen/16x16/actions/view-choose.png) !important;
 }
@@ -41,7 +39,6 @@
     background-image:url(../../images/oxygen/32x32/status/dialog-password.png) !important;
 }
 
-
 .action_addGroup {
     background-image:url(../../images/oxygen/16x16/actions/users.png) !important;
 }
@@ -52,7 +49,6 @@
     background-image:url(../../images/oxygen/32x32/actions/users.png) !important;
 }
 
-
 .action_password {
     background-image:url(../../images/oxygen/16x16/actions/password.png) !important;
 }
@@ -63,7 +59,6 @@
     background-image:url(../../images/oxygen/32x32/actions/password.png) !important;
 }
 
-
 .AdminIconCls {
     background-image:url(../../images/oxygen/16x16/apps/systemtray.png) !important;
 }
@@ -74,7 +69,6 @@
     background-image:url(../../images/oxygen/32x32/apps/systemtray.png) !important;
 }
 
-
 .admin-node-accesslog {
     background-image:url(../../images/oxygen/16x16/actions/view-process-own.png) !important;
 }
@@ -85,7 +79,6 @@
     background-image:url(../../images/oxygen/32x32/actions/view-process-own.png) !important;
 }
 
-
 .admin-node-user {
     background-image:url(../../images/oxygen/16x16/places/user-identity.png) !important;
 }
@@ -96,7 +89,6 @@
     background-image:url(../../images/oxygen/32x32/places/user-identity.png) !important;
 }
 
-
 .admin-node-groups {
     background-image:url(../../images/oxygen/16x16/actions/users.png) !important;
 }
     background-image:url(../../images/oxygen/32x32/actions/users.png) !important;
 }
 
-
 .admin-node-computers {
     background-image:url(../../images/oxygen/16x16/places/network-local.png) !important;
 }
     background-image:url(../../images/oxygen/32x32/places/network-local.png) !important;
 }
 
-
 .admin-node-applications {
     background-image:url(../../images/oxygen/16x16/places/user-desktop.png) !important;
 }
     background-image:url(../../images/oxygen/16x16/apps/kexi.png) !important;
 }
 
-
 .x-tree-node-collapsed .x-tree-node-icon.x-tree-node-leaf-checkbox, 
 .x-tree-node-expanded .x-tree-node-icon.x-tree-node-leaf-checkbox, 
 .x-tree-node-leaf .x-tree-node-icon.x-tree-node-leaf-checkbox ,
 .x-tree-node-leaf-checkbox {
-       width:0px;
+    width:0px;
 }
index 56fc82c..b5028c8 100644 (file)
@@ -23,8 +23,8 @@
                 </field>
                 <field>
                     <name>created_by</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                 </field>
                 <field>
                     <name>creation_time</name>
@@ -92,8 +92,8 @@
                 </field>
                     <field>
                     <name>organizer</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                 </field>
                 <field>
                     <name>priority</name>
                 </index>
             </declaration>
         </table>
-        
-        
     </tables>
 </application>
index 6e0026c..7137139 100644 (file)
@@ -29,7 +29,7 @@
 }
 
 .cal-sheet-view-type {
-       background-image:url(../../images/oxygen/16x16/actions/view-calendar-week.png) !important;
+    background-image:url(../../images/oxygen/16x16/actions/view-calendar-week.png) !important;
 }
 .x-btn-medium .cal-sheet-view-type {
     background-image:url(../../images/oxygen/22x22/actions/view-calendar-week.png) !important;
@@ -58,7 +58,6 @@
     background-image:url(../../images/oxygen/32x32/actions/view-calendar-day.png) !important;
 }
 
-
 .cal-week-view {
     background-image:url(../../images/oxygen/16x16/actions/view-calendar-week.png) !important;
 }
@@ -69,7 +68,6 @@
     background-image:url(../../images/oxygen/32x32/actions/view-calendar-week.png) !important;
 }
 
-
 .cal-month-view {
     background-image:url(../../images/oxygen/16x16/actions/view-calendar-month.png) !important;
 }
@@ -80,7 +78,6 @@
     background-image:url(../../images/oxygen/32x32/actions/view-calendar-month.png) !important;
 }
 
-
 .cal-resource {
     background-image:url(../../images/oxygen/16x16/devices/video-projector.png) !important;
 }
@@ -91,7 +88,6 @@
     background-image:url(../../images/oxygen/32x32/devices/video-projector.png) !important;
 }
 
-
 .cal-attendee-type-resource {
     background-image:url(../../images/oxygen/16x16/devices/video-projector.png) !important;
     background-position:2px 2px;
 }
 
 .cal-calselectwidget-fakelist-item {
-       position: relative;
-       padding: 0;
-       border: 0;
+    position: relative;
+    padding: 0;
+    border: 0;
 }
 
 .cal-calselectwidget-fakelist-calendar {
 }
 
 .cal-calselectwidget-fakelist-account {
-       width: 160px;
-       position: absolute;
-       right: 0;
-       border-left: 1px solid #B5B8C8;
-       padding-left: 5px;
-       background:url(../../images/trigger2-bg.gif) repeat-x #EFEFEF;
+    width: 160px;
+    position: absolute;
+    right: 0;
+    border-left: 1px solid #B5B8C8;
+    padding-left: 5px;
+    background:url(../../images/trigger2-bg.gif) repeat-x #EFEFEF;
 }
 
 /*** container select widget
@@ -161,7 +157,7 @@ span.tw-containerselect-trigger2 img.tw-containerselect-trigger2-bg {
 }
 
 .cal-calselectwdgt {
-       position: relative;
+    position: relative;
 }
 
 /**** date picker ****/
@@ -176,8 +172,8 @@ span.tw-containerselect-trigger2 img.tw-containerselect-trigger2-bg {
 .cal-event-icon {
     background-image:url(../../images/oxygen/16x16/actions/view-calendar-list.png) !important;
     background-position: 8px;
-       background-repeat:no-repeat;
-       padding: 2px 0px 2px 26px;
+    background-repeat:no-repeat;
+    padding: 2px 0px 2px 26px;
 }
 
 /**** conflict window ****/
@@ -195,17 +191,15 @@ span.tw-containerselect-trigger2 img.tw-containerselect-trigger2-bg {
 
 /**** status icons ****/
 .cal-status-icon {
-       background-image:url(../../images/calendar-status-icons.gif) !important;
+    background-image:url(../../images/calendar-status-icons.gif) !important;
     background-repeat:no-repeat;
     width: 10px;
     height: 10px;
     cursor: pointer;
 }
 
-
-
 .cal-recurring {
-       background-image:url(../../images/calendar-recurring.png);
+    background-image:url(../../images/calendar-recurring.png);
     background-repeat:no-repeat;
     width: 12px;
     height: 12px;
index 85e024b..da7004b 100644 (file)
 }
 
 .cal-daysviewpanel-dayheader {
-       float: left;
+    float: left;
 }
 
 .cal-daysviewpanel-dayheader-day {
-       padding-top: 3px;
-       text-align: center;
-       color:black;
+    padding-top: 3px;
+    text-align: center;
+    color:black;
     font-family:arial,tahoma,helvetica,sans-serif;
     font-size:11px;
     font-size-adjust:none;
 }
 /********************************* Body *********************************/
 .cal-daysviewpanel-body-inner {
-       position: relative;
-       top: 0px;
-       left: 0px;
+    position: relative;
+    top: 0px;
+    left: 0px;
 }
 
 .cal-daysviewpanel-scroller {
-       border-top: 1px solid #D0D0D0;
+    border-top: 1px solid #D0D0D0;
     overflow:auto;
     position:relative;
 }
@@ -82,9 +82,9 @@
 }
 
 .cal-daysviewpanel-body-daycolumn {
-       float: left;
-       position: absolute;
-       overflow: hidden;
+    float: left;
+    position: absolute;
+    overflow: hidden;
 }
 
 /*
 }
 
 .cal-daysviewpanel-body-daycolumn-today .cal-daysviewpanel-daycolumn-row-on {
-       border-top: 1px solid #EDEDED;
+    border-top: 1px solid #EDEDED;
 }
 
 .cal-daysviewpanel-body-daycolumn-inner {
-       border-left: 3px double #EDEDED;
-       height:100%;
+    border-left: 3px double #EDEDED;
+    height:100%;
     position:absolute;
     top:0;
 }
 
 .cal-daysviewpanel-daycolumn-row {
-       margin-left: 3px;
-       text-align: right;
-       font-family:arial,tahoma,helvetica,sans-serif;
+    margin-left: 3px;
+    text-align: right;
+    font-family:arial,tahoma,helvetica,sans-serif;
     font-size:10px;
     font-size-adjust:none;
     font-style:normal;
 }
 
 .cal-daysviewpanel-daycolumn-row:hover {
-       background-color:#DFE8F6;
-       color: #999999;
+    background-color:#DFE8F6;
+    color: #999999;
     /*cursor: pointer; see ticket #1484*/
 }
 
 .cal-daysviewpanel-timeRow-time {
-       width: 40px;
-       padding-top: 2px;
-       text-align: right;
-       color:black;
-       font-family:arial,tahoma,helvetica,sans-serif;
-       font-size:11px;
-       font-size-adjust:none;
-       font-style:normal;
-       font-variant:normal;
-       font-weight:normal;
-       line-height:normal;
-       white-space:nowrap;
+    width: 40px;
+    padding-top: 2px;
+    text-align: right;
+    color:black;
+    font-family:arial,tahoma,helvetica,sans-serif;
+    font-size:11px;
+    font-size-adjust:none;
+    font-style:normal;
+    font-variant:normal;
+    font-weight:normal;
+    line-height:normal;
+    white-space:nowrap;
 }
 
-
 .cal-daysviewpanel-timeRow-on {
-       border-top: 1px solid #EDEDED;
-       position: absolute;
-       width: 100%;
-       /*background-color:#F1F1F1;*/
+    border-top: 1px solid #EDEDED;
+    position: absolute;
+    width: 100%;
+    /*background-color:#F1F1F1;*/
 }
 .cal-daysviewpanel-timeRow-off {
-       width: 100%;
-       position: absolute;
-       /*background-color:#FFFFFF;*/
+    width: 100%;
+    position: absolute;
+    /*background-color:#FFFFFF;*/
 }
 
 .cal-daysviewpanel-daycolumn-row-on,
 }
 
 .cal-daysviewpanel-daycolumn-row-off {
-       border-top: 1px dotted #EDEDED;
+    border-top: 1px dotted #EDEDED;
 }
 
 /********************************* Events *********************************/
 .cal-daysviewpanel-event {
-       margin-left: 3px;
-       background: #EDEDED url(../../images/white-gradiend.png) repeat-y right;
-       border-radius: 8px;
+    margin-left: 3px;
+    background: #EDEDED url(../../images/white-gradiend.png) repeat-y right;
+    border-radius: 8px;
     position: absolute;
     border: 1px solid #808080;
     overflow: hidden;
 }
 
 .cal-daysviewpanel-event-drop-nodrop .x-dd-drop-icon {
-       left: 3px;
-       top: 0px;
-       background-color: transparent;
+    left: 3px;
+    top: 0px;
+    background-color: transparent;
     background-image:url(../../library/ExtJS/resources/images/default/dd/drop-no.gif);
 }
 
 }
 
 .cal-daysviewpanel-event-header {
-       width: 100%;
-       position: absolute;
+    width: 100%;
+    position: absolute;
     top: -1px;
     height: 14px;
     background-color: #808080;
 }
 
 .cal-daysviewpanel-event-croptop .cal-daysviewpanel-event-header {
-       display: none;
+    display: none;
     border-top-style: none;
     border-top-left-radius: 0px;
     border-top-right-radius: 0px;
 }
 
 .cal-daysviewpanel-event-header-inner {
-       color: white;
+    color: white;
     position: absolute;
     top: 1px;
     left: 4px;
 }
 
 .cal-daysviewpanel-body-wholedaycolumn-over {
-       width: 100%;
+    width: 100%;
     height: 100%;
     /*margin-left: 3px;*/
 }
 }
 
 .cal-daysviewpanel-event-cropright {
-       background-image: none;
+    background-image: none;
     border-right-style: hidden;
     border-top-right-radius: 0px;
     border-bottom-right-radius: 0px;
 }
 
 .cal-daysviewpanel-wholedayevent-body .x-form-text {
-       position: absolute;
-       top: 0px;
+    position: absolute;
+    top: 0px;
     padding-top: 0px;
     height: 11px;
 }
index f90c81b..391870a 100644 (file)
@@ -11,7 +11,7 @@
 }
 
 .cal-monthview-inner th {
-       border-top: none;
+    border-top: none;
     text-align: center;
     vertical-align: middle;
 }
@@ -26,8 +26,8 @@
 }
 
 .cal-monthview-wkcell:hover{
-       background: #CDDCEF url(../../library/ExtJS/resources/images/default/toolbar/bg.gif) repeat-x scroll left top;
-       /*cursor: pointer; see ticket #1484*/
+    background: #CDDCEF url(../../library/ExtJS/resources/images/default/toolbar/bg.gif) repeat-x scroll left top;
+    /*cursor: pointer; see ticket #1484*/
 }
 
 .cal-monthview-wkcell-header {
@@ -35,8 +35,8 @@
 }
 
 .cal-monthview-daycell {
-       vertical-align: top;
-       border-right: 1px solid #E1E1E1;
+    vertical-align: top;
+    border-right: 1px solid #E1E1E1;
     border-top: 1px solid #E1E1E1;
 }
 
@@ -53,7 +53,7 @@ cal-monthview-wkcell-header {
 }
 
 .cal-monthview-dayheader {
-       position: relative;
+    position: relative;
     width: 100%;
 }
 
@@ -67,11 +67,11 @@ cal-monthview-wkcell-header {
 }
 
 .cal-monthview-dayheader-date {
-       padding: 2px 5px;
-       border-collapse: separate;
-       color: #233D6D;
-       /*cursor: pointer; see ticket #1484*/
-       text-align: right !important;
+    padding: 2px 5px;
+    border-collapse: separate;
+    color: #233D6D;
+    /*cursor: pointer; see ticket #1484*/
+    text-align: right !important;
 }
 
 .cal-monthview-daybody {
@@ -91,10 +91,10 @@ cal-monthview-wkcell-header {
 }
 
 .cal-monthview-event {
-       margin: 0px 0px;
-       width: 100%;
-       cursor: pointer;
-       /*overflow: hidden;*/
+    margin: 0px 0px;
+    width: 100%;
+    cursor: pointer;
+    /*overflow: hidden;*/
 }
 
 .cal-monthview-eventslice .cal-monthview-event-editgrant {
@@ -106,15 +106,13 @@ cal-monthview-wkcell-header {
     overflow: hidden;
 }
 
-
-
 .cal-monthview-alldayevent {
-       border-radius: 8px;
-       margin: 0px 0px 1px 0px;
-       background-color: red;
-       height: 17px;
-       width: 100%;
-       /*overflow: visible;*/
+    border-radius: 8px;
+    margin: 0px 0px 1px 0px;
+    background-color: red;
+    height: 17px;
+    width: 100%;
+    /*overflow: visible;*/
 }
 
 .ext-gecko .cal-monthview-alldayevent {
@@ -131,7 +129,7 @@ cal-monthview-wkcell-header {
 }
 
 .cal-monthview-alldayevent-cropleft {
-       margin-left: 0px;
+    margin-left: 0px;
     border-left-style: none;
     border-top-left-radius: 0px;
     border-bottom-left-radius: 0px;
@@ -154,7 +152,7 @@ cal-monthview-wkcell-header {
 }
 
 .cal-monthview-alldayevent-cropright {
-       margin-right: 0px;
+    margin-right: 0px;
     background-image: none;
     border-right-style: hidden;
     border-top-right-radius: 0px;
@@ -185,18 +183,18 @@ cal-monthview-wkcell-header {
 }
 
 .cal-monthview-event-info-hide {
-       display: none;
+    display: none;
 }
 
 .cal-monthview-daypreviewbox .cal-monthview-event-info-hide {
-       display: block;
+    display: block;
 }
 
 /******************************* daypreviewbox ********************************/
 .cal-monthview-daypreviewbox {
-       position: absolute;
-       border-bottom: 1px solid #E1E1E1;
-       overflow-y: auto;
-       overflow-x: hidden;
-       z-index: 5000;
+    position: absolute;
+    border-bottom: 1px solid #E1E1E1;
+    overflow-y: auto;
+    overflow-x: hidden;
+    z-index: 5000;
 }
\ No newline at end of file
index 7d0424d..90a59a0 100644 (file)
@@ -33,8 +33,8 @@ table td {
 }
 
 .cal-print-title {
-       text-align: center;
-       font-size: 20px;
+    text-align: center;
+    font-size: 20px;
 }
 
 .cal-print-daysview-day-dayOfMonth {
@@ -80,7 +80,7 @@ table td {
 }
 
 .cal-print-daycell {
-       vertical-align: top;
+    vertical-align: top;
     border: 0;
 }
 
@@ -88,13 +88,12 @@ table td {
     display: none;
 }
 
-
 /* ------------ monthview ------------ */
 .cal-print-monthview-daycell {
     border: 0;
-       text-align: center;
-       font-size: 12px;
-       font-weight: bold;
+    text-align: center;
+    font-size: 12px;
+    font-weight: bold;
 }
 
 .cal-print-monthview .cal-print-daycell {
@@ -111,7 +110,7 @@ table td {
 }
 
 .cal-print-monthview {
-       font-size: 10px;
+    font-size: 10px;
 }
 
 .cal-print-monthview .cal-print-daysview-day-weekDay {
@@ -132,5 +131,5 @@ table td {
 
 .cal-print-monthview .cal-print-daysview-day-untilseperator,
 .cal-print-monthview .cal-print-daysview-day-endtime {
-       display: none;
+    display: none;
 }
\ No newline at end of file
index 3cef09d..be6548c 100644 (file)
 class Felamimail_Controller extends Tinebase_Controller_Event
 {
     /**
+     * holds the default Model of this application
+     * @var string
+     */
+    protected static $_defaultModel = 'Felamimail_Model_Message';
+    
+    /**
      * holds the instance of the singleton
      *
      * @var Felamimail_Controller
index 9ae4937..d9a70e6 100644 (file)
@@ -8,7 +8,6 @@
     background-image:url(../../images/oxygen/32x32/actions/flag-red.png) !important;
 }
 
-
 .action_email_reply {
     background-image:url(../../images/oxygen/16x16/actions/mail-reply-sender.png) !important;
 }
@@ -19,7 +18,6 @@
     background-image:url(../../images/oxygen/32x32/actions/mail-reply-sender.png) !important;
 }
 
-
 .action_email_replyAll {
     background-image:url(../../images/oxygen/16x16/actions/mail-reply-all.png) !important;
 }
@@ -30,7 +28,6 @@
     background-image:url(../../images/oxygen/32x32/actions/mail-reply-all.png) !important;
 }
 
-
 .action_email_forward {
     background-image:url(../../images/oxygen/16x16/actions/mail-forward.png) !important;
 }
@@ -41,9 +38,8 @@
     background-image:url(../../images/oxygen/32x32/actions/mail-forward.png) !important;
 }
 
-
 .action_update_cache {
-       background-image:url(../../images/oxygen/16x16/actions/mail-receive.png) !important;
+    background-image:url(../../images/oxygen/16x16/actions/mail-receive.png) !important;
 }
 .x-btn-medium .action_update_cache {
     background-image:url(../../images/oxygen/22x22/actions/mail-receive.png) !important;
@@ -52,7 +48,6 @@
     background-image:url(../../images/oxygen/32x32/actions/mail-receive.png) !important;
 }
 
-
 .action_mark_read {
     background-image:url(../../images/oxygen/16x16/actions/mail-mark-read.png) !important;
 }
@@ -62,7 +57,6 @@
 .x-btn-large .action_mark_read {
     background-image:url(../../images/oxygen/32x32/actions/mail-mark-read.png) !important;
 }
-       
 
 .FelamimailIconCls {
     background-image:url(../../images/oxygen/16x16/apps/kmail.png) !important;
@@ -74,7 +68,6 @@
     background-image:url(../../images/oxygen/32x32/apps/kmail.png) !important;
 }
 
-
 .action_folder_emptytrash {
     background-image:url(../../images/oxygen/16x16/actions/emptytrash.png) !important;
 }
 /**** preview *****/
 
 .preview-panel-felamimail {
-       padding: 5px;
-       overflow: 'hidden';
+    padding: 5px;
+    overflow: 'hidden';
 }
 
 .preview-panel-felamimail-headers {
 }
 
 .preview-panel-felamimail-attachments {
-       margin-top: 5px;
+    margin-top: 5px;
     background-color: #e8e8e8;
     width: 100%;
 }
          this need to be restructured e.g. by having a felamimail-message-body-text cls
 */
 .preview-panel-felamimail-body .x-form-textarea {
-       margin-top: 5px;
-       font: normal 13px courier;
-       border: 0px;
+    margin-top: 5px;
+    font: normal 13px courier;
+    border: 0px;
 }
 
 /***** node classes ******/
     font-weight: bold;
 }
 
-
 .felamimail-node-trash img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/user-trash.png);
 }
     background-image:url(../../images/oxygen/32x32/places/user-trash.png);
 }
 
-
 .felamimail-node-trash-full img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/user-trash-full.png);
 }
     background-image:url(../../images/oxygen/32x32/places/user-trash-full.png);
 }
 
-
 .felamimail-node-sent img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/mail-folder-sent.png);
 }
     background-image:url(../../images/oxygen/32x32/places/mail-folder-sent.png);
 }
 
-
 .felamimail-node-inbox img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/mail-folder-inbox.png);
 }
     background-image:url(../../images/oxygen/32x32/places/folder-txt.png);
 }
 
-
 .felamimail-node-templates img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/folder-tar.png);
 }
     background-image:url(../../images/oxygen/32x32/places/folder-tar.png);
 }
 
-
 .felamimail-node-junk img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/trashcan-empty-alt.png);
 }
     background-image:url(../../images/oxygen/32x32/places/trashcan-empty-alt.png);
 }
 
-
 .felamimail-node-unselectable img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/folder.png);
     opacity: 0.5;
     opacity: 0.5;
 }
 
-
 .felamimail-node-intelligent-marked img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/folder-important.png);
 }
     background-image:url(../../images/oxygen/32x32/places/folder-important.png);
 }
 
-
 .felamimail-node-intelligent-unread img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/folder-bookmarks.png);
     /* background-image:url(../../images/oxygen/16x16/places/mail-folder-sent.png); */
     /* background-image:url(../../images/oxygen/32x32/places/mail-folder-sent.png); */
 }
 
-
 .felamimail-node-account img.x-tree-node-icon {
     background-image:url(../../images/oxygen/16x16/places/user-home.png);
 }
 }
 
 .felamimail-node-statusbox {
-       padding-right: 5px;
-       position: absolute;
-       right: 0px;
+    padding-right: 5px;
+    position: absolute;
+    right: 0px;
 }
 
 .felamimail-node-statusbox-progress {
-       width: 16px;
+    width: 16px;
     height: 16px;
     margin-top: 1px;
     background-repeat: no-repeat;
     border-radius: 8px;
     background-color: #D9E8FB;
     color: black;
-       line-height: 16px;
-       margin-top: 1px;
-       padding: 0px 5px;
+    line-height: 16px;
+    margin-top: 1px;
+    padding: 0px 5px;
 }
 
 .x-tree-selected .felamimail-node-statusbox-unread {
-       background-color: #FFFFFF;
+    background-color: #FFFFFF;
 }
 
 .felamimail-node-accountfailure {
     position: absolute;
     right: 5px;
-       width: 16px;
+    width: 16px;
     height: 16px;
     background-image:url(../../images/warning.gif);
     margin-right: 10px;
 .felamimail-recipient-grid .x-grid3 {
     background-color: #DFE8F6;
 }
-       
+
 .felamimail-recipient-grid tr {
     border-color: #DFE8F6;  
 }
index 2c6f055..ebed39d 100644 (file)
@@ -52,6 +52,14 @@ class HumanResources_Config extends Tinebase_Config_Abstract
      * @var string
      */
     const EXTRA_FREETIME_TYPE = 'extraFreetimeType';
+    
+    /**
+     * id of (filsystem) container for vacation templates
+     *
+     * @var string
+     */
+    const REPORT_TEMPLATES_CONTAINER_ID = 'reportTemplatesContainerId';
+    
     /**
      * (non-PHPdoc)
      * @see tine20/Tinebase/Config/Definition::$_properties
@@ -115,7 +123,16 @@ class HumanResources_Config extends Tinebase_Config_Abstract
             'clientRegistryInclude' => TRUE,
             'setByAdminModule'      => TRUE,
             'default' => '03-15'
-        )
+        ),
+        self::REPORT_TEMPLATES_CONTAINER_ID => array(
+        //_('Report Templates Container ID')
+            'label'                 => 'Report Templates Container ID',
+            'description'           => 'Report Templates Container ID',
+            'type'                  => Tinebase_Config_Abstract::TYPE_STRING,
+            'clientRegistryInclude' => FALSE,
+            'setByAdminModule'      => FALSE,
+            'setBySetupModule'      => FALSE,
+        ),
     );
 
     /**
diff --git a/tine20/HumanResources/Frontend/WebDAV.php b/tine20/HumanResources/Frontend/WebDAV.php
new file mode 100644 (file)
index 0000000..ee6cdb5
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Tine 2.0
+ *
+ * @package     HumanResources
+ * @subpackage  Frontend
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ *
+ */
+
+/**
+ * class to handle WebDAV tree
+ *
+ * @package     HumanResources
+ * @subpackage  Frontend
+ */
+class HumanResources_Frontend_WebDAV extends Tinebase_Frontend_WebDAV_Abstract
+{
+    /**
+     * application name
+     * 
+     * @var string
+     */
+    protected $_applicationName = 'HumanResources';
+    
+    /**
+    * app has personal folders
+    *
+    * @var string
+    */
+    protected $_hasPersonalFolders = FALSE;
+}
diff --git a/tine20/HumanResources/Frontend/WebDAV/Container.php b/tine20/HumanResources/Frontend/WebDAV/Container.php
new file mode 100644 (file)
index 0000000..a8cbbc5
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+use Sabre\DAV;
+
+/**
+ * Tine 2.0
+ *
+ * @package     HumanResources
+ * @subpackage  Frontend
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ *
+ */
+
+/**
+ * class to handle containers in WebDAV tree
+ *
+ * @package     HumanResources
+ * @subpackage  Frontend
+ */
+class HumanResources_Frontend_WebDAV_Container extends Tinebase_Frontend_WebDAV_Container
+{
+    protected $_applicationName = 'HumanResources';
+    
+    /**
+    * webdav file class
+    *
+    * @var string
+    */
+    protected $_fileClass = 'HumanResources_Frontend_WebDAV_File';
+    
+    /**
+     * webdav directory class
+     *
+     * @var string
+     */
+    protected $_directoryClass = 'HumanResources_Frontend_WebDAV_Directory';
+    
+    /**
+    * Creates a new subdirectory
+    *
+    * @param string $name
+    * @throws Sabre\DAV\Exception\Forbidden
+    * @return void
+    */
+    public function createDirectory($name)
+    {
+        throw new DAV\Exception\Forbidden('Forbidden to create folders here');
+    }
+}
diff --git a/tine20/HumanResources/Frontend/WebDAV/Directory.php b/tine20/HumanResources/Frontend/WebDAV/Directory.php
new file mode 100644 (file)
index 0000000..7767f6a
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+use Sabre\DAV;
+
+/**
+ * Tine 2.0
+ * 
+ * @package     HumanResources
+ * @subpackage  Frontend
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ */
+
+/**
+ * class to handle webdav requests for HumanResources
+ * 
+ * @package     HumanResources
+ * @subpackage  Frontend
+ */
+class HumanResources_Frontend_WebDAV_Directory extends Tinebase_Frontend_WebDAV_Directory
+{
+    /**
+    * webdav file class
+    *
+    * @var string
+    */
+    protected $_fileClass = 'HumanResources_Frontend_WebDAV_File';
+    
+    /**
+     * webdav directory class
+     *
+     * @var string
+     */
+    protected $_directoryClass = 'HumanResources_Frontend_WebDAV_Directory';
+    
+    /**
+    * Creates a new subdirectory
+    *
+    * @param string $name
+    * @throws Sabre\DAV\Exception\Forbidden
+    * @return void
+    */
+    public function createDirectory($name)
+    {
+        throw new DAV\Exception\Forbidden('Forbidden to create folders here');
+    }
+}
diff --git a/tine20/HumanResources/Frontend/WebDAV/File.php b/tine20/HumanResources/Frontend/WebDAV/File.php
new file mode 100644 (file)
index 0000000..bd6a74b
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Tine 2.0
+ * 
+ * @package     HumanResources
+ * @subpackage  Frontend
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ */
+
+/**
+ * class to handle webdav requests for HumanResources
+ * 
+ * @package     HumanResources
+ * @subpackage  Frontend
+ */
+class HumanResources_Frontend_WebDAV_File extends Tinebase_Frontend_WebDAV_File
+{
+}
index ee13a41..ebc97f5 100644 (file)
@@ -159,4 +159,32 @@ class HumanResources_Setup_Initialize extends Setup_Initialize
         ));
         HumanResources_Controller_WorkingTime::getInstance()->create($_record);
     }
+    
+
+    /**
+     * init application folders
+     */
+    protected function _initializeFolders()
+    {
+        self::createReportTemplatesFolder();
+    }
+    
+    
+    /**
+     * create reporting templates folder
+     */
+    public static function createReportTemplatesFolder()
+    {
+        $templateContainer = Tinebase_Container::getInstance()->createSystemContainer(
+            'HumanResources',
+            'Report Templates',
+            HumanResources_Config::REPORT_TEMPLATES_CONTAINER_ID
+        );
+        try {
+            Tinebase_FileSystem::getInstance()->createContainerNode($templateContainer);
+        } catch (Tinebase_Exception_Backend $teb) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__
+                . ' Could not create template folder: ' . $teb);
+        }
+    }
 }
index b815edf..bc33b5a 100644 (file)
@@ -85,4 +85,14 @@ class HumanResources_Setup_Update_Release8 extends Setup_Update_Abstract
         }
         $this->setApplicationVersion('HumanResources', '8.3');
     }
+    
+    /**
+     * creates report templates folder
+     */
+    public function update_3()
+    {
+        HumanResources_Setup_Initialize::createReportTemplatesFolder();
+    
+        $this->setApplicationVersion('HumanResources', '8.4');
+    }
 }
index d65d780..33910de 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>HumanResources</name>
-    <version>8.3</version>
+    <version>8.4</version>
     <order>51</order>
     <depends>
         <application>Calendar</application>
index 343c285..d98348d 100644 (file)
@@ -19,8 +19,8 @@
                 </field>
                 <field>
                     <name>account_id</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
@@ -64,7 +64,7 @@
             </declaration>
         </table>
         <table>
-               <!-- @todo add constraints to phone_id/line_id? -->
+            <!-- @todo add constraints to phone_id/line_id? -->
             <name>phone_callhistory</name>
             <version>2</version>
             <declaration>
                 <field>
                     <name>ringing</name>
                     <type>integer</type>
-                </field>                
+                </field>
                 <field>
                     <name>direction</name>
                     <type>text</type>
index 7eef8b4..926abf8 100644 (file)
@@ -44,7 +44,7 @@ class Projects_Model_Project extends Tinebase_Record_Abstract
      * @var array
      */
     protected static $_resolveForeignIdFields = array(
-       'Tinebase_Model_User' => array('created_by', 'last_modified_by')
+        'Tinebase_Model_User' => array('created_by', 'last_modified_by')
     );    
 
     /**
@@ -99,3 +99,4 @@ class Projects_Model_Project extends Tinebase_Record_Abstract
             )
         );
 }
+
index 5309c20..ca7cc23 100644 (file)
     /*padding: 2px;*/
     border-bottom: 1px solid #EDEDED;
     font-family:arial,tahoma,helvetica,sans-serif;
-       font-size:11px;
-       font-size-adjust:none;
-       font-style:normal;
-       font-variant:normal;
-       font-weight:normal;
-       line-height:normal;
+    font-size:11px;
+    font-size-adjust:none;
+    font-style:normal;
+    font-variant:normal;
+    font-weight:normal;
+    line-height:normal;
 }
 
 .RequestTracker-History-Item {
-       padding: 2px 0px 2px 5px;
+    padding: 2px 0px 2px 5px;
     border-top: 1px solid #EDEDED;
 }
 
     border-left: 5px solid #888888;
     border-right: 2px solid #888888;
 }
+
index da48f6b..0e578a8 100644 (file)
  */
 class Sales_Acl_Rights extends Tinebase_Acl_Rights_Abstract
 {
-   /**
+    /**
      * the right to manage products
      * @staticvar string
      */
     const MANAGE_PRODUCTS = 'manage_products';
-        
+    
+    /**
+     * the right to manage cost centers
+     * @staticvar string
+     */
+    const MANAGE_COSTCENTERS = 'manage_costcenters';
+    
     /**
      * holds the instance of the singleton
      *
@@ -65,7 +71,7 @@ class Sales_Acl_Rights extends Tinebase_Acl_Rights_Abstract
     public static function getInstance() 
     {
         if (self::$_instance === NULL) {
-            self::$_instance = new Sales_Acl_Rights;
+            self::$_instance = new self();
         }
         
         return self::$_instance;
@@ -99,10 +105,14 @@ class Sales_Acl_Rights extends Tinebase_Acl_Rights_Abstract
         $translate = Tinebase_Translation::getTranslation('Sales');
         
         $rightDescriptions = array(
-            self::MANAGE_PRODUCTS  => array(
+            self::MANAGE_PRODUCTS => array(
                 'text'          => $translate->_('manage products'),
                 'description'   => $translate->_('add, edit and delete products'),
             ),
+            self::MANAGE_COSTCENTERS => array(
+                'text'          => $translate->_('manage cost centers'),
+                'description'   => $translate->_('add, edit and delete cost centers'),
+            ),
         );
         
         $rightDescriptions = array_merge($rightDescriptions, parent::getTranslatedRightDescriptions());
index 0951423..773b7c2 100644 (file)
@@ -18,6 +18,8 @@
  */
 class Sales_Controller_CostCenter extends Tinebase_Controller_Record_Abstract
 {
+    
+    protected $_duplicateCheckFields = array(array('number'));
 
     /**
      * check for container ACLs
@@ -41,14 +43,15 @@ class Sales_Controller_CostCenter extends Tinebase_Controller_Record_Abstract
      *
      * @var boolean
      */
-    protected $_purgeRecords = TRUE;
+    protected $_purgeRecords = FALSE;
 
     /**
      * omit mod log for this records
      *
      * @var boolean
      */
-    protected $_omitModLog = TRUE;
+    protected $_omitModLog = FALSE;
+    
     /**
      * the constructor
      * don't use the constructor. use the singleton
@@ -60,6 +63,31 @@ class Sales_Controller_CostCenter extends Tinebase_Controller_Record_Abstract
     }
 
     /**
+     * if foreign Id fields should be resolved on search and get from json
+     * should have this format:
+     *     array('Calendar_Model_Contact' => 'contact_id', ...)
+     * or for more fields:
+     *     array('Calendar_Model_Contact' => array('contact_id', 'customer_id), ...)
+     * (e.g. resolves contact_id with the corresponding Model)
+     *
+     * @var array
+     */
+    protected static $_resolveForeignIdFields = array(
+        'Tinebase_Model_User' => array('created_by', 'last_modified_by')
+    );
+    
+    /**
+     * name of fields containing datetime or an array of datetime information
+     *
+     * @var array list of datetime fields
+     */
+    protected $_datetimeFields = array(
+        'creation_time',
+        'last_modified_time',
+        'deleted_time'
+    );
+    
+    /**
      * holds the instance of the singleton
      * @var Sales_Controller_CostCenter
      */
@@ -72,7 +100,7 @@ class Sales_Controller_CostCenter extends Tinebase_Controller_Record_Abstract
     public static function getInstance()
     {
         if (self::$_instance === NULL) {
-            self::$_instance = new Sales_Controller_CostCenter();
+            self::$_instance = new self();
         }
 
         return self::$_instance;
index 4ea36ec..a610e57 100644 (file)
@@ -181,6 +181,8 @@ class Sales_Frontend_Json extends Tinebase_Frontend_Json_Abstract
         return $this->_delete($ids, $this->_productController);
     }
     
+    // costcenter methods
+    
     /**
      * Search for records matching given arguments
      *
@@ -193,6 +195,39 @@ class Sales_Frontend_Json extends Tinebase_Frontend_Json_Abstract
         return $this->_search($filter, $paging, Sales_Controller_CostCenter::getInstance(), 'Sales_Model_CostCenterFilter');
     }
     
+    /**
+     * Return a single record
+     *
+     * @param   string $id
+     * @return  array record data
+     */
+    public function getCostCenter($id)
+    {
+        return $this->_get($id, Sales_Controller_CostCenter::getInstance());
+    }
+    
+    /**
+     * creates/updates a record
+     *
+     * @param  array $recordData
+     * @return array created/updated record
+     */
+    public function saveCostCenter($recordData)
+    {
+        return $this->_save($recordData, Sales_Controller_CostCenter::getInstance(), 'CostCenter');
+    }
+    
+    /**
+     * deletes existing records
+     *
+     * @param  array $ids
+     * @return string
+     */
+    public function deleteCostCenters($ids)
+    {
+        return $this->_delete($ids, Sales_Controller_CostCenter::getInstance());
+    }
+    
     // division functions
 
     /**
index 58f8556..afd45d8 100644 (file)
@@ -45,6 +45,16 @@ class Sales_Model_CostCenter extends Tinebase_Record_Abstract
         'remark'                => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         // relations (linked users/groups and customers
         'relations'             => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => NULL),
+        
+        // modlog information
+        'created_by'            => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'creation_time'         => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'last_modified_by'      => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'last_modified_time'    => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'is_deleted'            => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'deleted_time'          => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'deleted_by'            => array(Zend_Filter_Input::ALLOW_EMPTY => true),
+        'seq'                   => array(Zend_Filter_Input::ALLOW_EMPTY => true),
     );
     
     /**
index f8b474c..7fbf3a7 100644 (file)
           "path": "js/"
         },
         {
+          "text": "CostCenterGridPanel.js",
+          "path": "js/"
+        },
+        {
+          "text": "CostCenterEditDialog.js",
+          "path": "js/"
+        },
+        {
           "text": "ContractGridPanel.js",
           "path": "js/"
         },
index 5711f57..aeca50b 100644 (file)
@@ -12,10 +12,62 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
 {
     /**
      * update to 8.1
+     *   - add modlog to costcenter model
+     */
+    public function update_0()
+    {
+        $fields = array('<field>
+                <name>created_by</name>
+                <type>text</type>
+                <length>40</length>
+            </field>','
+            <field>
+                <name>creation_time</name>
+                <type>datetime</type>
+            </field> ','
+            <field>
+                <name>last_modified_by</name>
+                <type>text</type>
+                <length>40</length>
+            </field>','
+            <field>
+                <name>last_modified_time</name>
+                <type>datetime</type>
+            </field>','
+            <field>
+                <name>is_deleted</name>
+                <type>boolean</type>
+                <default>false</default>
+            </field>','
+            <field>
+                <name>deleted_by</name>
+                <type>text</type>
+                <length>40</length>
+            </field>','
+            <field>
+                <name>deleted_time</name>
+                <type>datetime</type>
+            </field>','
+            <field>
+                <name>seq</name>
+                <type>integer</type>
+                <notnull>true</notnull>
+                <default>0</default>
+            </field>');
+        
+        foreach($fields as $field) {
+            $declaration = new Setup_Backend_Schema_Field_Xml($field);
+            $this->_backend->addCol('sales_cost_centers', $declaration);
+        }
+        
+        $this->setTableVersion('sales_cost_centers', 2);
+    }
+    
+    /**
      * @see: 0009048: sometimes the status of sales contract has an icon, sometimes not
      *       https://forge.tine20.org/mantisbt/view.php?id=9048
      */
-    public function update_0()
+    public function update_1()
     {
         $quotedTableName = $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "sales_contracts");
         
@@ -30,6 +82,6 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
         $sql =  "UPDATE " . $quotedTableName . " SET " . $this->_db->quoteIdentifier('cleared') . " = 'NOT_YET_CLEARED' WHERE " . $this->_db->quoteIdentifier('cleared') . " = 'not yet cleared';";
         $this->_db->query($sql);
         
-        $this->setApplicationVersion('Sales', '8.1');
+        $this->setApplicationVersion('Sales', '8.2');
     }
 }
index 19e0e49..74f3868 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Sales</name>
-    <version>8.1</version>
+    <version>8.2</version>
     <order>50</order>
     <status>enabled</status>
     <tables>
         </table>
         <table>
             <name>sales_cost_centers</name>
-            <version>1</version>
+            <version>2</version>
             <declaration>
                 <field>
                     <name>id</name>
                         <name>number</name>
                     </field>
                 </index>
+                <field>
+                    <name>created_by</name>
+                    <type>text</type>
+                    <length>40</length>
+                </field>
+                <field>
+                    <name>creation_time</name>
+                    <type>datetime</type>
+                </field> 
+                <field>
+                    <name>last_modified_by</name>
+                    <type>text</type>
+                    <length>40</length>
+                </field>
+                <field>
+                    <name>last_modified_time</name>
+                    <type>datetime</type>
+                </field>
+                <field>
+                    <name>is_deleted</name>
+                    <type>boolean</type>
+                    <default>false</default>
+                </field>
+                <field>
+                    <name>deleted_by</name>
+                    <type>text</type>
+                    <length>40</length>
+                </field>
+                <field>
+                    <name>deleted_time</name>
+                    <type>datetime</type>
+                </field>
+                <field>
+                    <name>seq</name>
+                    <type>integer</type>
+                    <notnull>true</notnull>
+                    <default>0</default>
+                </field>
             </declaration>
         </table>
         <table>
diff --git a/tine20/Sales/js/CostCenterEditDialog.js b/tine20/Sales/js/CostCenterEditDialog.js
new file mode 100644 (file)
index 0000000..f41df63
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Tine 2.0
+ * 
+ * @package     Sales
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ *
+ */
+Ext.namespace('Tine.Sales');
+
+/**
+ * CostCenter edit dialog
+ * 
+ * @namespace   Tine.Sales
+ * @class       Tine.Sales.CostCenterEditDialog
+ * @extends     Tine.widgets.dialog.EditDialog
+ * 
+ * <p>CostCenter Edit Dialog</p>
+ * <p><pre>
+ * </pre></p>
+ * 
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * 
+ * @param       {Object} config
+ * @constructor
+ * Create a new Tine.Sales.CostCenterGridPanel
+ */
+Tine.Sales.CostCenterEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
+    /**
+     * @private
+     */
+    windowNamePrefix: 'CostCenterEditWindow_',
+    appName: 'Sales',
+    recordClass: Tine.Sales.Model.CostCenter,
+    recordProxy: Tine.Sales.costcenterBackend,
+    tbarItems: [],
+    
+    initComponent: function() {
+        Tine.Sales.CostCenterEditDialog.superclass.initComponent.call(this);
+    },
+    /**
+     * called on multiple edit
+     * @return {Boolean}
+     */
+    isMultipleValid: function() {
+        return true;
+    },
+    
+    /**
+     * returns dialog
+     * 
+     * NOTE: when this method gets called, all initalisation is done.
+     */
+    getFormItems: function() {
+        return {
+            xtype: 'tabpanel',
+            border: false,
+            plain:true,
+            activeTab: 0,
+            border: false,
+            defaults: {
+                hideMode: 'offsets'
+            },
+            plugins: [{
+                ptype : 'ux.tabpanelkeyplugin'
+            }],
+            items:[
+                {
+                title: this.app.i18n.n_('Cost Center', 'Cost Centers', 1),
+                autoScroll: true,
+                border: false,
+                frame: true,
+                layout: 'border',
+                items: [{
+                    region: 'center',
+                    xtype: 'columnform',
+                    labelAlign: 'top',
+                    formDefaults: {
+                        xtype:'textfield',
+                        anchor: '100%',
+                        labelSeparator: '',
+                        columnWidth: .333
+                    },
+                    items: [[{
+                        columnWidth: .25,
+                        fieldLabel: this.app.i18n._('Number'),
+                        name: 'number',
+                        xtype:  'numberfield',
+                        multiEditable: false,
+                        allowBlank: false
+                    },{
+                        columnWidth: .75,
+                        fieldLabel: this.app.i18n._('Remark'),
+                        name: 'remark',
+                        allowBlank: false
+                    }]
+                    ]
+                }]
+            }]
+        };
+    }
+});
+
+/**
+ * Sales Edit Popup
+ */
+Tine.Sales.CostCenterEditDialog.openWindow = function (config) {
+    var id = (config.record && config.record.id) ? config.record.id : 0;
+    var window = Tine.WindowFactory.getWindow({
+        width: 650,
+        height: 450,
+        name: Tine.Sales.CostCenterEditDialog.prototype.windowNamePrefix + id,
+        contentPanelConstructor: 'Tine.Sales.CostCenterEditDialog',
+        contentPanelConstructorConfig: config
+    });
+    return window;
+};
diff --git a/tine20/Sales/js/CostCenterGridPanel.js b/tine20/Sales/js/CostCenterGridPanel.js
new file mode 100644 (file)
index 0000000..2fed9dc
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Tine 2.0
+ * 
+ * @package     Sales
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stintzing <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ *
+ */
+Ext.namespace('Tine.Sales');
+
+/**
+ * CostCenter grid panel
+ * 
+ * @namespace   Tine.Sales
+ * @class       Tine.Sales.CostCenterGridPanel
+ * @extends     Tine.widgets.grid.GridPanel
+ * 
+ * <p>CostCenter Grid Panel</p>
+ * <p><pre>
+ * </pre></p>
+ * 
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Alexander Stinting <a.stintzing@metaways.de>
+ * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * 
+ * @param       {Object} config
+ * @constructor
+ * 
+ * Create a new Tine.Sales.CostCenterGridPanel
+ */
+Tine.Sales.CostCenterGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
+    // model generics
+    recordClass: Tine.Sales.Model.CostCenter,
+    
+    // grid specific
+    defaultSortInfo: {field: 'remark', dir: 'ASC'},
+    gridConfig: {
+        autoExpandColumn: 'remark'
+    },
+    
+    multipleEdit: true,
+    
+    initComponent: function() {
+        this.recordProxy = Tine.Sales.costcenterBackend;
+        this.gridConfig.columns = this.getColumns();
+        Tine.Sales.CostCenterGridPanel.superclass.initComponent.call(this);
+    },
+    
+    /**
+     * returns cm
+     * @private
+     */
+    getColumns: function(){
+        return [{
+            id: 'number',
+            header: this.app.i18n._("Number"),
+            width: 100,
+            sortable: true,
+            dataIndex: 'number'
+        },{
+            id: 'remark',
+            header: this.app.i18n._("Remark"),
+            width: 200,
+            sortable: true,
+            dataIndex: 'remark'
+        }].concat(this.getModlogColumns())
+    }
+});
index c56662a..cf9ccc0 100644 (file)
@@ -172,12 +172,12 @@ Tine.Sales.Model.Contract.getFilterModel = function() {
 };
 
 // COST CENTER
-Tine.Sales.Model.CostCenterArray = [
+Tine.Sales.Model.CostCenterArray = Tine.Tinebase.Model.genericFields.concat([
     { name: 'id' },
     { name: 'number' },
     { name: 'remark' },
     { name: 'relations' }
-];
+]);
 
 /**
  * @namespace Tine.Sales.Model
@@ -196,7 +196,10 @@ Tine.Sales.Model.CostCenter = Tine.Tinebase.data.Record.create(Tine.Sales.Model.
     recordsName: 'Cost Centers',
     // ngettext('All CostCenters', 'All CostCenters', n);
     containerName: 'All CostCenters',
-    containersName: 'All CostCenters'
+    containersName: 'All CostCenters',
+    getTitle: function() {
+        return this.get('number')  + ' - ' + this.get('remark');
+    }
 });
 
 // costcenters filtermodel
index f968baf..6c2e0b6 100644 (file)
@@ -27,8 +27,10 @@ Ext.namespace('Tine.Sales');
 Tine.Sales.MainScreen = Ext.extend(Tine.widgets.MainScreen, {
     activeContentType: 'Product',
     contentTypes: [
-        {modelName: 'Product',  requiredRight: null, singularContainerMode: true},
-        {modelName: 'Contract', requiredRight: null, singularContainerMode: true, genericCtxActions: ['grants']}]
+        {modelName: 'Product', requiredRight: null, singularContainerMode: true},
+        {modelName: 'Contract', requiredRight: null, singularContainerMode: true, genericCtxActions: ['grants']},
+        {modelName: 'CostCenter', requiredRight: 'manage_costcenters', singularContainerMode: true}
+    ]
 });
 
 /**
@@ -59,6 +61,15 @@ Ext.extend(Tine.Sales.ContractFilterPanel, Tine.widgets.persistentfilter.PickerP
     filter: [{field: 'model', operator: 'equals', value: 'Sales_Model_ContractFilter'}]
 });
 
+Tine.Sales.CostCenterFilterPanel = function(config) {
+    Ext.apply(this, config);
+    Tine.Sales.CostCenterFilterPanel.superclass.constructor.call(this);
+};
+
+Ext.extend(Tine.Sales.CostCenterFilterPanel, Tine.widgets.persistentfilter.PickerPanel, {
+    filter: [{field: 'model', operator: 'equals', value: 'Sales_Model_CostCenterFilter'}]
+});
+
 /**
  * default contracts backend
  */
index e70a815..965158e 100644 (file)
@@ -179,10 +179,6 @@ msgstr "Beschreibung"
 msgid "Enter description..."
 msgstr "Bitte geben Sie eine Beschreibung ein..."
 
-#: js/ContractCostCenterFilterModel.js:30
-msgid "Cost Center"
-msgstr "Kostenstelle"
-
 #: js/ContractCostCenterFilterModel.js:32
 msgid "without CostCenter"
 msgstr "ohne Kostenstelle"
@@ -284,3 +280,14 @@ msgstr "Firma"
 #: Controller/Contract.php:83
 msgid "The number you have tried to set is already in use!"
 msgstr "Diese Nummer ist bereits vergeben!"
+
+msgid "manage cost centers"
+msgstr "Kostenstellen verwalten"
+
+msgid "add, edit and delete cost centers"
+msgstr "Kostenstellen hinzufügen, bearbeiten und löschen"
+
+msgid "Cost Center"
+msgid_plural "Cost Centers"
+msgstr[0] "Kostenstelle"
+msgstr[1] "Kostenstellen"
index 13ed52d..d4d8555 100644 (file)
@@ -277,3 +277,15 @@ msgstr ""
 #: Controller/Contract.php:83
 msgid "The number you have tried to set is already in use!"
 msgstr ""
+
+msgid "manage cost centers"
+msgstr ""
+
+msgid "add, edit and delete cost centers"
+msgstr ""
+
+msgid "Cost Centers"
+msgstr ""
+
+msgid "CostCenter"
+msgstr ""
index 8ac75fa..45397a9 100644 (file)
@@ -30,7 +30,7 @@ class SimpleFAQ_Model_Faq extends Tinebase_Record_Abstract
      */
     protected $_application = 'SimpleFAQ';
 
-       /**
+    /**
      * if foreign Id fields should be resolved on search and get from json
      * should have this format: 
      *     array('Calendar_Model_Contact' => 'contact_id', ...)
@@ -96,3 +96,4 @@ class SimpleFAQ_Model_Faq extends Tinebase_Record_Abstract
         // do something here if you like
      }
 }
+
index 8fc52c9..c85fd02 100644 (file)
 /**
  * class to hold contact data
  *
- * @property   account_id      id of associated user
- * @property   email           the email address of the contact
- * @property   n_family
- * @property   n_fileas        display name
- * @property   n_fn            the full name
- * @property   n_given
- * @property   type            type of contact
+ * @property    account_id   id of associated user
+ * @property    email        the email address of the contact
+ * @property    n_family
+ * @property    n_fileas    display name
+ * @property    n_fn        the full name
+ * @property    n_given
+ * @property    type        type of contact
  * @package     Sipgate
  */
 class Sipgate_Model_Line extends Tinebase_Record_Abstract
@@ -68,3 +68,4 @@ class Sipgate_Model_Line extends Tinebase_Record_Abstract
         'last_sync'
     );
 }
+
index 7db1b07..678a7c9 100644 (file)
@@ -21,7 +21,7 @@ class Tasks_Convert_Task_VCalendar_EMClient extends Tasks_Convert_Task_VCalendar
 
     // eM Client/5.0.17595.0
     const HEADER_MATCH = '/eM Client\/(?P<version>.*)/';
-       
+    
     protected $_supportedFields = array(
         'seq',
         'dtstart',
@@ -47,3 +47,4 @@ class Tasks_Convert_Task_VCalendar_EMClient extends Tasks_Convert_Task_VCalendar
         'originator_tz'
     );
 }
+
index d8b34f8..51ea641 100644 (file)
 class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract implements \Sabre\CalDAV\ICalendar
 {
     protected $_applicationName = 'Tasks';
-    
+
     protected $_model = 'Task';
 
     protected $_suffix = '.ics';
-    
+
     /**
      * Performs a calendar-query on the contents of this calendar.
      *
@@ -44,9 +44,9 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
     {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(
             __METHOD__ . '::' . __LINE__ . ' filters ' . print_r($filters, true));
-        
+
         //var_dump($filters['comp-filters'][0]);
-        
+
         $filterArray = array(
             array(
                 'field'    => 'container_id',
@@ -54,7 +54,7 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
                 'value'    => $this->_container->getId()
             )
         );
-        
+
         /*if (isset($filters['comp-filters']) && isset($filters['comp-filters'][0]['time-range'])) {
             if (isset($filters['comp-filters'][0]['time-range']['start'])) {
                 $filterArray[] = array(
@@ -70,17 +70,17 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
         
         $filterClass = $this->_application->name . '_Model_' . $this->_model . 'Filter';
         $filter = new $filterClass($filterArray);
-    
+
         /**
          * see http://forge.tine20.org/mantisbt/view.php?id=5122
          * we must use action 'sync' and not 'get' as
          * otherwise the calendar also return events the user only can see because of freebusy
          */
         $ids = $this->_getController()->search($filter, null, false, true, 'sync');
-    
+
         return $ids;
     }
-    
+
     /**
      * (non-PHPdoc)
      * @see \Sabre\DAV\Collection::getChild()
@@ -113,7 +113,7 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
                 ))
             ));
             $object = $this->_getController()->search($filter, null, false, false, 'sync')->getFirstRecord();
-        
+
             if ($object == null) {
                 throw new \Sabre\DAV\Exception\NotFound('Object not found');
             }
@@ -133,10 +133,10 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
         }
         
         $objectClass = $this->_application->name . '_Frontend_WebDAV_' . $this->_model;
-        
+
         return new $objectClass($this->_container, $object);
     }
-    
+
     /**
      * Returns an array with all the child nodes
      *
@@ -160,20 +160,20 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
                 )
             )
         ));
-    
+
         /**
          * see http://forge.tine20.org/mantisbt/view.php?id=5122
          * we must use action 'sync' and not 'get' as
          * otherwise the calendar also return events the user only can see because of freebusy
          */
         $objects = $this->_getController()->search($filter, null, false, false, 'sync');
-    
+
         $children = array();
-    
+
         foreach ($objects as $object) {
             $children[] = $this->getChild($object);
         }
-    
+
         return $children;
     }
     
@@ -186,14 +186,14 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
     public function getProperties($requestedProperties) 
     {
         $displayName = $this->_container->type == Tinebase_Model_Container::TYPE_SHARED ? $this->_container->name . ' (shared)' : $this->_container->name;
-        
+
         $ctags = Tinebase_Container::getInstance()->getContentSequence($this->_container);
-        
+
         $properties = array(
             '{http://calendarserver.org/ns/}getctag' => $ctags ? $ctags : 1,
             'id'                => $this->_container->getId(),
             'uri'               => $this->_useIdAsName == true ? $this->_container->getId() : $this->_container->name,
-            '{DAV:}resource-id'        => 'urn:uuid:' . $this->_container->getId(),
+            '{DAV:}resource-id' => 'urn:uuid:' . $this->_container->getId(),
             '{DAV:}owner'       => new \Sabre\DAVACL\Property\Principal(\Sabre\DAVACL\Property\Principal::HREF, 'principals/users/' . Tinebase_Core::getUser()->contact_id),
             '{DAV:}displayname' => $displayName,
             '{http://apple.com/ns/ical/}calendar-color' => (empty($this->_container->color)) ? '#000000' : $this->_container->color,
@@ -212,7 +212,7 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . print_r($properties, true));
         
         $response = array();
-    
+
         foreach($requestedProperties as $prop) {
             if (isset($properties[$prop])) {
                 $response[$prop] = $properties[$prop];
@@ -224,4 +224,4 @@ class Tasks_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstract
         
         return $response;
     }
-}
\ No newline at end of file
+}
index 9c3e8cd..f26259b 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
 .TasksIconCls, .TasksTask {
     background-image:url(../../images/oxygen/16x16/actions/todo.png) !important;
 }
     background-image:url(../../images/oxygen/32x32/actions/todo.png) !important;
 }
 
-
 .TasksMainGridStatus {
     width: 12px;
-       height: 12px;
+    height: 12px;
 }
 
 /***** tasks grid panel classes ******/
index 85f63a7..d80a04e 100644 (file)
@@ -95,8 +95,8 @@
                 </field>
                 <field>
                     <name>created_by</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                 </field>
                 <field>
                     <name>creation_time</name>
                 </field> 
                 <field>
                     <name>last_modified_by</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                 </field>
                 <field>
                     <name>last_modified_time</name>
                 </field>
                 <field>
                     <name>account_id</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
                 </field>
                 <field>
                     <name>created_by</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                 </field>
                 <field>
                     <name>creation_time</name>
         </table>
     </tables>
 </application>
+
index d8be343..a2a4591 100644 (file)
@@ -150,7 +150,7 @@ class Tinebase_Auth_ModSsl_Certificate_X509
     
         $out = array();
         // certificate verify ...
-       $w = exec('openssl verify -CAfile '.$this->casfile.' '.$certTempFile,$out);
+        $w = exec('openssl verify -CAfile '.$this->casfile.' '.$certTempFile,$out);
         self::removeTempFiles($temporary_files);
         $aux = explode(' ',$w);
         if(isset($aux[1])) {
@@ -365,7 +365,7 @@ class Tinebase_Auth_ModSsl_Certificate_X509
     {
         return $this->status['isValid'];
     }
-    
+
     public function getAuthorityKeyIdentifier()
     {
         return $this->authorityKeyIdentifier;
@@ -385,7 +385,7 @@ class Tinebase_Auth_ModSsl_Certificate_X509
     {
         return $this->status['errors'];
     }
-    
+
     public static function generateTempFilename(&$tab_arqs, $path)
     {
 
@@ -395,7 +395,7 @@ class Tinebase_Auth_ModSsl_Certificate_X509
         array_push($tab_arqs ,$aux);
         return  $aux;
     }
-    
+
     private static function removeTempFiles($tab_arqs)
     {
         foreach($tab_arqs as $file ) {
@@ -404,10 +404,9 @@ class Tinebase_Auth_ModSsl_Certificate_X509
             }
         }
     }
-    
+
     public static function writeTo($file, $content)
     {
         return file_put_contents($file, $content);   
     }
-
 }
\ No newline at end of file
index 2a6a8f6..5a2b5c9 100644 (file)
@@ -365,20 +365,23 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
      * used to get a list of all containers accesssible by the current user
      * 
      * @param   string|Tinebase_Model_User          $accountId
-     * @param   string                              $applicationName
+     * @param   string|Tinebase_Model_Application   $recordClass
      * @param   array|string                        $grant
      * @param   bool                                $onlyIds return only ids
      * @param   bool                                $ignoreACL
      * @return  Tinebase_Record_RecordSet|array
      * @throws  Tinebase_Exception_NotFound
      */
-    public function getContainerByACL($accountId, $applicationName, $grant, $onlyIds = FALSE, $ignoreACL = FALSE)
+    public function getContainerByACL($accountId, $recordClass, $grant, $onlyIds = FALSE, $ignoreACL = FALSE)
     {
+        // legacy handling 
+        $meta = $this->_resolveRecordClassArgument($recordClass);
+        
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
-            . ' app: ' . $applicationName . ' / account: ' . $accountId . ' / grant:' . implode('', (array)$grant));
+            . ' app: ' . $meta['appName'] . ' / account: ' . $accountId . ' / grant:' . implode('', (array)$grant));
         
         $accountId     = Tinebase_Model_User::convertUserIdToInt($accountId);
-        $applicationId = Tinebase_Application::getInstance()->getApplicationByName($applicationName)->getId();
+        $applicationId = Tinebase_Application::getInstance()->getApplicationByName($meta['appName'])->getId();
         $grant         = $ignoreACL ? '*' : $grant;
         
         $select = $this->_getSelect($onlyIds ? 'id' : '*')
@@ -410,7 +413,7 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
         // any account should have at least one personal folder
         // @todo add test for empty case
         if (empty($result)) {
-            $personalContainer = $this->getDefaultContainer($applicationName, $accountId);
+            $personalContainer = $this->getDefaultContainer($meta['appName'], $accountId);
             if ($personalContainer instanceof Tinebase_Model_Container) {
                 $result = ($onlyIds) ? 
                     array($personalContainer->getId()) : 
@@ -470,16 +473,19 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
     /**
      * return a container by container name
      *
-     * @param   string $appName app name
-     * @param   int|Tinebase_Model_Container $containerName
-     * @param   string $type
-     * @param   string $ownerId
+     * @param   string|Tinebase_Model_Application  $recordClass app name
+     * @param   int|Tinebase_Model_Container       $containerName
+     * @param   string                             $type
+     * @param   string                             $ownerId
      * @return  Tinebase_Model_Container
      * @throws  Tinebase_Exception_NotFound
      * @throws  Tinebase_Exception_UnexpectedValue
      */
-    public function getContainerByName($appName, $containerName, $type, $ownerId = NULL)
+    public function getContainerByName($recordClass, $containerName, $type, $ownerId = NULL)
     {
+        // legacy handling
+        $meta = $this->_resolveRecordClassArgument($recordClass);
+        
         if ($type !== Tinebase_Model_Container::TYPE_PERSONAL && $type !== Tinebase_Model_Container::TYPE_SHARED) {
             throw new Tinebase_Exception_UnexpectedValue ("Invalid type $type supplied.");
         }
@@ -490,7 +496,7 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
         
         $ownerId = $ownerId instanceof Tinebase_Model_User ? $ownerId->getId() : $ownerId;
         
-        $applicationId = Tinebase_Application::getInstance()->getApplicationByName($appName)->getId();
+        $applicationId = Tinebase_Application::getInstance()->getApplicationByName($meta['appName'])->getId();
 
         $select = $this->_getSelect()
             ->where("{$this->_db->quoteIdentifier('container.application_id')} = ?", $applicationId)
@@ -700,16 +706,19 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
      * returns the shared container for a given application accessible by the current user
      *
      * @param   string|Tinebase_Model_User          $_accountId
-     * @param   string|Tinebase_Model_Application   $_application
+     * @param   string|Tinebase_Model_Application   $recordClass
      * @param   array|string                        $_grant
      * @param   bool                                $_ignoreACL
      * @return  Tinebase_Record_RecordSet set of Tinebase_Model_Container
      * @throws  Tinebase_Exception_NotFound
      */
-    public function getSharedContainer($_accountId, $_application, $_grant, $_ignoreACL = FALSE)
+    public function getSharedContainer($_accountId, $recordClass, $_grant, $_ignoreACL = FALSE)
     {
+        // legacy handling
+        $meta = $this->_resolveRecordClassArgument($recordClass);
+        
         $accountId   = Tinebase_Model_User::convertUserIdToInt($_accountId);
-        $application = Tinebase_Application::getInstance()->getApplicationByName($_application);
+        $application = Tinebase_Application::getInstance()->getApplicationByName($meta['appName']);
         $grant       = $_ignoreACL ? '*' : $_grant;
         
         $select = $this->_getSelect()
@@ -740,14 +749,17 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
      * return users which made personal containers accessible to given account
      *
      * @param   string|Tinebase_Model_User          $_accountId
-     * @param   string|Tinebase_Model_Application   $_application
+     * @param   string|Tinebase_Model_Application   $recordClass
      * @param   array|string                        $_grant
      * @param   bool                                $_ignoreACL
      * @return  Tinebase_Record_RecordSet set of Tinebase_Model_User
      */
-    public function getOtherUsers($_accountId, $_application, $_grant, $_ignoreACL = FALSE)
+    public function getOtherUsers($_accountId, $recordClass, $_grant, $_ignoreACL = FALSE)
     {
-        $containersData = $this->_getOtherUsersContainerData($_accountId, $_application, $_grant, $_ignoreACL);
+        // legacy handling
+        $meta = $this->_resolveRecordClassArgument($recordClass);
+        
+        $containersData = $this->_getOtherUsersContainerData($_accountId, $meta['appName'], $_grant, $_ignoreACL);
         
         $userIds = array();
         foreach($containersData as $containerData) {
@@ -764,14 +776,17 @@ class Tinebase_Container extends Tinebase_Backend_Sql_Abstract
      * return set of all personal container of other users made accessible to the given account 
      *
      * @param   string|Tinebase_Model_User          $_accountId
-     * @param   string|Tinebase_Model_Application   $_application
+     * @param   string|Tinebase_Model_Application   $recordClass
      * @param   array|string                        $_grant
      * @param   bool                                $_ignoreACL
      * @return  Tinebase_Record_RecordSet set of Tinebase_Model_Container
      */
-    public function getOtherUsersContainer($_accountId, $_application, $_grant, $_ignoreACL = FALSE)
+    public function getOtherUsersContainer($_accountId, $recordClass, $_grant, $_ignoreACL = FALSE)
     {
-        $containerData = $this->_getOtherUsersContainerData($_accountId, $_application, $_grant, $_ignoreACL);
+        // legacy handling
+        $meta = $this->_resolveRecordClassArgument($recordClass);
+        
+        $containerData = $this->_getOtherUsersContainerData($_accountId, $meta['appName'], $_grant, $_ignoreACL);
         $result = new Tinebase_Record_RecordSet('Tinebase_Model_Container', $containerData, TRUE);
         
         return $result;
index 9d550ec..2ea5a35 100644 (file)
@@ -51,14 +51,14 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
      * @var string
      */
     protected $_subconfigKey =  NULL;
-    
+
     /**
     * client id
     *
     * @var string
     */
     protected $_clientId = NULL;
-    
+
     /**
      * the constructor
      * 
@@ -69,23 +69,23 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         if ($this->_configKey === NULL || $this->_subconfigKey === NULL) {
             throw new Tinebase_Exception_UnexpectedValue('Need config keys for this backend');
         }
-        
+
         // get email user backend config options (host, dbname, username, password, port)
         $emailConfig = Tinebase_Config::getInstance()->get($this->_configKey, new Tinebase_Config_Struct())->toArray();
-        
+
         // merge _config and email backend config
         $this->_config = array_merge($emailConfig[$this->_subconfigKey], $this->_config);
-        
+
         // _tablename (for example "dovecot_users")
         $this->_userTable = $this->_config['prefix'] . $this->_config['userTable'];
-        
+
         // connect to DB
         $this->_getDB($this->_config);
         $this->_dbCommand = Tinebase_Backend_Sql_Command::factory($this->_db);
-        
+
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($this->_config, TRUE));
     }
-    
+
     /**
      * get new email user
      * 
@@ -101,7 +101,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         
         return $result;
     }
-    
+
     /**
     * delete user by id
     *
@@ -114,7 +114,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         
         $this->_deleteUserById($_user->getId());
     }
-    
+
     /**
      * delete user by id
      * 
@@ -132,7 +132,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
     
         $this->_db->delete($this->_userTable, $where);
     }
-    
+
     /**
      * append domain if set or domain IS NULL
      * 
@@ -159,7 +159,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         
         return $cond;
     }
-    
+
     /**
      * inspect get user by property
      * 
@@ -200,7 +200,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
 
         $userProperty = $this->_configKey . 'User';
         $_user->{$userProperty} = $emailUser;
-        
+
         $_user->emailUser = isset($_user->emailUser) ? $_user->emailUser : null;
         $imapUser = ($this->_configKey === Tinebase_Config::SMTP) ? $_user->emailUser : clone($emailUser);
         $smtpUser = ($this->_configKey === Tinebase_Config::SMTP) ? clone($emailUser) : $_user->emailUser;
@@ -236,9 +236,9 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         
         $this->_db->update($this->_userTable, $values, $where);
     }
-    
+
     /*********  protected functions  *********/
-    
+
     /**
      * get the basic select object to fetch records from the database
      *  
@@ -247,7 +247,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
      * @return Zend_Db_Select
      */
     abstract protected function _getSelect($_cols = '*', $_getDeleted = FALSE);
-    
+
     /**
      * adds email properties for a new user
      * 
@@ -271,7 +271,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
             . ' Adding new ' . $this->_configKey . ' email user ' . $emailUsername);
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' 
-               . print_r($emailUserData, TRUE));
+            . print_r($emailUserData, TRUE));
 
         try {
             $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($this->_db);
@@ -280,24 +280,24 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
             if (empty($emailUserData[$this->_propertyMapping['emailPassword']])) {
                 $emailUserData[$this->_propertyMapping['emailPassword']] = Hash_Password::generate($this->_config['emailScheme'], Tinebase_Record_Abstract::generateUID());
             }
-            
+
             $insertData = $emailUserData;
             $this->_beforeAddOrUpdate($insertData);
-            
+
             $this->_db->insert($this->_userTable, $insertData);
-            
+
             $this->_afterAddOrUpdate($emailUserData);
-            
+
             Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
-            
+
             $this->inspectGetUserByProperty($_addedUser);
-            
+
         } catch (Zend_Db_Statement_Exception $zdse) {
             Tinebase_TransactionManager::getInstance()->rollBack();
             Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Error while creating email user: ' . $zdse);
         }
     }
-    
+
     /**
      * interceptor before add
      * 
@@ -305,7 +305,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
      */
     protected function _beforeAddOrUpdate(&$emailUserData)
     {
-        
+
     }
 
     /**
@@ -315,7 +315,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
      */
     protected function _afterAddOrUpdate(&$emailUserData)
     {
-        
+
     }
 
     /**
@@ -328,17 +328,17 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         $select = $this->_getSelect()
             ->where($this->_db->quoteIdentifier($this->_userTable . '.' . $this->_propertyMapping['emailUsername']) . ' = ?',   $email)
             ->where($this->_appendClientIdOrDomain());
-        
+
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $select);
-        
+
         $stmt = $this->_db->query($select);
         $queryResult = $stmt->fetch();
         $stmt->closeCursor();
-        
+
         if (! $queryResult) {
             return;
         }
-        
+
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($queryResult, TRUE));
         
         $userId = $queryResult['userid'];
@@ -350,7 +350,7 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
             $this->_deleteUserById($userId);
         }
     }
-    
+
     /**
      * updates email properties for an existing user
      * 
@@ -363,33 +363,33 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
 
         if (Tinebase_Core::isLogLevel(Zend_Log::INFO))  Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updating Dovecot user ' . $emailUserData[$this->_propertyMapping['emailUsername']]);
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($emailUserData, TRUE));
-        
+
         $where = array(
             $this->_db->quoteInto($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?', $emailUserData[$this->_propertyMapping['emailUserId']])
         );
         $this->_appendClientIdOrDomain($where);
-        
+
         try {
             $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($this->_db);
-            
+
             $updateData = $emailUserData;
-            
+
             $this->_beforeAddOrUpdate($updateData);
-            
+
             $this->_db->update($this->_userTable, $updateData, $where);
-            
+
             $this->_afterAddOrUpdate($emailUserData);
 
             Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
-            
+
             $this->inspectGetUserByProperty($_updatedUser);
-            
+
         } catch (Zend_Db_Statement_Exception $zdse) {
             Tinebase_TransactionManager::getInstance()->rollBack();
             Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Error while updating email user: ' . $zdse->getMessage());
         }
     }
-    
+
     /**
      * check if user exists already in email backjend user table
      * 
@@ -399,10 +399,10 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
     protected function _userExists(Tinebase_Model_FullUser $_user)
     {
         $select = $this->_getSelect();
-        
+
         $select
           ->where($this->_db->quoteIdentifier($this->_userTable . '.' . $this->_propertyMapping['emailUserId']) . ' = ?',   $_user->getId());
-          
+
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $select->__toString());
 
         // Perform query - retrieve user from database
@@ -418,10 +418,10 @@ abstract class Tinebase_EmailUser_Sql extends Tinebase_User_Plugin_Abstract
         if (!$queryResult) {
             return false;
         }
-        
+
         return true;
     }
-    
+
     /**
      * converts raw data from adapter into a single record / do mapping
      *
index f8af12e..46158fb 100644 (file)
@@ -505,4 +505,31 @@ abstract class Tinebase_Frontend_Json_Abstract extends Tinebase_Frontend_Abstrac
 
         return $result;
     }
+
+    /**
+     * get available templates by containerId
+     * 
+     * @param integer $containerId
+     * @return array
+     */
+    public function getTemplates($containerId = NULL)
+    {
+        if (! $containerId) {
+            throw new Tinebase_Exception_InvalidArgument('A container id must be set!');
+        }
+    
+        try {
+            $nodes = Tinebase_FileSystem::getInstance()->getNodesByContainer($containerId);
+            $result = $this->_multipleRecordsToJson($nodes);
+        } catch (Exception $e) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__
+                . ' Could not get template files: ' . $e);
+            $result = array();
+        }
+    
+        return array(
+            'totalcount' => count($result),
+            'results'    => $result,
+        );
+    }
 }
index 6ee8311..163aa02 100644 (file)
@@ -138,21 +138,38 @@ class Tinebase_ImportExportDefinition extends Tinebase_Controller_Record_Abstrac
      */
     public static function getOptionsAsZendConfigXml(Tinebase_Model_ImportExportDefinition $_definition, $_additionalOptions = array())
     {
-        $tmpfname = tempnam(Tinebase_Core::getTempDir(), "tine_tempfile_");
-        
-        if (! $tmpfname) {
-            throw new Tinebase_Exception_AccessDenied('Could not create temporary file.');
+        $cacheId = 'ZendConfigXml_' . md5($_definition);
+        $cache = Tinebase_Core::getCache();
+        if (! $cache->test($cacheId)) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
+                . ' Generate new Zend_Config_Xml object' . $cacheId);
+            $tmpfname = tempnam(Tinebase_Core::getTempDir(), "tine_tempfile_");
+            
+            if (! $tmpfname) {
+                throw new Tinebase_Exception_AccessDenied('Could not create temporary file.');
+            }
+            
+            $handle = fopen($tmpfname, "w");
+            fwrite($handle, $_definition->plugin_options);
+            fclose($handle);
+            
+            // read file with Zend_Config_Xml
+            $config = new Zend_Config_Xml($tmpfname, null, true);
+            unlink($tmpfname);
+            
+            $cache->save($config, $cacheId);
+        } else {
+            if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
+                . ' Get Zend_Config_Xml from cache' . $cacheId);
+            $config = $cache->load($cacheId);
         }
         
-        $handle = fopen($tmpfname, "w");
-        fwrite($handle, $_definition->plugin_options);
-        fclose($handle);
-        
-        // read file with Zend_Config_Xml
-        $config = new Zend_Config_Xml($tmpfname, null, TRUE);
-        $config->merge(new Zend_Config($_additionalOptions));
+        if (! empty($_additionalOptions)) {
+            $config->merge(new Zend_Config($_additionalOptions));
+        }
         
-        unlink($tmpfname);
+        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ 
+            . ' Config: ' . print_r($config->toArray(), true));
         
         return $config;
     }
index 1673354..a9228bf 100644 (file)
@@ -39,7 +39,7 @@
 }
 
 .x-form-cb-label {
-       top: 1px;
+    top: 1px;
 }
 
 .x-form-item {
@@ -48,7 +48,7 @@
     margin-bottom: 2px;
 }
 .ext-gecko .x-window-body .x-form-item {
-       overflow: hidden;
+    overflow: hidden;
 }
 
 .x-fieldset {
@@ -88,6 +88,6 @@
 }
 
 .x-progress-text {
-       font-size: 10px;
-       font-weight: bold;
-}
\ No newline at end of file
+    font-size: 10px;
+    font-weight: bold;
+}
index 4552a22..6fa043d 100644 (file)
@@ -386,6 +386,9 @@ html, body {
     background-image:url(../../images/oxygen/16x16/apps/utilities-terminal.png) !important;
 }
 
+.action_report {
+    background-image:url(../../images/oxygen/22x22/actions/history-kdeprint.png) !important;
+}
 
 /* ----- tree classes --------------------------------------------------------*/
 .tinebase-tree-drop-move  .x-dd-drop-icon {
index a55ea5a..492d7e0 100644 (file)
@@ -1,5 +1,5 @@
 .ux-arrowcollapse {
-       /*position:relative;*/
+    /*position:relative;*/
     padding-bottom:5px;
     overflow:hidden;
 }
 }
 
 .ux-arrowcollapse .ux-arrowcollapse-header {
-       line-height: 24px;
+    line-height: 24px;
     padding:0;
     /*border-bottom:1px solid #c3daf9;*/
 }
+
 .ux-arrowcollapse .ux-arrowcollapse-header-text {
     font-size:11px;
     font-family:tahoma,arial,sans-serif;
@@ -48,7 +48,7 @@
 .ux-arrowcollapse-body {
     overflow:hidden;
 }
+
 .ux-arrowcollapse-bwrap {
     overflow:hidden;
     zoom:1;
index a88ac7a..49fe669 100644 (file)
@@ -1,12 +1,12 @@
 .x-date-picker-wk {
     /*background:#A9BFD3 url(../../../library/ExtJS/resources/images/default/toolbar/bg.gif) repeat-x scroll left top;*/
     background-color: #F0F0F0;
-       border-color:#D0D0D0;
-       border-right:1px solid #D0D0D0;
-       text-align: center;
-       vertical-align:middle;
+    border-color:#D0D0D0;
+    border-right:1px solid #D0D0D0;
+    text-align: center;
+    vertical-align:middle;
 }
 
 .x-date-picker-wk-wkrowover {
-       background-color: #F0F0F0;
-}
\ No newline at end of file
+    background-color: #F0F0F0;
+}
index 4c008a0..7ede9e7 100644 (file)
@@ -32,9 +32,9 @@
     padding:0;
     /*border-bottom:1px solid #c3daf9;*/
 }
+
 .ux-subformpanel .ux-subformpanel-header-text {
-       color: #a0a0a0;
+    color: #a0a0a0;
     font-size: 18px;
     position: absolute;
     font-weight: bold;
     /*padding:1px 5px 1px 20px;*/
     /*color:#4e79b2*/;
     }
+
 .ux-subformpanel-body {
     overflow:hidden;
 }
+
 .ux-subformpanel-bwrap {
     overflow:hidden;
     zoom:1;
index dc698aa..a08da76 100644 (file)
@@ -5,16 +5,16 @@
 
 .x-ux-display label.x-form-item-label {
     color:#A0A0A0;
-       padding-right:5px;
-       text-align:right;
-       font-size:11px;
-       padding: 0;
+    padding-right:5px;
+    text-align:right;
+    font-size:11px;
+    padding: 0;
 }
 
 .x-ux-display .x-form-element {
     color:#404040;
-       font-family:verdana;
-       font-size:11px;
+    font-family:verdana;
+    font-size:11px;
 }
 
 .x-ux-display textarea.x-ux-display-textarea {
@@ -47,9 +47,9 @@
 }
 
 .x-ux-display .x-ux-display-declaration {
-       color:#A0A0A0;
-       font-size:12px;
-       font-weight:bold;
+    color:#A0A0A0;
+    font-size:12px;
+    font-weight:bold;
 }
 
 .x-ux-display .x-ux-display-header {
index 783ec4d..e295885 100644 (file)
@@ -6,7 +6,7 @@
 .x-edit-removeFormat {background: url(../../../../images/oxygen/16x16/actions/eraser.png) 0 0 no-repeat !important;}
 
 /*
-       These are examples of styles for the button icons
+    These are examples of styles for the button icons
 */
 .x-edit-wordpaste {background: url(../images/document-word-text.png) 0 0 no-repeat !important;}
 .x-edit-table {background: url(../images/table.png) 0 0 no-repeat !important;}
 .x-edit-superscript {background: url(../images/text_super.png) 0 0 no-repeat !important;}
 
 /*
-       These styles are used for the character map
+    These styles are used for the character map
 */
 .char-item {
-       float: left; 
-       border: 1px solid #99BBE8; 
-       margin: 3px; 
-       text-align: center; 
-       vertical-align: middle; 
-       width: 20px; 
-       height: 20px; 
-       font-size: 14px;
-       color: #15428B;
-       cursor: pointer;
+    float: left; 
+    border: 1px solid #99BBE8; 
+    margin: 3px; 
+    text-align: center; 
+    vertical-align: middle; 
+    width: 20px; 
+    height: 20px; 
+    font-size: 14px;
+    color: #15428B;
+    cursor: pointer;
 }
 
 .char-item.x-view-selected {
-       background-color: #777;
+    background-color: #777;
 }
 
 .char-over {
-       border: 1px solid #15428B;
-       background-color:#d0def0;
-}
\ No newline at end of file
+    border: 1px solid #15428B;
+    background-color:#d0def0;
+}
index 5c6d19b..c1f858a 100755 (executable)
@@ -1,50 +1,49 @@
-.x-form-spinner-proxy{\r
-       /*background-color:#ff00cc;*/\r
-}\r
-.x-form-field-wrap img.x-form-spinner-trigger {\r
-    background:transparent url(../../../../images/spinner.gif) no-repeat 0 0;\r
-}\r
-\r
-.x-form-field-wrap .x-form-spinner-overup{\r
-    background-position:-17px 0;\r
-}\r
-.x-form-field-wrap .x-form-spinner-clickup{\r
-    background-position:-34px 0;\r
-}\r
-.x-form-field-wrap .x-form-spinner-overdown{\r
-    background-position:-51px 0;\r
-}\r
-.x-form-field-wrap .x-form-spinner-clickdown{\r
-    background-position:-68px 0;\r
-}\r
-\r
-\r
-.x-trigger-wrap-focus .x-form-spinner-trigger{\r
-    background-position:-85px 0;\r
-}\r
-.x-trigger-wrap-focus .x-form-spinner-overup{\r
-    background-position:-102px 0;\r
-}\r
-.x-trigger-wrap-focus .x-form-spinner-clickup{\r
-    background-position:-119px 0;\r
-}\r
-.x-trigger-wrap-focus .x-form-spinner-overdown{\r
-    background-position:-136px 0;\r
-}\r
-.x-trigger-wrap-focus .x-form-spinner-clickdown{\r
-    background-position:-153px 0;\r
-}\r
-.x-trigger-wrap-focus .x-form-trigger{\r
-    border-bottom: 1px solid #7eadd9;\r
-}\r
-\r
-.x-form-field-wrap .x-form-spinner-splitter {\r
-       line-height:1px;\r
-       font-size:1px;\r
-    background:transparent url(../../../../images/spinner-split.gif) no-repeat 0 0;\r
-       position:absolute;\r
-       cursor: n-resize;\r
-}\r
-.x-trigger-wrap-focus .x-form-spinner-splitter{\r
-    background-position:-14px 0;\r
-}\r
+.x-form-spinner-proxy{
+    /*background-color:#ff00cc;*/
+}
+.x-form-field-wrap img.x-form-spinner-trigger {
+    background:transparent url(../../../../images/spinner.gif) no-repeat 0 0;
+}
+
+.x-form-field-wrap .x-form-spinner-overup{
+    background-position:-17px 0;
+}
+.x-form-field-wrap .x-form-spinner-clickup{
+    background-position:-34px 0;
+}
+.x-form-field-wrap .x-form-spinner-overdown{
+    background-position:-51px 0;
+}
+.x-form-field-wrap .x-form-spinner-clickdown{
+    background-position:-68px 0;
+}
+
+.x-trigger-wrap-focus .x-form-spinner-trigger{
+    background-position:-85px 0;
+}
+.x-trigger-wrap-focus .x-form-spinner-overup{
+    background-position:-102px 0;
+}
+.x-trigger-wrap-focus .x-form-spinner-clickup{
+    background-position:-119px 0;
+}
+.x-trigger-wrap-focus .x-form-spinner-overdown{
+    background-position:-136px 0;
+}
+.x-trigger-wrap-focus .x-form-spinner-clickdown{
+    background-position:-153px 0;
+}
+.x-trigger-wrap-focus .x-form-trigger{
+    border-bottom: 1px solid #7eadd9;
+}
+
+.x-form-field-wrap .x-form-spinner-splitter {
+    line-height:1px;
+    font-size:1px;
+    background:transparent url(../../../../images/spinner-split.gif) no-repeat 0 0;
+    position:absolute;
+    cursor: n-resize;
+}
+.x-trigger-wrap-focus .x-form-spinner-splitter{
+    background-position:-14px 0;
+}
index e344bef..4460c73 100644 (file)
@@ -5,5 +5,5 @@
     padding-top: 0px;
 }
 .tw-editdialog .x-panel-footer {
-       background-color: rgb(240, 240, 240);
-}
\ No newline at end of file
+    background-color: rgb(240, 240, 240);
+}
index db8f657..85af119 100644 (file)
 }
 
 .x-panel-bwrap .tw-filtertoolbar  {
-       background-image: none;
-       background-color: #E5EDF8;
+    background-image: none;
+    background-color: #E5EDF8;
 }
 
 
 .tw-filtertoolbar  td { 
-       padding: 0px 5px 0px;
+    padding: 0px 5px 0px;
 }
 
 .tw-filtertoolbar .tw-ftb-frow-pbutton { 
@@ -38,7 +38,7 @@
 }
 
 .tw-filtertoolbar .tw-ftb-frow-prefix {
-       text-align: right;
+    text-align: right;
 }
 
 /* fix Ext.Button Layout */
@@ -87,4 +87,4 @@
 .tw-filtertoolbar .fw-ftb-actionrow td { 
     padding: 0px 5px 1px;
 }
-*/
\ No newline at end of file
+*/
index 020c6c5..2197263 100644 (file)
@@ -3,32 +3,31 @@
 }
 
 .x-widget-tag-tagitem {
-       margin: 1px 2px 1px 1px;
-       background-color: #FFF8E0;
-       height: 13px;
+    margin: 1px 2px 1px 1px;
+    background-color: #FFF8E0;
+    height: 13px;
     border: 1px solid gray;
-       float: left;
-       color: gray;
+    float: left;
+    color: gray;
 }
 
 .x-widget-tag-tagitem-color {
-       padding: 0 0 0 0;
-       margin: 0 0 0 0;
-       float: left;
-       background-color: #FFFFFF;
-       border-right: 1px solid gray;
-       width: 4px;
-       height: 13px;
+    padding: 0 0 0 0;
+    margin: 0 0 0 0;
+    float: left;
+    background-color: #FFFFFF;
+    border-right: 1px solid gray;
+    width: 4px;
+    height: 13px;
 }
 
 .x-widget-tag-tagitem-text {
-       padding: 0 5px 0 5px;
+    padding: 0 5px 0 5px;
     margin: 0 0 0 0;
     line-height: 13px;
     font-size: 11px;
     font-weight: normal;
     font-style: italic;
-   
 }
 
 .x-widget-tag-tagitem-over {
index ae8a922..a4b7e4b 100644 (file)
@@ -29,7 +29,7 @@ Ext.extend(Tine.Tinebase.data.MemoryBackend, Tine.Tinebase.data.AbstractBackend,
     loadRecord: function(record, options) {
         options.success.defer(1000, options.scope, record);
     },
-    
+
     /**
      * searches all (lightweight) records matching filter
      * 
@@ -40,7 +40,7 @@ Ext.extend(Tine.Tinebase.data.MemoryBackend, Tine.Tinebase.data.AbstractBackend,
      * @success {Object} root:[recrods], totalcount: number
      */
     searchRecords: function(filter, paging, options) {
-        console.log(filter);
+        //Tine.log.info('filter', filter);
         var records = [];
         for (var id in this.list) {
             records.push(this.recordReader({responseText: this.list[id]}));
@@ -66,7 +66,7 @@ Ext.extend(Tine.Tinebase.data.MemoryBackend, Tine.Tinebase.data.AbstractBackend,
         
         options.success.defer(500, options.scope, [this.recordReader({responseText: this.list[record.data.id]})]);
     },
-    
+
     /**
      * deletes multiple records identified by their ids
      * 
@@ -78,7 +78,7 @@ Ext.extend(Tine.Tinebase.data.MemoryBackend, Tine.Tinebase.data.AbstractBackend,
     deleteRecords: function(records, options) {
         options.success.defer(1000, options.scope);
     },
-    
+
     /**
      * updates multiple records with the same data
      * 
@@ -90,7 +90,7 @@ Ext.extend(Tine.Tinebase.data.MemoryBackend, Tine.Tinebase.data.AbstractBackend,
     updateRecords: function(filter, updates, options) {
         options.success.defer(1000, options.scope, []);
     },
-    
+
     /**
      * reads a single 'fully featured' record from json data
      * 
@@ -110,5 +110,4 @@ Ext.extend(Tine.Tinebase.data.MemoryBackend, Tine.Tinebase.data.AbstractBackend,
         
         return record;
     }
-    
 });
index 189a2ad..d19edfd 100644 (file)
@@ -27,5 +27,5 @@ table td {
 }
 
 #csscheck {
-       display: none;
-}
\ No newline at end of file
+    display: none;
+}
index 7f9df1a..d2a4fd9 100644 (file)
                 </index>
             </declaration>
         </table>
-        
+
         <table>
             <name>snom_phones</name>
             <engine>InnoDB</engine>
                     </field>
                 </index>
             </declaration>
-        </table> 
-        
+        </table>
+
         <table>
             <name>snom_phone_settings</name>
             <engine>InnoDB</engine>
                 </field>
                 <field>
                     <name>account_id</name>
-                       <type>text</type>
-                       <length>40</length>
+                    <type>text</type>
+                    <length>40</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
                     <type>boolean</type>
                     <default>false</default>
                 </field>
-                
                 <index>
                     <name>id</name>
                     <primary>true</primary>
                 </index>
             </declaration>
         </table>
-        
+
         <table>
             <name>asterisk_redirects</name>
             <engine>InnoDB</engine>
index e21bbf2..b992fb0 100644 (file)
@@ -7,7 +7,7 @@
 <!-- http://www.phing.info                         -->
 <!-- ============================================  -->
 <project name="tine20" description="Tine 2.0 build file" default="build">
-    
+
     <property name="builddir" value="${project.basedir}/build" override="true" />
     <property name="userdatadir" value="${project.basedir}/userdata" override="true" />
     <property name="localedir" value="Tinebase/js/Locale" override="true" />
     <target name="prepare">
         <echo msg="$buildDate: ${project.basedir}" />
         <init />
-        
+
         <php expression="getDevelopmentRevision();" returnProperty="buildRevision" />
         <echo msg="$buildRevision: ${buildRevision}" />
-        
+
         <php expression="date_create('now')->format('Y-m-d H:i:s');" returnProperty="buildDate" />
         <echo msg="$buildDate: ${buildDate}" />
-        
+
         <echo msg="Making build directory" />
         <mkdir dir="${builddir}" />
         <mkdir dir="${builddir}/${localedir}/build" />
         <mkdir dir="${builddir}/${localedir}/static" />
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: build                                 -->
     <!-- ============================================  -->
             </fileset>
         </foreach>
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: phpdoc                                -->
     <!-- ============================================  -->
     <target name="phpdoc">
         <echo msg="Building Tine 2.0 PHP API Documentation..." />
-        
+
         <includepath classpath="${project.basedir}/vendor/phpdocumentor" />
-        
+
         <mkdir dir="${builddir}/apidocs" />
-        
+
         <phpdoc2 title="Tine 2.0 PHP API Documentation" destdir="${builddir}/apidocs" template="responsive-twig">
             <fileset dir=".">
                 <include name="**/*.php" />
              ${testinclude} " />
         </exec>
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: report                                -->
     <!-- TODO remove code duplication (phpunit target) -->
     <!-- ============================================  -->
     <target name="report">
         <echo msg="Starting Tests..." />
-        
+
         <delete dir="${builddir}/reports"/>
         <mkdir dir="${builddir}/reports/tests"/>
         <mkdir dir="${builddir}/reports/coverage"/>
         <phpunitreport infile="${builddir}/reports/testsuites.xml" format="frames" todir="${builddir}/reports/tests"/>
         <coverage-report outfile="${builddir}/reports/coverage.xml">
             <report todir="${builddir}/reports/coverage" title="Tine 2.0"/>
-        </coverage-report>  
+        </coverage-report>
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: build-module                          -->
     <!-- ============================================  -->
     <target name="build-module" description="build single module" depends="prepare">
         <echo msg="Building ${name}" />
-        
+
         <!-- do jsb2tk build -->
         <jsb2tk-build appName="${name}" />
-        
+
         <!-- replace buildstuff -->
         <reflexive>
             <filterchain>
                     <regexp pattern="Tine\.clientVersion\.buildRevision\s*=[^=]{1}[^;]*" replace='Tine.clientVersion.codeName="${buildRevision}"' modifiers="i"/>
                 </replaceregexp>
             </filterchain>
-            
+
             <fileset dir="${builddir}">
                 <include name="${name}/js/*-FAT*" />
             </fileset>
         </reflexive>
-        
+
         <!-- debug mode for debug files -->
         <reflexive>
             <filterchain>
                     <regexp pattern="Tine\.clientVersion\.buildType\s*=[^=]{1}[^;]*" replace="Tine.clientVersion.buildType = 'DEBUG'"/>
                 </replaceregexp>
             </filterchain>
-            
+
             <fileset dir="${builddir}">
                 <include name="${name}/js/*-FAT-debug*" />
             </fileset>
         </reflexive>
-        
+
         <!-- original jsb2 builds -->
         <!-- NOTE as jsb2tk has no path adoption yet we need to do it here -->
         <copy toDir="${project.basedir}">
             <fileset dir="${builddir}">
                 <include name="${name}/*/*" />
             </fileset>
-            
+
             <filterchain>
                 <replaceregexp>
                     <regexp pattern="(\.\.\/){2,}images" replace="../../images" modifiers="i"/>
                     <regexp pattern="(\.\.\/){2,}library" replace="../../library" modifiers="i"/>
                 </replaceregexp>
             </filterchain>
-            
+
         </copy>
-        
+
         <!-- adopt path for getJS/getCSS -->
         <!-- TODO add deploymode GETTER and move this to jsb2tk -->
         <copy toDir="${project.basedir}">
             <mapper type="regexp" from="^(.*\.(js|css))" to="\1.inc"/>
-            
+
             <filterchain>
                 <replaceregexp>
                     <regexp pattern="(\.\.\/)+images" replace="images" modifiers="i"/>
             <fileset dir="${builddir}">
                 <include name="${name}/*/*" />
             </fileset>
-            
+
         </copy>
-        
+
         <!-- translations -->
         <translation-build appName="${name}" />
         <jsMin targetDir="${builddir}/${name}/js" failOnError="false">
                 <include name="*-lang-*-debug.js"/>
             </fileset>
         </jsMin>
-        
+
         <copy toDir="${project.basedir}/${name}/js">
             <fileset dir="${builddir}/${name}/js">
                 <include name="*-lang-*-debug.js" />
             </fileset>
         </copy>
-        
+
         <copy toDir="${project.basedir}/${name}/js">
             <fileset dir="${builddir}/${name}/js">
                 <include name="*-lang-*-debug-min.js" />
             </fileset>
-            
+
             <mapper type="regexp" from="^(.*)-debug-min.js" to="\1.js"/>
         </copy>
-        
+
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: clean                                 -->
     <!-- ============================================  -->
             </fileset>
         </delete>
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: mimetypes                                 -->
     <!-- ============================================  -->
     <target name="mimetypes">
         <build-mimetypes appName="${name}" />
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: tx-pull                               -->
     <!-- ============================================  -->
         <echo msg="git commit -a -m 'update lang templates'" />
         <echo msg="git push gerrit HEAD:refs/heads/master" />
     </target>
-    
+
     <!-- ============================================  -->
     <!-- Target: translation-test                      -->
     <!-- ============================================  -->
     <adhoc-task name="init"><![CDATA[
         class initTask extends Task {
             function main() {
-                echo `composer install`;
+                passthru('composer install');
                 require_once 'vendor/autoload.php';
             }
         }
     ]]></adhoc-task>
-    
+
     <!-- ============================================  -->
     <!-- Task: jsb2tk-build                            -->
     <!-- ============================================  -->
     <adhoc-task name="jsb2tk-build"><![CDATA[
         class jsb2tkTask extends Task {
             private $appName;
-            
+
             function setAppName($appName) {
                 $this->appName = $appName;
             }
-            
+
             function main() {
                 $jsb2 = "${project.basedir}/{$this->appName}/{$this->appName}.jsb2";
                 if (file_exists($jsb2)) {
                     $this->log("In jsb2tkTask: " . $this->appName);
-                    
+
                     require_once('${project.basedir}/library/jsb2tk/jsb2tk.php');
-                    
+
                     $tk = new jsb2tk(array(
                         'homeDir' => '${builddir}'
                     ));
-                    
+
                     $tk->register($jsb2);
                     $tk->buildAll();
                 }
             }
         }
     ]]></adhoc-task>
-    
+
     <!-- ============================================  -->
     <!-- Task: translation-build                       -->
     <!-- ============================================  -->
     <adhoc-task name="translation-build"><![CDATA[
         class translationTask extends Task {
             private $appName;
-        
+
             function setAppName($appName) {
                 $this->appName = $appName;
             }
-            
+
             function main() {
                 if (! file_exists('${builddir}/' . "{$this->appName}/js")) return;
                 $availableTranslations = Tinebase_Translation::getAvailab