Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOLIO: Support delivery fulfillment preference for requests #3930

Merged

Conversation

maccabeelevine
Copy link
Member

@maccabeelevine maccabeelevine commented Sep 10, 2024

FOLIO supports delivery as a fulfillment preference, instead of just picking up items at the hold shelf. https://docs.folio.org/docs/access/requests/requests/#processing-delivery-requests

TODO

  • When merging, document new permissions required
  • Add to the ILS drivers wiki page documenting the new optional return value locationsLabel in getRequestGroups.

@maccabeelevine
Copy link
Member Author

maccabeelevine commented Sep 10, 2024

This is not ready for detailed review (much left to be done), but it's worth discussing the UX and implementation strategy. Originally I was going to introduce a fulfillment preference concept to VuFind (pick up, delivery, maybe others like electronic delivery). But I took @EreMaijala 's good suggestion from Slack to use the existing request group capability.

There's already support for such field combination in the form of request group + pickup location. If used, the user has to choose a request group first. Then the pickup location list is populated based on that.

I think this works because there is otherwise not exactly a concept of a request group in FOLIO that matches what the wiki defines ("This optional method returns information used to group together collections of pickup locations."). There is the closely related concept of the list of pick up locations associated with this item's physical location, but it's not technically a group of locations, and in any case I handled that scenario already in #3876.

One problem is that the Pickup Location field now does double-duty as a delivery location field, so I will have to find a way to dynamically change the field name if the delivery request group is selected. But that seems doable.

I also don't love how all the delivery logic is forced into functions about getPickupLocations etc., but I guess that's pretty minor.

Does this work conceptually?

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @maccabeelevine! At first glance, I don't see anything obviously wrong with this approach. See below for a handful of minor review comments. I'll also add a TODO comment to document the newly-required permissions.

config/vufind/Folio.ini Outdated Show resolved Hide resolved
module/VuFind/src/VuFind/ILS/Driver/Folio.php Outdated Show resolved Hide resolved
module/VuFind/src/VuFind/ILS/Driver/Folio.php Outdated Show resolved Hide resolved
module/VuFind/src/VuFind/ILS/Driver/Folio.php Outdated Show resolved Hide resolved
@maccabeelevine
Copy link
Member Author

Thanks, @maccabeelevine! At first glance, I don't see anything obviously wrong with this approach. See below for a handful of minor review comments. I'll also add a TODO comment to document the newly-required permissions.

Great, thanks. I'll finish the implementation then and address those comments before I mark ready for a full review.

languages/en.ini Outdated Show resolved Hide resolved
languages/en.ini Outdated Show resolved Hide resolved
@maccabeelevine maccabeelevine marked this pull request as ready for review October 1, 2024 19:21
@maccabeelevine
Copy link
Member Author

Actually tested now with FOLIO and it works.

Still have to figure out this:

One problem is that the Pickup Location field now does double-duty as a delivery location field, so I will have to find a way to dynamically change the field name if the delivery request group is selected. But that seems doable.

@maccabeelevine
Copy link
Member Author

One problem is that the Pickup Location field now does double-duty as a delivery location field, so I will have to find a way to dynamically change the field name if the delivery request group is selected. But that seems doable.

Ok I've taken a first crack at this, just for the purposes of the initial hold form. There is no logic (yet) to change the label on any other form that displays requests, or if you never choose a request group in the first place. These are probably low-priority enhancements if they are necessary at all, but I think it's worth considering the effect that change would have around various templates as a (perhaps) necessary side effect if we take this approach of using request group for fulfillment method.

@EreMaijala EreMaijala self-requested a review October 8, 2024 08:13
<option value="<?=$this->escapeHtmlAttr($group['id'])?>"<?=($selected == $group['id']) ? ' selected="selected"' : ''?>>
<option
value="<?=$this->escapeHtmlAttr($group['id'])?>"
data-locations-label="<?=$this->transEsc('pick_up_location_label_' . $group['id'], null, $this->transEsc('pick_up_location'))?>"
Copy link
Contributor

Choose a reason for hiding this comment

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

While this probably works fine in most practical cases, I'd prefer a slightly different approach where Folio driver's getConfig would return the translation keys for the group id's. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm fine with defining the translation keys in Folio.ini (based on group id) instead of hard-coding in this way. But I'm not clear where you mean to call getConfig()? Here in the template with something like $this->ils()->getConfig() etc.? Or do you mean something internal to the driver's getRequestGroups(), where each group returned would include its translation key?

Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant:
In HoldsTrait $checkHolds gets the Holds configuration from the driver by calling $catalog->checkFunction() that in turn calls the ILS driver's getConfig() method. So if you return the translation keys alongside other hold configuration, you can access them in HoldsTrait and pass them on to the template. I'd consider something like $checkHolds['requestGroupPickUpLocationLabels'][$id]. If there are only the hard-coded values, I'd leave them out of Folio.ini and just append them to the config in the getConfig() method.

But now that you mentioned it, extending getRequestGroups so that it would return the labels as well would be a much simpler approach. Plus it would probably work better with the "ajaxy" implementation.

@demiankatz demiankatz added new feature new language strings adds new text in need of translation labels Oct 8, 2024
@demiankatz demiankatz added this to the 11.0 milestone Oct 8, 2024
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

The code looks fine to me (though I confess I haven't been able to actually test it hands-on); just one thought about scheduling the merge...

languages/en.ini Outdated
@@ -1089,6 +1089,8 @@ Photo = "Photo"
Physical Description = "Physical Description"
Physical Object = "Physical Object"
pick_up_location = "Pickup Location"
pick_up_location_label_delivery = "Delivery Address"
Copy link
Member

Choose a reason for hiding this comment

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

Since translation is already underway for release 10.1, we have a freeze on adding new translation strings. Since these are essentially just examples, if you really want to get this included in the release, perhaps we could remove the example configurations and language strings from this PR and introduce them in a separate PR targeted for 11.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I've taken that advice. I did need to leave in one new config, allowDelivery = false, to effectively disable to code, because it breaks without some of the config (which itself breaks without translation). The second PR is #3930.

maccabeelevine added a commit to maccabeelevine/vufind that referenced this pull request Oct 8, 2024
@demiankatz demiankatz modified the milestones: 11.0, 10.1 Oct 8, 2024
@demiankatz demiankatz requested a review from EreMaijala October 8, 2024 17:18
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @maccabeelevine -- one last question.

Also, since it seems very likely this will get merged in time for 10.1, do you want to go ahead and update the wiki page about permissions to reflect the new requirements?

module/VuFind/src/VuFind/ILS/Driver/Folio.php Show resolved Hide resolved
@demiankatz demiankatz removed the new language strings adds new text in need of translation label Oct 8, 2024
@maccabeelevine
Copy link
Member Author

Also, since it seems very likely this will get merged in time for 10.1, do you want to go ahead and update the wiki page about permissions to reflect the new requirements?

Yes, done!

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @maccabeelevine!

@demiankatz demiankatz merged commit c25507f into vufind-org:dev Oct 17, 2024
6 checks passed
@maccabeelevine maccabeelevine deleted the folio-request-groups-delivery branch October 18, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants