Attached Files |
form_modification_detector_part1.patch [^] (2,848 bytes) 2010-03-02 08:36
[Show Content]
Index: kernel/db/cat_dbitem.php
===================================================================
--- kernel/db/cat_dbitem.php (revision 13152)
+++ kernel/db/cat_dbitem.php (working copy)
@@ -101,10 +101,14 @@
function Update($id=null, $system_update=false)
{
$this->VirtualFields['ResourceId'] = Array();
- $this->SetDBField('Modified', adodb_mktime() );
- $this->UpdateFormattersSubFields(array('Modified'));
- $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ if ($this->GetChangedFields()) {
+ $now = adodb_mktime();
+ $this->SetDBField('Modified_date', $now);
+ $this->SetDBField('Modified_time', $now);
+ $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ }
+
if ($this->useFilenames) {
$this->checkFilename();
$this->generateFilename();
Index: units/categories/categories_event_handler.php
===================================================================
--- units/categories/categories_event_handler.php (revision 13168)
+++ units/categories/categories_event_handler.php (working copy)
@@ -1301,7 +1301,9 @@
$object =& $event->getObject();
/* @var $object kDBItem */
- $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ if ($object->GetChangedFields()) {
+ $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ }
$this->_beforeItemChange($event);
}
@@ -1553,8 +1555,10 @@
$now = adodb_mktime();
- $object->SetDBField('Modified_date', $now);
- $object->SetDBField('Modified_time', $now);
+ if ($object->GetChangedFields()) {
+ $object->SetDBField('Modified_date', $now);
+ $object->SetDBField('Modified_time', $now);
+ }
$object->setRequired('PageCacheKey', $object->GetDBField('OverridePageCacheKey'));
$object->SetDBField('Template', $this->_stripTemplateExtension( $object->GetDBField('Template') ));
Index: units/modules/modules_event_handler.php
===================================================================
--- units/modules/modules_event_handler.php (revision 13152)
+++ units/modules/modules_event_handler.php (working copy)
@@ -84,13 +84,13 @@
}
$object->Load($id);
-
$object->SetDBField($status_field, $event->Name == 'OnMassApprove' ? 1 : 0);
+ $updated = $object->Update();
- if ($object->Update()) {
+ if ($updated) {
$sql = 'UPDATE ' . TABLE_PREFIX . 'ImportScripts
- SET Status = ' . ($event->Name == 'OnMassApprove' ? STATUS_ACTIVE : STATUS_DISABLED) . '
- WHERE Module = "' . $object->GetDBField('Name') . '"';
+ SET Status = ' . ($event->Name == 'OnMassApprove' ? STATUS_ACTIVE : STATUS_DISABLED) . '
+ WHERE Module = "' . $object->GetDBField('Name') . '"';
$this->Conn->Query($sql);
$event->status = erSUCCESS;
modification_detector_core.patch [^] (3,851 bytes) 2010-05-26 04:16
[Show Content]
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 13635)
+++ install/upgrades.sql (working copy)
@@ -1892,3 +1892,6 @@
DELETE FROM Permissions WHERE Permission LIKE 'in-portal:configuration_email%';
DELETE FROM Permissions WHERE Permission LIKE 'in-portal:user_email%';
DELETE FROM Phrase WHERE Phrase IN ('la_fld_FromToUser', 'la_col_FromToUser');
+
+# ===== v 5.1.0-B2 =====
+UPDATE Events SET Headers = NULL WHERE Headers = '';
\ No newline at end of file
Index: kernel/db/cat_dbitem.php
===================================================================
--- kernel/db/cat_dbitem.php (revision 13557)
+++ kernel/db/cat_dbitem.php (working copy)
@@ -107,10 +107,14 @@
function Update($id=null, $system_update=false)
{
$this->VirtualFields['ResourceId'] = Array();
- $this->SetDBField('Modified', adodb_mktime() );
- $this->UpdateFormattersSubFields(array('Modified'));
- $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ if ($this->GetChangedFields()) {
+ $now = adodb_mktime();
+ $this->SetDBField('Modified_date', $now);
+ $this->SetDBField('Modified_time', $now);
+ $this->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ }
+
if ($this->useFilenames) {
$this->checkFilename();
$this->generateFilename();
Index: units/categories/categories_event_handler.php
===================================================================
--- units/categories/categories_event_handler.php (revision 13581)
+++ units/categories/categories_event_handler.php (working copy)
@@ -1304,7 +1304,9 @@
$object =& $event->getObject();
/* @var $object kDBItem */
- $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ if ($object->GetChangedFields()) {
+ $object->SetDBField('ModifiedById', $this->Application->RecallVar('user_id'));
+ }
$this->_beforeItemChange($event);
}
@@ -1556,8 +1558,10 @@
$now = adodb_mktime();
- $object->SetDBField('Modified_date', $now);
- $object->SetDBField('Modified_time', $now);
+ if ($object->GetChangedFields()) {
+ $object->SetDBField('Modified_date', $now);
+ $object->SetDBField('Modified_time', $now);
+ }
$object->setRequired('PageCacheKey', $object->GetDBField('OverridePageCacheKey'));
$object->SetDBField('Template', $this->_stripTemplateExtension( $object->GetDBField('Template') ));
Index: units/helpers/email_message_helper.php
===================================================================
--- units/helpers/email_message_helper.php (revision 13557)
+++ units/helpers/email_message_helper.php (working copy)
@@ -28,7 +28,7 @@
}
}
- $ret['Headers'] = implode("\n", $headers);
+ $ret['Headers'] = $headers ? implode("\n", $headers) : null; // it's null field
$lines = array_slice($lines, $line_id + 1);
Index: units/modules/modules_event_handler.php
===================================================================
--- units/modules/modules_event_handler.php (revision 13581)
+++ units/modules/modules_event_handler.php (working copy)
@@ -84,13 +84,13 @@
}
$object->Load($id);
-
$object->SetDBField($status_field, $event->Name == 'OnMassApprove' ? 1 : 0);
+ $updated = $object->Update();
- if ($object->Update()) {
+ if ($updated) {
$sql = 'UPDATE ' . TABLE_PREFIX . 'ImportScripts
- SET Status = ' . ($event->Name == 'OnMassApprove' ? STATUS_ACTIVE : STATUS_DISABLED) . '
- WHERE Module = "' . $object->GetDBField('Name') . '"';
+ SET Status = ' . ($event->Name == 'OnMassApprove' ? STATUS_ACTIVE : STATUS_DISABLED) . '
+ WHERE Module = "' . $object->GetDBField('Name') . '"';
$this->Conn->Query($sql);
$event->status = erSUCCESS;
modification_detector_modules.patch [^] (7,357 bytes) 2010-05-26 04:16
[Show Content]
Index: in-commerce/admin_templates/products/products_access.tpl
===================================================================
--- in-commerce/admin_templates/products/products_access.tpl (revision 13557)
+++ in-commerce/admin_templates/products/products_access.tpl (working copy)
@@ -83,7 +83,7 @@
<table class="edit-form" style="border-bottom: 1px solid black;">
<inp2:m_RenderElement name="subsection" title="!la_section_Product!"/>
- <inp2:m_RenderElement name="inp_edit_options" prefix="p" field="AccessGroupId" title="la_fld_AccessGroup" size="4"/>
+ <inp2:m_RenderElement name="inp_edit_options" prefix="p" field="AccessGroupId" title="la_fld_AccessGroup" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="IsRecurringBilling" title="la_fld_IsRecurringBilling"/>
<!-- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="PayPalRecurring" title="la_fld_IsPayPalRecurring"/> -->
Index: in-commerce/admin_templates/products/products_files.tpl
===================================================================
--- in-commerce/admin_templates/products/products_files.tpl (revision 13557)
+++ in-commerce/admin_templates/products/products_files.tpl (working copy)
@@ -111,7 +111,7 @@
<div id="scroll_container" mode="minimal">
<table class="edit-form" style="border-bottom: 1px solid black;">
<inp2:m_RenderElement name="subsection" title="!la_section_Product!"/>
- <inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Price" title="!la_fld_Price!" size="8"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Price" title="!la_fld_Price!" style="width: 100px;"/>
<inp2:m_RenderElement name="inp_edit_filler"/>
<inp2:m_RenderElement name="subsection" title="!la_section_Files!"/>
</table>
Index: in-commerce/install/install_schema.sql
===================================================================
--- in-commerce/install/install_schema.sql (revision 13558)
+++ in-commerce/install/install_schema.sql (working copy)
@@ -301,7 +301,7 @@
Modified int(10) unsigned DEFAULT NULL,
Expire int(10) unsigned DEFAULT NULL,
Hits double NOT NULL DEFAULT '0',
- CachedRating decimal(11,10) NOT NULL DEFAULT '0.0000000000',
+ CachedRating varchar(10) NOT NULL default '0',
CachedVotesQty int(11) NOT NULL DEFAULT '0',
CachedReviewsQty int(11) NOT NULL DEFAULT '0',
CreatedById int(11) NOT NULL DEFAULT '0',
Index: in-commerce/install/upgrades.sql
===================================================================
--- in-commerce/install/upgrades.sql (revision 13632)
+++ in-commerce/install/upgrades.sql (working copy)
@@ -157,4 +157,7 @@
ADD INDEX (PaymentTypes);
UPDATE Phrase SET Module = 'Core' WHERE Phrase IN ('la_btn_Add', 'la_fld_RecipientName', 'la_fld_SenderName');
-DELETE FROM Permissions WHERE Permission LIKE 'in-commerce:incommerce_configemail%';
\ No newline at end of file
+DELETE FROM Permissions WHERE Permission LIKE 'in-commerce:incommerce_configemail%';
+
+# ===== v 5.1.0-B2 =====
+ALTER TABLE Products CHANGE CachedRating CachedRating varchar(10) NOT NULL default '0';
\ No newline at end of file
Index: in-commerce/units/pricing/pricing_event_handler.php
===================================================================
--- in-commerce/units/pricing/pricing_event_handler.php (revision 13557)
+++ in-commerce/units/pricing/pricing_event_handler.php (working copy)
@@ -365,18 +365,25 @@
$event->redirect_params = Array('opener' => 's'); //stay!
}
+ /**
+ * Resets primary mark for other pricings of given product, when current pricing is primary
+ *
+ * @param kEvent $event
+ */
function OnBeforeItemUpdate(&$event)
{
- // TODO: during import special of product is not empty as usual and this raises problems to getLinkedInfo
+ parent::OnBeforeItemUpdate($event);
+
$object =& $event->getObject();
- $table_info = $object->getLinkedInfo();
+ /* @var $object kDBItem */
- $table_info['ParentId'] = ($table_info['ParentId']?$table_info['ParentId']:0);
-
- if ( $object->GetDBField('IsPrimary') == 1 ){
- $this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ if ($object->GetDBField('IsPrimary') == 1) {
+ // make all pricings non primary, when this one is
+ $sql = 'UPDATE ' . $object->TableName . '
+ SET IsPrimary = 0
+ WHERE (ProductId = ' . $object->GetDBField('ProductId') . ') AND (' . $object->IDField . ' <> ' . $object->GetID() . ')';
+ $this->Conn->Query($sql);
}
-
}
/**
Index: in-commerce/units/products/products_config.php
===================================================================
--- in-commerce/units/products/products_config.php (revision 13632)
+++ in-commerce/units/products/products_config.php (working copy)
@@ -492,7 +492,7 @@
'not_null' => 1, 'default' => 0,
),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'CachedRating' => Array ('not_null' => 1, 'default' => 0, 'type' => 'float', 'formatter' => 'kFormatter', 'format' => '%0.2f'),
+ 'CachedRating' => Array ('type' => 'string', 'not_null' => 1, 'formatter' => 'kFormatter', 'default' => 0),
'CachedVotesQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Hits' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%d', 'not_null' => 1, 'default' => 0),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
Index: in-news/admin_templates/category_properties.tpl
===================================================================
--- in-news/admin_templates/category_properties.tpl (revision 13557)
+++ in-news/admin_templates/category_properties.tpl (working copy)
@@ -24,9 +24,9 @@
<inp2:m_RenderElement name="subsection" title="!la_section_RssProperties!"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="c" field="cust_RssSource" type_field="cust_RssSource" title="!la_fld_RssSource!" size="50"/>
-<inp2:m_RenderElement name="inp_edit_type" prefix="c" field="cust_RssUpdateInterval" type_field="cust_RssUpdateIntervalType" title="!la_fld_RssUpdateInterval!"/>
+<inp2:m_RenderElement name="inp_edit_type" prefix="c" field="cust_RssUpdateInterval" type_field="cust_RssUpdateIntervalType" title="!la_fld_RssUpdateInterval!" has_empty="1"/>
<inp2:m_RenderElement name="subsection" title="!la_section_RssExpiration!"/>
-<inp2:m_RenderElement name="inp_edit_type" prefix="c" field="cust_RssDefaultExpiration" type_field="cust_RssDefaultExpirationType" title="!la_fld_RssDefaultExpiration!"/>
-<inp2:m_RenderElement name="inp_edit_type" prefix="c" field="cust_RssExpireInterval" type_field="cust_RssExpireIntervalType" title="!la_fld_RssExpireInterval!"/>
+<inp2:m_RenderElement name="inp_edit_type" prefix="c" field="cust_RssDefaultExpiration" type_field="cust_RssDefaultExpirationType" title="!la_fld_RssDefaultExpiration!" has_empty="1"/>
+<inp2:m_RenderElement name="inp_edit_type" prefix="c" field="cust_RssExpireInterval" type_field="cust_RssExpireIntervalType" title="!la_fld_RssExpireInterval!" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="c" field="cust_RssDeleteExpired" title="!la_fld_RssDeleteExpired!"/>
|