original_string: protected function addUserLogin(\Gems_Model_JoinModel $model, $loginField, $organizationField)
      {
          $model->addTable(
                  'gems__user_logins',
                  array($loginField => 'gul_login', $organizationField => 'gul_id_organization'),
                  'gul',
                  \MUtil_Model_DatabaseModelAbstract::SAVE_MODE_INSERT |
                  \MUtil_Model_DatabaseModelAbstract::SAVE_MODE_UPDATE |
                  \MUtil_Model_DatabaseModelAbstract::SAVE_MODE_DELETE
                  );
  
          if ($model->has('gul_enable_2factor') && $model->has('gul_two_factor_key')) {
              $model->addColumn(
                      new \Zend_Db_Expr("CASE
                          WHEN gul_enable_2factor IS NULL THEN -1
                          WHEN gul_enable_2factor = 1 AND gul_two_factor_key IS NULL THEN 1
                          WHEN gul_enable_2factor = 1 AND gul_two_factor_key IS NOT NULL THEN 2
                          ELSE 0 END"),
                      'has_2factor'
                      );
          }
      }
code: protected function addUserLogin(\Gems_Model_JoinModel $model, $loginField, $organizationField)
      {
          $model->addTable(
                  'gems__user_logins',
                  array($loginField => 'gul_login', $organizationField => 'gul_id_organization'),
                  'gul',
                  \MUtil_Model_DatabaseModelAbstract::SAVE_MODE_INSERT |
                  \MUtil_Model_DatabaseModelAbstract::SAVE_MODE_UPDATE |
                  \MUtil_Model_DatabaseModelAbstract::SAVE_MODE_DELETE
                  );
  
          if ($model->has('gul_enable_2factor') && $model->has('gul_two_factor_key')) {
              $model->addColumn(
                      new \Zend_Db_Expr("CASE
                          WHEN gul_enable_2factor IS NULL THEN -1
                          WHEN gul_enable_2factor = 1 AND gul_two_factor_key IS NULL THEN 1
                          WHEN gul_enable_2factor = 1 AND gul_two_factor_key IS NOT NULL THEN 2
                          ELSE 0 END"),
                      'has_2factor'
                      );
          }
      }
code_tokens: protected function addUserLogin ( \ Gems_Model_JoinModel $ model , $ loginField , $ organizationField ) { $ model -> addTable ( 'gems__user_logins' , array ( $ loginField => 'gul_login' , $ organizationField => 'gul_id_organization' ) , 'gul' , \ MUtil_Model_DatabaseModelAbstract :: SAVE_MODE_INSERT | \ MUtil_Model_DatabaseModelAbstract :: SAVE_MODE_UPDATE | \ MUtil_Model_DatabaseModelAbstract :: SAVE_MODE_DELETE ) ; if ( $ model -> has ( 'gul_enable_2factor' ) && $ model -> has ( 'gul_two_factor_key' ) ) { $ model -> addColumn ( new \ Zend_Db_Expr ( "CASE
                          WHEN gul_enable_2factor IS NULL THEN -1
                          WHEN gul_enable_2factor = 1 AND gul_two_factor_key IS NULL THEN 1
                          WHEN gul_enable_2factor = 1 AND gul_two_factor_key IS NOT NULL THEN 2
                          ELSE 0 END" ) , 'has_2factor' ) ; } }
docstring: Link the model to the user_logins table.
  
  @param \Gems_Model_JoinModel $model
  @param string $loginField Field that links to login name field.
  @param string $organizationField Field that links to the organization field.
docstring_tokens: Link the model to the user_logins table .