Skip to content

GetThis feature + Regex config file support#4359

Open
rominail wants to merge 170 commits into
vufind-org:devfrom
MSU-Libraries:getThis
Open

GetThis feature + Regex config file support#4359
rominail wants to merge 170 commits into
vufind-org:devfrom
MSU-Libraries:getThis

Conversation

@rominail

@rominail rominail commented May 5, 2025

Copy link
Copy Markdown
Member

This is a rewrite of this feature we call "Get this" which allows having a button next to the holding to open a lightbox showing the option the patron has to "get this" record. The options include placing a request, request for a in-person delivery, inter library loan, ...
It's made to be flexible and easy to extend, in order to add other sections to the lightbox; ie : in our case some logic specific to our collections.
It relies on Regex for some logic. We didn't have the proposed logic implemented hence the code is new and it's a feature on it's own which is completely reusable for other components.

I plan to write the tests once most of the logic is agreed upon.

Please, propose new names (for variables, functions, ...) when they don't make sense or are not clear.

Line 13 of themes/bootstrap5/templates/record/get-this/holdings.phtml We were not sure how to name the item when the call number is not present to be displayed in the dropdown

TODO:

@demiankatz demiankatz added new feature new language strings adds new text in need of translation labels May 6, 2025

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @rominail. I have not had a chance to try this hands-on yet, or to review every file carefully, but see below for a few thoughts based on a relatively quick look at the code.

Comment thread config/vufind/GetThis.yaml Outdated
Comment thread config/vufind/GetThis.yaml Outdated
Comment thread languages/en.ini Outdated
Comment thread languages/en.ini Outdated
Comment thread languages/en.ini Outdated
Comment thread themes/bootstrap5/templates/RecordTab/holdingsils/standard.phtml Outdated
Comment thread themes/bootstrap5/templates/ajax/status-full.phtml Outdated
Comment thread themes/bootstrap5/templates/record/get-this.phtml Outdated
Comment thread themes/bootstrap5/theme.config.php Outdated
Comment thread themes/bootstrap5/templates/record/get-this/remote-delivery.phtml Outdated
…s, move the getThisAction from trait to the controller, add a supportGetThis method instead of a hardcoded class, switcyh getThis constructor params from yamlReader to config, change priority of js file
Comment thread config/vufind/GetThis.yaml Outdated
Comment thread languages/en.ini Outdated

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @rominail, I've resolved all of the open conversation threads that have been fully addressed, and have opened a few new ones below (along with contributing to ongoing ones).

Comment thread config/vufind/GetThis.yaml Outdated
Comment thread config/vufind/GetThis.yaml Outdated
Comment thread config/vufind/GetThis.yaml Outdated
Comment thread config/vufind/GetThis.yaml Outdated
Comment thread config/vufind/GetThis.yaml Outdated
Comment thread module/VuFind/src/VuFind/Regex/RegexFactory.php Outdated
Comment thread module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php Outdated
Comment thread themes/bootstrap5/templates/RecordTab/holdingsils/standard.phtml Outdated
Comment thread themes/bootstrap5/templates/ajax/status-full.phtml Outdated
Comment thread config/vufind/Regex.yaml
rominail and others added 11 commits May 8, 2025 11:16
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
…x.yaml, renaming to microform_viewing_request_html
Comment thread config/vufind/GetThis.yaml Outdated
rominail and others added 6 commits May 8, 2025 15:24
Comment thread languages/fr.ini Outdated
rominail and others added 3 commits June 4, 2026 13:35
Co-authored-by: Demian Katz <demian.katz@villanova.edu>
Co-authored-by: Stefan Weil <sw@weilnetz.de>

@EreMaijala EreMaijala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry if I'm commenting on something that's already been addressed. There was just so much going on here that I may have missed a bunch. And I didn't even try to grasp everything here, so apologies if I'm missing the mark.

My thoughts:

  • This seems quite a complex feature to set up, and would benefit from a wiki page that would describe the feature and possible uses (including examples).
  • Translations should have their own text domain.
  • Since getThisURI is always a URL, could it be called getThisURL?
  • I'd prefer explicit comparison with null instead of isset(). E.g. in GetThisLoader isset($this->items) => null !== $this->items.
  • I'd also prefer to have public methods first and protected ones after them, but that's just my preference.

