Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/units/orders/orders_event_handler.php
Show First 20 Lines • Show All 312 Lines • ▼ Show 20 Line(s) | |||||
'PortalUserId' => $user->GetID(), | 'PortalUserId' => $user->GetID(), | ||||
'BillingEmail' => $user->GetDBField('Email'), | 'BillingEmail' => $user->GetDBField('Email'), | ||||
); | ); | ||||
if ( $affiliate_id ) { | if ( $affiliate_id ) { | ||||
$fields_hash['AffiliateId'] = $affiliate_id; | $fields_hash['AffiliateId'] = $affiliate_id; | ||||
} | } | ||||
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | /** @var OrdersItem $object */ | ||||
$table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); | $object = $this->Application->recallObject($event->Prefix . '.-item', null, array('skip_autoload' => true)); | ||||
$object->Load($order_id); | |||||
$this->Conn->doUpdate($fields_hash, $table_name, $id_field . ' = ' . $order_id); | |||||
$object = $event->getObject(); | |||||
/* @var $object kDBItem */ | |||||
// set user id to object, since it will be used during order update from OnRecalculateItems event | if ( $object->isLoaded() ) { | ||||
$object->SetDBField('PortalUserId', $user->GetID()); | $object->SetDBFieldsFromHash($fields_hash); | ||||
$object->Update(); | |||||
} | |||||
} | } | ||||
function isAffiliate($user_id) | function isAffiliate($user_id) | ||||
{ | { | ||||
$affiliate_user = $this->Application->recallObject('affil.-item', null, Array('skip_autoload' => true) ); | $affiliate_user = $this->Application->recallObject('affil.-item', null, Array('skip_autoload' => true) ); | ||||
/* @var $affiliate_user kDBItem */ | /* @var $affiliate_user kDBItem */ | ||||
$affiliate_user->Load($user_id, 'PortalUserId'); | $affiliate_user->Load($user_id, 'PortalUserId'); | ||||
▲ Show 20 Lines • Show All 3759 Lines • Show Last 20 Lines |