- // getPredefinedExpenses - obtains predefined expenses for a group.
- static function getPredefinedExpenses($group_id) {
- global $user;
- $replaceDecimalMark = ('.' != $user->decimal_mark);
-
- $mdb2 = getConnection();
-
- $result = array();
- $sql = "select id, name, cost from tt_predefined_expenses where group_id = $group_id";
- $res = $mdb2->query($sql);
- $result = array();
- if (!is_a($res, 'PEAR_Error')) {
- while ($val = $res->fetchRow()) {
- if ($replaceDecimalMark)
- $val['cost'] = str_replace('.', $user->decimal_mark, $val['cost']);
- $result[] = $val;
- }
- return $result;
- }
- return false;
- }
-
- // getNotifications - obtains notification descriptions for a group.
- static function getNotifications($group_id) {
- $mdb2 = getConnection();
-
- $result = array();
- $sql = "select c.id, c.cron_spec, c.email, c.report_condition, fr.name from tt_cron c
- left join tt_fav_reports fr on (fr.id = c.report_id)
- where c.group_id = $group_id and c.status = 1 and fr.status = 1";
- $res = $mdb2->query($sql);
- $result = array();
- if (!is_a($res, 'PEAR_Error')) {
- while ($val = $res->fetchRow()) {
- $result[] = $val;
- }
- return $result;
- }
- return false;
- }
-