Compare commits

...

40 Commits

Author SHA1 Message Date
Jonathan Druart a6ef152db9 Bug 21105: (follow-up) Regression tests 2 years ago
Martin Renvoize de75673d8a Bug 29408: Add JSDoc documentation for kohaTable function 2 years ago
Martin Renvoize 030db7cc8d Bug 29408: Update all existing uses of .api to .kohaTable 2 years ago
Martin Renvoize db4cec8498 Bug 29408: Rename Koha dataTables wrapper 2 years ago
Martin Renvoize f0ca6749c5 Bug 29405: Fix date_renewed attribute format in patron spec 2 years ago
Christophe Croullebois 0255f0cf2c Bug 29452: remove unnecessary warns in the logs 2 years ago
Marcel de Rooy aeb242dd15 Bug 29321: Remove a last without loop context 2 years ago
Kyle Hall 6fdf64e06b Bug 27145: Wrap delete and move_to_deleted in a transaction 3 years ago
Kyle Hall 83dcdf2a5a Bug 27145: Rethrow all other exceptions 3 years ago
Tomás Cohen Arazi 38f1901461 Bug 21105: (QA follow-up) Avoid MySQL-ism 2 years ago
Tomás Cohen Arazi 5cce101444 Bug 21105: (QA follow-up) Silence warning because of tests setup 2 years ago
Tomás Cohen Arazi 24c2fee5b4 Bug 21105: Regression tests 2 years ago
Rudolf Byker 0b3d856bc4 Bug 21105: oai.pl returns invalid earliestDatestamp 2 years ago
Marcel de Rooy 62bda478ab Bug 29460: Fix typo 'pendin g approval' 2 years ago
Marcel de Rooy 90c87b2ab2 Bug 29334: Do not apply defaultvalue to existing auth record 2 years ago
Marcel de Rooy 5e191e229e Bug 29146: Add test for editing existing item 2 years ago
Marcel de Rooy 35ad731102 Bug 29146: Same for item editor 2 years ago
Marcel de Rooy dc30d4c376 Bug 29146: Apply framework defaultvalue only to new records 2 years ago
Jonathan Druart 22392e4a61 Bug 29273: Remove warnings from plugin tests 2 years ago
Nick Clemens c7e2837c4e Bug 28627: Calculate unitprice if not set 2 years ago
Owen Leonard 95d3c30132 Bug 29255: Built-in offline circulation broken with SQL error 2 years ago
Kyle Hall e9bc90ebb0 Bug 29264: SIP config allows use of non-branchcode institution ids causes workers to die without responding 2 years ago
Joonas Kylmälä 3cca6f4440 Bug 29204: (QA follow-up) Fix variable name 2 years ago
Jonathan Druart 70f0d50d07 Bug 29204: Fix reports/issues_stats.pl for MySQL 8 2 years ago
Jonathan Druart ec3a354415 Bug 28374: DBRev 21.06.00.047 2 years ago
Tomás Cohen Arazi c559cdeec0 Bug 28374: (QA follow-up) Avoid adding duplicate USE 2 years ago
Martin Renvoize 5c6312b873 Bug 28374: Update existing notices 2 years ago
Martin Renvoize b1fbae1580 Bug 28374: Convert printreceipt to use GetPreparedLetter 2 years ago
Magnus Enger 88e9cca359 Bug 28994: Fix logical errors with amount vs amoutoutstanding 2 years ago
Tomás Cohen Arazi a4c44ac212 Bug 29183: (follow-up) Add x-koha-query option 2 years ago
Martin Renvoize c4d1b30276 Bug 29183: Add some documentation around query filtering 2 years ago
Marcel de Rooy 562e543c3e Bug 29330: (QA follow-up) Change to message/rfc822 2 years ago
Tomás Cohen Arazi 0d6ef70bb0 Bug 29330: (QA follow-up) Use passed MIME type 2 years ago
Tomás Cohen Arazi bbd700ce0b Bug 29330: Restore handling of serialized MIME messages in message_queue 2 years ago
Tomás Cohen Arazi c741692e14 Bug 29330: Add Koha::Email->new_from_string 2 years ago
Andreas Roussos 43a603d9cc Bug 29435: include missing subroutine from C4::AuthoritiesMarc 2 years ago
Owen Leonard 5b5b443d6c Bug 29459: Replace some missed datetimepickers in circulation templates with Flatpickr 2 years ago
Andrew Nugged 0d06aa52c6 Bug 28413: (QA follow-up) Fix for missing use Koha::Items 2 years ago
Jonathan Druart c44edf6f1c Bug 28376: (follow-up) Replace jQueryUI date/timepicker with Flatpickr 2 years ago
Jonathan Druart 02d094a36c Bug 27360: (follow-up) DBRev 21.06.00.041 2 years ago
  1. 100
      C4/Letters.pm
  2. 3
      C4/SIP/SIPServer.pm
  3. 2
      C4/SIP/Sip.pm
  4. 8
      C4/SIP/Sip/Configuration.pm
  5. 2
      Koha.pm
  6. 1
      Koha/BackgroundJob/BatchDeleteItem.pm
  7. 44
      Koha/Email.pm
  8. 17
      Koha/OAI/Server/Identify.pm
  9. 2
      Koha/UI/Form/Builder/Item.pm
  10. 1
      api/v1/swagger/definitions/patron.json
  11. 36
      api/v1/swagger/swagger.yaml
  12. 38
      authorities/authorities.pl
  13. 7
      cataloguing/addbiblio.pl
  14. 2
      installer/data/mysql/db_revs/210600041.pl
  15. 39
      installer/data/mysql/db_revs/210600047.pl
  16. 25
      installer/data/mysql/en/mandatory/sample_notices.yml
  17. 2
      installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
  18. 4
      koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc
  19. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
  20. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
  21. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
  22. 1
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
  23. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt
  24. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
  25. 50
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
  26. 10
      koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt
  27. 19
      koha-tmpl/intranet-tmpl/prog/en/modules/pos/printreceipt.tt
  28. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt
  29. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt
  30. 14
      koha-tmpl/intranet-tmpl/prog/js/datatables.js
  31. 16
      koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js
  32. 23
      members/deletemem.pl
  33. 6
      misc/cronjobs/writeoff_debts.pl
  34. 2
      offline_circ/download.pl
  35. 2
      opac/opac-authoritiesdetail.pl
  36. 3
      opac/opac-suggestions.pl
  37. 33
      pos/printreceipt.pl
  38. 6
      reports/issues_stats.pl
  39. 27
      t/Koha/Email.t
  40. 7
      t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t
  41. 2
      t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t
  42. 47
      t/db_dependent/Koha/Plugins/Broken.t
  43. 2
      t/db_dependent/Koha/Plugins/Circulation_hooks.t
  44. 2
      t/db_dependent/Koha/Plugins/Holds_hooks.t
  45. 2
      t/db_dependent/Koha/Plugins/Patron.t
  46. 23
      t/db_dependent/Koha/Plugins/Plugins.t
  47. 10
      t/db_dependent/Koha/UI/Form/Builder/Item.t
  48. 18
      t/db_dependent/OAI/Server.t
  49. 0
      t/lib/bad_plugins/Koha/Plugin/BrokenInstall.pm
  50. 0
      t/lib/bad_plugins/Koha/Plugin/BrokenUpgrade.pm
  51. 0
      t/lib/plugins/Koha/Plugin/BadAPIRoute.pm
  52. 0
      t/lib/plugins/Koha/Plugin/MarcFieldValues.pm
  53. 0
      t/lib/plugins/Koha/Plugin/Test.pm
  54. 0
      t/lib/plugins/Koha/Plugin/Test/Controller.pm
  55. 0
      t/lib/plugins/Koha/Plugin/TestItemBarcodeTransform.pm

