Commit a4cb1a48 authored by Øyvind Julsrud's avatar Øyvind Julsrud
Browse files

Merge branch 'master' into DEICH-5917-refactor

parents e2dbac4c 0f7158d6
......@@ -49,6 +49,13 @@ security:
redirect-uris:
- ${EXTERNAL_URL_FUGE}/auth/login-response?base64path=Lw==
client-secret: ${FUGE_SSO_CLIENT_SECRET}
- client-name: deichman-katalog
resource-id: deichman-resource-id
authorizedGrantTypes: authorization_code, implicit
scopes: read, write
redirect-uris:
- ${EXTERNAL_URL_FUGE}/auth/login-response?base64path=Lw==
client-secret: ${FUGE_SSO_CLIENT_SECRET}
- client-name: koha
resource-id: deichman-resource-id
authorizedGrantTypes: authorization_code
......
......@@ -70,67 +70,67 @@ const MyLoans = props => {
hasPurreOrKemnerSak = true;
}
return (
<>
<Head title="Min side - Deichman.no" />
<SubNav items={loggedInPages} />
{isRequestingLoansAndReservations ? (
<FullScreen>
<Loader />
</FullScreen>
) : (
<Container>
{noLoans && (
<Block top={8} bottom={8} responsive>
<p>Du har for tiden ingen lån.</p>
</Block>
)}
{kemnersaker && kemnersaker.length > 0 && (
<Block top={8} bottom={8} responsive>
<Outlined>
<LoanList
items={kemnersaker}
hasPurreOrKemnerSak={hasPurreOrKemnerSak}
>
<Block>
<h3>Lån med erstatningskrav</h3>
<p>
Det har blitt sendt ut erstatningskrav følgende lån og
bibliotekkortet ditt er derfor sperret. Du kan ikke
forlenge eksisterende lån eller låne mer før saken er
avsluttet.
</p>
</Block>
</LoanList>
</Outlined>
</Block>
)}
{purresaker && purresaker.length > 0 && (
<Block top={8} bottom={8} responsive>
{isJuvenile && (
<Outlined background="transparent">
<LoanList
items={purresaker}
hasPurreOrKemnerSak={hasPurreOrKemnerSak}
isJuvenile={isJuvenile}
>
<Block>
<Flex justify="space-between">
<h3>Lån som leveres</h3>
</Flex>
<p>
Du har fått to purringer følgende lån og
bibliotekkortet ditt er sperret. Kortet åpnes igjen
når lånene er levert.
</p>
</Block>
</LoanList>
</Outlined>
)}
{!isJuvenile && (
render() {
const {
isRequestingLoansAndReservations,
personalInformation
} = this.props.profile;
const { loanerCategory } = personalInformation;
const isJuvenile = loanerCategory === "B" ? true : false;
const { isRequestingNetsUrl } = this.props.payments;
const {
loans = [],
purresaker = [],
kemnersaker = [],
remoteLoans = []
} = this.props.profile.loansAndReservations;
const {
isRequestingExtendAllLoans,
hasRequestedRenewAll
} = this.props.checkouts;
const sortedActiveLoans = loans
.sort(dueDateComparator)
.filter(loan => loan.isPurresak !== true && loan.isKemnersak !== true);
const sortedRemoteLoans = remoteLoans.sort(dueDateComparator);
const noLoans =
kemnersaker.length < 1 &&
purresaker.length < 1 &&
sortedActiveLoans.length < 1 &&
sortedRemoteLoans.length < 1;
let purreId = -1;
if (purresaker && purresaker.length > 0) {
purreId = purresaker[0].purreId;
}
let hasPurreOrKemnerSak = false;
if (
(purresaker && purresaker.length > 0) ||
(kemnersaker && kemnersaker.length > 0)
) {
hasPurreOrKemnerSak = true;
}
return (
<Fragment>
<Head title="Min side - Deichman.no" />
<SubNav items={loggedInPages} />
{isRequestingLoansAndReservations ? (
<FullScreen>
<Loader />
</FullScreen>
) : (
<Container>
{noLoans && (
<Block top={8} bottom={8} responsive>
<p>Du har for tiden ingen lån.</p>
</Block>
)}
{kemnersaker && kemnersaker.length > 0 && (
<Block top={8} bottom={8} responsive>
<Outlined>
<LoanList
items={purresaker}
......@@ -150,45 +150,105 @@ const MyLoans = props => {
</Button>
</Flex>
<p>
Du har purregebyr følgende lån. Bibliotekkortet ditt
åpnes igjen når gebyret er betalt.
Det har blitt sendt ut erstatningskrav følgende lån
og bibliotekkortet ditt er derfor sperret. Du kan ikke
forlenge eksisterende lån eller låne mer før saken er
avsluttet.
</p>
</Block>
</LoanList>
</Outlined>
)}
</Block>
)}
{sortedActiveLoans.length > 0 && (
<Block top={8} bottom={8} responsive>
<LoanList
items={sortedActiveLoans}
headline={`Mine lån (${sortedActiveLoans.length})`}
hasPurreOrKemnerSak={hasPurreOrKemnerSak}
onRenewAll={() => props.extendAllLoans(sortedActiveLoans)}
isRequestingExtendAllLoans={isRequestingExtendAllLoans}
hasRequestedRenewAll={hasRequestedRenewAll}
isJuvenile={isJuvenile}
/>
</Block>
)}
{sortedRemoteLoans.length > 0 && (
<Block top={8} bottom={8} responsive>
<LoanList
items={sortedRemoteLoans}
isJuvenile={isJuvenile}
headline="Lån fra andre bibliotek"
info="Det er ikke mulig å fornye lån fra andre bibliotek enn Deichman."
/>
</Block>
)}
</Container>
)}
</>
);
};
</Block>
)}
{purresaker && purresaker.length > 0 && (
<Block top={4} bottom={8} responsive>
{isJuvenile && (
<Outlined background="transparent">
<LoanList
items={purresaker}
hasPurreOrKemnerSak={hasPurreOrKemnerSak}
isJuvenile={isJuvenile}
>
<Block>
<Flex justify="space-between">
<h3>Lån som leveres</h3>
</Flex>
<p>
Du har fått to purringer følgende lån og
bibliotekkortet ditt er sperret. Kortet åpnes igjen
når lånene er levert.
</p>
</Block>
</LoanList>
</Outlined>
)}
{!isJuvenile && (
<Outlined>
<LoanList
items={purresaker}
hasPurreOrKemnerSak={hasPurreOrKemnerSak}
isJuvenile={isJuvenile}
>
<Block bottom={4}>
<Flex justify="space-between" wrap>
<Block top={4}>
<h3>Lån med gebyr</h3>
</Block>
<Block top={4}>
<Button
disabled={kemnersaker && kemnersaker.length > 0}
loading={isRequestingNetsUrl}
onClick={() => this.props.startPayFine(purreId)}
primary
>
Betal gebyr 100,-
</Button>
</Block>
</Flex>
</Block>
<p>
Du har purregebyr følgende lån. Bibliotekkortet ditt
åpnes igjen når gebyret er betalt.
</p>
</LoanList>
</Outlined>
)}
</Block>
)}
{sortedActiveLoans.length > 0 && (
<Block top={8} bottom={8} responsive>
<LoanList
items={sortedActiveLoans}
headline={`Mine lån (${sortedActiveLoans.length})`}
hasPurreOrKemnerSak={hasPurreOrKemnerSak}
onRenewAll={() =>
this.props.extendAllLoans(sortedActiveLoans)
}
isRequestingExtendAllLoans={isRequestingExtendAllLoans}
hasRequestedRenewAll={hasRequestedRenewAll}
isJuvenile={isJuvenile}
/>
</Block>
)}
{sortedRemoteLoans.length > 0 && (
<Block top={8} bottom={8} responsive>
<LoanList
items={sortedRemoteLoans}
isJuvenile={isJuvenile}
headline="Lån fra andre bibliotek"
info="Det er ikke mulig å fornye lån fra andre bibliotek enn Deichman."
/>
</Block>
)}
</Container>
)}
</Fragment>
);
}
}
MyLoans.propTypes = {
profile: PropTypes.object.isRequired,
......
......@@ -84,6 +84,10 @@ const redirects = [
{
new: "/aktuelt/Skoletjenesten_4ae2685c-6c64-4fe7-9f9e-1af09f292a1f",
old: "/skoletjenesten"
},
{
old: "/utstillinger",
new: "/vi-tilbyr/utstillinger_e721ee86-62fb-41f2-9b56-936fe4033a7b"
}
];
module.exports = redirects;
......@@ -92,6 +92,11 @@ routes.get("/:id", async (request, response) => {
const json = await res.json();
if (json.dontShowOnWeb === true) {
response.sendStatus(404);
return;
}
// Remove internal data
const cleanedResult = searchParser.processLibraryService(json);
response.status(200).send(cleanedResult);
......
......@@ -411,6 +411,18 @@ services:
org.label-schema.description: "Docker image containing (often more complex, cross-application) jobs intended to be run by cronicle"
no.deichman.label.component-category: "Backend"
sms-proxy:
image: "digibib/proximity:${TAG:-latest}"
profiles:
- "include-build-only-services"
build:
context: proximity
labels:
<<: *common-labels
org.label-schema.name: "proximity"
org.label-schema.description: "Simple HTTPS proxy for debugging purposes"
no.deichman.label.component-category: "Backend"
# zookeeper:
# image: confluentinc/cp-zookeeper:latest
......
PREFIX : <http://data.deichman.no/ontology#>
SELECT DISTINCT ?resource
WHERE {
FILTER (?uri IN (__URI_LIST__))
?resource ?p ?uri
{
?resource ?p ?uri .
} UNION {
?resource :publicationOf ?work .
?work ?p ?uri .
}
FILTER(isIRI(?resource))
}
......@@ -115,13 +115,13 @@ patch-koha-production:
- /.*\.hotfix(\..*)?/
patch-mailrelay-production:
patch-sms-proxy-production:
extends:
- .production
- .ssh-setup
- .patch-prod
script:
make remote-patch-version CONTAINER=mailrelay TAG=${CI_COMMIT_TAG} ssh_servers="$SSH_SERVERS" ssh_user=$SSH_USER
make remote-patch-version CONTAINER=sms-proxy TAG=${CI_COMMIT_TAG} ssh_servers="$SSH_SERVERS" ssh_user=$SSH_USER
only:
#only creating this job for branches/tags named something.hotfix and optionally something.hotfix.somethingelse
- /.*\.hotfix(\..*)?/
......
......@@ -260,6 +260,17 @@ patch-virtuoso-staging:
- .patch
script:
make remote-patch-version CONTAINER=virtuoso TAG=${CI_COMMIT_TAG} ssh_servers="$SSH_SERVERS" ssh_user=$SSH_USER
only:
#only creating this job for branches/tags named something.hotfix and optionally something.hotfix.somethingelse
- /.*\.hotfix(\..*)?/
patch-sms-proxy-staging:
extends:
- .staging
- .ssh-setup
- .patch
script:
make remote-patch-version CONTAINER=sms-proxy TAG=${CI_COMMIT_TAG} ssh_servers="$SSH_SERVERS" ssh_user=$SSH_USER
only:
#only creating this job for branches/tags named something.hotfix and optionally something.hotfix.somethingelse
- /.*\.hotfix(\..*)?/
\ No newline at end of file
......@@ -214,6 +214,16 @@ deploy-skranke-test:
only:
changes: [ "Makefile", ".gitlab-ci.yml", "gitlab-ci/deploy/test.yml", "gitlab-ci/deploy-jobs.yml", "*.sh", "skranke/**/*"]
deploy-sms-proxy-test:
extends:
- .testdeploy
- .devtest
- .deploy-scp
variables:
APPLICATION_NAME: sms-proxy
only:
changes: [ "Makefile", ".gitlab-ci.yml", "gitlab-ci/deploy/test.yml", "gitlab-ci/deploy-jobs.yml", "*.sh", "proximity/**/*"]
deploy-test-ldap-test:
extends:
- .testdeploy
......@@ -579,3 +589,15 @@ patch-mailchimp-synchonizer-test:
only:
#only creating this job for branches/tags named something.hotfix and optionally something.hotfix.somethingelse
- /.*\.hotfix(\..*)?/
patch-sms-proxy-test:
extends:
- .testdeploy
- .devtest
- .ssh-setup
- .patch
script:
make remote-patch-version CONTAINER=sms-proxy TAG=${CI_COMMIT_TAG} ssh_servers="$SSH_SERVERS" ssh_user=$SSH_USER
only:
#only creating this job for branches/tags named something.hotfix and optionally something.hotfix.somethingelse
- /.*\.hotfix(\..*)?/
......@@ -249,6 +249,17 @@ push-mailrelay-latest:
- master
changes: [ "Makefile", ".gitlab-ci.yml", "*.sh", "mailrelay/**/*", "gitlab-ci/**/*.*"]
push-sms-proxy-latest:
extends:
- .push
when: on_success
variables:
APPLICATION_NAME: sms-proxy
only:
refs:
- master
changes: [ "Makefile", ".gitlab-ci.yml", "*.sh", "proximity/**/*", "gitlab-ci/**/*.*"]
push-test-ldap-latest:
extends:
- .push
......
......@@ -880,7 +880,7 @@ sub canItemBeRenewed {
if ($self->Deichman::Item::CanItemFillHold()) {
my $ignoreFound = 1;
try { $self->Deichman::Item::GetBiblioReserves($ignoreFound) };
if (scalar @{$self->{biblioHolds}} > $self->Deichman::Item::AvailableItemsCount()) {
if (scalar @{$self->{biblioHolds}} >= $self->Deichman::Item::AvailableItemsCount()) {
$self->{error} = Core::Exception::Circulation::RenewErrorWithMessage->new("on_hold");
return $self;
}
......
......@@ -131,77 +131,82 @@ sub GetExpanded {
my @items;
while (my $item = $sth->fetchrow_hashref() ) {
my $it = Deichman::Item->new();
$it->{item} = $item;
$it->Deichman::Spore::DB::GetLocation();
$it->Deichman::Spore::DB::CalculateDestination();
$it->Deichman::Spore::DB::GetLocationMeta($it->{destination}->{dest});
$it->Deichman::Spore::DB::GetLocationPoi($it->{destination}->{dest});
# DEICH-5814 replace homebranch with co branch if present
if (my $co = $it->{location}->{co}) {
$it->{item}->{homebranch} = substr($co, 0, index($co, "."));
}
# we assume item is available, countable and reservable by default
$item->{public_status} = "Ledig";
$item->{countable} = 1;
$item->{reservable} = 1;
# we assume item is available, countable and reservable by def$it->ault
$it->{item}->{public_status} = "Ledig";
$it->{item}->{countable} = 1;
$it->{item}->{reservable} = 1;
if ($item->{intransfer} || $item->{holdingbranch} ne $item->{homebranch}) {
$item->{public_status} = "Utlånt";
if ($it->{item}->{intransfer} || $it->{item}->{holdingbranch} ne $it->{item}->{homebranch}) {
$it->{item}->{public_status} = "Utlånt";
}
# Non reservable by item type or holding branch
if ( $item->{itype} =~ m/^(PERIODIKA|DAGSLAAN|UKESLAAN|10DLAAN|TOUKESLAAN)$/) {
$item->{reservable} = 0;
if ($it->{item}->{itype} =~ m/^(PERIODIKA|DAGSLAAN|UKESLAAN|10DLAAN|TOUKESLAAN)$/) {
$it->{item}->{reservable} = 0;
}
if (not $askingForKLBorrower and ($item->{itype} eq "SETT" or $item->{homebranch} eq 'hsko')) {
$item->{reservable} = 0;
if (not $askingForKLBorrower and ($it->{item}->{itype} eq "SETT" or $it->{item}->{homebranch} eq 'hsko')) {
$it->{item}->{reservable} = 0;
}
# On loan
if ($item->{onloan} || $item->{onhold}) {
$item->{public_status} = "Utlånt";
if ($it->{item}->{onloan} || $it->{item}->{onhold}) {
$it->{item}->{public_status} = "Utlånt";
}
my $notloan = $item->{notforloan};
my $notloan = $it->{item}->{notforloan};
if ($notloan) {
# -2 Bestilt
# -1 Til klargjøring
# 2 Til reparasjon
# 4 Til retting
if ($notloan == -2 || $notloan == -1 || $notloan == 2 || $notloan == 4 ) {
$item->{public_status} = "Utlånt";
$it->{item}->{public_status} = "Utlånt";
} elsif ($notloan == 8) { # Ikke til utlån
$item->{public_status} = "Ikke til hjemlån";
$item->{reservable} = 0;
if ($item->{onloan}) {
$item->{public_status} = "Ikke til hjemlån (utlånt)"
$it->{item}->{public_status} = "Ikke til hjemlån";
$it->{item}->{reservable} = 0;
if ($it->{item}->{onloan}) {
$it->{item}->{public_status} = "Ikke til hjemlån (utlånt)"
}
} elsif ($notloan == 1) { # Til internt bruk
$item->{public_status} = "Utilgjengelig";
$item->{countable} = 0;
$item->{reservable} = 0;
$it->{item}->{public_status} = "Utilgjengelig";
$it->{item}->{countable} = 0;
$it->{item}->{reservable} = 0;
}
}
# Not reservable, countable or available
if ($item->{itemlost} || $item->{damaged}) {
$item->{public_status} = "Utilgjengelig";
$item->{countable} = 0;
$item->{reservable} = 0;
if ($it->{item}->{itemlost} || $it->{item}->{damaged}) {
$it->{item}->{public_status} = "Utilgjengelig";
$it->{item}->{countable} = 0;
$it->{item}->{reservable} = 0;
}
# DEICH-5481
# Following lost-statuses are reservable and countable:
# 7 På hentehylle - avbestilt
# 9 På hentehylle - utgått
if ($item->{itemlost} and ($item->{itemlost} == 7 || $item->{itemlost} == 9)) {
$item->{countable} = 1;
$item->{reservable} = 1;
if ($it->{item}->{itemlost} and ($it->{item}->{itemlost} == 7 || $it->{item}->{itemlost} == 9)) {
$it->{item}->{countable} = 1;
$it->{item}->{reservable} = 1;
}
# TODO: Remove $item->{status} when no longer needed
$item->{status} = $item->{public_status};
my $fullitem = Deichman::Item->new();
$fullitem->{item} = $item;
$fullitem->Deichman::Spore::DB::GetLocation();
$fullitem->Deichman::Spore::DB::CalculateDestination();
$fullitem->Deichman::Spore::DB::GetLocationMeta($fullitem->{destination}->{dest});
$fullitem->Deichman::Spore::DB::GetLocationPoi($fullitem->{destination}->{dest});
my $outitem = $fullitem->{item};
$outitem->{newLocation} = $fullitem->{location};
$outitem->{newLocation}->{destination} = $fullitem->{destination};
# TODO: Remove $it->{item}->{status} when no longer needed
$it->{item}->{status} = $it->{item}->{public_status};
my $outitem = $it->{item};
$outitem->{newLocation} = $it->{location};
$outitem->{newLocation}->{destination} = $it->{destination};
push @items, $outitem;
}
......
......@@ -97,6 +97,33 @@ sub Find {
return $self;
}
sub FindByBirthdate {