Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1171372
currencies_tag_processor.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
Sun, Sep 28, 12:49 AM
Size
3 KB
Mime Type
text/x-php
Expires
Tue, Sep 30, 12:49 AM (1 d, 13 h)
Engine
blob
Format
Raw Data
Handle
759003
Attached To
rMINC Modules.In-Commerce
currencies_tag_processor.php
View Options
<?php
/**
* @version $Id: currencies_tag_processor.php 16522 2017-01-20 20:28:16Z 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
CurrenciesTagProcessor
extends
kDBTagProcessor
{
function
DisableUnusedWarning
(
$params
)
{
$ret
=
''
;
$saved_ids
=
$this
->
Application
->
RecallVar
(
'saved_curr_ids'
);
// when saving currency(-ies)
$check_all
=
$this
->
Application
->
RecallVar
(
'check_unused_currencies'
);
// when saving payment type
$config
=
$this
->
getUnitConfig
();
if
(
$saved_ids
||
$check_all
)
{
$sql
=
'SELECT DISTINCT CurrencyId
FROM '
.
$this
->
Application
->
getUnitConfig
(
'ptc'
)->
getTableName
();
$used_ids
=
$this
->
Conn
->
GetCol
(
$sql
);
if
(
$check_all
)
{
$sql
=
'SELECT DISTINCT CurrencyId
FROM '
.
$config
->
getTableName
();
$all_ids
=
$this
->
Conn
->
GetCol
(
$sql
);
$unused_ids
=
implode
(
','
,
array_diff
(
$all_ids
,
$used_ids
));
$this
->
Application
->
RemoveVar
(
'check_unused_currencies'
);
}
else
{
$saved_ids
=
explode
(
','
,
$saved_ids
);
$unused_ids
=
implode
(
','
,
array_diff
(
$saved_ids
,
$used_ids
));
$this
->
Application
->
RemoveVar
(
'saved_curr_ids'
);
}
if
(
$unused_ids
)
{
$this
->
Application
->
SetVar
(
'unused_ids'
,
$unused_ids
);
$sql
=
'SELECT ISO
FROM '
.
$config
->
getTableName
()
.
'
WHERE CurrencyId IN('
.
$unused_ids
.
') AND Status = 1'
;
$params
[
'unused_iso'
]
=
implode
(
', '
,
$this
->
Conn
->
GetCol
(
$sql
));
if
(
$params
[
'unused_iso'
]
)
{
$params
[
'unused_ids'
]
=
$unused_ids
;
$params
[
'name'
]
=
$params
[
'block'
];
$ret
=
$this
->
Application
->
ParseBlock
(
$params
);
}
}
}
return
$ret
;
}
function
ListCurrencies
(
$params
)
{
return
$this
->
PrintList2
(
$params
);
}
function
CurrencyLink
(
$params
)
{
/** @var kDBItem $object */
$object
=
$this
->
getObject
(
$params
);
$params
[
'pass'
]
=
'm,curr'
;
$params
[
'curr_event'
]
=
'OnChangeCurrency'
;
$params
[
'curr_iso'
]
=
$object
->
GetDBField
(
'ISO'
);
return
$this
->
Application
->
ProcessParsedTag
(
'm'
,
'Link'
,
$params
);
}
function
SelectedCurrency
(
$params
)
{
$object
=
$this
->
Application
->
recallObject
(
$this
->
getPrefixSpecial
());
return
$object
->
GetDBField
(
'ISO'
)
==
$this
->
Application
->
RecallVar
(
'curr_iso'
);
}
function
PrimaryCurrencyISO
(
$params
)
{
$sql
=
'SELECT ISO
FROM '
.
$this
->
getUnitConfig
()->
getTableName
()
.
'
WHERE IsPrimary = 1'
;
return
$this
->
Conn
->
GetOne
(
$sql
);
}
function
PrimaryCurrencyName
(
$params
)
{
$sql
=
'SELECT Name
FROM '
.
$this
->
getUnitConfig
()->
getTableName
()
.
'
WHERE IsPrimary = 1'
;
return
$this
->
Application
->
Phrase
(
$this
->
Conn
->
GetOne
(
$sql
)
);
}
}
Event Timeline
Log In to Comment