Commits

Jason Green  committed 054e388 Merge

Merge with default

  • Participants
  • Parent commits b958451, 21acf1c
  • Branches gamification

Comments (0)

Files changed (9)

 app/protected/config/debug.php
 app/protected/config/perInstanceTest.php
 app/protected/config/debugTest.php
+app/report

File app/protected/extensions/zurmoinc/framework/exceptions/MissingBeanException.php

      * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
      ********************************************************************************/
 
-     /*********************************************************************************
-     * Zurmo is a customer relationship management program developed by
-     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
-     *
-     * Zurmo is free software; you can redistribute it and/or modify it under
-     * the terms of the GNU General Public License version 3 as published by the
-     * Free Software Foundation with the addition of the following permission added
-     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
-     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
-     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
-     *
-     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
-     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-     * details.
-     *
-     * You should have received a copy of the GNU General Public License along with
-     * this program; if not, see http://www.gnu.org/licenses or write to the Free
-     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-     * 02110-1301 USA.
-     *
-     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
-     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
-     ********************************************************************************/
-
     /**
      * Exception thrown when a bean is missing during the RedBean __construct method. This
      * can happen if while a model is being retrieved it has been removed by some other

File app/protected/extensions/zurmoinc/framework/tests/unit/TestCustomFieldsModelTest.php

+<?php
+    /*********************************************************************************
+     * Zurmo is a customer relationship management program developed by
+     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
+     *
+     * Zurmo is free software; you can redistribute it and/or modify it under
+     * the terms of the GNU General Public License version 3 as published by the
+     * Free Software Foundation with the addition of the following permission added
+     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
+     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
+     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
+     *
+     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
+     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+     * details.
+     *
+     * You should have received a copy of the GNU General Public License along with
+     * this program; if not, see http://www.gnu.org/licenses or write to the Free
+     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+     * 02110-1301 USA.
+     *
+     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
+     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
+     ********************************************************************************/
+
+    class TestCustomFieldsModelTest extends BaseTest
+    {
+        public static function setUpBeforeClass()
+        {
+            parent::setUpBeforeClass();
+            $multiSelectValues = array(
+                'Multi 1',
+                'Multi 2',
+                'Multi 3',
+            );
+            $customFieldData = CustomFieldData::getByName('MultipleSomethings');
+            $customFieldData->serializedData = serialize($multiSelectValues);
+            assert($customFieldData->save());
+
+            $tagCloudValues = array(
+                'Cloud 1',
+                'Cloud 2',
+                'Cloud 3',
+            );
+            $customFieldData = CustomFieldData::getByName('TagCloud');
+            $customFieldData->serializedData = serialize($tagCloudValues);
+            assert($customFieldData->save());
+        }
+
+        public function testMultiSelectAndTagCloudRelationships()
+        {
+            $testModel = new TestCustomFieldsModel();
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Multi 1';
+            $testModel->multipleSomethings->values->add($customFieldValue);
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Multi 3';
+            $testModel->multipleSomethings->values->add($customFieldValue);
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Cloud 2';
+            $testModel->tagCloud->values->add($customFieldValue);
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Cloud 3';
+            $testModel->tagCloud->values->add($customFieldValue);
+
+            $this->assertEquals(2, count($testModel->multipleSomethings->values));
+            $this->assertEquals('Multi 1', $testModel->multipleSomethings->values[0]);
+            $this->assertEquals('Multi 3', $testModel->multipleSomethings->values[1]);
+
+            $this->assertEquals(2, count($testModel->tagCloud->values));
+            $this->assertEquals('Cloud 2', $testModel->tagCloud->values[0]);
+            $this->assertEquals('Cloud 2', $testModel->tagCloud->values[1]);
+        }
+    }

