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' => ','),