VuFind
  1. VuFind
  2. VUFIND-1269

Using Koha's information about volumes for display in VuFind

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1
    • Fix Version/s: 5.0
    • Component/s: ILS Driver
    • Labels:
      None

      Description

      Koha has very detailed information about serials' volumes.
      The information is stored in "items.enumchron". In order to display this detailed information on VuFind's holding tab, I added the field to the select clause starting at about line 765

      <snip>
       i.reserves as RESERVES, i.itemcallnumber as CALLNO, i.barcode as BARCODE,
                  i.copynumber as COPYNO, i.notforloan as NOTFORLOAN,
                  i.enumchron AS ENUMCHRON,
                  i.itemnotes as PUBLICNOTES, b.frameworkcode as DOCTYPE,
                  t.frombranch as TRANSFERFROM, t.tobranch as TRANSFERTO,
                  i.itemlost as ITEMLOST, i.itemlost_on AS LOSTON
      </snip>

      Additionally I added a new field "enumchron" to the holdings-array starting at about line 931:

      <snip>
       'number' => (null == $rowItem['COPYNO'])
                          ? '' : $rowItem['COPYNO'],
       'enumchron' => (null == $rowItem['ENUMCHRON'])
                          ? '' : $rowItem['ENUMCHRON'],
       'requests_placed' => $reservesCount ? $reservesCount : 0,
      </snip>

      In /usr/local/vufind/themes/bibb/templates/RecordTab/holdingsils.phtml I added the following lines atsrting at about line 122:

      <? if (isset($row['enumchron']) && $row['enumchron']): ?>
                     <?=$row['enumchron'] .": "?>
      <? endif;?>

      Example of the display see attached.

        Activity

        Hide
        Demian Katz added a comment -
        It is possible to gain access to VuFind's translator from within the ILS driver itself. If a driver implements the TranslatorAwareInterface and uses the TranslatorAwareTrait, it will have access to a $this->translate() method that it can use to translate strings to the current user-selected language. You can see an example of this in the LBS4 driver:

        https://github.com/vufind-org/vufind/blob/af4dee334426ad68369fdcc6570291ca63fe0fdc/module/VuFind/src/VuFind/ILS/Driver/LBS4.php#L29

        This is not always the best approach, but in cases where you need to manipulate strings deeper in the code, it is a viable option.
        Show
        Demian Katz added a comment - It is possible to gain access to VuFind's translator from within the ILS driver itself. If a driver implements the TranslatorAwareInterface and uses the TranslatorAwareTrait, it will have access to a $this->translate() method that it can use to translate strings to the current user-selected language. You can see an example of this in the LBS4 driver: https://github.com/vufind-org/vufind/blob/af4dee334426ad68369fdcc6570291ca63fe0fdc/module/VuFind/src/VuFind/ILS/Driver/LBS4.php#L29 This is not always the best approach, but in cases where you need to manipulate strings deeper in the code, it is a viable option.
        Hide
        Jason Cooper added a comment - - edited
        Personally, I'm not a fan of bundling multiple fields into one in the ILS driver as it can quickly gets difficult to maintain. Long term I would rather the ILS Drivers made additional fields available which can then by used by the theme in whichever way it likes. If we want to pursue that direction then we could add in the additional fields as a first step and anyone who wishes to use them would have to edit their theme's holdingsils template (though I can see a holdingsils template using flexboxes that would allow a lot of customization in layout to be done by CSS).
        Show
        Jason Cooper added a comment - - edited Personally, I'm not a fan of bundling multiple fields into one in the ILS driver as it can quickly gets difficult to maintain. Long term I would rather the ILS Drivers made additional fields available which can then by used by the theme in whichever way it likes. If we want to pursue that direction then we could add in the additional fields as a first step and anyone who wishes to use them would have to edit their theme's holdingsils template (though I can see a holdingsils template using flexboxes that would allow a lot of customization in layout to be done by CSS).
        Hide
        Demian Katz added a comment -
        I agree that separate fields are a cleaner solution -- but it's ultimately a matter of weighing the disruption of doing things a new way against the disadvantages of maintaining the existing approach. I'm open to either path forward -- but whatever approach we take, I hope we can ensure that it maintains compatibility with existing drivers (and perhaps updates some that can take advantage of new features).

        Perhaps a good compromise solution would be to populate the number field by combining data in order to take advantage of the existing architecture, but also populate some extra fields to allow more granular handling in future. We could then add support for these fields in more drivers, and eventually update the templates to look for the new fields, using the old field as a mechanism for graceful degradation.

        In any case, for now, my main goal is to give Roland an easy entry point into getting started on a pull request. :-)
        Show
        Demian Katz added a comment - I agree that separate fields are a cleaner solution -- but it's ultimately a matter of weighing the disruption of doing things a new way against the disadvantages of maintaining the existing approach. I'm open to either path forward -- but whatever approach we take, I hope we can ensure that it maintains compatibility with existing drivers (and perhaps updates some that can take advantage of new features). Perhaps a good compromise solution would be to populate the number field by combining data in order to take advantage of the existing architecture, but also populate some extra fields to allow more granular handling in future. We could then add support for these fields in more drivers, and eventually update the templates to look for the new fields, using the old field as a mechanism for graceful degradation. In any case, for now, my main goal is to give Roland an easy entry point into getting started on a pull request. :-)
        Hide
        Jason Cooper added a comment -
        It looks like Roland's got enough code written to get a good start on the pull request for adding the extra `enumchron` field and it should be pretty easy to add an option to extend the copy number field. How that data's handled long term in the templates is separate issue and you're right that we shouldn't let that get in the way of Roland getting his enhancements into the code base.
        Show
        Jason Cooper added a comment - It looks like Roland's got enough code written to get a good start on the pull request for adding the extra `enumchron` field and it should be pretty easy to add an option to extend the copy number field. How that data's handled long term in the templates is separate issue and you're right that we shouldn't let that get in the way of Roland getting his enhancements into the code base.
        Hide
        Demian Katz added a comment - - edited
        Roland has opened a PR here -- https://github.com/vufind-org/vufind/pull/1115 . Please feel free to add further feedback there. I also haven't forgotten about the related "extended holdings" pull request at https://github.com/vufind-org/vufind/pull/1100 ; it's been incredibly busy over here, but I hope to have time to comment on that in more detail in the coming weeks.
        Show
        Demian Katz added a comment - - edited Roland has opened a PR here -- https://github.com/vufind-org/vufind/pull/1115 . Please feel free to add further feedback there. I also haven't forgotten about the related "extended holdings" pull request at https://github.com/vufind-org/vufind/pull/1100 ; it's been incredibly busy over here, but I hope to have time to comment on that in more detail in the coming weeks.

          People

          • Assignee:
            Unassigned
            Reporter:
            Roland Keck
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: