Skip to content

Commit

Permalink
Merge branch '24.09.00' into koha_close_all_db_queries
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnoble73 authored Aug 22, 2024
2 parents aba40a4 + 1175f38 commit 0492420
Show file tree
Hide file tree
Showing 11 changed files with 235 additions and 143 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ jobs:
id: extract_branch

- name: Log in to Docker Hub
if: github.repository == 'Aspen-Discover/aspen-discovery'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GHCR
if: github.repository == 'Aspen-Discover/aspen-discovery'
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin

- name: Log in to Quay.io
if: github.repository == 'Aspen-Discover/aspen-discovery'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: quay.io
Expand Down Expand Up @@ -75,15 +78,18 @@ jobs:
id: extract_branch

- name: Log in to Docker Hub
if: github.repository == 'Aspen-Discover/aspen-discovery'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GHCR
if: github.repository == 'Aspen-Discover/aspen-discovery'
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin

- name: Log in to Quay.io
if: github.repository == 'Aspen-Discover/aspen-discovery'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: quay.io
Expand Down Expand Up @@ -124,15 +130,18 @@ jobs:
id: extract_branch

- name: Log in to Docker Hub
if: github.repository == 'Aspen-Discover/aspen-discovery'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GHCR
if: github.repository == 'Aspen-Discover/aspen-discovery'
run: echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin

- name: Log in to Quay.io
if: github.repository == 'Aspen-Discover/aspen-discovery'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: quay.io
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/pull_request_qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,43 @@ jobs:
echo "No changes detected in the release notes."
exit 1
fi
check_tabs_vs_spaces:
runs-on: ubuntu-latest

steps:
- name: Checkout pull request branch
uses: actions/checkout@v4

- name: Add official Aspen Discovery repo as another remote
run: git remote add official https://github.com/Aspen-Discovery/aspen-discovery.git && git fetch official

