Commits

Jason Green committed e45a755 Merge

Merge with default

Comments (0)

Files changed (8)

 a15550fac71038d20faca4627aa69aef3d42e4fd stable
 3427a57fb55dbaef3127b166b5a177281269b5e8 unstable
 a15550fac71038d20faca4627aa69aef3d42e4fd unstable
+a15550fac71038d20faca4627aa69aef3d42e4fd stable
+a242d3c64eabd4682b24c2deea69d9787953abd3 stable
+a15550fac71038d20faca4627aa69aef3d42e4fd unstable
+a242d3c64eabd4682b24c2deea69d9787953abd3 unstable

app/protected/extensions/zurmoinc/framework/adapters/YiiToJqueryUIDatePickerLocalization.php

                     return 'y/mm/dd';
                 case 'dd-MM-yy':    //nl format
                         return 'dd-mm-y';
+                case 'd/MM/yy':     //en_au format
+                        return 'd/mm/y';
                 default :
                     throw new NotImplementedException();
             }
             {
                 case 'HH:mm':       //de, es, fr, it, pt, nl, sr_yu, vi format
                     return 'hh:mm';
-                case 'h:mm a':      //en, hi format
+                case 'h:mm a':      //en, hi, en_au format
                     return 'h:mm tt';
                 case 'H:mm':        //sk, fa_ir, ru, ja format
                     return 'h:mm';

app/protected/modules/gamification/data/GamificationDemoDataMaker.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 that builds demo game data.
+     */
+    class GamificationDemoDataMaker extends DemoDataMaker
+    {
+        protected $ratioToLoad = 1;
+
+        public static function getDependencies()
+        {
+            return array('users');
+        }
+
+        public function makeAll(& $demoDataHelper)
+        {
+            assert('$demoDataHelper instanceof DemoDataHelper');
+            assert('$demoDataHelper->isSetRange("User")');
+
+            foreach (User::getAll() as $user)
+            {
+                $gameScore         = GameScore::resolveToGetByTypeAndPerson('LoginUser',  $user);
+                $gameScore->value  = 10;
+                $saved = $gameScore->save();
+                assert('$saved');
+                $gamePoint = GamePoint::resolveToGetByTypeAndPerson(GamePoint::TYPE_USER_ADOPTION, $user);
+                $gamePoint->value  = mt_rand(100, 300);
+                $saved = $gamePoint->save();
+                assert('$saved');
+                $gameScore         = GameScore::resolveToGetByTypeAndPerson('CreateAccount',  $user);
+                $gameScore->value  = 10;
+                $saved = $gameScore->save();
+                assert('$saved');
+                $gamePoint = GamePoint::resolveToGetByTypeAndPerson(GamePoint::TYPE_NEW_BUSINESS, $user);
+                $gamePoint->value  = 100;
+                $saved = $gamePoint->save();
+                assert('$saved');
+
+                //Badges
+                $gameBadge = new GameBadge();
+                $gameBadge->type = 'LoginUser';
+                $gameBadge->grade = 2;
+                $gameBadge->person = $user;
+                $saved = $gameBadge->save();
+                assert('$saved');
+                $gameBadge = new GameBadge();
+                $gameBadge->type = 'CreateAccount';
+                $gameBadge->grade = 3;
+                $gameBadge->person = $user;
+                $saved = $gameBadge->save();
+                assert('$saved');
+
+                //Levels
+                $gameLevel = GameLevel::resolveByTypeAndPerson(GameLevel::TYPE_GENERAL, $user);
+                $gameLevel->value = 1;
+                $saved = $gameLevel->save();
+                assert('$saved');
+                $gameLevel = GameLevel::resolveByTypeAndPerson(GameLevel::TYPE_NEW_BUSINESS, $user);
+                $gameLevel->value = 1;
+                $saved = $gameLevel->save();
+                assert('$saved');
+            }
+        }
+    }
+?>

app/protected/modules/install/controllers/DefaultController.php

             $messageStreamer = new MessageStreamer($template);
             $messageStreamer->add(Yii::t('Default', 'Starting to load demo data.'));
             $messageLogger = new MessageLogger($messageStreamer);
-            DemoDataUtil::load($messageLogger, 3);
+            DemoDataUtil::load($messageLogger, 6);
             $messageStreamer->add(Yii::t('Default', 'Finished loading demo data.'));
             $messageStreamer->add(Yii::t('Default', 'Locking Installation.'));
             InstallUtil::writeInstallComplete(INSTANCE_ROOT);

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

                 }
                 else
                 {
-                    DemoDataUtil::load($messageLogger, 3);
+                    DemoDataUtil::load($messageLogger, 6);
                 }
                 $messageStreamer->add(Yii::t('Default', 'Finished loading demo data.'));
             }

