Coder Social home page Coder Social logo

koha_snippets's Introduction

Koha Snippets

Snippets of code to be inserted into the administrative settings of Koha.

Development

npm scripts automate development tasks. These tasks let us write many small snippets of code which accomplish one thing & then combine them into a single optimized file. Run npm install to get the necessary dependencies. Then, from inside this project, these npm run scripts are available:

  • build - run all the compilation scripts listed here, meta-task
  • ajs - minify all admin (staff-side) JavaScript
  • cjs - minify all public catalog JavaScript
  • acss - compile & minify staff-side styles
  • ccss - compile & minify public catalog styles

Each of these tasks are compile/minify code for a specific Koha setting, copy the output to the Mac OS clipboard, and open the setting's URL in Koha's administration module. The first letter of the task stands for either "admin" or "catalog". CCA's intranet domain is hard-coded into them. All output also goes in the "dist" directory.

License

ECL-2.0

koha_snippets's People

Contributors

dependabot[bot] avatar phette23 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koha_snippets's Issues

Recalls: only show in appropriate circumstances

Only show the Place recall button on a bib details page when it makes sense, e.g. when there is at least one unavailable item (currently shows even for bibs where all items are available).

Unfortunately, there's probably no way to stop it from displaying on search results. Maybe by parsing the "availability" line?

highlights items away from their homebranch upon checkin

Whenever a row has homebranch != location, add some error/warning highlighting.

Useful for LUO type items that were sent to the other branch—they don't show a warning upon checkin that they need to be sent back to the other branch, whereas non-LUO items do.

suggestions management form customization

Two requested changes to suggestions management form on the staff side:

  • default the library branch under acquisition information to "Any"
  • default the number of suggestions shown to "all" (for every tab)

less confusing Subscription tab

for a serial records Subscription tab (see Artforum for example), the "missing issues" line should only display if there are missing issues (reads very confusing otherwise) and the "subscription has" line should be hidden as it always directly contradicts the "library has" line just above.

subs-tab

Recalls: make them work for unauthenticated users

Typical Koha problem: the recall button displays even if you're not logged in, but if you click it and go through the authentication flow, you end up on your patron details page, not on the recalls page. I need to apply my usual technique of storing the bib number of the record being acted on and redirecting users from the patron details page to the appropriate spot.

show OPACMySummaryNote warning only for relevant patrons

Right now we use OPACMySummaryNote to display a notice towards the end of the semester about student accounts expiring. It displays for everyone even though it's only relevant for Undergraduate and Grad Student patron types. Ideally, we would only show it for relevant types.

There are a few use cases where knowing the patron type of the logged in user would help us deliver more appropriate messages. It appears this isn't possible without further work. My first idea is to make a public report that accepts a borrowernumber parameter and returns the patron category. That seems sufficiently secure (passing usernames or real names would not be).

Note that we're using a hack in catalog-js/opac-user.js to show this message right now because Koha bug 23968 broke the OPACMySummaryNote display. It will be fixed in 19.11 and then we can remove our JS hack.

Word for Dutch in adv search language dropdown is mis-encoded

https://library.cca.edu/cgi-bin/koha/opac-search.pl - if you look at the Languages dropdown menu, the word for Dutch comes out as "nedərlɑns" when it should be "nedərlɑns". The flipped e and a variant (I don't know the names of the Dutch characters) are shown as HTML character references. Maybe you can't use character references in a dropdown? The solution is probably to find and swap out the text content of that particular . We should check that we're A) on the opac-search.pl URL and B) the user agent's language is English before swapping the text.

"Save to your lists" action for unauthenticated users

  • write report to see how many reports each patron category has made
  • opac-detail.pl: add sidebar link "Save to your lists"
    • copy HTML & icon from signed in state so they look the same
    • onclick store biblionumber & some sort of "save to lists" action code
    • then redirect to opac-user.pl so user can sign in
  • opac-user.pl: if we have this stored data, redirect to opac-detail.pl bib record
  • opac-detail.pl: check if we have stored data, if so click "Save to my lists"

multiple 520 summaries tag look awkward because label repeats

I hate how the "summary" label repeats for each MARC 520, see on Metaphysics : a very short introduction for instance:
Screen Shot 2020-05-17 at 18 23 13

Unfortunately, CSS doesn't solve this because of the way the -of-type selectors work. You'd think either of these might work:

.results_summary.summary:nth-of-type(n + 2) .label { display: none; }
/* or */
.results_summary.summary .label { display: none; }
.results_summary.summary:first-of-type .label { display: inline; }

They don't because the "type" being referred to is not element that match the selector being modified, but sibling elements. So without counting all the earlier .results_summary elements make it impossible to target the few summaries at the end, unless I'm missing something.

expose password reset function

We overwrite the login HTML pretty heavily in html/OPACLoginInstructions & catalog-js/login-cas.js and I think this is causing the password reset functionality to be erased but I'm not sure, as we haven't previously exposed it.

Currently only relevant for Alumni who don't login with their CCA accounts.

koha logo in upper left

  • should say "catalog" and not koha probably
  • should be linked to the catalog home page

Seems like we can only affect this with OPAC JavaScript.

Koha admin color theme

