Skip to content

Instantly share code, notes, and snippets.

View xmorave2's full-sized avatar

Josef Moravec xmorave2

View GitHub Profile
@xmorave2
xmorave2 / hold_slip.tt
Created February 11, 2019 14:09
hold_slip.tt
[% USE KohaDates %]
<p><small>Tisk: [% today | $KohaDates with_hours => 1 %]</small></p>
<h2 style="border-bottom: 1px solid black; margin-bottom: 1em;">[% branch.branchname %]</h2>
<div style="font-size: 1.2em; font-weight: bold;"><i>[% biblio.author %]</i>:<br />[% biblio.title %]</div>
<ul>
<li>Č. kód: [% item.barcode %]</li>
<li>Čeká do: <strong>[% hold.expirationdate | $KohaDates%]</strong></li>
</ul>
@xmorave2
xmorave2 / issueslip.tt
Created February 11, 2019 14:08
issueslip.tt
[% USE KohaDates %]
[% BLOCK detail %]
<p style="font-size: 1.1em; border-bottom: 1px dotted black;">
[% IF checkout.item.biblio.author %]<i>[% checkout.item.biblio.author | remove(',$') %]</i>:[% END %]
<strong>[% checkout.item.biblio.title | remove(' \/$') | remove(' :$') %]</strong>
[%- IF checkout.item.enumchron %], [% checkout.item.enumchron %][% END %]
<br />
Půjčeno od: [% checkout.issuedate | $KohaDates %]<br />
Vrátit do: <b>[% checkout.date_due | $KohaDates %]</b><br />
[% branch.branchname %]
@xmorave2
xmorave2 / zakony-pro-lidi-indexer.sh
Created January 9, 2019 10:07
Zákony pro lidi
#!/bin/bash
#
# dependencies: xml-twig-tools, wget
apikey=test
collection=cs
export VUFIND_HOME="/usr/local/vufind"
export VUFIND_LOCAL_DIR="/usr/local/vufind/local"
cd /usr/local/vufind/local/harvest
@xmorave2
xmorave2 / cron.daily
Created April 27, 2018 06:31
Upomínky
koha-foreach --enabled /usr/share/koha/bin/cronjobs/fines.pl
koha-shell chocen -c '/usr/share/koha/bin/cronjobs/finesChocen.pl -c'
@xmorave2
xmorave2 / autority.sh
Created March 23, 2018 07:13
autority.sh
#!/bin/bash
export KOHA_CONF=/etc/koha/sites/usti/koha-conf.xml
export PERL5LIB=/usr/share/koha/lib
#for bn in $(echo 'SELECT biblionumber FROM biblio ORDER BY biblionumber LIMIT 10000, 10000;' | koha-mysql usti)
for bn in $(echo 'SELECT biblionumber FROM virtualshelfcontents where shelfnumber = 7;' | koha-mysql usti)
do
if [ "$bn" != "biblionumber" ]; then
/usr/share/koha/bin/link_bibs_to_authorities.pl -v --bib-limit="biblionumber = $bn";
koha-rebuild-zebra usti
@xmorave2
xmorave2 / plack-error.log
Created March 12, 2018 14:53
Error log když se nepodaří přes svc api prodloužit výpůjčku
Can't call method "contains" on unblessed reference at /usr/share/koha/lib/Koha/Calendar.pm line 243.
at /usr/share/koha/intranet/cgi-bin/circ/returns.pl line 34.
CGI::Compile::ROOT::usr_share_koha_intranet_cgi_2dbin_circ_returns_2epl::__ANON__("Can't call method \"contains\" on unblessed reference at /usr/s"...) called at /usr/share/koha/lib/Koha/Calendar.pm line 243
Koha::Calendar::is_holiday(Koha::Calendar=HASH(0xe53d5d0), DateTime=HASH(0xe3eb370)) called at /usr/share/koha/lib/Koha/Calendar.pm line 217
Koha::Calendar::addDays(Koha::Calendar=HASH(0xe53d5d0), DateTime=HASH(0xe44d298), DateTime::Duration=HASH(0xe521fe8)) called at /usr/share/koha/lib/Koha/Calendar.pm line 155
Koha::Calendar::addDate(Koha::Calendar=HASH(0xe53d5d0), DateTime=HASH(0xe44d298), DateTime::Duration=HASH(0xe521fe8), "days") called at /usr/share/koha/lib/C4/Circulation.pm line 3592
C4::Circulation::CalcDateDue(DateTime=HASH(0xe6cf488), "KN", "DOSP", HASH(0xcfc9fe0), "is a renewal", "", DateTime=HASH(0xe40daf0)) called at /usr/s
@xmorave2
xmorave2 / finesClavius.pl
Created October 23, 2017 15:35
Cronjob pro výpočet upomínek alá Clavius
#!/usr/bin/perl
use Modern::Perl;
use DateTime;
use Getopt::Long;
use Koha::Database;
use Koha::DateUtils;
#!/usr/bin/perl
# Copyright 2010 BibLibre SARL
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
@xmorave2
xmorave2 / SolrMarc.php
Last active October 13, 2017 10:37
Dílovky VuFind
public function getSerie()
{
$ret = [];
$fields = $this->getMarcRecord()->getFields('787');
foreach ($fields as $field) {
if ($subfield_i = $field->getSubfield('i')) {
if (strpos($subfield_i->getData(), 'Z cyklu') !== false) {
$subfield_g = $field->getSubfield('g');
$subfield_t = $field->getSubfield('t');
@xmorave2
xmorave2 / format.bsh
Last active July 19, 2017 07:26
format.bsh
/**
* Get and normalize EAN code (from ISBN)
*
* @param Record record
* @return String EAN code
*/
private String getEAN(Record record) {
DataField isbn = (DataField) record.getVariableField("020");
if(isbn != null) {