100
C4/Letters.pm

@ -19,7 +19,6 @@ package C4::Letters;
use Modern::Perl;
use MIME::Lite;
use Carp qw( carp croak );
use Template;
use Module::Load::Conditional qw( can_load );
@ -41,6 +40,8 @@ use Koha::Patrons;
use Koha::SMTP::Servers;
use Koha::Subscriptions;
use constant SERIALIZED_EMAIL_CONTENT_TYPE => 'message/rfc822';
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ -955,7 +956,6 @@ sub EnqueueLetter {
$params->{'letter'} = _add_attachments(
{ letter => $params->{'letter'},
attachments => $params->{'attachments'},
message => MIME::Lite->new( Type => 'multipart/mixed' ),
}
);
}
@ -1219,45 +1219,50 @@ sub ResendMessage {
=head2 _add_attachements
_add_attachments({ letter => $letter, attachments => $attachments });
named parameters:
letter - the standard letter hashref
attachments - listref of attachments. each attachment is a hashref of:
type - the mime type, like 'text/plain'
content - the actual attachment
filename - the name of the attachment.
message - a MIME::Lite object to attach these to.
returns your letter object, with the content updated.
This routine picks the I<content> of I<letter> and generates a MIME
email, attaching the passed I<attachments> using Koha::Email. The
content is replaced by the string representation of the MIME object,
and the content-type is updated for later handling.
=cut
sub _add_attachments {
my $params = shift;
my $letter = $params->{'letter'};
my $attachments = $params->{'attachments'};
my $letter = $params->{letter};
my $attachments = $params->{attachments};
return $letter unless @$attachments;
my $message = $params->{'message'};
# First, we have to put the body in as the first attachment
$message->attach(
Type => $letter->{'content-type'} || 'TEXT',
Data => $letter->{'is_html'}
? _wrap_html($letter->{'content'}, $letter->{'title'})
: $letter->{'content'},
);
my $message = Koha::Email->new;
if ( $letter->{is_html} ) {
$message->html_body( _wrap_html( $letter->{content}, $letter->{title} ) );
}
else {
$message->text_body( $letter->{content} );
}
foreach my $attachment ( @$attachments ) {
$message->attach(
Type => $attachment->{'type'},
Data => $attachment->{'content'},
Filename => $attachment->{'filename'},
Encode::encode( "UTF-8", $attachment->{content} ),
content_type => $attachment->{type} || 'application/octet-stream',
name => $attachment->{filename},
disposition => 'attachment',
);
}
# we're forcing list context here to get the header, not the count back from grep.
( $letter->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) );
$letter->{'content-type'} =~ s/^Content-Type:\s+//;
$letter->{'content'} = $message->body_as_string;
$letter->{'content-type'} = SERIALIZED_EMAIL_CONTENT_TYPE;
$letter->{content} = $message->as_string;
return $letter;
@ -1389,21 +1394,37 @@ sub _send_message_by_email {
);
return;
};
my $email = try {
Koha::Email->create(
{
to => $to_address,
(
C4::Context->preference('NoticeBcc')
? ( bcc => C4::Context->preference('NoticeBcc') )
: ()
),
from => $from_address,
reply_to => $message->{'reply_address'} || $branch_replyto,
sender => $branch_returnpath,
subject => "" . $message->{subject}
my $email;
try {
my $params = {
to => $to_address,
(
C4::Context->preference('NoticeBcc')
? ( bcc => C4::Context->preference('NoticeBcc') )
: ()
),
from => $from_address,
reply_to => $message->{'reply_address'} || $branch_replyto,
sender => $branch_returnpath,
subject => "" . $message->{subject}
};
if ( $message->{'content_type'} && $message->{'content_type'} eq SERIALIZED_EMAIL_CONTENT_TYPE ) {
# The message has been previously composed as a valid MIME object
# and serialized as a string on the DB
$email = Koha::Email->new_from_string($content);
$email->create($params);
} else {
$email = Koha::Email->create($params);
if ($is_html) {
$email->html_body( _wrap_html( $content, $subject ) );
} else {
$email->text_body($content);
}
);
}
}
catch {
if ( ref($_) eq 'Koha::Exceptions::BadParameter' ) {
@ -1427,15 +1448,6 @@ sub _send_message_by_email {
};
return unless $email;
if ( $is_html ) {
$email->html_body(
_wrap_html( $content, $subject )
);
}
else {
$email->text_body( $content );
}
my $smtp_server;
if ( $library ) {
$smtp_server = $library->smtp_server;

3
C4/SIP/SIPServer.pm

@ -30,6 +30,9 @@ use base qw(Net::Server::PreFork);
use constant LOG_SIP => "local6"; # Local alias for the logging facility
set_logger( Koha::Logger->get( { interface => 'sip' } ) );
#
# Main # not really, since package SIPServer
#

2
C4/SIP/Sip.pm

@ -99,7 +99,7 @@ sub maybe_add {
return q{} if first { $_ eq $fid } @fields;
}
if ( $fid eq FID_SCREEN_MSG && $server->{account}->{screen_msg_regex} ) {
if ( $fid eq FID_SCREEN_MSG && $server->{account}->{screen_msg_regex} && defined($value)) {
foreach my $regex (
ref $server->{account}->{screen_msg_regex} eq "ARRAY"
? @{ $server->{account}->{screen_msg_regex} }

8
C4/SIP/Sip/Configuration.pm

@ -9,8 +9,10 @@ package C4::SIP::Sip::Configuration;
use strict;
use warnings;
use XML::Simple qw(:strict);
use List::Util qw(uniq);
use C4::SIP::Sip qw(siplog);
use Koha::Libraries;
my $parser = XML::Simple->new(
KeyAttr => {
@ -47,6 +49,12 @@ sub new {
}
$cfg->{listeners} = \%listeners;
my @branchcodes = Koha::Libraries->search()->get_column('branchcode');
my @institutions = uniq( keys %{ $cfg->{institutions} } );
foreach my $i ( @institutions ) {
siplog("LOG_ERR", "ERROR: Institution $i does does not match a branchcode. This can cause unexpected behavior.") unless grep( /^$i$/, @branchcodes );
}
return bless $cfg, $class;
}

2
Koha.pm

@ -29,7 +29,7 @@ use vars qw{ $VERSION };
# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
$VERSION = "21.06.00.046";
$VERSION = "21.06.00.047";
sub version {
return $VERSION;

1
Koha/BackgroundJob/BatchDeleteItem.pm

@ -28,6 +28,7 @@ use Try::Tiny;
use Koha::BackgroundJobs;
use Koha::DateUtils qw( dt_from_string );
use Koha::Items;
use base 'Koha::BackgroundJob';

44
Koha/Email.pm

@ -22,7 +22,9 @@ use Modern::Perl;
use Email::Address;
use Email::MessageID;
use Email::MIME;
use List::Util qw( pairs );
use Scalar::Util qw( blessed );
use Koha::Exceptions;
@ -38,6 +40,31 @@ Koha::Email - A wrapper around Email::Stuffer
=head2 Class methods
=head3 new_from_string
my $email = Koha::Email->new_from_string( $email_string );
Constructor for the Koha::Email class. The I<$email_string> (mandatory)
parameter will be parsed with I<Email::MIME>.
Note: I<$email_string> can be the produced by the I<as_string> method from
B<Koha::Email> or B<Email::MIME>.
=cut
sub new_from_string {
my ( $class, $email_string ) = @_;
Koha::Exceptions::MissingParameter->throw("Mandatory string parameter missing.")
unless $email_string;
my $self = $class->SUPER::new();
my $mime = Email::MIME->new( $email_string );
$self->{email} = $mime;
return $self;
}
=head3 create
my $email = Koha::Email->create(
@ -126,7 +153,22 @@ sub create {
$args->{bcc} = $addresses->{bcc}
if $addresses->{bcc};
my $email = $self->SUPER::new( $args );
my $email;
# FIXME: This is ugly, but aids backportability
# TODO: Remove this and move address and default headers handling
# to separate subs to be (re)used
if ( blessed($self) ) {
$email = $self;
$email->to( $args->{to} ) if $args->{to};
$email->from( $args->{from} ) if $args->{from};
$email->cc( $args->{cc} ) if $args->{cc};
$email->bcc( $args->{bcc} ) if $args->{bcc};
$email->reply_to( $args->{reply_to} ) if $args->{reply_to};
$email->subject( $args->{subject} ) if $args->{subject};
}
else {
$email = $self->SUPER::new( $args );
}
$email->header( 'Reply-To', $addresses->{reply_to} )
if $addresses->{reply_to};

17
Koha/OAI/Server/Identify.pm

@ -20,15 +20,20 @@
package Koha::OAI::Server::Identify;
use Modern::Perl;
use HTTP::OAI;
use C4::Context;
use Koha::DateUtils qw(dt_from_string);
use base ("HTTP::OAI::Identify");
sub new {
my ($class, $repository) = @_;
my ($baseURL) = $repository->self_url() =~ /(.*)\?.*/;
my $baseURL = $repository->self_url();
$baseURL = $+{base_url}
if $baseURL =~ m/(?<base_url>.*)\?.*/;
my $self = $class->SUPER::new(
baseURL => $baseURL,
repositoryName => C4::Context->preference("LibraryName"),
@ -54,8 +59,14 @@ sub new {
# will be returned and we will report the fallback 0001-01-01.
sub _get_earliest_datestamp {
my $dbh = C4::Context->dbh;
my ( $earliest ) = $dbh->selectrow_array("SELECT MIN(timestamp) AS earliest FROM biblio" );
return $earliest
# We do not need to perform timezone conversion here, because the time zone
# is set to UTC for the entire SQL session in Koha/OAI/Server/Repository.pm
my ( $earliest ) = $dbh->selectrow_array(q{
SELECT MIN(timestamp) AS earliest
FROM biblio
});
return dt_from_string( $earliest, 'sql' )->strftime('%FT%TZ');
}
1;

2
Koha/UI/Form/Builder/Item.pm

@ -119,7 +119,7 @@ sub generate_subfield_form {
$subfield->{kohafield} || 'items.more_subfields_xml';
if ( $prefill_with_default_values && ( !defined($value) || $value eq '' ) ) {
$value = $subfield->{defaultvalue};
$value = $subfield->{defaultvalue} if !$item->{itemnumber}; # apply defaultvalue only to new items
if ($value) {
# get today date & replace <<YYYY>>, <<YY>>, <<MM>>, <<DD>> if provided in the default value

1
api/v1/swagger/definitions/patron.json

@ -144,6 +144,7 @@
},
"date_renewed": {
"type": ["string", "null"],
"format": "date",
"description": "date the patron's card was last renewed"
},
"incorrect_address": {

36
api/v1/swagger/swagger.yaml

@ -48,6 +48,42 @@ info:
Note: Some routes might offer additional attributes in their error responses but that's
subject to change and thus not documented.
## Filtering responses
The API allows for some advanced response filtering using a JSON based query syntax. The
query can be added to the requests:
* as a query parameter `q=`
* in the request body
* in a special header `x-koha-query`
For simple field equality matches we can use `{ "fieldname": "value" }` where the fieldname
matches one of the fields as described in the particular endpoints response object.
We can refine that with more complex matching clauses by nesting a the clause into the
object; `{ "fieldname": { "clause": "value" } }`.
Available matching clauses include ">", "<", ">=", "<=", "-like", and "-not_like".
We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH`
level will result in an 'AND' query, whilst combinding them in an `ARRAY` wilth result in an
'OR' query: `{ "field1": 'value2', "field2": "value2" }` will filter the response to only those
results with both field1 containing value2 AND field2 containing value2 for example.
### Examples
The following request would return any patron with firstname "Henry" and lastname "Acevedo";
`curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/' --data-raw '{ "surname": "Acevedo", "firstname": "Henry" }'`
The following request would return any patron whose lastname begins with "Ace";
`curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/' --data-raw '{ "surname": { "-like": "Ace%" }'`
The following request would return any patron whilse lastname is 'Acevedo' OR 'Bernardo'
`curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/' --data-raw '{ "surname": [ "Acevedo", "Bernardo" ] }'`
## Special headers
### x-koha-library

38
authorities/authorities.pl

@ -36,7 +36,6 @@ use vars qw( $tagslib);
use vars qw( $authorised_values_sth);
use vars qw( $is_a_modif );
my $itemtype; # created here because it can be used in build_authorized_values_list sub
our($authorised_values_sth,$is_a_modif,$usedTagsLib,$mandatory_z3950);
=head1 FUNCTIONS
@ -70,50 +69,34 @@ sub build_authorized_values_list {
my @authorised_values;
my %authorised_lib;
#---- branch
my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
push @authorised_values, q{} unless $tagslib->{$tag}->{$subfield}->{mandatory} && $value;
if ( $category eq "branches" ) {
my $sth =
$dbh->prepare(
"select branchcode,branchname from branches order by branchname");
my $sth = $dbh->prepare( "select branchcode,branchname from branches order by branchname" );
$sth->execute;
push @authorised_values, ""
unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
push @authorised_values, $branchcode;
$authorised_lib{$branchcode} = $branchname;
}
}
elsif ( $category eq "itemtypes" ) {
push @authorised_values, ""
unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
&& ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
my $itemtype;
my $itemtypes = Koha::ItemTypes->search_with_localization;
while ( $itemtype = $itemtypes->next ) {
while ( my $itemtype = $itemtypes->next ) {
push @authorised_values, $itemtype->itemtype;
$authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
}
$value = $itemtype unless ($value);
#---- "true" authorised value
}
else {
else { # "true" authorised value
$authorised_values_sth->execute(
$tagslib->{$tag}->{$subfield}->{authorised_value} );
push @authorised_values, ""
unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
&& ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
$tagslib->{$tag}->{$subfield}->{authorised_value}
);
while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
push @authorised_values, $value;
$authorised_lib{$value} = $lib;
}
}
return {
type => 'select',
id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
@ -125,7 +108,6 @@ sub build_authorized_values_list {
};
}
=item create_input
builds the <input ...> entry for a subfield.
@ -133,7 +115,7 @@ builds the <input ...> entry for a subfield.
=cut
sub create_input {
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi ) = @_;
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth, $cgi ) = @_;
my $index_subfield = CreateKey(); # create a specifique key for each subfield
@ -147,7 +129,7 @@ sub create_input {
# if there is no value provided but a default value in parameters, get it
if ($value eq '') {
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} if !$cgi->param('authid'); # only for new records
if (!defined $value) {
$value = q{};
}

7
cataloguing/addbiblio.pl

@ -288,8 +288,9 @@ sub create_input {
my $index_subfield = CreateKey(); # create a specifique key for each subfield
# if there is no value provided but a default value in parameters, get it
if ( $value eq '' ) {
# Apply optional framework default value when it is a new record
# Substitute date parts, user name
if ( $value eq '' && !$cgi->param('biblionumber') ) {
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{};
# get today date & replace <<YYYY>>, <<YY>>, <<MM>>, <<DD>> if provided in the default value
@ -305,8 +306,8 @@ sub create_input {
# And <<USER>> with surname (?)
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian");
$value=~s/<<USER>>/$username/g;
}
my $dbh = C4::Context->dbh;
# map '@' as "subfield" label for fixed fields

2
installer/data/mysql/db_revs/210600041.pl

@ -9,7 +9,7 @@ return {
unless ( column_exists('branches', 'public') ) {
$dbh->do(q{
ALTER TABLE branches ADD public tinyint DEFAULT 1 AFTER pickup_location
ALTER TABLE branches ADD public tinyint(1) NOT NULL DEFAULT 1 AFTER pickup_location
});
}
},

39
installer/data/mysql/db_revs/210600047.pl

@ -0,0 +1,39 @@
use Modern::Perl;
return {
bug_number => "28374",
description => "Update point of sale print receipt",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{
UPDATE letter
SET content = CONCAT('[% USE KohaDates %][% USE Branches %][% USE Price %]', content),
is_html = 1
WHERE code = 'RECEIPT'
AND content NOT LIKE '%[\% USE KohaDates \%][\% USE Branches \%][\% USE Price \%]%';
});
say $out "Added KohaDates, Branches and Price plugins";
$dbh->do(q{
UPDATE letter SET content = REPLACE(content, 'payment.', 'credit.') WHERE code = 'RECEIPT';
});
say $out "Replaced 'payment' with 'credit' param in RECEIPT template";
$dbh->do(q{
UPDATE letter SET content = REPLACE(content, 'offsets', 'credit.debits') WHERE code = 'RECEIPT';
});
say $out "Replaced 'offsets' with 'credit.debits' param in RECEIPT template";
$dbh->do(q{
UPDATE letter SET content = REPLACE(content, 'offset', 'debit') WHERE code = 'RECEIPT';
});
say $out "Replaced 'offset' with 'debit' param in RECEIPT template";
$dbh->do(q{
UPDATE letter SET content = REPLACE(content, 'debit.debit', 'debit') WHERE code = 'RECEIPT';
});
say $out "Replaced 'debit.debit' with 'debit' param in RECEIPT template";
},
}

25
installer/data/mysql/en/mandatory/sample_notices.yml

@ -1113,11 +1113,14 @@ tables:
code: RECEIPT
branchcode: ""
name: "Point of sale receipt"
is_html: 0
is_html: 1
title: "Receipt"
message_transport_type: print
lang: default
content:
- "[% USE KohaDates %]"
- "[% USE Branches %]"
- "[% USE Price %]"
- "[% PROCESS \"accounts.inc\" %]"
- "<table>"
- "[% IF ( LibraryName ) %]"
@ -1129,24 +1132,24 @@ tables:
- "[% END %]"
- " <tr>"
- " <th colspan=\"2\" class=\"centerednames\">"
- " <h2>[% Branches.GetName( payment.branchcode ) | html %]</h2>"
- " <h2>[% Branches.GetName( credit.branchcode ) | html %]</h2>"
- " </th>"
- " </tr>"
- "<tr>"
- " <th colspan=\"2\" class=\"centerednames\">"
- " <h3>[% payment.date | $KohaDates %]</h3>"
- " <h3>[% credit.date | $KohaDates %]</h3>"
- "</tr>"
- "<tr>"
- " <td>Transaction ID: </td>"
- " <td>[% payment.accountlines_id %]</td>"
- " <td>[% credit.accountlines_id %]</td>"
- "</tr>"
- "<tr>"
- " <td>Operator ID: </td>"
- " <td>[% payment.manager_id %]</td>"
- " <td>[% credit.manager_id %]</td>"
- "</tr>"
- "<tr>"
- " <td>Payment type: </td>"
- " <td>[% payment.payment_type %]</td>"
- " <td>[% credit.payment_type %]</td>"
- "</tr>"
- " <tr></tr>"
- " <tr>"
@ -1160,17 +1163,17 @@ tables:
- " <th>Amount</th>"
- " </tr>"
- ""
- " [% FOREACH offset IN offsets %]"
- " [% FOREACH debit IN credit.debits %]"
- " <tr>"
- " <td>[% PROCESS account_type_description account=offset.debit %]</td>"
- " <td>[% offset.amount * -1 | $Price %]</td>"
- " <td>[% PROCESS account_type_description account=debit %]</td>"
- " <td>[% debit.amount * -1 | $Price %]</td>"
- " </tr>"
- " [% END %]"
- ""
- "<tfoot>"
- " <tr class=\"highlight\">"
- " <td>Total: </td>"
- " <td>[% payment.amount * -1| $Price %]</td>"
- " <td>[% credit.amount * -1| $Price %]</td>"
- " </tr>"
- " <tr>"
- " <td>Tendered: </td>"
@ -1357,7 +1360,7 @@ tables:
message_transport_type: email
lang: default
content:
- "<h3>Suggestion pendin g approval</h3>"
- "<h3>Suggestion pending approval</h3>"
- " <p><h4>Suggested by</h4>"
- " <ul>"
- " <li><<borrowers.firstname>> <<borrowers.surname>></li>"

2
installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql

@ -27,7 +27,7 @@ VALUES
('members', 'PROBLEM_REPORT','OPAC problem report','OPAC problem report','Username: <<problem_reports.username>>\n\nProblem page: <<problem_reports.problempage>>\n\nTitle: <<problem_reports.title>>\n\nMessage: <<problem_reports.content>>','email');
INSERT INTO `letter` (module, code, name, title, content, is_html, message_transport_type)
VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','<h3>Suggestion pendin g approval</h3>
VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','<h3>Suggestion pending approval</h3>
<p><h4>Suggested by</h4>
<ul>
<li><<borrowers.firstname>> <<borrowers.surname>></li>

4
koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc

@ -10,8 +10,8 @@
<td colspan="3">
[% END %]
<div class="date-select">
<p><label for="newduedate">Renewal due date:</label> <input type="text" size="12" id="newduedate" name="newduedate" value="" /></p>
<p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="12" name="newonholdduedate" value="" /></p>
<p><label for="newduedate">Renewal due date:</label> <input type="text" size="20" id="newduedate" name="newduedate" value="" /></p>
<p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="20" name="newonholdduedate" value="" /></p>
<p><label for="exemptfine">Forgive fines on return:</label> <input type="checkbox" id="exemptfine" name="exemptfine" value="1" /></p>
</div>
</td>

6
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt

@ -377,9 +377,11 @@
<li>
<label for="unitprice">Actual cost:</label>
[% IF (invoiceincgst) %]
<input type="text" size="20" name="unitprice" id="unitprice" value="[% order.unitprice_tax_included | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span>
[% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_included : order.ecost_tax_included %]
<input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span>
[% ELSE %]
<input type="text" size="20" name="unitprice" id="unitprice" value="[% order.unitprice_tax_excluded | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span>
[% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_excluded : order.ecost_tax_excluded %]
<input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span>
[% END %]
<label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
</li>

2
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt

@ -377,7 +377,7 @@
}));
}
var pending_orders_table = $("#pending_orders").api({
var pending_orders_table = $("#pending_orders").kohaTable({
"ajax": {
"url": '/api/v1/acquisitions/orders?only_active=1'
},

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt

@ -345,7 +345,7 @@ Libraries &rsaquo; Administration &rsaquo; Koha
$(document).ready(function() {
var libraries_url = '/api/v1/libraries';
var libraries = $("#libraries").api({
var libraries = $("#libraries").kohaTable({
"ajax": {
"url": libraries_url
},

1
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt

@ -683,7 +683,6 @@
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% Asset.js("js/messaging-preference-form.js") | $raw %]
[% Asset.js("lib/flatpickr/flatpickr.min.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt

@ -227,7 +227,7 @@
cities_table_url += 'q='+ encodeURIComponent(JSON.stringify(city_name_filter));
[% END %]
var cities_table = $("#table_cities").api({
var cities_table = $("#table_cities").kohaTable({
"ajax": {
"url": cities_table_url
},

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt

@ -298,7 +298,7 @@
$(document).ready(function() {
var smtp_servers_url = '/api/v1/config/smtp_servers';
window.smtp_servers = $("#smtp_servers").api({
window.smtp_servers = $("#smtp_servers").kohaTable({
"ajax": {
"url": smtp_servers_url
},

50
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

@ -808,11 +808,8 @@
<div class="date-select" id="return_date_override_fields">
<div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
<input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
<input type="text" size="20" class="pastdate" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
<button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
<div class="circ-setting">
[% IF ( return_date_override_remember ) %]
<input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" checked="checked" />
@ -1041,44 +1038,15 @@
"dom": 'B<"clearfix">t',
}, columns_settings);
$("#return_date_override").datetimepicker({
onClose: function(dateText, inst) {
if (validate_date(dateText, inst) ) {
$("#barcode").focus();
}
},
defaultDate: -1,
hour: 23,
minute: 59,
maxDate: 0
}).on("change", function(e, value) {
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
});
$("#return_date_override").on("blur", function() {
check_valid_return_date();
});
$("#checkin-form").submit(function( event ) {
if ( !check_valid_return_date() ) {
event.preventDefault();
$("#return_date_override").flatpickr({
enableTime: true,
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
maxDate: "today",
onClose: function() {
$("#barcode").focus();
}
});
function check_valid_return_date() {
if ( $("#return_date_override").val() ) {
var datetime = DateTime_from_syspref( $("#return_date_override").val() );
var now = new Date();
if ( !datetime || datetime > now ) {
alert("Invalid return date/time!");
$("#return_date_override").val("")
return false;
}
}
// Add saved date information to onscreen message, which
// may or may not be hidden
$("#saved_return_date").text( $("#return_date_override").val() );
return true;
}
$("#exemptcheck").change(function () {
if (this.checked == true) {
$("#barcode").addClass("input-warning");
@ -1089,22 +1057,22 @@
}
$("#barcode").focus();
});
$("#dropboxcheck").change(function () {
if (this.checked == true) {
$("#barcode").addClass("input-warning");
$("#dropboxmode").show();
$("#return_date_override_fields :input").prop('disabled', true);
$("#return_date_override").datetimepicker("disable");
} else {
$("#barcode").removeClass("input-warning");
$("#dropboxmode").hide();
$("#return_date_override_fields :input").prop('disabled', false);
$("#return_date_override").datetimepicker("enable");
}
$("#barcode").focus();
});
$("#forgivemanualholdsexpire").change(function () {
if (this.checked == true) {
$("#barcode").addClass("input-warning");

10
koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt

@ -839,12 +839,12 @@
var prefilters = '[% prefilters | $raw %]';
// Set column settings
var columns_settings = [% TablesSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %];
$("#ill_checkout_duedate_input").datetimepicker({
hour: 23,
minute: 59
}).on("change", function(e, value) {
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
$("#ill_checkout_duedate_input").flatpickr({
enableTime: true,
dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
});
[% IF services_json.length > 0 %]
var services = [% services_json | $raw %];
[% ELSE %]

19
koha-tmpl/intranet-tmpl/prog/en/modules/pos/printreceipt.tt

@ -1,14 +1,15 @@
[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% USE Price %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Print receipt</title>
[% INCLUDE 'doc-head-close.inc' %]
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
[% INCLUDE 'blocking_errors.inc' %]
</head>
@ -16,7 +17,17 @@
<body id="pat_printfeercpt" class="pat">
<div id="receipt">
[% letter.content | $raw | evaltt %]
[% IF slip %]
[% IF plain %]
<pre>
[% slip | html %]
</pre>
[% ELSE %]
[% slip | $raw %]
[% END %]
[% ELSE %]
No print template found
[% END %]
</div>
[% MACRO jsinclude BLOCK %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt

@ -425,7 +425,7 @@
var cashups_table_url = "/api/v1/cash_registers/[% register.id | html %]/cashups?";
var cashups_table = $("#table_cashups").api({
var cashups_table = $("#table_cashups").kohaTable({
"ajax": {
"url": cashups_table_url
},

2
koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt

@ -156,7 +156,7 @@
$(document).ready(function() {
var quotes_url = '/api/v1/quotes';
var quotes = $("#quotes").api({
var quotes = $("#quotes").kohaTable({
"ajax": {
"url": quotes_url
},

14
koha-tmpl/intranet-tmpl/prog/js/datatables.js

@ -517,7 +517,19 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
(function($) {
$.fn.api = function(options, columns_settings, add_filters, default_filters) {
/**
* Create a new dataTables instance that uses the Koha RESTful API's as a data source
* @param {Object} options Please see the dataTables documentation for further details
* We extend the options set with the `criteria` key which allows
* the developer to select the match type to be applied during searches
* Valid keys are: `contains`, `starts_with`, `ends_with` and `exact`
* @param {Object} column_settings The arrayref as returned by TableSettings.GetColums function available
* from the columns_settings template toolkit include
* @param {Boolean} add_filters Add a filters row as the top row of the table
* @param {Object} default_filters Add a set of default search filters to apply at table initialisation
* @return {Object} The dataTables instance
*/
$.fn.kohaTable = function(options, columns_settings, add_filters, default_filters) {
var settings = null;
if ( add_filters ) {

16
koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js

@ -29,17 +29,6 @@ $(document).ready(function() {
radioCheckBox($(this));
});
$("#newduedate, #newonholdduedate input").datetimepicker({
onClose: function(dateText, inst) {
validate_date(dateText, inst);
},
minDate: 1, // require that renewal date is after today
hour: 23,
minute: 59
}).on("change", function(e) {
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
});