app/protected/modules/meetings/data/MeetingsDemoDataMaker.php

             assert('$demoDataHelper->isSetRange("Opportunity")');
 
             $meetings = array();
+            //Future meetings
             for ($i = 0; $i < $this->resolveQuantityToLoad(); $i++)
             {
                 $meeting        = new Meeting();
                 assert('$saved');
                 $meetings[] = $meeting->id;
             }
+            //Past meetings
+            for ($i = 0; $i < $this->resolveQuantityToLoad(); $i++)
+            {
+                $meeting        = new Meeting();
+                $opportunity    = $demoDataHelper->getRandomByModelName('Opportunity');
+                $meeting->owner = $opportunity->owner;
+                $meeting->activityItems->add($opportunity);
+                $meeting->activityItems->add($opportunity->contacts[0]);
+                $meeting->activityItems->add($opportunity->account);
+                $this->populateModel($meeting, false);
+                $saved = $meeting->save();
+                assert('$saved');
+                $meetings[] = $meeting->id;
+            }
             $demoDataHelper->setRangeByModelName('Meeting', $meetings[0], $meetings[count($meetings)-1]);
         }
 
-        public function populateModel(& $model)
+        public function populateModel(& $model, $setInFuture = true)
         {
             assert('$model instanceof Meeting');
             parent::populateModel($model);
             $category          = RandomDataUtil::getRandomValueFromArray(
                                  static::getCustomFieldDataByName('MeetingCategories'));
             $location          = RandomDataUtil::getRandomValueFromArray($meetingRandomData['locations']);
-            $startTimeStamp    = time() + (mt_rand(1, 200) * 60 * 60 * 24);
-            $startDateTime     = DateTimeUtil::convertTimestampToDbFormatDateTime($startTimeStamp);
-            $endDateTime       = DateTimeUtil::convertTimestampToDbFormatDateTime($startTimeStamp + (mt_rand(1, 24) * 15));
+            if($setInFuture)
+            {
+                $startTimeStamp    = time() + (mt_rand(1, 60) * 60 * 60 * 24);
+                $startDateTime     = DateTimeUtil::convertTimestampToDbFormatDateTime($startTimeStamp);
+                $endDateTime       = DateTimeUtil::convertTimestampToDbFormatDateTime($startTimeStamp + (mt_rand(1, 24) * 15));
+            }
+            else
+            {
+                $startTimeStamp    = time() - (mt_rand(1, 30) * 60 * 60 * 24);
+                $startDateTime     = DateTimeUtil::convertTimestampToDbFormatDateTime($startTimeStamp);
+                $endDateTime       = DateTimeUtil::convertTimestampToDbFormatDateTime($startTimeStamp + (mt_rand(1, 24) * 15));
+            }
 
             $model->name             =      $name;
             $model->category->value  =      $category;

app/protected/modules/zurmo/tests/unit/DemoDataUtilTest.php

             $this->assertEquals(3, Account::getCount());
             $this->assertEquals(12, Contact::getCount());
             $this->assertEquals(6, Opportunity::getCount());
-            $this->assertEquals(9, Meeting::getCount());
+            $this->assertEquals(18, Meeting::getCount());
             $this->assertEquals(9, Note::getCount());
             $this->assertEquals(9, Task::getCount());
             $this->assertEquals(9, User::getCount());
 
     define('MAJOR_VERSION', 0);                           // Update for marketing purposes.
     define('MINOR_VERSION', 6);                           // Update when functionality changes.
-    define('PATCH_VERSION', 5);                           // Update when fixes are made that does not change functionality.
+    define('PATCH_VERSION', 6);                           // Update when fixes are made that does not change functionality.
     define('REPO_ID',       '$Revision$');                // Updated by Mercurial. Numbers like 3650 have no meaning across
                                                           // clones. This tells us the actual changeset that is universally
                                                           // meaningful.