- name: Get default branch
id: get_default_branch
run: |
default_branch=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/Aspen-Discovery/aspen-discovery | jq -r .default_branch)
echo "Default branch is $default_branch"
echo "DEFAULT_BRANCH=$default_branch" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check for spaces instead of tabs
run: |
# Find files that are modified in the pull request
MODIFIED_FILES=$(git diff --name-only official/$DEFAULT_BRANCH HEAD)
# Loop through each file and check for spaces used instead of tabs
EXIT_CODE=0
for file in $MODIFIED_FILES; do
echo "Found modified file: $file";
if [[ $file == *.php || $file == *.js || $file == *.java ]]; then
#echo "Checking $file for whitespace issues"
DIFF=$(git diff official/$DEFAULT_BRANCH HEAD -- $file)
#echo "DIFF: $DIFF"
if [[ $DIFF =~ " " ]]; then
echo "Detected spaces instead of tabs in $file"
EXIT_CODE=1
fi
fi
done
exit $EXIT_CODE
13 changes: 9 additions & 4 deletions code/web/Drivers/Koha.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,17 @@ public function getCheckouts(User $patron): array {
$circulationRulesForCheckout = [];
/** @noinspection SqlResolve */
/** @noinspection SqlDialectInspection */
$circulationRulesSql = "SELECT * FROM circulation_rules where (categorycode IN ('$patronType', '*') OR categorycode IS NULL) and (itemtype IN('$itemType', '*') OR itemtype is null) and (branchcode IN ('$checkoutBranch', '*') OR branchcode IS NULL) order by branchcode desc, categorycode desc, itemtype desc";
$circulationRulesSql = "
SELECT * FROM circulation_rules
WHERE (categorycode IN ('$patronType', '*') OR categorycode IS NULL)
AND (itemtype IN('$itemType', '*') OR itemtype is null)
AND (branchcode IN ('$checkoutBranch', '*') OR branchcode IS NULL)
ORDER BY branchcode desc, categorycode desc, itemtype desc LIMIT 1
";
$circulationRulesRS = mysqli_query($this->dbConnection, $circulationRulesSql);
if ($circulationRulesRS !== false) {
while ($circulationRulesRow = $circulationRulesRS->fetch_assoc()) {
$circulationRulesForCheckout[] = $circulationRulesRow;
}
$circulationRulesRow = $circulationRulesRS->fetch_assoc();
$circulationRulesForCheckout[] = $circulationRulesRow;
$circulationRulesRS->close();
}
$timer->logTime("Load circulation rules for checkout");
Expand Down
36 changes: 13 additions & 23 deletions code/web/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,32 +408,22 @@ function getValidServerNames(): array {

function getGitBranch() {
global $interface;
global $configArray;

$gitName = $configArray['System']['gitVersionFile'];
$branchName = 'Unknown';
$branchNameWithCommit = 'Unknown';
if ($gitName == 'HEAD') {
$stringFromFile = file(ROOT_DIR . '/../../.git/HEAD');
$stringFromFile = $stringFromFile[0]; //get the string from the array
$explodedString = explode("/", $stringFromFile); //separate out by the "/" in the string
$branchName = trim($explodedString[2]); //get the one that is always the branch name
$branchNameWithCommit = $branchName;
} else {
if (file_exists(ROOT_DIR . '/../../.git/FETCH_HEAD')) {
$stringFromFile = file(ROOT_DIR . '/../../.git/FETCH_HEAD');
if (!empty($stringFromFile)) {
$stringFromFile = $stringFromFile[0]; //get the string from the array
if (preg_match('/(.*?)\s+branch\s+\'(.*?)\'.*/', $stringFromFile, $matches)) {
$branchName = $matches[2]; //get the branch name
$branchNameWithCommit = $matches[2] . ' (' . substr($matches[1], 0, 7) . ')'; //get the branch name
}
}
} else {
$branchName = 'Unknown';
$branchNameWithCommit = 'Unknown';
$branchName = '';
$branchNameWithCommit = '';

$files = [];
foreach (glob('release_notes/*.MD') as $filename) {
if (preg_match('/\d{2}\.\d{2}\.\d{2}\.MD/', $filename)) {
$tmp = str_replace('.MD', '', $filename);
$tmp = str_replace('release_notes/', '', $tmp);
$files[] = $tmp;
}
}
asort($files);

$branchName = end($files);
$branchNameWithCommit = end($files);

if (!empty($interface)) {
$interface->assign('gitBranch', $branchName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>{translate text="Collection Report" isAdminFacing=true}</h1>
{foreach from=$allLibraries item="tmpLibrary"}
<h2>{$tmpLibrary.displayName}</h2>
<table>
<table class="table table-striped">
<thead>
<tr>
<th>Palace Project Name</th>
Expand All @@ -17,7 +17,7 @@
<td>{$collection.palaceProjectName}</td>
<td>{$collection.displayName}</td>
<td style="text-align: right">{$collection.numTitles|number_format}</td>
<td>{$collection.numDeletedTitles|number_format}</td>
<td style="text-align: right">{$collection.numDeletedTitles|number_format}</td>
</tr>
{/foreach}
</tbody>
Expand Down
16 changes: 14 additions & 2 deletions code/web/release_notes/24.09.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@

</div>

### Palace Project Updates
- Update formatting of Palace Project Collection report to apply default table styling and right align the number of deleted titles. (*MDN-G*)

### Self Check Updates
- Add a test page to test self check within Aspen Discovery. The test page can be used for both testing check outs as well as check ins. Check ins currently only work with the Sierra ILS. (AD-9) (*MDN-G*)
- Add additional error handling if SIP Host or Port are not configured when attempting a checkout by SIP. (*MDN-G*)
Expand Down Expand Up @@ -73,6 +76,7 @@
- In User API added updateAlternateLibraryCard to allow updating or removing of alternate library cards for a patron. (*KK*)
- In User API modified getPatronProfile to include the alternateLibraryCard value, if any. (*KK*)
- Added showAlternateLibraryCard and alternateLibraryCardConfig array in the Library API to get alternate library card setup options. (*KK*)
- Added alternate library card details to linked accounts in getLinkedAccounts in the User API. (*KK*)

### cloudLibrary Updates
- On Library Systems and Locations, assigned cloudLibrary scopes will again display. (*KK*)
Expand All @@ -84,6 +88,10 @@
### Web Resources Updates
- Added authentication to web resources tha require login unless accessing from the library. Checking 'Requires being logged in to access, unless in library' now displays a new setting 'Allow Access to patrons of these home libraries' to select the libraries whose patrons should have access to the resource. By default, existing resources with the logged in required setting checked, will provide access to all their libraries. (Ticket 135273) (*KK*)

### Other Updates
- Added function to gather all the various alternate library card settings for a library system. (*KK*)
- Changed how Aspen Discovery determines its current version by using the most recent release notes file instead of looking in the git file. (*KK*)

<div markdown="1" class="settings">

#### New Settings
Expand Down Expand Up @@ -114,6 +122,8 @@
// pedro

// lucas
### Other updates
- Add supportingCompany support in Docker scripts. (*LM*)

// James Staub
### Reports
Expand All @@ -133,9 +143,12 @@
- Hide empty item groups for volume-level holds in Koha (*KMH*)
- Remove old pre-production Koha volumes code (*KMH*)
- Properly close the connections to Koha from Aspen (*KMH*)
- Fix query to select circulation rules for Koha (*KMH*)

### GitHub Actions
- Add GitHub Actions to check pull requests for release notes (*KMH*)
- Add GitHub Actions to check pull requests for spaces vs tabs (*KMH*)
- Prevent GitHub Actions from attempting to push Docker images unless the push is to the official rep (*KMH*)

// Liz Rea
### Other Updates
Expand Down Expand Up @@ -167,5 +180,4 @@
- Chloe Zermatten (CZ)

- Theke Solutions
- Lucas Montoya (LM)

- Lucas Montoya (LM)
5 changes: 4 additions & 1 deletion code/web/services/API/UserAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4710,6 +4710,9 @@ function getLinkedAccounts() {
$account[$linkedAccount->id]['expired'] = $linkedAccount->_expired;
$account[$linkedAccount->id]['expires'] = $linkedAccount->_expires;
$account[$linkedAccount->id]['ils_barcode'] = $linkedAccount->ils_barcode;
$account[$linkedAccount->id]['alternateLibraryCard'] = $linkedAccount->getAlternateLibraryCardBarcode();
$account[$linkedAccount->id]['alternateLibraryCardPassword'] = $linkedAccount->getAlternateLibraryCardPasswordOrPin();
$account[$linkedAccount->id]['alternateLibraryCardOptions'] = $linkedAccount->getHomeLibrary()->getAlternateLibraryCardOptions();
}
return [
'success' => true,
Expand Down Expand Up @@ -6068,7 +6071,7 @@ function updateAlternateLibraryCard(): array {
$user->alternateLibraryCardPassword = $alternateLibraryCardPassword;
}
} else {
$user->alternateLibraryCard = null;
$user->alternateLibraryCard = '';
$user->alternateLibraryCardPassword = '';
}

Expand Down
27 changes: 26 additions & 1 deletion code/web/sys/LibraryLocation/Library.php
Original file line number Diff line number Diff line change
Expand Up @@ -5226,7 +5226,7 @@ public function getApiInfo(): array {
];
}

$apiInfo['useAlternateLibraryCardForCloudLibrary'] = 0;
$apiInfo['useAlternateCardForCloudLibrary'] = 0;
require_once ROOT_DIR . '/sys/CloudLibrary/LibraryCloudLibraryScope.php';
$libraryCloudLibraryScope = new LibraryCloudLibraryScope();
$libraryCloudLibraryScope->libraryId = $this->libraryId;
Expand Down Expand Up @@ -5400,4 +5400,29 @@ public function getMainLocation() {
}
return $this->_mainLocation;
}

public function getAlternateLibraryCardOptions() {
$useAlternateLibraryCardForCloudLibrary = false;
require_once ROOT_DIR . '/sys/CloudLibrary/CloudLibraryScope.php';
$cloudLibraryScope = new CloudLibraryScope();
$cloudLibraryScope->id = $this->getCloudLibraryScope();
if($cloudLibraryScope->find(true)) {
require_once ROOT_DIR . '/sys/CloudLibrary/CloudLibrarySetting.php';
$cloudLibrarySettings = new CloudLibrarySetting();
$cloudLibrarySettings->id = $cloudLibraryScope->settingId;
if($cloudLibrarySettings->find(true)) {
$useAlternateLibraryCardForCloudLibrary = $cloudLibrarySettings->useAlternateLibraryCard;
}
}

return [
'showAlternateLibraryCard' => $this->showAlternateLibraryCard,
'alternateLibraryCardFormMessage' => $this->alternateLibraryCardFormMessage,
'alternateLibraryCardLabel' => $this->alternateLibraryCardLabel,
'alternateLibraryCardStyle' => $this->alternateLibraryCardStyle,
'alternateLibraryCardPasswordLabel' => $this->alternateLibraryCardPasswordLabel,
'showAlternateLibraryCardPassword' => $this->showAlternateLibraryCardPassword,
'useAlternateLibraryCardForCloudLibrary' => $useAlternateLibraryCardForCloudLibrary,
];
}
}
1 change: 1 addition & 0 deletions docker/files/env/default.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Aspen settings
SITE_NAME=aspen.localhost
SUPPORTING_COMPANY=ByWater Solutions
LIBRARY=Test library
TITLE=Test library (title)
URL=http://aspen.localhost
Expand Down
Loading

0 comments on commit 0492420

Please sign in to comment.