create empty work if switching to registration with it
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 20 Feb 2013 18:19:29 +0000 (19:19 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 20 Feb 2013 18:19:29 +0000 (19:19 +0100)
app/js/controllers.js

index e52344d..321d570 100644 (file)
@@ -79,6 +79,14 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
                        $scope.user.registration_type == 'symposium' ||
                        $scope.user.registration_type == 'round'
                ) {
+                       if ( angular.isUndefined( $scope.registration.work ) ) {
+                               $log.info('create empty work');
+                               $scope.registration.work = { persons: [ $scope.user ] };
+                               if ( angular.isUndefined( $scope.work ) )
+                                       $scope.work = $scope.registration.work;
+                       }
+
+
                        $scope.work.type = $scope.user.registration_type;
                        $scope.has_work = true;
                        $log.info( $scope.user.registration_type, " type updated");