File app/protected/modules/api/adapters/api/MultiSelectDropDownRedBeanModelAttributeValueToApiValueAdapter.php

         public function resolveData(& $data)
         {
             assert('$this->model->{$this->attribute} instanceof OwnedMultipleValuesCustomField');
-            $values = $this->model->{$this->attribute}->values;
-            if (count($values) > 0)
+            $customFieldValues = $this->model->{$this->attribute}->values;
+            if (count($customFieldValues) > 0)
             {
-                foreach ($values as $value)
+                foreach ($customFieldValues as $customFieldValue)
                 {
-                    if (isset($value->value) && $value->value != '')
+                    if (isset($customFieldValue->value) && $customFieldValue->value != '')
                     {
-                        $data[$this->attribute][] = $value->value;
+                        $data[$this->attribute]['values'][] = $customFieldValue->value;
                     }
                 }
+                if (!isset($data[$this->attribute]['values']))
+                {
+                    $data[$this->attribute]['values'] = null;
+                }
             }
             else
             {
-                $data[$this->attribute] = null;
+                $data[$this->attribute]['values'] = null;
             }
         }
     }

File app/protected/modules/api/tests/unit/ApiRestMeetingTest.php

     /**
     * Test Meeting related API functions.
     */
-    class ApiRestAAMeetingTest extends ApiRestTest
+    class ApiRestMeetingTest extends ApiRestTest
     {
         public function testApiServerUrl()
         {

File app/protected/modules/api/tests/unit/ApiRestTestModelItemTest.php

     */
     class ApiRestTestModelItemTest extends ApiRestTest
     {
+        public static function setUpBeforeClass()
+        {
+            parent::setUpBeforeClass();
+            $multiSelectValues = array(
+                'Multi 1',
+                'Multi 2',
+                'Multi 3',
+            );
+            $customFieldData = CustomFieldData::getByName('ApiTestMultiDropDown');
+            $customFieldData->serializedData = serialize($multiSelectValues);
+            assert($customFieldData->save());
+
+            $tagCloudValues = array(
+                'Cloud 1',
+                'Cloud 2',
+                'Cloud 3',
+            );
+            $customFieldData = CustomFieldData::getByName('ApiTestTagCloud');
+            $customFieldData->serializedData = serialize($tagCloudValues);
+            assert($customFieldData->save());
+        }
+
         public function testApiServerUrl()
         {
             $this->assertTrue(strlen($this->serverUrl) > 0);
         */
         public function testCreate()
         {
-            $values = array(
-                'Multi 1',
-                'Multi 2',
-                'Multi 3',
-            );
-            $customFieldData = CustomFieldData::getByName('ApiTestMultiDropDown');
-            $customFieldData->serializedData = serialize($values);
-            $saved = $customFieldData->save();
-            assert($saved);    // Not Coding Standard
-
-            $values = array(
-                'Cloud 1',
-                'Cloud 2',
-                'Cloud 3',
-            );
-            $customFieldData = CustomFieldData::getByName('ApiTestTagCloud');
-            $customFieldData->serializedData = serialize($values);
-            $saved = $customFieldData->save();
-            assert($saved);    // Not Coding Standard
-
             $super = User::getByUsername('super');
             Yii::app()->user->userModel        = $super;
 
             $this->assertTrue($testItem3_2->save());
 
             $testItem = new ApiTestModelItem();
+
             $testItem->firstName     = 'Bob5';
             $testItem->lastName      = 'Bob5';
             $testItem->boolean       = true;

File app/protected/modules/api/tests/unit/RedBeanModelToApiDataUtilTest.php

         {
             parent::setUpBeforeClass();
             $super = SecurityTestHelper::createSuperAdmin();
+            $multiSelectValues = array(
+                'Multi 1',
+                'Multi 2',
+                'Multi 3',
+            );
+            $customFieldData = CustomFieldData::getByName('ApiTestMultiDropDown');
+            $customFieldData->serializedData = serialize($multiSelectValues);
+            assert($customFieldData->save());
+
+            $tagCloudValues = array(
+                'Cloud 1',
+                'Cloud 2',
+                'Cloud 3',
+            );
+            $customFieldData = CustomFieldData::getByName('ApiTestTagCloud');
+            $customFieldData->serializedData = serialize($tagCloudValues);
+            assert($customFieldData->save());
         }
 
         public function setUp()
             $testItem->textArea  = 'Some Text Area';
             $testItem->url       = 'http://www.asite.com';
             $testItem->owner     = $super;
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Multi 1';
+            $testItem->multiDropDown->values->add($customFieldValue);
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Multi 3';
+            $testItem->multiDropDown->values->add($customFieldValue);
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Cloud 2';
+            $testItem->tagCloud->values->add($customFieldValue);
+
+            $customFieldValue = new CustomFieldValue();
+            $customFieldValue->value = 'Cloud 3';
+            $testItem->tagCloud->values->add($customFieldValue);
+
             $createStamp         = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
             $this->assertTrue($testItem->save());
             $id = $testItem->id;
                     'id'       => $super->id,
                     'username' => 'super'
                 ),
-                'multiDropDown'    => null,
-                'tagCloud'         => null,
+                'multiDropDown'    => array('values' => array('Multi 1', 'Multi 3')),
+                'tagCloud'         => array('values' => array('Cloud 2', 'Cloud 3')),
             );
             $this->assertEquals($compareData, $data);
         }
                     'id' => $super->id,
                     'username' => 'super'
                 ),
-                'multiDropDown'    => null,
-                'tagCloud'         => null,
+                'multiDropDown'    => array('values' => null),
+                'tagCloud'         => array('values' => null),
             );
             $this->assertEquals($compareData, $data);
         }
                             'id' => $super->id,
                             'username' => 'super'
                         ),
