Attached Files |
specific_field_db_update_core.patch [^] (3,688 bytes) 2012-07-16 11:37
[Show Content]
Index: kernel/db/cat_dbitem.php
===================================================================
--- kernel/db/cat_dbitem.php (revision 15437)
+++ kernel/db/cat_dbitem.php (working copy)
@@ -84,18 +84,19 @@
*
* @access public
* @param int $id Primary Key Id to update
+ * @param Array $update_fields
* @param bool $system_update
* @return bool
* @access public
*/
- public function Update($id = null, $system_update = false)
+ public function Update($id = null, $update_fields = null, $system_update = false)
{
if ( $this->useFilenames ) {
$this->checkFilename();
$this->generateFilename();
}
- $ret = parent::Update($id, $system_update);
+ $ret = parent::Update($id, $update_fields, $system_update);
if ( $ret ) {
$filename = $this->useFilenames ? (string)$this->GetDBField('Filename') : '';
Index: kernel/db/dbitem.php
===================================================================
--- kernel/db/dbitem.php (revision 15446)
+++ kernel/db/dbitem.php (working copy)
@@ -661,11 +661,12 @@
*
* @access public
* @param int $id Primary Key Id to update
+ * @param Array $update_fields
* @param bool $system_update
* @return bool
* @access public
*/
- public function Update($id = null, $system_update = false)
+ public function Update($id = null, $update_fields = null, $system_update = false)
{
if ( isset($id) ) {
$this->setID($id);
@@ -692,11 +693,15 @@
$sql = '';
- foreach ($this->FieldValues as $field_name => $field_value) {
+ $set_fields = isset($update_fields) ? $update_fields : array_keys($this->FieldValues);
+
+ foreach ($set_fields as $field_name) {
if ( $this->skipField($field_name) ) {
continue;
}
+ $field_value = $this->FieldValues[$field_name];
+
if ( is_null($field_value) ) {
if ( array_key_exists('not_null', $this->Fields[$field_name]) && $this->Fields[$field_name]['not_null'] ) {
// "kFormatter::Parse" methods converts empty values to NULL and for
@@ -726,7 +731,16 @@
$this->saveCustomFields();
$this->raiseEvent('OnAfterItemUpdate');
- $this->OriginalFieldValues = $this->FieldValues;
+
+ if ( !isset($update_fields) ) {
+ $this->OriginalFieldValues = $this->FieldValues;
+ }
+ else {
+ foreach ($update_fields as $update_field) {
+ $this->OriginalFieldValues[$update_field] = $this->FieldValues[$update_field];
+ }
+ }
+
$this->Loaded = true;
if ( !$this->IsTempTable() ) {
Index: units/images/image_event_handler.php
===================================================================
--- units/images/image_event_handler.php (revision 15437)
+++ units/images/image_event_handler.php (working copy)
@@ -238,7 +238,7 @@
}
if ( in_array($event->Name, Array ('OnAfterClone', 'OnBeforeCopyToLive', 'OnAfterCopyToTemp')) ) {
- $object->Update(null, true);
+ $object->Update(null, null, true);
}
}
Index: units/users/users_item.php
===================================================================
--- units/users/users_item.php (revision 15437)
+++ units/users/users_item.php (working copy)
@@ -121,13 +121,14 @@
*
* @access public
* @param int $id Primary Key Id to update
+ * @param Array $update_fields
* @param bool $system_update
* @return bool
* @access public
*/
- public function Update($id = null, $system_update = false)
+ public function Update($id = null, $update_fields = null, $system_update = false)
{
- $ret = parent::Update($id, $system_update);
+ $ret = parent::Update($id, $update_fields, $system_update);
if ( $ret ) {
// find out how to synchronize user only when it's copied to live table
specific_field_db_update_modules.patch [^] (1,172 bytes) 2012-07-16 11:37
[Show Content]
Index: in-commerce/units/shipping_costs/shipping_costs_event_handler.php
===================================================================
--- in-commerce/units/shipping_costs/shipping_costs_event_handler.php (revision 15437)
+++ in-commerce/units/shipping_costs/shipping_costs_event_handler.php (working copy)
@@ -260,7 +260,7 @@
// by weight and US/UK system - we need to store recalculated price per Kg cause shipping calculation is done per Kg!
if ( $shipping_obj->GetDBField('Type') == 1 && $lang_object->GetDBField('UnitSystem') == 2 ) {
$object->SetDBField('PerUnit', $object->GetDBField('PerUnit') * kUtil::POUND_TO_KG);
- $object->Update(null, true);
+ $object->Update(null, null, true);
}
}
@@ -293,7 +293,7 @@
// by weight and US/UK system - we need to store recalculated price per Kg cause shipping calculation is done per Kg!
if ( $shipping_obj->GetDBField('Type') == 1 && $lang_object->GetDBField('UnitSystem') == 2 ) {
$object->SetDBField('PerUnit', $object->GetDBField('PerUnit') / kUtil::POUND_TO_KG);
- $object->Update(null, true);
+ $object->Update(null, null, true);
}
}
}
\ No newline at end of file
specific_field_db_update_core_513.patch [^] (3,441 bytes) 2012-07-16 12:09
[Show Content]
Index: kernel/db/cat_dbitem.php
===================================================================
--- kernel/db/cat_dbitem.php (revision 15331)
+++ kernel/db/cat_dbitem.php (working copy)
@@ -83,7 +83,7 @@
$this->assignToCategory($this->GetDBField('CategoryId'), true);
}
- function Update($id=null, $system_update=false)
+ function Update($id = null, $update_fields = null, $system_update = false)
{
$this->VirtualFields['ResourceId'] = Array();
@@ -99,7 +99,7 @@
$this->generateFilename();
}
- $ret = parent::Update($id, $system_update);
+ $ret = parent::Update($id, $update_fields, $system_update);
if ($ret) {
$filename = $this->useFilenames ? (string)$this->GetDBField('Filename') : '';
Index: kernel/db/dbitem.php
===================================================================
--- kernel/db/dbitem.php (revision 15331)
+++ kernel/db/dbitem.php (working copy)
@@ -528,9 +528,10 @@
*
* @access public
* @param int Primery Key Id to update
+ * @param bool $system_update
* @return bool
*/
- function Update($id = null, $system_update = false)
+ function Update($id = null, $update_fields = null, $system_update = false)
{
if (isset($id)) {
$this->setID($id);
@@ -556,12 +557,15 @@
}
$sql = '';
+ $set_fields = isset($update_fields) ? $update_fields : array_keys($this->FieldValues);
- foreach ($this->FieldValues as $field_name => $field_value) {
+ foreach ($set_fields as $field_name) {
if ($this->skipField($field_name)) {
continue;
}
+ $field_value = $this->FieldValues[$field_name];
+
if ( is_null($field_value) ) {
if (array_key_exists('not_null', $this->Fields[$field_name]) && $this->Fields[$field_name]['not_null']) {
// "kFormatter::Parse" methods converts empty values to NULL and for
@@ -590,7 +594,16 @@
$this->saveCustomFields();
$this->raiseEvent('OnAfterItemUpdate');
- $this->OriginalFieldValues = $this->FieldValues;
+
+ if ( !isset($update_fields) ) {
+ $this->OriginalFieldValues = $this->FieldValues;
+ }
+ else {
+ foreach ($update_fields as $update_field) {
+ $this->OriginalFieldValues[$update_field] = $this->FieldValues[$update_field];
+ }
+ }
+
$this->Loaded = true;
if ($this->mode != 't') {
Index: units/images/image_event_handler.php
===================================================================
--- units/images/image_event_handler.php (revision 15331)
+++ units/images/image_event_handler.php (working copy)
@@ -169,7 +169,7 @@
}
}
if ( in_array($event->Name, Array('OnAfterClone', 'OnBeforeCopyToLive', 'OnAfterCopyToTemp')) ) {
- $object->Update(null, true);
+ $object->Update(null, null, true);
}
}
Index: units/users/users_item.php
===================================================================
--- units/users/users_item.php (revision 15331)
+++ units/users/users_item.php (working copy)
@@ -92,9 +92,9 @@
}
- function Update($id=null, $system_update=false)
+ function Update($id = null, $update_fields = null, $system_update = false)
{
- $ret = parent::Update($id, $system_update);
+ $ret = parent::Update($id, $update_fields, $system_update);
if ($ret) {
// find out how to syncronize user only when it's copied to live table
$sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
specific_field_db_update_modules_513.patch [^] (1,154 bytes) 2012-07-16 12:10
[Show Content]
Index: in-commerce/units/shipping_costs/shipping_costs_event_handler.php
===================================================================
--- in-commerce/units/shipping_costs/shipping_costs_event_handler.php (revision 15331)
+++ in-commerce/units/shipping_costs/shipping_costs_event_handler.php (working copy)
@@ -208,7 +208,7 @@
// by weight and US/UK system - we need to store recalculated price per Kg cause shipping calculation is done per Kg!
if ($shipping_obj->GetDBField('Type') == 1 && $lang_object->GetDBField('UnitSystem') == 2) {
$object->SetDBField('PerUnit', $object->GetDBField('PerUnit') * POUND_TO_KG);
- $object->Update(null, true);
+ $object->Update(null, null, true);
}
}
@@ -224,7 +224,7 @@
// by weight and US/UK system - we need to store recalculated price per Kg cause shipping calculation is done per Kg!
if ($shipping_obj->GetDBField('Type') == 1 && $lang_object->GetDBField('UnitSystem') == 2) {
$object->SetDBField('PerUnit', $object->GetDBField('PerUnit') / POUND_TO_KG);
- $object->Update(null, true);
+ $object->Update(null, null, true);
}
}
}
\ No newline at end of file
specific_field_db_update_core_addon_513.patch [^] (555 bytes) 2012-07-18 04:19
[Show Content]
Index: categories_item.php
===================================================================
--- categories_item.php (revision 15331)
+++ categories_item.php (working copy)
@@ -52,12 +52,12 @@
}
- function Update($id=null, $system_update = false)
+ function Update($id = NULL, $update_fields = NULL, $system_update = false)
{
$this->checkFilename();
$this->generateFilename();
- return parent::Update($id, $system_update);
+ return parent::Update($id, $update_fields, $system_update);
}
function buildParentPath()
|