Skip to content

Commit a59eb35

Browse files
UBMA Sysadminsstweil
authored andcommitted
Add implementation and test for getFunds with Alma ILS driver
Signed-off-by: UBMA Sysadmins <sysadmin.ub@uni-mannheim.de>
1 parent 12cf577 commit a59eb35

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

module/VuFind/src/VuFind/ILS/Driver/Alma.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,8 @@ public function getFunds()
21282128
try {
21292129
$xml = $this->makeRequest('/acq/funds');
21302130
} catch (ILSException $e) {
2131+
// API key not defined or not configured to allow this API.
2132+
// Required permission: Acquisition Read.
21312133
$xml = [];
21322134
}
21332135
$result = [];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"expectedParams": [
4+
"/acq/funds",
5+
[],
6+
[],
7+
"GET",
8+
null,
9+
null,
10+
[],
11+
false
12+
],
13+
"resultFixture": "get-funds.xml"
14+
}
15+
]
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<funds total_record_count="7">
3+
<fund link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/acq/funds/FUND-01">
4+
<id>FUND-01</id>
5+
<code>VUFIND-01</code>
6+
<name>VuFind Community</name>
7+
<type desc="Regulär">REG</type>
8+
<entity_type desc="Allocated fund">ALLOCATED</entity_type>
9+
<owner desc="My University">VUFIND_INST</owner>
10+
<status desc="Active">ACTIVE</status>
11+
<fiscal_period desc="FY-2025">19</fiscal_period>
12+
<currency desc="Euro">EUR</currency>
13+
<allocated_balance>12000</allocated_balance>
14+
<expended_balance>0</expended_balance>
15+
<cash_balance>12000</cash_balance>
16+
<encumbered_balance>12000</encumbered_balance>
17+
<available_balance>0</available_balance>
18+
<available_for_libraries>
19+
<available_for_library desc="VuFind Library 1">100</available_for_library>
20+
<available_for_library desc="VuFind Library 2">102</available_for_library>
21+
</available_for_libraries>
22+
<parent link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/acq/funds/FUND">FUND</parent>
23+
<overencumbrance_allowed desc="No limits">NO_LIMITS</overencumbrance_allowed>
24+
<overexpenditure_allowed desc="Yes">YES</overexpenditure_allowed>
25+
<overencumbrance_warning_percent>0.0</overencumbrance_warning_percent>
26+
<overexpenditure_warning_sum>20000.0</overexpenditure_warning_sum>
27+
<overencumbrance_limit_percent>0.0</overencumbrance_limit_percent>
28+
<overexpenditure_limit_sum>20000.0</overexpenditure_limit_sum>
29+
<encumbrances_prior_to_fiscal_period>0</encumbrances_prior_to_fiscal_period>
30+
<expenditures_prior_to_fiscal_period>0</expenditures_prior_to_fiscal_period>
31+
<transfers_prior_to_fiscal_period>0</transfers_prior_to_fiscal_period>
32+
<fiscal_period_end_encumbrance_grace_period>-16</fiscal_period_end_encumbrance_grace_period>
33+
<fiscal_period_end_expenditure_grace_period>-11</fiscal_period_end_expenditure_grace_period>
34+
</fund>
35+
<fund link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/acq/funds/FUND-02">
36+
<id>FUND-02</id>
37+
<code>VUFIND-02</code>
38+
<name>VuFind Sponsors</name>
39+
<external_id>123456/78</external_id>
40+
<type desc="Regulär">REG</type>
41+
<entity_type desc="Allocated fund">ALLOCATED</entity_type>
42+
<owner desc="Universität Mannheim">VUFIND_INST</owner>
43+
<status desc="Active">ACTIVE</status>
44+
<fiscal_period desc="FY-2025">19</fiscal_period>
45+
<currency desc="Euro">EUR</currency>
46+
<allocated_balance>6000.02</allocated_balance>
47+
<expended_balance>390.14</expended_balance>
48+
<cash_balance>5609.88</cash_balance>
49+
<encumbered_balance>5600</encumbered_balance>
50+
<available_balance>9.88</available_balance>
51+
<available_for_libraries>
52+
<available_for_library desc="VuFind Library 2">102</available_for_library>
53+
</available_for_libraries>
54+
<parent link="https://api-eu.hosted.exlibrisgroup.com/almaws/v1/acq/funds/FUND">FUND</parent>
55+
<overencumbrance_allowed desc="Yes">YES</overencumbrance_allowed>
56+
<overexpenditure_allowed desc="Yes">YES</overexpenditure_allowed>
57+
<overencumbrance_warning_percent>20.0</overencumbrance_warning_percent>
58+
<overexpenditure_warning_sum>1000.0</overexpenditure_warning_sum>
59+
<overencumbrance_limit_percent>20.0</overencumbrance_limit_percent>
60+
<overexpenditure_limit_sum>1000.0</overexpenditure_limit_sum>
61+
<encumbrances_prior_to_fiscal_period>0</encumbrances_prior_to_fiscal_period>
62+
<expenditures_prior_to_fiscal_period>0</expenditures_prior_to_fiscal_period>
63+
<transfers_prior_to_fiscal_period>0</transfers_prior_to_fiscal_period>
64+
<fiscal_period_end_encumbrance_grace_period>-8</fiscal_period_end_encumbrance_grace_period>
65+
<fiscal_period_end_expenditure_grace_period>2</fiscal_period_end_expenditure_grace_period>
66+
</fund>
67+
</funds>

module/VuFind/tests/unit-tests/src/VuFindTest/ILS/Driver/AlmaTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,22 @@ public function testGetCourses()
197197
$this->assertEquals($expected, $result);
198198
}
199199

200+
/**
201+
* Testing getFunds
202+
*
203+
* @return void
204+
*/
205+
public function testGetFunds()
206+
{
207+
$this->createConnector('get-funds');
208+
$result = $this->driver->getFunds();
209+
$expected = [
210+
'FUND-01' => 'VuFind Community',
211+
'FUND-02' => 'VuFind Sponsors',
212+
];
213+
$this->assertEquals($expected, $result);
214+
}
215+
200216
/**
201217
* Test getHolding
202218
*

0 commit comments

Comments
 (0)