-                        'multiDropDown'    => null,
-                        'tagCloud'         => null,
+                        'multiDropDown'    => array('values' => null),
+                        'tagCloud'         => array('values' => null),
             );
             $this->assertEquals($compareData, $data);
         }

File app/protected/modules/install/utils/InstallUtil.php

             if (RedBeanDatabase::isFrozen())
             {
                 RedBeanDatabase::unfreeze();
-                $unfreezeWhenDone = true;
+                $freezeWhenDone = true;
             }
             $template        = "{message}\n";
             $messageStreamer = new MessageStreamer($template);
             self::autoBuildDatabase($messageLogger);
             $messageStreamer->add(Yii::t('Default', 'Schema update complete.'));
 
+            if ($freezeWhenDone)
+            {
+                RedBeanDatabase::freeze();
+            }
+
             // Send notification to super admin to clean assets folder(optional).
             $message                    = new NotificationMessage();
             $message->textContent       = Yii::t('Default', 'Please delete all files from assets folder on server.');
             $rules                      = new ClearAssetsFolderNotificationRules();
-            NotificationsUtil::submit($message, $rules);
-
-            if ($unfreezeWhenDone)
-            {
-                RedBeanDatabase::freeze();
-            }
+            //NotificationsUtil::submit($message, $rules); //running this causes stack overrun. Turn on once thread stack
+            //overrun issue is resolved.
         }
 
         public static function getDefaultHostInfo()

File app/protected/modules/zurmo/messages/it/Default.php

      * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
      ********************************************************************************/
 
-     /*********************************************************************************
-     * Zurmo is a customer relationship management program developed by
-     * Zurmo, Inc. Copyright (C) 2012 Zurmo Inc.
-     *
-     * Zurmo is free software; you can redistribute it and/or modify it under
-     * the terms of the GNU General Public License version 3 as published by the
-     * Free Software Foundation with the addition of the following permission added
-     * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
-     * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
-     * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
-     *
-     * Zurmo is distributed in the hope that it will be useful, but WITHOUT
-     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-     * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-     * details.
-     *
-     * You should have received a copy of the GNU General Public License along with
-     * this program; if not, see http://www.gnu.org/licenses or write to the Free
-     * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-     * 02110-1301 USA.
-     *
-     * You can contact Zurmo, Inc. with a mailing address at 113 McHenry Road Suite 207,
-     * Buffalo Grove, IL 60089, USA. or at email address contact@zurmo.com.
-     ********************************************************************************/
-
     // KEEP these in alphabetical order.
     // KEEP them indented correctly.
     // KEEP all the language files up-to-date with each other.