X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FCore%2FPseudoConstant.php;h=17c7c95332e2e3b0e30a05b6db358bd978c041f3;hb=d44a51e500618f1d9abfad4cc6de65cf20226c10;hp=dfed28d604be8a32e22f85593ff2a7ab1b69a46c;hpb=e01a5ffed559ccb3a64fba29f0ca8964e00d3178;p=civicrm-core.git diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index dfed28d604..17c7c95332 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -1,7 +1,7 @@ $name DAO. @@ -543,7 +550,6 @@ class CRM_Core_PseudoConstant { * @param null $force * * @return void - * @access public * @static */ public static function populate( @@ -596,7 +602,6 @@ class CRM_Core_PseudoConstant { * Flush given pseudoconstant so it can be reread from db * nex time it's requested. * - * @access public * @static * * @param bool|string $name pseudoconstant to be flushed @@ -611,15 +616,12 @@ class CRM_Core_PseudoConstant { } /** - * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * @deprecated Please use the buildOptions() method in the appropriate BAO object. * * Get all Activty types. * * The static array activityType is returned * - * @internal param bool $all - get All Activity types - default is to get only active ones. - * - * @access public * @static * * @return array - array reference of all activity types. @@ -694,7 +696,6 @@ class CRM_Core_PseudoConstant { * * Note: any database errors will be trapped by the DAO. * - * @access public * @static * * @param bool|int $id - Optional id to return @@ -750,7 +751,6 @@ class CRM_Core_PseudoConstant { * * Same as above, except gets the abbreviations instead of the names. * - * @access public * @static * * @param bool|int $id - Optional id to return @@ -818,7 +818,6 @@ WHERE id = %1"; * * Note: any database errors will be trapped by the DAO. * - * @access public * @static * * @param bool|int $id - Optional id to return @@ -896,7 +895,6 @@ WHERE id = %1"; * * Note: any database errors will be trapped by the DAO. * - * @access public * @static * * @param bool $id @@ -919,7 +917,7 @@ WHERE id = %1"; } /** - * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * @deprecated Please use the buildOptions() method in the appropriate BAO object. * * Get all groups from database * @@ -930,9 +928,8 @@ WHERE id = %1"; * Note: any database errors will be trapped by the DAO. * * @param string $groupType type of group(Access/Mailing) - * @param bool|\boolen $excludeHidden exclude hidden groups. + * @param bool $excludeHidden exclude hidden groups. * - * @access public * @static * * @return array - array reference of all groups. @@ -961,7 +958,6 @@ WHERE id = %1"; * called for the first time * * - * @access public * @static * * @param bool $styledLabels @@ -991,7 +987,6 @@ WHERE id = %1"; * @param string $groupType type of group(Access/Mailing) * @param bool $excludeHidden exclude hidden groups. * - * @access public * @static * * @return array - array reference of all groups. @@ -1021,7 +1016,6 @@ WHERE id = %1"; * * Note: any database errors will be trapped by the DAO. * - * @access public * @static * * @param bool $onlyPublic @@ -1063,7 +1057,6 @@ WHERE id = %1"; * @param string $valueColumnName db column name/label. * @param boolean $reset reset relationship types if true * - * @access public * @static * * @return array - array reference of all relationship types. @@ -1099,11 +1092,10 @@ WHERE id = %1"; } /** - * get all the ISO 4217 currency codes + * Get all the ISO 4217 currency codes * * so far, we use this for validation only, so there's no point of putting this into the database * - * @access public * * @return array - array reference of all currency codes * @static @@ -1392,7 +1384,6 @@ WHERE id = %1"; * * Note: any database errors will be trapped by the DAO. * - * @access public * @static * * @param bool|int $id - Optional id to return @@ -1418,12 +1409,11 @@ WHERE id = %1"; } /** - * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * @deprecated Please use the buildOptions() method in the appropriate BAO object. * Get all active payment processors * * The static array paymentProcessor is returned * - * @access public * @static * * @param boolean $all - get payment processors - default is to get only active ones. @@ -1454,16 +1444,15 @@ WHERE id = %1"; } /** - * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * @deprecated Please use the buildOptions() method in the appropriate BAO object. * * The static array paymentProcessorType is returned * - * @access public * @static * * @param boolean $all - get payment processors - default is to get only active ones. * - * @param null $id + * @param int $id * @param string $return * * @return array - array of all payment processor types @@ -1482,7 +1471,6 @@ WHERE id = %1"; /** * Get all the World Regions from Database * - * @access public * * @param bool $id * @@ -1507,13 +1495,12 @@ WHERE id = %1"; } /** - * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * @deprecated Please use the buildOptions() method in the appropriate BAO object. * * Get all Activity Statuses. * * The static array activityStatus is returned * - * @access public * @static * * @param string $column @@ -1534,13 +1521,12 @@ WHERE id = %1"; } /** - * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * @deprecated Please use the buildOptions() method in the appropriate BAO object. * * Get all Visibility levels. * * The static array visibility is returned * - * @access public * @static * * @param string $column @@ -1560,7 +1546,7 @@ WHERE id = %1"; } /** - * @param $countryID + * @param int $countryID * @param string $field * * @return array @@ -1615,7 +1601,7 @@ ORDER BY name"; } /** - * @param $stateID + * @param int $stateID * * @return array */ @@ -1680,9 +1666,8 @@ ORDER BY name"; * * @return int the country id that the state belongs to * @static - * @public */ - static function countryIDForStateID($stateID) { + public static function countryIDForStateID($stateID) { if (empty($stateID)) { return CRM_Core_DAO::$_nullObject; } @@ -1702,7 +1687,6 @@ WHERE id = %1 * * The static array of greeting is returned * - * @access public * @static * * @param $filter - get All Email Greetings - default is to get only active ones. @@ -1753,7 +1737,6 @@ WHERE id = %1 /** * Construct array of default greeting values for contact type * - * @access public * @static * * @return array - array reference of default greetings. @@ -1787,7 +1770,6 @@ WHERE id = %1 * FIXME: This is called by civix but not by any core code. We * should provide an API call which civix can use instead. * - * @access public * @static * * @return array - array($fullyQualifiedName => $label) list of extensions @@ -1814,12 +1796,11 @@ WHERE id = %1 * * The static array option values is returned * - * @access public * @static * * @param boolean $optionGroupName - get All Option Group values- default is to get only active ones. * - * @param null $id + * @param int $id * @param null $condition * * @return array - array reference of all Option Group Name @@ -1840,7 +1821,6 @@ WHERE id = %1 * Fetch the list of active extensions of type 'module' * * @param $fresh bool whether to forcibly reload extensions list from canonical store - * @access public * @static * * @return array - array(array('prefix' => $, 'file' => $)) @@ -1848,5 +1828,36 @@ WHERE id = %1 public static function getModuleExtensions($fresh = FALSE) { return CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles($fresh); } -} + + /** + * Get all tax rates + * + * The static array tax rates is returned + * + * @static + * + * @return array - array list of tax rates with the financial type + */ + public static function getTaxRates() { + if (!self::$taxRates) { + self::$taxRates = array(); + $sql = " + SELECT fa.tax_rate, efa.entity_id + FROM civicrm_entity_financial_account efa + INNER JOIN civicrm_financial_account fa ON fa.id = efa.financial_account_id + INNER JOIN civicrm_option_value cov ON cov.value = efa.account_relationship + INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id + WHERE efa.entity_table = 'civicrm_financial_type' + AND cov.name = 'Sales Tax Account is' + AND cog.name = 'account_relationship' + AND fa.is_active = 1"; + $dao = CRM_Core_DAO::executeQuery($sql); + while ($dao->fetch()) { + self::$taxRates[$dao->entity_id] = $dao->tax_rate; + } + } + + return self::$taxRates; + } +}