first commit
This commit is contained in:
27
admin/class/smarty_plugins/function.get_named_vats.php
Normal file
27
admin/class/smarty_plugins/function.get_named_vats.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
||||
use KupShop\OrderingBundle\Util\Order\OrderInfo;
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
function smarty_function_get_named_vats($params, &$smarty)
|
||||
{
|
||||
if (!isset($params['vats'])) {
|
||||
throw new InvalidArgumentException('Parameter \'vats\' is required!');
|
||||
}
|
||||
if (!is_array($params['vats'])) {
|
||||
throw new InvalidArgumentException('Parameter \'vats\' must be of type array!');
|
||||
}
|
||||
|
||||
$orderInfo = ServiceContainer::getService(OrderInfo::class);
|
||||
|
||||
$namedVats = $orderInfo->getNamedVats($params['vats']);
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$smarty->assign($params['assign'], $namedVats);
|
||||
} else {
|
||||
return $namedVats;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user