Code:
```
lang=php
/** @var CategoriesItem $category */
$category = $application->recallObject('c', null, array('skip_autoload' => true));
$category->Clear();
// Set date from virtual.
$category->SetDBFieldsFromHash(array(
'CreatedOn_date' => 1732023005,
'CreatedOn_time' => 1732023005,
));
$category->UpdateFormattersMasterFields();
$test_result = $category->GetDBField('CreatedOn') == 1732023005 && $category->GetDBField('CreatedOn_date') == 1732023005 && $category->GetDBField('CreatedOn_time') == 1732023005;
echo 'Test 1: ' . ($test_result ? 'OK' : 'FAILED') . '<br/>' . PHP_EOL;
// Clear date from virtual.
$category->SetDBFieldsFromHash(array(
'CreatedOn_date' => null,
'CreatedOn_time' => null,
));
$category->UpdateFormattersMasterFields();
$test_result = $category->GetDBField('CreatedOn') === null && $category->GetDBField('CreatedOn_date') === null && $category->GetDBField('CreatedOn_time') === null;
echo 'Test 2: ' . ($test_result ? 'OK' : 'FAILED') . '<br/>' . PHP_EOL;
// Set date from combined.
$category->SetDBFieldsFromHash(array(
'CreatedOn' => 1732023005,
'CreatedOn_date' => 123,
'CreatedOn_time' => 123,
'CreatedOn_combined' => 1,
));
$category->UpdateFormattersMasterFields();
$test_result = $category->GetDBField('CreatedOn') == 1732023005 && $category->GetDBField('CreatedOn_date') == 123 && $category->GetDBField('CreatedOn_time') == 123;
echo 'Test 3: ' . ($test_result ? 'OK' : 'FAILED') . '<br/>' . PHP_EOL;
// Clear date from combined.
$category->SetDBFieldsFromHash(array(
'CreatedOn' => null,
'CreatedOn_date' => 456,
'CreatedOn_time' => 456,
'CreatedOn_combined' => 1,
));
$category->UpdateFormattersMasterFields();
$test_result = $category->GetDBField('CreatedOn') === null && $category->GetDBField('CreatedOn_date') == 456 && $category->GetDBField('CreatedOn_time') == 456;
echo 'Test 4: ' . ($test_result ? 'OK' : 'FAILED') . '<br/>' . PHP_EOL;
// Set date directly.
$category->SetDBFieldsFromHash(array(
'CreatedOn' => 1732023005,
));
$category->UpdateFormattersSubFields(array('CreatedOn'));
$test_result = $category->GetDBField('CreatedOn') == 1732023005 && $category->GetDBField('CreatedOn_date') == 1732023005 && $category->GetDBField('CreatedOn_time') == 1732023005;
echo 'Test 5: ' . ($test_result ? 'OK' : 'FAILED') . '<br/>' . PHP_EOL;
// Clear date directly.
$category->SetDBFieldsFromHash(array(
'CreatedOn' => null,
));
$category->UpdateFormattersSubFields(array('CreatedOn'));
$test_result = $category->GetDBField('CreatedOn') === null && $category->GetDBField('CreatedOn_date') === null && $category->GetDBField('CreatedOn_time') === null;
echo 'Test 6: ' . ($test_result ? 'OK' : 'FAILED') . '<br/>' . PHP_EOL;
```
# Test Plan
# in the IDE replace the `$application->Run();` line in the `/index.php` with the above-shown code and save changes
# open the `/index.php` in the Web Browser
# confirm, that all tests pass# Part 1
# in the IDE replace the `$application->Run();` line in the `/index.php` with the above-shown code and save changes
# open the `/index.php` in the Web Browser
# confirm, that all tests pass
# Part 2 - e-mail log
# login to Admin Console
# go to the {nav Logs & Reports > E-mail Log} section
# delete all the records in that grid
# go to the {nav User Management > Mailings} section
# switch to the `Email Queue` tab
# delete all the records in that grid
# go to the {nav User Management > Users} section
# create a user in the `Active` status
# use the `Decline` toolbar button on the above-created user
# go to the {nav User Management > Mailings} section
# switch to the `Email Queue` tab
# confirm, that 1 record, representing the `USER.DENY` e-mail, is shown in the grid
# press the `Process Queue` toolbar button
# confirm, that no records are shown in the grid
# go to the {nav Logs & Reports > E-mail Log} section
# confirm, that 1 record representing the `USER.DENY` e-mail, is shown in the grid AND that record has a non-empty value in the `Sent On` column
# Part 3 - orders
* go to Admin Console
# go to the {nav Website & Content > Structure & Data > Products} section
# switch to the `Products` tab
# add a new tangible product with Price=$10.00 and Status=Active
# go to the {nav Configuration > E-commerce > Shipping} section
# add new custom shipping, that will:
* on the `General` tab: have ShippingType=handling,BaseFee=5
* on the `Shipping Zones` tab: use single zone to cover for all countries
* on the `Brackets` tab: have single infinity bracket
# go to the {nav Configuration > E-commerce > Payment Types} section
# set the `Check/MO` payment type as primary
* go to Front-End
# place an order using the above-created product/shipping type and primary payment type (use any fake address for testing)
* go to Admin Console
# go to the {nav E-commerce > Orders} section
# switch to the `Pending` tab
# select the sales order, that was just submitted on the Front-End
# press the `Approve` toolbar button
# switch to the `To Ship` tab
# select the sales order, that was just approved
# press the `Ship` toolbar button
# switch to the `Processed` tab
# open the sales order, that was just shipped for editing
# go to the `Shipping` tab
# confirm, that the `Shipping Date/Time` is populated
# close the editing window
# select the sales order, that was just shipped
# press the `Clone` toolbar button
# switch to the `Incomplete` tab
# open the sales order, that was just cloned for editing
# go to the `Shipping` tab
# confirm, that the `Shipping Date/Time` is empty
# Part 4 - session logging
# login to Admin Console
# go to the {nav Configuration > Website > Advanced} section
# enable the `Track database changes to change log` system setting
# save changes
# re-login to the Admin Console for `Active` session log record to be created
# re-login to the Admin Console for the above-created session log record to be marked as `Logged Out`
# go to the {nav Logs & Reports > Session Log} section
# confirm, that above made re-login actions caused a `Logged Out` session log record to be created with both `Session Start` and `Session End` dates to be populated