Lines 45-52
sub list_funds {
Link Here
|
45 |
my $filter; |
45 |
my $filter; |
46 |
|
46 |
|
47 |
for my $filter_param ( keys %$args ) { |
47 |
for my $filter_param ( keys %$args ) { |
48 |
$filter->{$filter_param} = { LIKE => $args->{$filter_param} . "%" } |
48 |
if ($args->{$filter_param}) { |
49 |
if $args->{$filter_param}; |
49 |
if ($filter_param eq "budget_owner_id") { |
|
|
50 |
# Perform an exact search on the borrowernumber |
51 |
$filter->{$filter_param} = { "=" => $args->{$filter_param} } |
52 |
} else { |
53 |
# And a "start with" search on the budget name |
54 |
$filter->{$filter_param} = { LIKE => $args->{$filter_param} . "%" } |
55 |
} |
56 |
} |
50 |
} |
57 |
} |
51 |
|
58 |
|
52 |
return try { |
59 |
return try { |
Lines 77-85
the attribute names the exposed REST api spec.
Link Here
|
77 |
sub _to_api { |
84 |
sub _to_api { |
78 |
my $fund = shift; |
85 |
my $fund = shift; |
79 |
my $returnfund; |
86 |
my $returnfund; |
80 |
$returnfund->{id} = delete $fund->{budget_id}; |
87 |
$returnfund->{fund_id} = delete $fund->{budget_id}; |
81 |
$returnfund->{code} = delete $fund->{budget_code}; |
88 |
$returnfund->{code} = delete $fund->{budget_code}; |
82 |
$returnfund->{name} = delete $fund->{budget_name}; |
89 |
$returnfund->{name} = delete $fund->{budget_name}; |
|
|
90 |
$returnfund->{library_id} = delete $fund->{budget_branchcode}; |
91 |
$returnfund->{total_amount} = delete $fund->{budget_amount}; |
92 |
$returnfund->{warn_at_percentage} = delete $fund->{budget_encumb}; |
93 |
$returnfund->{warn_at_amount} = delete $fund->{budget_expend}; |
94 |
$returnfund->{notes} = delete $fund->{budget_notes}; |
95 |
$returnfund->{budget_id} = delete $fund->{budget_period_id}; |
96 |
$returnfund->{timestamp} = delete $fund->{timestamp}; |
97 |
$returnfund->{fund_owner_id} = delete $fund->{budget_owner_id}; |
98 |
$returnfund->{fund_access} = delete $fund->{budget_permission}; |
99 |
$returnfund->{statistic1_auth_value_category} = delete $fund->{sort1_authcat}; |
100 |
$returnfund->{statistic2_auth_value_category} = delete $fund->{sort2_authcat}; |
83 |
|
101 |
|
84 |
return $returnfund; |
102 |
return $returnfund; |
85 |
} |
103 |
} |
Lines 93-105
attribute names.
Link Here
|
93 |
|
111 |
|
94 |
sub _to_model { |
112 |
sub _to_model { |
95 |
my $fund = shift; |
113 |
my $fund = shift; |
|
|
114 |
my $returnfund; |
96 |
|
115 |
|
97 |
# Rename back |
116 |
# Rename back |
98 |
$fund->{budget_id} = delete $fund->{id}; |
117 |
$returnfund->{budget_id} = delete $fund->{fund_id}; |
99 |
$fund->{budget_code} = delete $fund->{code}; |
118 |
$returnfund->{budget_code} = delete $fund->{code}; |
100 |
$fund->{budget_name} = delete $fund->{name}; |
119 |
$returnfund->{budget_name} = delete $fund->{name}; |
|
|
120 |
$returnfund->{budget_branchcode} = delete $fund->{library_id}; |
121 |
$returnfund->{budget_amount} = delete $fund->{total_amount}; |
122 |
$returnfund->{budget_encumb} = delete $fund->{warn_at_percentage}; |
123 |
$returnfund->{budget_expend} = delete $fund->{warn_at_amount}; |
124 |
$returnfund->{budget_notes} = delete $fund->{notes}; |
125 |
$returnfund->{budget_period_id} = delete $fund->{budget_id}; |
126 |
$returnfund->{budget_owner_id} = delete $fund->{fund_owner_id}; |
127 |
$returnfund->{timestamp} = delete $fund->{timestamp}; |
128 |
$returnfund->{budget_permission} = delete $fund->{fund_access}; |
129 |
$returnfund->{sort1_authcat} = delete $fund->{statistic1_auth_value_category}; |
130 |
$returnfund->{sort2_authcat} = delete $fund->{statistic2_auth_value_category}; |
101 |
|
131 |
|
102 |
return $fund; |
132 |
return $returnfund; |
103 |
} |
133 |
} |
104 |
|
134 |
|
105 |
1; |
135 |
1; |