Attached Files |
user_selector_missing_username_core_fix.patch [^] (24,597 bytes) 2012-10-09 10:38
[Show Content]
Index: admin_templates/user_selector.tpl
===================================================================
--- admin_templates/user_selector.tpl (revision 15437)
+++ admin_templates/user_selector.tpl (working copy)
@@ -49,7 +49,7 @@
<inp2:Field field="$field" first_chars="$first_chars" nl2br="$nl2br" grid="$grid" no_special="$no_special" format="$format"/>
<script type="text/javascript">
- $user_logins[ <inp2:Field name="$IdField"/> ] = '<inp2:Field name="Username" js_escape="1"/>';
+ $user_logins[ <inp2:Field name="$IdField"/> ] = '<inp2:UserSelectorTitle js_escape="1"/>';
</script>
</inp2:m_DefineElement>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 15552)
+++ install/install_data.sql (working copy)
@@ -114,7 +114,7 @@
# Section "in-portal:configure_users":
INSERT INTO SystemSettings VALUES(DEFAULT, 'User_Allow_New', '3', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_allow_new', 'radio', '', '1=la_opt_UserInstantRegistration||2=la_opt_UserNotAllowedRegistration||3=la_opt_UserUponApprovalRegistration||4=la_opt_UserEmailActivation', 10.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'AdvancedUserManagement', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_prompt_AdvancedUserManagement', 'checkbox', NULL, NULL, 10.011, 0, 1, NULL);
-INSERT INTO SystemSettings VALUES(DEFAULT, 'RegistrationUsernameRequired', '1', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_RegistrationUsernameRequired', 'checkbox', NULL, NULL, 10.02, 0, 0, NULL);
+INSERT INTO SystemSettings VALUES(DEFAULT, 'RegistrationUsernameRequired', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_RegistrationUsernameRequired', 'checkbox', NULL, NULL, 10.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'RegistrationCaptcha', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_registration_captcha', 'checkbox', NULL, NULL, 10.025, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Min_UserName', '3', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_username', 'text', '', 'style="width: 50px;"', 10.03, 1, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxUserName', '', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_username', 'text', '', 'style="width: 50px;"', 10.03, 2, 0, NULL);
Index: kernel/constants.php
===================================================================
--- kernel/constants.php (revision 15437)
+++ kernel/constants.php (working copy)
@@ -131,6 +131,7 @@
define('SUBMISSION_LOG_ATTACHMENT_PATH', WRITEBALE_BASE . '/user_files/submission_log/');
define('TIMENOW', adodb_mktime()); // for faster message processing
+ define('USER_TITLE_FIELD', 'IF(Email = "", Username, Email)');
// site domains
define('SITE_DOMAIN_REDIRECT_CURRENT', 1);
Index: kernel/db/cat_event_handler.php
===================================================================
--- kernel/db/cat_event_handler.php (revision 15437)
+++ kernel/db/cat_event_handler.php (working copy)
@@ -2174,21 +2174,7 @@
$object = $event->getObject();
/* @var $object kDBItem */
- $user_id = $object->GetDBField($id_field);
- $options = $object->GetFieldOptions($id_field);
-
- if ( isset($options['options'][$user_id]) ) {
- $object->SetDBField($cached_field, $options['options'][$user_id]);
- }
- else {
- $id_field = $this->Application->getUnitOption('u', 'IDField');
- $table_name = $this->Application->getUnitOption('u', 'TableName');
-
- $sql = 'SELECT Username
- FROM ' . $table_name . '
- WHERE ' . $id_field . ' = ' . $user_id;
- $object->SetDBField($cached_field, $this->Conn->GetOne($sql));
- }
+ $object->SetDBField($cached_field, $object->GetField($id_field));
}
/**
Index: kernel/utility/formatters/left_formatter.php
===================================================================
--- kernel/utility/formatters/left_formatter.php (revision 15437)
+++ kernel/utility/formatters/left_formatter.php (working copy)
@@ -46,7 +46,10 @@
if ( !isset($options['options'][$value]) ) {
// required option is not defined in config => query for it
- $sql = sprintf($options['left_sql'], $options['left_title_field'], $options['left_key_field'], $this->Conn->escape($value));
+ $display_field = $this->_escapeField($options['left_title_field']);
+ $match_field = $this->_escapeField($options['left_key_field']);
+
+ $sql = sprintf($options['left_sql'], $display_field, $match_field . ' = ' . $this->Conn->qstr($value));
$options['options'][$value] = $this->Conn->GetOne($sql);
if ( $options['options'][$value] === false ) {
@@ -58,6 +61,22 @@
}
/**
+ * Escape field names, but not expressions
+ *
+ * @param string $field_name
+ * @return string
+ * @access protected
+ */
+ protected function _escapeField($field_name)
+ {
+ if ( preg_match('/^[a-z_]+$/i', $field_name) ) {
+ return '`' . $field_name . '`';
+ }
+
+ return $field_name;
+ }
+
+ /**
* Performs basic type validation on form field value
*
* @param mixed $value
@@ -81,7 +100,10 @@
}
// requested option is not found in field options -> query for it
- $sql = sprintf($options['left_sql'], $options['left_key_field'], $options['left_title_field'], $this->Conn->escape($value));
+ $display_field = $this->_escapeField($options['left_key_field']);
+ $match_field = $this->_escapeField($options['left_title_field']);
+
+ $sql = sprintf($options['left_sql'], $display_field, $match_field . ' = ' . $this->Conn->qstr($value));
$found = $this->Conn->GetOne($sql);
if ( $found !== false ) {
@@ -90,7 +112,7 @@
}
$skip_errors = array_key_exists('skip_errors', $options) && $options['skip_errors'];
-
+
if ( $found === false && !$skip_errors ) {
// option not found at all -> return not formatted value & set error
$object->SetError($field_name, 'invalid_option', 'la_error_InvalidOption');
Index: units/categories/categories_config.php
===================================================================
--- units/categories/categories_config.php (revision 15471)
+++ units/categories/categories_config.php (working copy)
@@ -327,7 +327,7 @@
'MetaKeywords' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'CachedDescendantCatsQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CachedNavbar' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
- 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'ResourceId' => Array ('type' => 'int', 'default' => null),
'ParentPath' => Array ('type' => 'string', 'default' => null),
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
@@ -339,7 +339,7 @@
'NewItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'CachedTemplate' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'CachedTemplateHash' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0),
Index: units/helpers/page_helper.php
===================================================================
--- units/helpers/page_helper.php (revision 15437)
+++ units/helpers/page_helper.php (working copy)
@@ -32,7 +32,7 @@
'pr.IsDraft = 1',
);
- $sql = 'SELECT CASE pr.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE u.Username END
+ $sql = 'SELECT CASE pr.CreatedById WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(u.Username = "", u.Email, u.Username) END
FROM ' . $this->Application->getUnitOption('page-revision', 'TableName') . ' pr
LEFT JOIN ' . TABLE_PREFIX . 'Users u ON u.PortalUserId = pr.CreatedById
WHERE (' . implode(') AND (', $where_clause) . ')';
Index: units/logs/system_logs/system_logs_config.php
===================================================================
--- units/logs/system_logs/system_logs_config.php (revision 15552)
+++ units/logs/system_logs/system_logs_config.php (working copy)
@@ -86,7 +86,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'Username' => 'CASE %1$s.LogUserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), u.Username) END',
+ 'Username' => 'CASE %1$s.LogUserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(u.Username = "", u.Email, u.Username)) END',
),
),
Index: units/mailing_lists/mailing_lists_config.php
===================================================================
--- units/mailing_lists/mailing_lists_config.php (revision 15461)
+++ units/mailing_lists/mailing_lists_config.php (working copy)
@@ -98,7 +98,8 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'required' => 1, 'not_null' => 1, 'default' => USER_ROOT,
),
Index: units/page_revisions/page_revisions_config.php
===================================================================
--- units/page_revisions/page_revisions_config.php (revision 15437)
+++ units/page_revisions/page_revisions_config.php (working copy)
@@ -57,7 +57,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'CreatedBy' => 'created_by.Username',
+ 'CreatedBy' => 'IF(created_by.Username = "", created_by.Email, created_by.Username)',
'IsLive' => 'IF(%1$s.RevisionNumber = c.LiveRevisionNumber, 1, 0)',
),
),
@@ -74,7 +74,7 @@
'FromRevisionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CreatedById' => Array (
'type' => 'int',
- 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest', 'required' => 1,
+ 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest', 'required' => 1,
'default' => NULL
),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
Index: units/reviews/reviews_config.php
===================================================================
--- units/reviews/reviews_config.php (revision 15437)
+++ units/reviews/reviews_config.php (working copy)
@@ -138,10 +138,8 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\' ',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'required' => 1, 'default' => NULL,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
),
Index: units/spam_reports/spam_reports_config.php
===================================================================
--- units/spam_reports/spam_reports_config.php (revision 15437)
+++ units/spam_reports/spam_reports_config.php (working copy)
@@ -64,7 +64,7 @@
'CalculatedFields' => Array (
'' => Array (
'ItemName' => 'IF(%1$s.ItemPrefix LIKE "%rev", review.ReviewText, "")',
- 'ReportedBy' => 'reported_by.Username',
+ 'ReportedBy' => 'IF(reported_by.Username = "", reported_by.Email, reported_by.Username)',
),
),
@@ -86,7 +86,7 @@
'ReportedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'ReportedById' => Array (
'type' => 'int',
- 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest',
+ 'formatter' => 'kLEFTFormatter', 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'sample_value' => 'Guest',
'default' => NULL
)
),
Index: units/structure/structure_config.php
===================================================================
--- units/structure/structure_config.php (revision 15437)
+++ units/structure/structure_config.php (working copy)
@@ -141,7 +141,7 @@
'MetaKeywords' => Array('type' => 'string', 'default' => null),
'CachedDescendantCatsQty' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'CachedNavbar' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
- 'CreatedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'CreatedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'ResourceId' => Array('type' => 'int', 'default' => null),
'ParentPath' => Array('type' => 'string', 'default' => null),
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
@@ -153,7 +153,7 @@
'NewItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Modified' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- 'ModifiedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'CachedTemplate' => Array('type' => 'string', 'not_null' => 1, 'default' => ''),
'CachedTemplateHash' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0),
Index: units/system_event_subscriptions/system_event_subscriptions_config.php
===================================================================
--- units/system_event_subscriptions/system_event_subscriptions_config.php (revision 15437)
+++ units/system_event_subscriptions/system_event_subscriptions_config.php (working copy)
@@ -80,7 +80,7 @@
'' => Array (
'BindToSystemEvent' => 'ee.BindToSystemEvent',
'EmailEventName' => 'ee.Event',
- 'Username' => 'CASE %1$s.UserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(%1$s.UserId IS NULL, "Guest", u.Username)) END',
+ 'Username' => 'CASE %1$s.UserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(%1$s.UserId IS NULL, "Guest", IF(u.Username = "", u.Email, u.Username))) END',
'CategoryName' => 'c.l%2$s_Name',
'ItemName' => '%1$s.ItemId',
'ParentItemName' => '%1$s.ParentItemId',
@@ -101,7 +101,7 @@
'required' => 1, 'default' => NULL
),
'SubscriberEmail' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
- 'UserId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'UserId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'CategoryId' => Array ('type' => 'int', 'default' => NULL),
'IncludeSublevels' => Array (
'type' => 'int',
Index: units/user_groups/user_groups_config.php
===================================================================
--- units/user_groups/user_groups_config.php (revision 15437)
+++ units/user_groups/user_groups_config.php (working copy)
@@ -37,7 +37,7 @@
'CalculatedFields' => Array (
'' => Array(
'UserName' => 'CONCAT(u.LastName, \' \', u.FirstName)',
- 'UserLogin' => 'u.Username',
+ 'UserLogin' => 'IF(u.Username = "", u.Email, u.Username)',
'PrimaryGroup' => 'IF(u.PrimaryGroupId = %1$s.GroupId, 1, 0)',
),
),
Index: units/users/users_tag_processor.php
===================================================================
--- units/users/users_tag_processor.php (revision 15517)
+++ units/users/users_tag_processor.php (working copy)
@@ -359,4 +359,19 @@
$user_helper->loginUserById( $login_user->GetID() );
}
}
+
+ /**
+ * Returns user selector title
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function UserSelectorTitle($params)
+ {
+ $object = $this->getObject($params);
+ /* @var $object kDBItem */
+
+ return $object->GetDBField('Email') ? $object->GetDBField('Email') : $object->GetDBField('Username');
+ }
}
\ No newline at end of file
Index: units/visits/visits_config.php
===================================================================
--- units/visits/visits_config.php (revision 15437)
+++ units/visits/visits_config.php (working copy)
@@ -85,11 +85,11 @@
'CalculatedFields' => Array (
'' => Array (
- 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), u.Username)',
+ 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), IF(u.Username = "", u.Email, u.Username))',
),
'incommerce' => Array (
- 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), u.Username)',
- 'AffiliateUser' => 'IF( LENGTH(au.Username),au.Username,\'!la_None!\')',
+ 'UserName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), IF(u.Username = "", u.Email, u.Username))',
+ 'AffiliateUser' => 'IF(au.PortalUserId IS NULL, "!la_None!", IF(au.Username = "", au.Email, au.Username))',
'AffiliatePortalUserId' => 'af.PortalUserId',
'OrderTotalAmount' => 'IF(ord.Status = 4, ord.SubTotal+ord.ShippingCost+ord.VAT, 0)',
'OrderAffiliateCommission' => 'IF(ord.Status = 4, ord.AffiliateCommission, 0)',
@@ -133,7 +133,7 @@
'VisitDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'custom_filter' => 'date_range', 'default' => NULL),
'Referer' => Array ('type' => 'string','not_null' => '1','default' => ''),
'IPAddress' => Array ('type' => 'string','not_null' => '1','default' => ''),
- 'AffiliateId' => Array ('type' => 'int','formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (0 => 'lu_None'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users pu ON pu.PortalUserId = af.PortalUserId WHERE `%s` = \'%s\'','left_key_field' => 'AffiliateId','left_title_field' => 'Username','not_null'=>1,'default'=>0),
+ 'AffiliateId' => Array ('type' => 'int','formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (0 => 'lu_None'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users u ON u.PortalUserId = af.PortalUserId WHERE %s','left_key_field' => 'AffiliateId','left_title_field' => 'IF(u.Email = "", u.Username, u.Email)','not_null'=>1,'default'=>0),
'PortalUserId' => Array ('type' => 'int','not_null' => '1','default' => USER_GUEST),
),
user_selector_missing_username_modules_fix.patch [^] (32,860 bytes) 2012-10-09 10:38
[Show Content]
Index: in-bulletin/units/poll_comments/poll_comments_config.php
===================================================================
--- in-bulletin/units/poll_comments/poll_comments_config.php (revision 15437)
+++ in-bulletin/units/poll_comments/poll_comments_config.php (working copy)
@@ -59,12 +59,15 @@
'CommentId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'PollId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'AnswerId' => Array ('type' => 'int', 'default' => NULL),
- 'CreatedById' => Array ('type' => 'int', 'formatter'=>'kLEFTFormatter',
- 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
- 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'',
- 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username',
- 'required' => 1, 'default' => NULL),
+ 'CreatedById' => Array (
+ 'type' => 'int',
+ 'formatter'=>'kLEFTFormatter',
+ 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
+ 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
+ 'required' => 1, 'default' => NULL
+ ),
'GuestName' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'GuestEmail' => Array('type' => 'string', 'max_len' => 255, 'formatter'=>'kFormatter', 'regexp'=>'/^(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')$/i', 'sample_value' => 'email@domain.com', 'not_null' => '1', 'default' => '', 'error_msgs' => Array('invalid_format'=>'!la_invalid_email!', 'unique'=>'!lu_email_already_exist!'),'required' => 0 ),
'CommentBody' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL, 'required' => 1),
@@ -81,7 +84,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'CommentedByUser' => 'IF( ISNULL(pu.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', \'root\', IF (%1$s.CreatedById = ' . USER_GUEST . ', \'Guest\', \'n/a\')), pu.Username )',
+ 'CommentedByUser' => 'IF( ISNULL(pu.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', \'root\', IF (%1$s.CreatedById = ' . USER_GUEST . ', \'Guest\', \'n/a\')), IF(pu.Username = "", pu.Email, pu.Username))',
),
),
Index: in-bulletin/units/posts/posts_config.php
===================================================================
--- in-bulletin/units/posts/posts_config.php (revision 15437)
+++ in-bulletin/units/posts/posts_config.php (working copy)
@@ -64,7 +64,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Username)',
+ 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), IF(u.Username = "", u.Email, u.Username))',
'AltName' => 'img.AltName',
'SameImages' => 'img.SameImages',
@@ -87,8 +87,8 @@
'GraphicsUrl' => Array ('type' => 'string', 'max_len' => 255, 'default' => NULL),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL),
- 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
- 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
+ 'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'TopicId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'ResourceId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'ReplyTo' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
Index: in-bulletin/units/private_messages/private_messages_config.php
===================================================================
--- in-bulletin/units/private_messages/private_messages_config.php (revision 15437)
+++ in-bulletin/units/private_messages/private_messages_config.php (working copy)
@@ -76,8 +76,8 @@
'Body' => 'pmb.Body',
'Options' => 'pmb.Options',
- 'FromName' => 'IF (ISNULL(from_user.Username), IF (%1$s.FromId = ' . USER_ROOT . ', "root", IF (%1$s.FromId = ' . USER_GUEST . ', "Guest", "n/a")), from_user.Username)',
- 'ToName' => 'IF (ISNULL(to_user.Username), IF (%1$s.ToId = ' . USER_ROOT . ', "root", IF (%1$s.ToId = ' . USER_GUEST . ', "Guest", "n/a")), to_user.Username)',
+ 'FromName' => 'IF (ISNULL(from_user.Username), IF (%1$s.FromId = ' . USER_ROOT . ', "root", IF (%1$s.FromId = ' . USER_GUEST . ', "Guest", "n/a")), IF(from_user.Username = "", from_user.Email, from_user.Username))',
+ 'ToName' => 'IF (ISNULL(to_user.Username), IF (%1$s.ToId = ' . USER_ROOT . ', "root", IF (%1$s.ToId = ' . USER_GUEST . ', "Guest", "n/a")), IF(to_user.Username = "", to_user.Email, to_user.Username))',
'FromFullName' => 'TRIM(CONCAT(from_user.FirstName, " ", from_user.LastName))',
'ToFullName' => 'TRIM(CONCAT(to_user.FirstName, " ", to_user.LastName))',
@@ -86,8 +86,8 @@
'Fields' => Array (
'PmId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'FromId' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!lu_error_UserNotFound!'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'required' => 1, 'default' => null),
- 'ToId' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!lu_error_UserNotFound!'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'required' => 1, 'default' => null),
+ 'FromId' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!lu_error_UserNotFound!'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'required' => 1, 'default' => null),
+ 'ToId' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!lu_error_UserNotFound!'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'required' => 1, 'default' => null),
'FolderId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'lu_Inbox', 1 => 'lu_Sent'), 'use_phrases' => 1, 'not_null' => 1, 'default' => PM_FOLDER_SENT),
'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'lu_opt_MessageUnread', 1 => 'lu_opt_MessageViewed', 2 => 'lu_opt_MessageRead', 3 => 'lu_opt_MessageReplied', 4 => 'lu_opt_MessageSent'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'PMBodyId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
Index: in-bulletin/units/topics/topics_config.php
===================================================================
--- in-bulletin/units/topics/topics_config.php (revision 15467)
+++ in-bulletin/units/topics/topics_config.php (working copy)
@@ -290,7 +290,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.OwnerId = ' . USER_ROOT . ', "root", IF (%1$s.OwnerId = ' . USER_GUEST . ', "Guest", "n/a")), u.Username)',
+ 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.OwnerId = ' . USER_ROOT . ', "root", IF (%1$s.OwnerId = ' . USER_GUEST . ', "Guest", "n/a")), IF(u.Username = "", u.Email, u.Username))',
'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId',
'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename',
'CategoryFilename' => TABLE_PREFIX.'Categories.NamedParentPath',
@@ -386,10 +386,8 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\' ',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'sample_value' => 'Guest', 'required' => 1, 'default' => NULL,
),
@@ -397,10 +395,8 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\' ',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'default' => NULL,
),
Index: in-commerce/install/install_schema.sql
===================================================================
--- in-commerce/install/install_schema.sql (revision 15437)
+++ in-commerce/install/install_schema.sql (working copy)
@@ -663,7 +663,7 @@
CREATE TABLE Affiliates (
AffiliateId int(11) NOT NULL AUTO_INCREMENT,
- PortalUserId int(10) unsigned NOT NULL DEFAULT '0',
+ PortalUserId int(10) DEFAULT NULL,
AffiliatePlanId int(10) unsigned NOT NULL DEFAULT '0',
AccumulatedAmount decimal(10,2) NOT NULL DEFAULT '0.00',
AmountToPay decimal(10,2) NOT NULL DEFAULT '0.00',
@@ -677,8 +677,8 @@
Comments text,
CreatedOn int(11) DEFAULT NULL,
PRIMARY KEY (AffiliateId),
+ UNIQUE KEY AffiliateCode (AffiliateCode),
UNIQUE KEY PortalUserId (PortalUserId),
- UNIQUE KEY AffiliateCode (AffiliateCode),
KEY LastOrderDate (LastOrderDate),
KEY AffiliatePlanId (AffiliatePlanId),
KEY `Status` (`Status`),
Index: in-commerce/install/upgrades.php
===================================================================
--- in-commerce/install/upgrades.php (revision 15547)
+++ in-commerce/install/upgrades.php (working copy)
@@ -61,6 +61,7 @@
'5.2.0-B3' => Array ('Core' => '5.2.0-B3'),
'5.2.0-RC1' => Array ('Core' => '5.2.0-RC1'),
'5.2.0' => Array ('Core' => '5.2.0'),
+ '5.2.1-B1' => Array ('Core' => '5.2.1-B1'),
);
}
Index: in-commerce/install/upgrades.sql
===================================================================
--- in-commerce/install/upgrades.sql (revision 15468)
+++ in-commerce/install/upgrades.sql (working copy)
@@ -282,3 +282,7 @@
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:general.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:output.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:contacts.add', 11, 1, 1, 0);
+
+# ===== v 5.2.1-B1 =====
+ALTER TABLE Affiliates CHANGE PortalUserId PortalUserId INT(10) NULL DEFAULT NULL;
+UPDATE Affiliates SET PortalUserId = NULL WHERE PortalUserId = 0;
Index: in-commerce/units/affiliate_payments/affiliate_payments_config.php
===================================================================
--- in-commerce/units/affiliate_payments/affiliate_payments_config.php (revision 15437)
+++ in-commerce/units/affiliate_payments/affiliate_payments_config.php (working copy)
@@ -87,7 +87,7 @@
'PortalUserId' => 'af.PortalUserId',
),
'log' => Array(
- 'Username' => 'au.Username',
+ 'Username' => 'IF(au.Username = "", au.Email, au.Username)',
'PortalUserId' => 'af.PortalUserId',
),
),
@@ -106,7 +106,7 @@
'Fields' => Array(
'AffiliatePaymentId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'AffiliateId' => Array('type'=>'int','formatter'=>'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(0 => 'lu_None'), 'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users pu ON pu.PortalUserId = af.PortalUserId WHERE `%s` = \'%s\'','left_key_field'=>'AffiliateId','left_title_field'=>'Username','not_null'=>1,'default'=>0),
+ 'AffiliateId' => Array('type'=>'int','formatter'=>'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(0 => 'lu_None'), 'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users u ON u.PortalUserId = af.PortalUserId WHERE %s','left_key_field'=>'af.AffiliateId','left_title_field'=>'IF(u.Email = "", u.Username, u.Email)','not_null'=>1,'default'=>0),
'PaymentDate' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'default' => '#NOW#'),
'Amount' => Array('type' => 'double', 'formatter'=>'kFormatter', 'format'=>'%.02f', 'not_null' => '1', 'required'=>1, 'default' => '0.00'),
'Comment' => Array('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
Index: in-commerce/units/affiliates/affiliates_config.php
===================================================================
--- in-commerce/units/affiliates/affiliates_config.php (revision 15437)
+++ in-commerce/units/affiliates/affiliates_config.php (working copy)
@@ -172,7 +172,7 @@
'CalculatedFields' => Array(
'' => Array (
'UserId' => 'u.PortalUserId',
- 'UserName' => 'IF( LENGTH(u.Username), u.Username, \'\')',
+ 'UserName' => 'IF(u.Username = "", u.Email, u.Username)',
'PlanName' => 'ap.Name',
),
),
@@ -196,7 +196,7 @@
'Fields' => Array(
'AffiliateId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'PortalUserId' => Array('type' => 'int', 'unique'=>Array('PortalUserId'), 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!', 'unique' => '!la_affiliate_already_exists!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'required' => 1, 'not_null' => 1, 'default' => 0, ),
+ 'PortalUserId' => Array('type' => 'int', 'unique'=>Array(), 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!', 'unique' => '!la_affiliate_already_exists!'), 'options' => Array(USER_ROOT => 'root', USER_GUEST => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'required' => 1, 'default' => null),
'AffiliatePlanId' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options_sql'=>'SELECT Name, AffiliatePlanId FROM '.TABLE_PREFIX.'AffiliatePlans WHERE Enabled = 1 ORDER BY Name', 'option_key_field'=>'AffiliatePlanId', 'option_title_field'=>'Name', 'not_null' => 1, 'default' => 0),
'AccumulatedAmount' => Array('type' => 'double', 'formatter'=>'kFormatter', 'format'=>'%.02f', 'not_null' => '1','default' => '0.00'),
'AmountToPay' => Array('type' => 'double', 'formatter'=>'kFormatter', 'format'=>'%.02f', 'not_null' => '1','default' => '0.00'),
Index: in-commerce/units/coupons/coupons_config.php
===================================================================
--- in-commerce/units/coupons/coupons_config.php (revision 15437)
+++ in-commerce/units/coupons/coupons_config.php (working copy)
@@ -112,12 +112,13 @@
),
'Amount' => Array ('type' => 'double', 'default' => null),
'LastUsedBy' => Array (
- 'type' => 'int', 'formatter' => 'kLEFTFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kLEFTFormatter',
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId',
- 'left_title_field' => 'Username', 'required' => 0, 'default' => null,
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
+ 'required' => 0, 'default' => null,
),
'LastUsedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL),
'NumberOfUses' => Array ('type' => 'int', 'default' => 1),
Index: in-commerce/units/orders/orders_config.php
===================================================================
--- in-commerce/units/orders/orders_config.php (revision 15437)
+++ in-commerce/units/orders/orders_config.php (working copy)
@@ -250,8 +250,8 @@
'CalculatedFields' => Array (
'' => Array (
- 'CustomerName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', \'root\', IF (%1$s.PortalUserId = ' . USER_GUEST . ', \'Guest\', \'n/a\')), CONCAT(u.FirstName,\' \',u.LastName) )',
- 'Username' => 'IF( ISNULL(u.Username),\'root\',u.Username)',
+ 'CustomerName' => 'IF( ISNULL(u.Username), IF (%1$s.PortalUserId = ' . USER_ROOT . ', "root", IF (%1$s.PortalUserId = ' . USER_GUEST . ', "Guest", "n/a")), CONCAT(u.FirstName," ",u.LastName) )',
+ 'Username' => 'IF( ISNULL(u.Username),"root",IF(u.Username = "", u.Email, u.Username))',
'OrderNumber' => 'CONCAT(LPAD(Number,6,"0"),\'-\',LPAD(SubNumber,3,"0") )',
'SubtotalWithoutDiscount' => '(SubTotal + DiscountTotal)',
'SubtotalWithDiscount' => '(SubTotal)',
@@ -259,7 +259,7 @@
'TotalAmount' => 'SubTotal+ShippingCost+IF(VATIncluded=1,0,VAT)+ProcessingFee+InsuranceFee-GiftCertificateDiscount',
'CouponCode' => 'pc.Code',
'CouponName' => 'pc.Name',
- 'AffiliateUser' => 'IF( LENGTH(au.Username),au.Username,\'!la_None!\')',
+ 'AffiliateUser' => 'IF(au.PortalUserId IS NULL, "!la_None!", IF(au.Username = "", au.Email, au.Username))',
'AffiliatePortalUserId' => 'af.PortalUserId',
'GiftCertificateCode' => 'gc.Code',
'GiftCertificateRecipient' => 'gc.Recipient',
@@ -320,7 +320,7 @@
'not_null' => 1, 'default' => 0,
),
'OrderDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'),
- 'PortalUserId' =>Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' =>Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'required' =>1, 'not_null' =>1, 'default' =>-1),
+ 'PortalUserId' =>Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' =>Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'required' =>1, 'not_null' =>1, 'default' =>-1),
'OrderIP' => Array ('type' => 'string', 'not_null' => 1, 'default' => '', 'filter_type' => 'like'),
'UserComment' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
'AdminComment' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
@@ -456,7 +456,7 @@
),
'GWResult1' => Array ('type' => 'string', 'formatter' => 'kSerializedFormatter', 'default' => NULL),
'GWResult2' => Array ('type' => 'string', 'formatter' => 'kSerializedFormatter', 'default' => NULL),
- 'AffiliateId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (0 => 'lu_None'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users pu ON pu.PortalUserId = af.PortalUserId WHERE `%s` = \'%s\'', 'left_key_field' => 'AffiliateId', 'left_title_field' => 'Username', 'not_null' =>1, 'default' =>0),
+ 'AffiliateId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (0 => 'lu_None'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Affiliates af LEFT JOIN '.TABLE_PREFIX.'Users u ON u.PortalUserId = af.PortalUserId WHERE %s', 'left_key_field' => 'AffiliateId', 'left_title_field' => 'IF(u.Email = "", u.Username, u.Email)', 'not_null' =>1, 'default' =>0),
'VisitId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'AffiliateCommission' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%.02f', 'not_null' => 1, 'default' => '0.0000'),
'ProcessingFee' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%.02f', 'not_null' => '0', 'default' => '0.0000'),
Index: in-commerce/units/products/products_config.php
===================================================================
--- in-commerce/units/products/products_config.php (revision 15468)
+++ in-commerce/units/products/products_config.php (working copy)
@@ -509,10 +509,8 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\'',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'sample_value' => 'Guest', 'required' => 1, 'default' => NULL,
),
@@ -548,13 +546,13 @@
'ProcessingData' => Array ('type' => 'string', 'default' => null),
'ShippingLimitation' => Array ('type' => 'string', 'default' => NULL),
- 'AssignedCoupon' =>
- Array ('type' => 'int', 'not_null' => 1, 'default' => 0,
- 'formatter' => 'kLEFTFormatter',
- 'options' => Array (0 => 'None'),
- 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'ProductsCoupons WHERE `%s` = \'%s\'',
- 'left_key_field' => 'CouponId',
- 'left_title_field' => 'Name'),
+ 'AssignedCoupon' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kLEFTFormatter', 'options' => Array (0 => 'None'),
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'ProductsCoupons WHERE %s',
+ 'left_key_field' => 'CouponId', 'left_title_field' => 'Name',
+ 'not_null' => 1, 'default' => 0,
+ ),
'MinQtyFreePromoShipping' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'MetaKeywords' => Array ('type' => 'string', 'default' => null),
'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
Index: in-link/units/links/links_config.php
===================================================================
--- in-link/units/links/links_config.php (revision 15469)
+++ in-link/units/links/links_config.php (working copy)
@@ -396,7 +396,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Username)',
+ 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), IF(u.Username = "", u.Email, u.Username))',
'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId',
'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename',
'CategoryFilename' => TABLE_PREFIX.'Categories.NamedParentPath',
@@ -467,14 +467,12 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\'',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'sample_value' => 'Guest', 'required' => 1, 'default' => NULL,
),
- 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Status' => Array (
'type' => 'int',
Index: in-link/units/listings/listings_config.php
===================================================================
--- in-link/units/listings/listings_config.php (revision 15437)
+++ in-link/units/listings/listings_config.php (working copy)
@@ -106,7 +106,7 @@
'CalculatedFields' => Array (
'' => Array (
'LinkName' => 'CONCAT(item_table.Name, " (", item_table.Url, ")")',
- 'LinkOwner' => 'IF (ISNULL(u.Username), IF (item_table.CreatedById = ' . USER_ROOT . ', "root", IF (item_table.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Username)',
+ 'LinkOwner' => 'IF (ISNULL(u.Username), IF (item_table.CreatedById = ' . USER_ROOT . ', "root", IF (item_table.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), IF(u.Username = "", u.Email, u.Username))',
),
),
'Fields' => Array (
Index: in-news/units/articles/articles_config.php
===================================================================
--- in-news/units/articles/articles_config.php (revision 15470)
+++ in-news/units/articles/articles_config.php (working copy)
@@ -331,7 +331,7 @@
'CalculatedFields' => Array (
'' => Array (
- 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), u.Username)',
+ 'UserName' => 'IF (ISNULL(u.Username), IF (%1$s.CreatedById = ' . USER_ROOT . ', "root", IF (%1$s.CreatedById = ' . USER_GUEST . ', "Guest", "n/a")), IF(u.Username = "", u.Email, u.Username))',
'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId',
'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename',
'CategoryFilename' => TABLE_PREFIX.'Categories.NamedParentPath',
@@ -399,10 +399,8 @@
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
- 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users
- WHERE `%s` = \'%s\'',
- 'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Username',
+ 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
+ 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'sample_value' => 'Guest', 'required' => 1, 'default' => NULL,
),
@@ -439,7 +437,7 @@
'HotItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Archived' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 2 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'ModifiedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Users WHERE %s', 'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD, 'default' => NULL),
'OrgId' => Array ('type' => 'int', 'default' => null),
'MetaKeywords' => Array ('type' => 'string', 'default' => null),
'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
@@ -474,7 +472,6 @@
'FullUrl' => Array ('type' => 'string', 'default' => ''),
// export related fields: begin
- 'CategoryId' => Array ('type' => 'int', 'default' => 0),
'ExportFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CSV', /*2 => 'XML'*/), 'default' => 1),
'ExportFilename' => Array ('type' => 'string', 'default' => ''),
'FieldsSeparatedBy' => Array ('type' => 'string', 'default' => ','),
|