diff --git a/C4/Letters.pm b/C4/Letters.pm
index a06f006ee1..87b82624c6 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -794,12 +794,12 @@ sub _parseletter_sth {
($table eq 'aqorders' ) ? "SELECT * FROM $table WHERE ordernumber = ?" :
($table eq 'aqbasket' ) ? "SELECT * FROM $table WHERE basketno = ?" :
($table eq 'illrequests' ) ? "SELECT * FROM $table WHERE illrequest_id = ?" :
- ($table eq 'opac_news' ) ? "SELECT * FROM $table WHERE idnew = ?" :
($table eq 'article_requests') ? "SELECT * FROM $table WHERE id = ?" :
($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" :
($table eq 'subscription') ? "SELECT * FROM $table WHERE subscriptionid = ?" :
($table eq 'serial') ? "SELECT * FROM $table WHERE serialid = ?" :
($table eq 'problem_reports') ? "SELECT * FROM $table WHERE reportid = ?" :
+ ($table eq 'additional_contents' || $table eq 'opac_news') ? "SELECT * FROM additional_contents WHERE idnew = ?" :
undef ;
unless ($query) {
warn "ERROR: No _parseletter_sth query for table '$table'";
@@ -1682,8 +1682,14 @@ sub _get_tt_params {
plural => 'items',
pk => 'itemnumber',
},
+ additional_contents => {
+ module => 'Koha::AdditionalContents',
+ singular => 'additional_content',
+ plural => 'additional_contents',
+ pk => 'idnew',
+ },
opac_news => {
- module => 'Koha::News',
+ module => 'Koha::AdditionalContents',
singular => 'news',
plural => 'news',
pk => 'idnew',
diff --git a/C4/Members.pm b/C4/Members.pm
index 73b254cb5e..210a9ea0de 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -33,7 +33,7 @@ use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Database;
use Koha::Holds;
-use Koha::News;
+use Koha::AdditionalContents;
use Koha::Patrons;
use Koha::Patron::Categories;
@@ -490,7 +490,7 @@ sub GetBorrowersToExpunge {
- <>
+ <>
ISSUEQSLIP:
@@ -582,10 +582,14 @@ sub IssueSlip {
issues => $all,
};
}
- my $news = Koha::News->search_for_display({
- location => 'slip',
+ my $news = Koha::AdditionalContents->search_for_display(
+ {
+ category => 'news',
+ location => 'slip',
+ lang => $patron->lang,
library_id => $branch,
- });
+ }
+ );
my @news;
while ( my $n = $news->next ) {
my $all = $n->unblessed_all_relateds;
@@ -597,7 +601,7 @@ sub IssueSlip {
$all->{timestamp} = $published_on_dt;
push @news, {
- opac_news => $all,
+ additional_contents => $all,
};
}
$letter_code = 'ISSUESLIP';
@@ -609,7 +613,8 @@ sub IssueSlip {
%loops = (
issues => [ map { $_->{issues}{itemnumber} } @checkouts ],
overdues => [ map { $_->{issues}{itemnumber} } @overdues ],
- opac_news => [ map { $_->{opac_news}{idnew} } @news ],
+ opac_news => [ map { $_->{additional_contents}{idnew} } @news ],
+ additional_contents => [ map { $_->{additional_contents}{idnew} } @news ],
);
}
diff --git a/Koha/NewsItem.pm b/Koha/AdditionalContent.pm
similarity index 83%
rename from Koha/NewsItem.pm
rename to Koha/AdditionalContent.pm
index 152e777023..c0c321458f 100644
--- a/Koha/NewsItem.pm
+++ b/Koha/AdditionalContent.pm
@@ -1,4 +1,4 @@
-package Koha::NewsItem;
+package Koha::AdditionalContent;
# Copyright ByWater Solutions 2015
#
@@ -29,9 +29,7 @@ use base qw(Koha::Object);
=head1 NAME
-Koha::NewsItem - Koha News Item object class
-
-Koha::NewsItem represents a single piece of news from the opac_news table
+Koha::AdditionalContent - Koha Additional content object class
=head1 API
@@ -41,9 +39,9 @@ Koha::NewsItem represents a single piece of news from the opac_news table
=head3 author
- $newsitem->author;
+ $additional_content->author;
-Return the Koha::Patron object for the patron who authored this news item
+Return the Koha::Patron object for the patron who authored this additional content
=cut
@@ -56,9 +54,9 @@ sub author {
=head3 is_expired
-my $is_expired = $news_item->is_expired;
+my $is_expired = $additional_content->is_expired;
-Returns 1 if the news item is expired or 0;
+Returns 1 if the additional content is expired or 0;
=cut
@@ -72,7 +70,7 @@ sub is_expired {
=head3 library
-my $library = $news_item->library;
+my $library = $additional_content->library;
Returns Koha::Library object or undef
@@ -92,7 +90,7 @@ sub library {
=cut
sub _type {
- return 'OpacNews';
+ return 'AdditionalContent';
}
=head1 AUTHOR
diff --git a/Koha/AdditionalContents.pm b/Koha/AdditionalContents.pm
new file mode 100644
index 0000000000..fa32aa6318
--- /dev/null
+++ b/Koha/AdditionalContents.pm
@@ -0,0 +1,134 @@
+package Koha::AdditionalContents;
+
+# Copyright ByWater Solutions 2015
+#
+# 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.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see .
+
+use Modern::Perl;
+
+use Koha::Database;
+use Koha::Exceptions;
+use Koha::AdditionalContent;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::AdditionalContents - Koha Additional content object set class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 search_for_display
+
+my $contents = Koha::AdditionalContents->search_for_display({
+ category => 'news', # news or html_customizations
+ location => 'slip',
+ lang => 'es-ES',
+ library_id => $branchcode
+})
+
+Return Koha::AdditionalContents set for display to user
+
+You can limit the results by location, language and library by optional params
+
+library_id should be valid branchcode of defined library
+
+location is one of this:
+- slip - for ISSUESLIP notice
+- staff_only - for intranet
+- opac_only - for OPAC
+- staff_and_opac - for intranet and online catalogue
+- OpacNavRight - Right column in the online catalogue
+- opacheader
+- OpacCustomSearch
+- OpacMainUserBlock
+- opaccredits
+- OpacLoginInstructions
+- OpacSuggestionInstructions
+- ArticleRequestsDisclaimerText
+
+=cut
+
+sub search_for_display {
+ my ( $self, $params ) = @_;
+
+ my $search_params;
+ $search_params->{location} = $params->{location};
+ $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id};
+ $search_params->{published_on} = { '<=' => \'NOW()' };
+ $search_params->{-or} = [ expirationdate => { '>=' => \'NOW()' },
+ expirationdate => undef ];
+
+ if ( $params->{lang} ) {
+ # FIXME I am failing to translate the following query
+ # SELECT a1.category, a1.code, COALESCE(a2.title, a1.title)
+ # FROM additional_contents a1
+ # LEFT JOIN additional_contents a2 on a1.code=a2.code AND a2.lang="es-ES"
+ # WHERE a1.lang = 'default';
+
+ # So we are retrieving the code with a translated content, then the other ones
+ my $translated_contents =
+ $self->SUPER::search( { %$search_params, lang => $params->{lang} } );
+ my $default_contents = $self->SUPER::search(
+ {
+ %$search_params,
+ lang => 'default',
+ code =>
+ { '-not_in' => [ $translated_contents->get_column('code') ] }
+ }
+ );
+
+ return $self->SUPER::search(
+ {
+ idnew => [
+ $translated_contents->get_column('idnew'),
+ $default_contents->get_column('idnew')
+ ]
+ },
+ { order_by => 'number' }
+ );
+ }
+
+ return $self->SUPER::search({%$search_params, lang => 'default'}, { order_by => 'number'});
+}
+
+=head3 _type
+
+=cut
+
+sub _type {
+ return 'AdditionalContent';
+}
+
+=head3 object_class
+
+=cut
+
+sub object_class {
+ return 'Koha::AdditionalContent';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall
+
+=cut
+
+1;
diff --git a/Koha/Manual.pm b/Koha/Manual.pm
index a69c079806..30a815545e 100644
--- a/Koha/Manual.pm
+++ b/Koha/Manual.pm
@@ -215,7 +215,7 @@ our $mapping = {
'tools/holidays' => '/tools.html#calendar',
'tools/import_borrowers' => '/tools.html#patron-import',
'tools/inventory' => '/tools.html#inventory-stocktaking',
- 'tools/koha-news' => '/tools.html#news',
+ 'tools/additional-contents' => '/tools.html#news', # FIXME Needs a change to the manual
'tools/letter' => '/tools.html#notices-slips',
'tools/manage-marc-import' => '/tools.html#staged-marc-record-management',
'tools/marc_modification_templates' => '/tools.html#marc-modification-templates',
diff --git a/Koha/News.pm b/Koha/News.pm
deleted file mode 100644
index 5bb78a6a30..0000000000
--- a/Koha/News.pm
+++ /dev/null
@@ -1,114 +0,0 @@
-package Koha::News;
-
-# Copyright ByWater Solutions 2015
-#
-# 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.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see .
-
-use Modern::Perl;
-
-
-use Koha::Database;
-use Koha::Exceptions;
-use Koha::NewsItem;
-
-use base qw(Koha::Objects);
-
-=head1 NAME
-
-Koha::News - Koha News object set class
-
-=head1 API
-
-=head2 Class Methods
-
-=cut
-
-=head3 search_for_display
-
-my $news = Koha::News->search_for_display({
- location => 'slip',
- lang => 'en',
- library_id => $branchcode
-})
-
-Return Koha::News set for display to user
-
-You can limit the results by location, language and library by optional params
-
-library_id should be valid branchcode of defined library
-
-type is one of this:
-- slip - for ISSUESLIP notice
-- koha - for intranet
-- opac - for online catalogue
-- OpacNavRight - Right column in the online catalogue
-- OpacLoginInstructions
-- OpacMainUserBlock
-- OpacCustomSearch
-- opacheader
-- opaccredits
-
-lang is language code - it is used only when type is opac or any of OPAC locations
-
-=cut
-
-sub search_for_display {
- my ( $self, $params ) = @_;
-
- my $search_params;
- if ($params->{location} ) {
- if ( $params->{location} eq 'slip' || $params->{location} eq 'koha') {
- $search_params->{lang} = [ $params->{location}, '' ];
- } elsif ( $params->{location} eq 'opac' && $params->{lang} ) {
- $search_params->{lang} = [ $params->{lang}, '' ];
- } elsif ( $params->{lang} ) {
- $search_params->{lang} = $params->{location} . '_' . $params->{lang};
- } else {
- Koha::Exceptions::BadParameter->throw("The location ($params->{location}) and lang ($params->{lang}) parameters combination is not valid");
- }
- }
-
- $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id};
- $search_params->{published_on} = { '<=' => \'NOW()' };
- $search_params->{-or} = [ expirationdate => { '>=' => \'NOW()' },
- expirationdate => undef ];
-
- return $self->SUPER::search($search_params, { order_by => 'number' });
-}
-
-=head3 _type
-
-=cut
-
-sub _type {
- return 'OpacNews';
-}
-
-=head3 object_class
-
-=cut
-
-sub object_class {
- return 'Koha::NewsItem';
-}
-
-=head1 AUTHOR
-
-Kyle M Hall
-
-=cut
-
-1;
diff --git a/Koha/Template/Plugin/KohaNews.pm b/Koha/Template/Plugin/AdditionalContents.pm
similarity index 61%
rename from Koha/Template/Plugin/KohaNews.pm
rename to Koha/Template/Plugin/AdditionalContents.pm
index 75669de861..c37abece4e 100644
--- a/Koha/Template/Plugin/KohaNews.pm
+++ b/Koha/Template/Plugin/AdditionalContents.pm
@@ -1,4 +1,4 @@
-package Koha::Template::Plugin::KohaNews;
+package Koha::Template::Plugin::AdditionalContents;
# Copyright ByWater Solutions 2012
# Copyright BibLibre 2014
@@ -26,31 +26,32 @@ use base qw( Template::Plugin );
use C4::Koha;
use C4::Context;
-use Koha::News;
+use Koha::AdditionalContents;
sub get {
my ( $self, $params ) = @_;
- my $display_location = $params->{location};
+ my $category = $params->{category};
+ my $location = $params->{location};
my $blocktitle = $params->{blocktitle};
- my $lang = $params->{lang} || 'en';
- my $library = $params->{library};
+ my $lang = $params->{lang} || 'default';
+ my $library = $params->{library};
- my $content = Koha::News->search_for_display({
- location => $display_location,
- lang => $lang,
+ my $content = Koha::AdditionalContents->search_for_display(
+ {
+ category => $category,
+ location => $location,
+ lang => $lang,
library_id => $library,
- });
+ }
+ );
-
- if( $content->count ){
+ if ( $content->count ) {
return {
- content => $content,
- location => $display_location,
+ content => $content,
+ location => $location,
blocktitle => $blocktitle
};
- } else {
- return;
}
}
@@ -58,20 +59,20 @@ sub get {
=head1 NAME
-Koha::Template::Plugin::KohaNews - TT Plugin for displaying Koha news
+Koha::Template::Plugin::AdditionalContents - TT Plugin for displaying additional contents
=head1 SYNOPSIS
-[% USE KohaNews %]
+[% USE AdditionalContents %]
-[% KohaNews.get() %]
+[% AdditionalContents.get() %]
=head1 ROUTINES
=head2 get
In a template, you can get the all categories with
-the following TT code: [% KohaNews.get() %]
+the following TT code: [% AdditionalContents.get() %]
=head1 AUTHOR
diff --git a/installer/data/mysql/atomicupdate/bug_24387.perl b/installer/data/mysql/atomicupdate/bug_24387.perl
new file mode 100644
index 0000000000..26e3681ae8
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_24387.perl
@@ -0,0 +1,139 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+
+ if( TableExists('opac_news') ) {
+ $dbh->do(q|
+ ALTER TABLE opac_news RENAME additional_contents
+ |);
+ }
+
+ if ( foreign_key_exists('additional_contents', 'opac_news_branchcode_ibfk') ) {
+
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ DROP KEY borrowernumber_fk,
+ DROP KEY opac_news_branchcode_ibfk,
+ DROP FOREIGN KEY borrowernumber_fk,
+ DROP FOREIGN KEY opac_news_branchcode_ibfk
+ |);
+
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ ADD CONSTRAINT additional_contents_borrowernumber_fk
+ FOREIGN KEY (borrowernumber)
+ REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE
+ |);
+
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ ADD CONSTRAINT additional_contents_branchcode_ibfk
+ FOREIGN KEY (branchcode)
+ REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
+ |);
+ }
+
+ $dbh->do(q|
+ UPDATE letter
+ SET content = REGEXP_REPLACE(content, '<<\\\\s*opac_news\.', '<do(q|
+ UPDATE letter
+ SET content = REGEXP_REPLACE(content, '\\\\[%\\\\s*opac_news\.', '[% additional_contents.')
+ |);
+
+ $dbh->do(q|
+ UPDATE systempreferences
+ SET variable="AdditionalContentsEditor"
+ WHERE variable="NewsToolEditor"
+ |);
+
+ $dbh->do(q|
+ UPDATE permissions
+ SET code="edit_additional_contents"
+ WHERE code="edit_news"
+ |);
+
+ unless ( column_exists('additional_contents', 'category' ) ) {
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ ADD COLUMN `category` VARCHAR(20) NOT NULL COMMENT 'category for the additional content'
+ AFTER `idnew`
+ |);
+ }
+ unless ( column_exists('additional_contents', 'location' ) ) {
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ ADD COLUMN `location` VARCHAR(255) NOT NULL COMMENT 'location of the additional content'
+ AFTER `category`
+ |);
+ }
+
+ unless ( column_exists('additional_contents', 'code' ) ) {
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ ADD COLUMN `code` VARCHAR(100) NOT NULL COMMENT 'code to group content per lang'
+ AFTER `category`
+ |);
+ }
+
+ my $contents = $dbh->selectall_arrayref(q|SELECT * FROM additional_contents|, { Slice => {} });
+ for my $c ( @$contents ) {
+ my ( $category, $location, $new_lang );
+ if ( $c->{lang} eq '' ) {
+ $category = 'news';
+ $location = 'staff_and_opac';
+ $new_lang = 'default';
+ } elsif ( $c->{lang} eq 'koha' ) {
+ $category = 'news';
+ $location = 'staff_only';
+ $new_lang = 'default';
+ } elsif ( $c->{lang} eq 'slip' ) {
+ $category = 'news';
+ $location = 'slip';
+ $new_lang = 'default';
+ } elsif ( $c->{lang} =~ m|_| ) {
+ ( $location, $new_lang ) = split '_', $c->{lang};
+ $category = 'html_customizations'
+ } else {
+ $category = 'news';
+ $location = 'opac_only';
+ $new_lang = $c->{lang};
+ }
+
+ die "There is something wrong here, we didn't find a valid category for idnew=" . $c->{idnew} unless $category;
+
+ # Now this is getting weird
+ # We are adding an extra news with the same code when the lang is not "default" (/"en")
+
+ $new_lang = "default" if $new_lang eq 'en'; # Assume that "en" is "default"
+
+ my $sth_update = $dbh->prepare(q|
+ UPDATE additional_contents
+ SET category=?, location=?, lang=?
+ WHERE idnew=?
+ |);
+
+ my $parent_idnew;
+ if ( $new_lang ne 'default' ) {
+ $dbh->do(q|
+ INSERT INTO additional_contents(category, code, location, branchcode, title, content, lang, published_on, updated_on, expirationdate, number, borrowernumber)
+ VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ |, undef, $category, 'tmp_code', $location, $c->{branchcode}, $c->{title}, $c->{content}, 'default', $c->{published_on}, $c->{updated_on}, $c->{expirationdate}, $c->{number}, $c->{borrowernumber});
+
+ $parent_idnew = $dbh->last_insert_id(undef, undef, 'additional_contents', undef);
+ }
+ $sth_update->execute($category, $location, $new_lang, $c->{idnew});
+
+ my $idnew = $parent_idnew || $c->{idnew};
+ my $code = ( grep {$_ eq $location} qw( staff_and_opac staff_only opac_only slip ) ) ? "${location}_$idnew" : "News_$idnew";
+ $dbh->do(q|UPDATE additional_contents SET code=? WHERE idnew = ?|, undef, $code, $idnew) if $parent_idnew;
+ $dbh->do(q|UPDATE additional_contents SET code=? WHERE idnew = ?|, undef, $code, $idnew);
+ }
+
+ $dbh->do(q|
+ ALTER TABLE additional_contents
+ ADD UNIQUE KEY additional_contents_uniq (`category`,`code`,`branchcode`,`lang`)
+ |);
+
+ NewVersion( $DBversion, 24387, "Rename opac_news with additional_contents");
+}
diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml
index db40a3a4cc..aae1fb558b 100644
--- a/installer/data/mysql/en/mandatory/sample_notices.yml
+++ b/installer/data/mysql/en/mandatory/sample_notices.yml
@@ -528,9 +528,9 @@ tables:
- "
News
"
- ""
- "
"
- - "
<>
"
- - "
<>
"
- - "
Posted on <>
"
+ - "
<>
"
+ - "
<>
"
+ - "
Posted on <>
"
- ""
- "
"
- ""
diff --git a/installer/data/mysql/en/optional/sample_news.yml b/installer/data/mysql/en/optional/sample_news.yml
index badff452a3..8368027c65 100644
--- a/installer/data/mysql/en/optional/sample_news.yml
+++ b/installer/data/mysql/en/optional/sample_news.yml
@@ -21,7 +21,7 @@ description:
- "Sample news items"
tables:
- - opac_news:
+ - additional_contents:
translatable: [ title, content ]
multiline: [ content ]
rows:
diff --git a/installer/data/mysql/fr-CA/facultatif/sample_news.sql b/installer/data/mysql/fr-CA/facultatif/sample_news.sql
index a0d6c48913..d525626175 100644
--- a/installer/data/mysql/fr-CA/facultatif/sample_news.sql
+++ b/installer/data/mysql/fr-CA/facultatif/sample_news.sql
@@ -1 +1 @@
-INSERT INTO `opac_news` (`title`, `content`, `lang`, `published_on`, `expirationdate`, `number`) VALUES ('Bienvenue dans Koha !','Bienvenue dans Koha, la toute nouvelle version du système intégré de gestion de bibliothèque (SIGB) open source de référence. Développé initialement en Nouvelle Zélande et déployé pour la première fois en janvier 2000, Koha est un projet international soutenu par des sociétés de services en logiciels libres et par des bibliothécaires du monde entier.','koha','2008-01-14 03:25:58','2099-01-10',1),('Et maintenant ?','Félicitations ! vous avez désormais une version opérationnelle de Koha. Et maintenant, que faire ?\r\n
\r\n','koha','2008-01-14 03:34:45','2099-01-10',2);
+INSERT INTO `additional_contents` (`title`, `content`, `lang`, `published_on`, `expirationdate`, `number`) VALUES ('Bienvenue dans Koha !','Bienvenue dans Koha, la toute nouvelle version du système intégré de gestion de bibliothèque (SIGB) open source de référence. Développé initialement en Nouvelle Zélande et déployé pour la première fois en janvier 2000, Koha est un projet international soutenu par des sociétés de services en logiciels libres et par des bibliothécaires du monde entier.','koha','2008-01-14 03:25:58','2099-01-10',1),('Et maintenant ?','Félicitations ! vous avez désormais une version opérationnelle de Koha. Et maintenant, que faire ?\r\n
\r\n','koha','2008-01-14 03:34:45','2099-01-10',2);
diff --git a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
index 3bb351231f..5cd66e49e1 100644
--- a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
+++ b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
@@ -4,7 +4,7 @@ INSERT INTO `letter` (module, code, branchcode, name, is_html, title, content, m
('circulation','DUE','','Document à rendre aujourd\'hui',0,'Document à rendre aujourd\'hui','Bonjour <> <>,\r\n\r\nLe prêt de ce document arrive à expiration aujourd\'hui.\r\n\r\n<>, <> (<>)\r\n\r\nMerci de nous le retourner.\r\n\r\n<>','email'),
('circulation','DUEDGST','','Document à rendre aujourd\'hui (Résumé)',0,'Document à rendre aujourd\'hui','Bonjour <> <>,\r\n\r\nVous avez <> document(s) dont le prêt arrive à expiration.\r\n\r\nMerci de nous le(s) retourner rapidement.\r\n\r\n<>','email'),
('circulation','ISSUEQSLIP','','Ticket rapide de prêts',1,'Ticket rapide de prêts','
<>
\r\nEmprunté par <> <> \r\n(<>) \r\n\r\n<> \r\n\r\n
Emprunté(s) aujourd\'hui
\r\n\r\n
\r\n<> \r\nCode-barres : <> \r\nDate de retour : <> \r\n
\r\n','email'),
-('circulation','ISSUESLIP','','Ticket de prêts',1,'Ticket de prêts','
<>
\r\nEmprunté par <> <> \r\n(<>) \r\n\r\n<> \r\n\r\n
Emprunté(s) aujourd\'hui
\r\n\r\n
\r\n<> \r\nCode-barres : <> \r\nDate de retour : <> \r\n
\r\n\r\n\r\n
Retards
\r\n\r\n
\r\n<> \r\nCode-barres : <> \r\nDate de retour : <> \r\n
\r\n\r\n\r\n\r\n\r\n
Nouvelles
\r\n\r\n
\r\n
<>
\r\n
<>
\r\n
Publiée le <>
\r\n\r\n
\r\n','email'),
+('circulation','ISSUESLIP','','Ticket de prêts',1,'Ticket de prêts','
<>
\r\nEmprunté par <> <> \r\n(<>) \r\n\r\n<> \r\n\r\n
Emprunté(s) aujourd\'hui
\r\n\r\n
\r\n<> \r\nCode-barres : <> \r\nDate de retour : <> \r\n
\r\n\r\n\r\n
Retards
\r\n\r\n
\r\n<> \r\nCode-barres : <> \r\nDate de retour : <> \r\n
\r\n\r\n\r\n\r\n\r\n
Nouvelles
\r\n\r\n
\r\n
<>
\r\n
<>
\r\n
Publiée le <>
\r\n\r\n
\r\n','email'),
('circulation','ODUE','','Document(s) en retard',0,'Document(s) en retard','Bonjour <> <>,\r\n\r\nSelon nos informations, vous avez au moins un document en retard. Merci de retourner ou renouveller ce ou ces documents dans votre bibliothèque le plus rapidement possible.\r\n\r\n<>\r\n<>\r\n<> <>\r\nTél : <>\r\nFax : <>\r\nCourriel : <>\r\n\r\nSi vous avez le mot de passe de votre compte lecteur, vous pouvez renouveler directement en ligne. Sinon, merci de nous contacter.\r\n\r\nLe ou les documents suivants sont en retard :\r\n\r\n\"<>\" par <>, <>, code-barres : <> Amende : <>\r\n\r\nMerci de votre attention.\r\n\r\n<>','email'),
('circulation','PREDUE','','Document à rendre bientôt',0,'Document à rendre bientôt','Bonjour <> <>,\r\n\r\nNous souhaitons vous informer que le prêt de ce document arrive bientôt à expiration :\r\n\r\n<>, <> (<>)\r\n\r\nMerci.\r\n\r\n<>','email'),
('circulation','PREDUEDGST','','Document à rendre bientôt (Résumé)',0,'Document(s) à rendre bientôt','Bonjour <> <>,\r\n\r\nVous avez <> document(s) dont le prêt arrive bientôt à expiration.\r\n\r\n<>','email'),
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
index 22bb673a68..a0cee7092e 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
@@ -98,9 +98,9 @@ Retour le : <>
Nouvelles
-
<>
-
<>
-
Posted on <>
+
<>
+
<>
+
Posted on <>
', 1),
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_news.sql b/installer/data/mysql/fr-FR/2-Optionel/sample_news.sql
index a0d6c48913..d525626175 100644
--- a/installer/data/mysql/fr-FR/2-Optionel/sample_news.sql
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_news.sql
@@ -1 +1 @@
-INSERT INTO `opac_news` (`title`, `content`, `lang`, `published_on`, `expirationdate`, `number`) VALUES ('Bienvenue dans Koha !','Bienvenue dans Koha, la toute nouvelle version du système intégré de gestion de bibliothèque (SIGB) open source de référence. Développé initialement en Nouvelle Zélande et déployé pour la première fois en janvier 2000, Koha est un projet international soutenu par des sociétés de services en logiciels libres et par des bibliothécaires du monde entier.','koha','2008-01-14 03:25:58','2099-01-10',1),('Et maintenant ?','Félicitations ! vous avez désormais une version opérationnelle de Koha. Et maintenant, que faire ?\r\n
\r\n','koha','2008-01-14 03:34:45','2099-01-10',2);
+INSERT INTO `additional_contents` (`title`, `content`, `lang`, `published_on`, `expirationdate`, `number`) VALUES ('Bienvenue dans Koha !','Bienvenue dans Koha, la toute nouvelle version du système intégré de gestion de bibliothèque (SIGB) open source de référence. Développé initialement en Nouvelle Zélande et déployé pour la première fois en janvier 2000, Koha est un projet international soutenu par des sociétés de services en logiciels libres et par des bibliothécaires du monde entier.','koha','2008-01-14 03:25:58','2099-01-10',1),('Et maintenant ?','Félicitations ! vous avez désormais une version opérationnelle de Koha. Et maintenant, que faire ?\r\n
\r\n','koha','2008-01-14 03:34:45','2099-01-10',2);
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index da14acace2..8e5348edff 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -3891,28 +3891,32 @@ CREATE TABLE `old_reserves` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
--- Table structure for table `opac_news`
+-- Table structure for table `additional_contents`
--
-DROP TABLE IF EXISTS `opac_news`;
+DROP TABLE IF EXISTS `additional_contents`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `opac_news` (
- `idnew` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the news article',
- `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'branch code users to create branch specific news, NULL is every branch.',
- `title` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'title of the news article',
- `content` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the body of your news article',
- `lang` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'location for the article (koha is the staff interface, slip is the circulation receipt and language codes are for the opac)',
+CREATE TABLE `additional_contents` (
+ `idnew` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the additional content',
+ `category` varchar(20) NOT NULL COMMENT 'category for the additional content',
+ `code` varchar(20) NOT NULL COMMENT 'code to group content per lang',
+ `location` varchar(255) NOT NULL COMMENT 'location of the additional content',
+ `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'branch code users to create branch specific additional content, NULL is every branch.',
+ `title` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'title of the additional content',
+ `content` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'the body of your additional content',
+ `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'location for the additional content(koha is the staff interface, slip is the circulation receipt and language codes are for the opac)',
`published_on` date DEFAULT NULL COMMENT 'publication date',
`updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
- `expirationdate` date DEFAULT NULL COMMENT 'date the article is set to expire or no longer be visible',
- `number` int(11) DEFAULT NULL COMMENT 'the order in which this article appears in that specific location',
- `borrowernumber` int(11) DEFAULT NULL COMMENT 'The user who created the news article',
+ `expirationdate` date DEFAULT NULL COMMENT 'date the additional content is set to expire or no longer be visible',
+ `number` int(11) DEFAULT NULL COMMENT 'the order in which this additional content appears in that specific location',
+ `borrowernumber` int(11) DEFAULT NULL COMMENT 'The user who created the additional content',
PRIMARY KEY (`idnew`),
- KEY `borrowernumber_fk` (`borrowernumber`),
- KEY `opac_news_branchcode_ibfk` (`branchcode`),
+ UNIQUE KEY `additional_contents_uniq` (`category`,`code`,`branchcode`,`lang`),
+ KEY `additional_contents_borrowernumber_fk` (`borrowernumber`),
+ KEY `additional_contents_branchcode_ibfk` (`branchcode`),
CONSTRAINT `borrowernumber_fk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
- CONSTRAINT `opac_news_branchcode_ibfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `additional_contents_branchcode_ibfk` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index c98d6032a2..ee2954d02f 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -9,6 +9,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('AcquisitionLog','0',NULL,'If ON, log acquisitions activity','YesNo'),
('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: their own only, any within their branch, or all','Choice'),
('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
+('AdditionalContentsEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'),
('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'),
('AddressForFailedOverdueNotices', '', NULL, 'Destination email for failed overdue notices. If left empty then it will fallback to the first defined address in the following list: Library ReplyTo, Library Email, ReplytoDefault and KohaAdminEmailAddress', 'free'),
('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'),
@@ -349,7 +350,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''),
('NewsAuthorDisplay','none','none|opac|staff|both','Display the author name for news items.','Choice'),
('NewsLog','0',NULL,'If ON, log OPAC news changes','YesNo'),
-('NewsToolEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'),
('noissuescharge','5','','Define maximum amount withstanding before checkouts are blocked','Integer'),
('NoIssuesChargeGuarantees','','','Define maximum amount withstanding before checkouts are blocked','Integer'),
('NoIssuesChargeGuarantorsWithGuarantees','','','Define maximum amount withstanding before checkouts are blocked including guarantors and their other guarantees','Integer'),
diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql
index edb52f0fdd..f1c2d8883b 100644
--- a/installer/data/mysql/mandatory/userpermissions.sql
+++ b/installer/data/mysql/mandatory/userpermissions.sql
@@ -74,7 +74,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
(11, 'merge_invoices', 'Merge invoices'),
(11, 'delete_baskets', 'Delete baskets'),
(12, 'suggestions_manage', 'Manage purchase suggestions'),
- (13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
+ (13, 'edit_additional_contents', 'Write additional contents for the OPAC and staff interfaces (news and HTML customizations)'),
(13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
(13, 'edit_calendar', 'Define days when the library is closed'),
(13, 'moderate_comments', 'Moderate patron comments'),
diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
index 14d500af76..bf54ff7735 100644
--- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
+++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
@@ -118,9 +118,9 @@ Innleveringsfrist: <>
Nyheter
-
<>
-
<>
-
Publisert <>
+
<>
+
<>
+
Publisert <>
', 1),
diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_news.sql b/installer/data/mysql/nb-NO/2-Valgfritt/sample_news.sql
index fb7cba9884..ec23a419c5 100644
--- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_news.sql
+++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_news.sql
@@ -1,2 +1,2 @@
-INSERT INTO `opac_news` (`title`, `content`, `lang`, `published_on`, `expirationdate`, `number`) VALUES ('Velkommen til Koha!','Velkommen til Koha. Koha er et biblioteksystem rikt på funksjoner. Koha ble opprinnelig utviklet i New Zealand av Katipo Communications Ltd og først tatt i bruk i januar 2000 av Horowhenua Library Trust. I dag vedlikeholdes Koha av et verdensomspennende fellesskap av bibliotek og leverandører.','koha',DATE_SUB(NOW(), INTERVAL 1 DAY),'2099-01-10',1),
+INSERT INTO `additional_contents` (`title`, `content`, `lang`, `published_on`, `expirationdate`, `number`) VALUES ('Velkommen til Koha!','Velkommen til Koha. Koha er et biblioteksystem rikt på funksjoner. Koha ble opprinnelig utviklet i New Zealand av Katipo Communications Ltd og først tatt i bruk i januar 2000 av Horowhenua Library Trust. I dag vedlikeholdes Koha av et verdensomspennende fellesskap av bibliotek og leverandører.','koha',DATE_SUB(NOW(), INTERVAL 1 DAY),'2099-01-10',1),
('Hva nå?','Hva kan du gjøre nå som du har installert Koha? Her er noen forslag:\r\n
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref
index 33cef05398..4a569b4cae 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref
@@ -38,8 +38,8 @@ Tools:
both: "both OPAC and staff interface"
- "."
-
- - By default edit news items with
- - pref: NewsToolEditor
+ - By default edit additional contents and news items with
+ - pref: AdditionalContentsEditor
choices:
tinymce: "a WYSIWYG editor (TinyMCE)"
codemirror: "a text editor (CodeMirror)"
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
index 01ac044783..0f56178b93 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
@@ -33,14 +33,14 @@
[% koha_new.content | $raw %]
Posted on [% koha_new.published_on | $KohaDates %][% IF( show_author && koha_new.author ) %] by [% INCLUDE 'patron-title.inc' patron=koha_new.author %] [% END %]
[% IF ( CAN_user_tools ) %]
- Edit
- | Delete
- | New
+ Edit
+ | Delete
+ | New
[% END %]
[% END %]
-
+
[% END %]
[% IF ( daily_quote ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
new file mode 100644
index 0000000000..8aebc2f012
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
@@ -0,0 +1,602 @@
+[% USE raw %]
+[% USE Asset %]
+[% USE Koha %]
+[% USE KohaDates %]
+[% USE Branches %]
+[% SET footerjs = 1 %]
+[% INCLUDE 'doc-head-open.inc' %]
+Additional contents › Tools › Koha
+[% INCLUDE 'doc-head-close.inc' %]
+[% UNLESS ( wysiwyg ) %]
+ [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
+ [% Asset.css("lib/codemirror/lint.min.css") | $raw %]
+
+[% END %]
+
+
+
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'cat-search.inc' %]
+
+
+
+[% IF op == 'add_form' %]
+
+
+
+[% ELSE %]
+
+
+
+[% END %]
+
+
+
+ [% FOR m IN messages %]
+
+ [% SWITCH m.code %]
+ [% CASE 'error_on_update' %]
+ An error occurred when updating this content. Perhaps it already exists.
+ [% CASE 'error_on_insert' %]
+ An error occurred when adding this content. Check the logs
+ [% CASE 'error_on_delete' %]
+ An error occurred when deleting this content. Check the logs.
+ [% CASE 'success_on_update' %]
+ Content updated successfully.
+ [% CASE 'success_on_insert' %]
+ Content added successfully.
+ [% CASE 'success_on_delete' %]
+ Content deleted successfully.
+ [% CASE %]
+ [% m.code | html %]
+ [% END %]
+
+ [% END %]
+
+ [% IF op == 'add_form' %]
+ [% PROCESS add_form %]
+ [% ELSE %]
+ [% PROCESS list %]
+ [% END %]
+
+
+
+ [% IF op != 'add_form' %]
+