Comment thread module/VuFind/src/VuFind/Regex/Regex.php Outdated
Comment thread module/VuFind/src/VuFind/RecordTab/HoldingsILSFactory.php Outdated
Comment thread module/VuFind/src/VuFind/RecordTab/HoldingsILS.php Outdated
Comment thread config/vufind/Regex.yaml Outdated
Comment thread module/VuFind/src/VuFind/GetThis/GetThisLoader.php Outdated
Comment thread themes/bootstrap5/js/check_item_statuses.js Outdated
Comment thread themes/bootstrap5/js/check_item_statuses.js Outdated
Comment thread themes/bootstrap5/templates/record/get-this/holdings.phtml Outdated
Comment thread themes/bootstrap5/templates/record/get-this/holdings.phtml Outdated
Comment thread themes/bootstrap5/templates/record/get-this/holdings.phtml Outdated
@demiankatz

Copy link
Copy Markdown
Member

Thanks for the review, @EreMaijala, and for the progress, @rominail.

One point I'd like to highlight: Ere suggests moving the new text strings to a separate text domain. This is probably a good idea, but since Susan has already begun processing translation requests for translators, it will create extra work if we change it now. So I think there's a question of how strongly we feel. For purely practical reasons, I'm not inclined to fight too hard for change, but I do think it might be the right choice. We can potentially plan to adjust the text AFTER the translation work is completed but before the release of 11.1, if that turns out to be the easiest path.

@rominail

rominail commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

I'm not familiar with translations much, I'm not for extra work, doing it when the translations come back before the release sounds good; but again you are more aware than me

@demiankatz

Copy link
Copy Markdown
Member

Thanks, @rominail, I'll merge the translations as-is this week to facilitate the translation process while we finish up the final touches on this PR. If we decide to move them, we can do so in a follow-up shortly before the 11.1 release. I think that's the simplest approach under the circumstances.

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks once again, @rominail!

I took a closer look at @EreMaijala's review and your response to it. I also started building a Get This wiki page. It's bare minimum right now, but please let me know what you think of it, and if you'd like wiki access so you can expand upon it.

While reviewing recent changes and studying code to ensure the accuracy of my wiki page, I noticed a few more things -- see below:

Comment thread config/vufind/Regex.yaml Outdated
Comment thread module/VuFind/src/VuFind/Controller/RecordController.php Outdated
<?php
$selectedItem = $this->getThis->getItem();
$useDropdown = $this->getThis->makeHoldingsDropdown();
$holdingsList = $this->render('record/get-this/holdings-list.phtml');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to use renderInContext here, and pass in $selectedItem and $useDropdown? I realize it's not expensive to retrieve the values again inside holdings-list.phtml, but passing the values explicitly might make it more clear that these settings impact the behavior of the template.

(I'm not insisting on this change, just suggesting it for your consideration).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering simpler code to read and easier to understand where the variables come from
But I don't have a strong opinion
Let me know what you prefer and I'll do the code change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can see if @EreMaijala has a strong opinion when he reviews the refactoring...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the values come from same place I don't really mind it being as is. What I find a bit confusing though is having GetThisLoader as $this->getThis in the template.

Comment thread themes/bootstrap5/templates/record/get-this/holding-display.phtml Outdated

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the adjustments -- see below for some further simplifications that I think should work (but I apologize if I've made any mistakes).

Comment thread themes/bootstrap5/templates/record/get-this/holding-display.phtml Outdated
rominail and others added 2 commits June 9, 2026 14:28

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @rominail -- see below for one slight simplification.

After that, I'll try to follow up with others who currently have "request changes" reviews here so we can wrap this up!

Comment thread module/VuFind/src/VuFind/Controller/RecordController.php Outdated
@demiankatz demiankatz requested a review from EreMaijala June 11, 2026 13:03

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rominail, regarding your latest changes, do you think it would be more clear to rename setRecord to setRecordDriver rather than just setDriver to make it clear what kind of driver is being set? I can live with it as is, but since this class also interacts with the ILS driver, more specific naming might be clearer.

Other than that, I think I'm finished commenting -- I'll re-request reviews from everyone with a pending "request changes" review so we can get those cleared out.

}

if (isset($this->getThis)) {
$urlHelper = $this->renderer->plugin('url');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to get url helper already here? As far as I can see it's only used once below conditionally.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is to prevent having it in the foreach loop, but I have no problem moving it

@stweil stweil Jun 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it depends on the typical number of loop iterations whether this optimisation should be done or not. For only a few iterations, I'd suggest to move it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it

@EreMaijala EreMaijala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment about the use of url helper as it seems a bit out of place and fragile, but other than that I've no further issues, so I'll approve now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature new language strings adds new text in need of translation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants