Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1169410
payment_type_currencies_event_handler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Sep 25, 11:52 PM
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Sep 27, 11:52 PM (1 d, 7 h)
Engine
blob
Format
Raw Data
Handle
757673
Attached To
rMINC Modules.In-Commerce
payment_type_currencies_event_handler.php
View Options
<?php
/**
* @version $Id: payment_type_currencies_event_handler.php 16516 2017-01-20 14:12:22Z alex $
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined
(
'FULL_PATH'
)
or
die
(
'restricted access!'
);
class
PaymentTypeCurrenciesEventHandler
extends
kDBEventHandler
{
/**
* Creates new kDBItem
*
* @param kEvent $event
* @return void
* @access protected
*/
protected
function
OnCreate
(
kEvent
$event
)
{
$currency_id_list
=
$this
->
Application
->
GetVar
(
'currency_list'
);
if
(
!
$currency_id_list
)
{
return
;
}
/** @var kDBItem $object */
$object
=
$event
->
getObject
(
Array
(
'skip_autoload'
=>
true
));
$pt_id
=
$this
->
Application
->
GetVar
(
'pt_id'
);
if
(
$pt_id
===
false
)
{
return
;
}
$sql
=
'DELETE FROM '
.
$object
->
TableName
.
'
WHERE PaymentTypeId = '
.
$pt_id
;
$this
->
Conn
->
Query
(
$sql
);
foreach
(
$currency_id_list
as
$id
)
{
$object
->
SetDBField
(
'CurrencyId'
,
$id
);
$object
->
SetDBField
(
'PaymentTypeId'
,
$pt_id
);
$this
->
customProcessing
(
$event
,
'before'
);
if
(
$object
->
Create
()
)
{
$this
->
customProcessing
(
$event
,
'after'
);
$event
->
status
=
kEvent
::
erSUCCESS
;
}
else
{
$event
->
status
=
kEvent
::
erFAIL
;
$event
->
redirect
=
false
;
$this
->
Application
->
SetVar
(
$event
->
getPrefixSpecial
()
.
'_SaveEvent'
,
'OnCreate'
);
$object
->
setID
(
0
);
}
}
}
}
Event Timeline
Log In to Comment