Ali asked if the color scheme could be something other than green. I don't see the east way to do this—CSS variables—so we'd need to find everything the theme color is used and change it, but it's definitely possible.

admin - list basket/order info on serials/subscription-detail.pl page

Right now if the order's been closed then nothing shows, and if it's open it only shows the last order. So if there's a price correction then it'll show that but not the initial charge, which is misleading.

In order to fix this the approach probably should be:

  • design a public report that'll accept a serial ID number as a parameter
  • the report will return related order information
  • write a script for the subscription detail page which hits the report with AJAX & inserts the returned data into a table

Lists opac-shelves.pl #toolbar looks awful

Screen Shot 2019-08-15 at 12 20 25

Huge, empty gray space. I don't mind the large dropdown menus but two of them seems silly, not sure if I can work around that though. Ideally the controls would be flat on top of the #selections-toolbar below and not floating in space.

remove reliance on Libraries Wagtail site

Since libraries.cca.edu is down right now and will be for about a week, we need to remove all references to it throughout Koha. This includes

  • using the hours API in opacnavbottom
  • linking to material type icons
  • pulling in serials subscription data via the sersol API
  • various links to Libraries web pages

Investigate reports of disappearing serials barcodes

We've seen this before and I believe I made a customization to work around it but then removed that customization when it was no longer needed. 20.05 might have regressed so it's relevant again. It's something to do with barcodes disappearing when a serial is checked in.

patron autocomplete does allow keyboard select

In this gif I'm pressing Enter first & then spacebar; neither selects the highlighted autocomplete item (the highlighting in effect does nothing):
patron autocomplete

The autocomplete implementation appears to be a <script> tag on the page:

<script type="text/javascript">
         $(document).ready(function(){
             var obj = $( "#findborrower" ).autocomplete({
                 source: "/cgi-bin/koha/circ/ysearch.pl",
                 minLength: 3,
             }).data( "ui-autocomplete" );
             if( obj ) {
                 obj._renderItem = function( ul, item ) {
                     var cardnumber = "";
                     if( item.cardnumber != "" ){
                         // Display card number in parentheses if it exists
                         cardnumber = " (" + item.cardnumber + ") ";
                     }
                     return $( "<li></li>" )
                     .data( "ui-autocomplete-item", item )
                     .append( "<a href=\"/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
                     .appendTo( ul );
                 };
             }
         });
     </script>

better lists display

Email to the listserv pointed out that other catalogs can show recent lists like this:

Screen Shot 2019-03-15 at 11 31 02

That's a pretty nice display and certainly draws more attention to the lists than they get now, buried under a drop-down menu with only their boring names to look at. I imagine building out something like this would involve writing a public report that publishes JSON data about the most recent X lists and their titles (so we can grab cover images).

The bigger question is where would this list display live—we already have a "new titles" cover display on the Koha home page and it's not a page that we link to very often. Most people engage with the catalog by dropping directly into a search, record display, or their user account. There's simply no reason to visit the home page itself. So it's likely that this lists display should live on the main website or a LibGuide instead.

cash register report: auto-record payment type in notes field

As a workaround for Koha Bug 21791 Add payment type on Cash register report make the form where we add payments automatically append the payment type to the "notes" field:

Screen Shot 2020-01-29 at 10 59 05

The URL for this form is /cgi-bin/koha/members/paycollect.pl?borrowernumber={id} but already I see a problem; if you go to a patron's Accounting tab and use the Pay button for an individual fine, as opposed to the Pay amount or Pay selected buttons at the bottom, there's no notes field on the form!

no notes

Note that the URL is more complex for this Pay button because it passes not only the patron's ID but data about the fine as well: /cgi-bin/koha/members/paycollect.pl?borrowernumber={borrowernumber}&type=payment&amt={amount}&selected={fine_id}&notes= there's a "notes" parameter in the URL! Perhaps this is meant to copy the note from the fine itself (important to understand both fines and payments have a note field).

Add JS, SASS linting

Use gulp-eslint and whatever the gulp SASS lint tool is, review both admin and catalog files.

password reset notice

Tell users that it resets their Koha password and not CCA password, then link to the Accounts site where they can reset their CCA password for themselves.

Currently we only allow Alumni users to reset passwords. All other users always sign in with their CCA credentials. Some Alumni do, too.

cover images for ComicsPlus records

The imported ComicsPlus records from LibraryPass come with an 856 field labelled "Image" that contains a public link to the title's cover image. We could look for a link of this format and use it as the cover image of the record (if one is not present), mimicking the HTML of typical cover images.

Comics Plus records.

21.05 upgrade omnibus

This ticket is just a placeholder for commits related to it to reference. There were a lot of theme changes in the 21.05 update we received on Monday, September 27th so much of it will be removing or modifying this repo's customizations.

AVAILABLE status spans two lines in OPAC

Awkwardly, the "AVAILABLE" status text is just barely too long to fit in the Status column now on serials (does not affect most item types, it appers):
Screenshot 2023-06-20 at 1 26 30 PM

It must be because of the introduction of a new column into the holdings table in 22.11? Maybe "Item holds" wasn't there before? Or there was some slight typographic or layout change that caused this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.