Bugzilla – Attachment 110243 Details for
Bug 25776
Add last updated date for notices and slips
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25776: Add a 'last updated' column for notices
Bug-25776-Add-a-last-updated-column-for-notices.patch (text/plain), 6.77 KB, created by
Martin Renvoize (ashimema)
on 2020-09-17 08:13:50 UTC
(
hide
)
Description:
Bug 25776: Add a 'last updated' column for notices
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-09-17 08:13:50 UTC
Size:
6.77 KB
patch
obsolete
>From 20d42d82c7d6a21b2da63b93ab7d353b55acec33 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Thu, 27 Aug 2020 10:38:25 +0000 >Subject: [PATCH] Bug 25776: Add a 'last updated' column for notices > >This add an 'udated_on' column to the letter table and displays >the information in 'slips and notices'. > >To test: >- Apply patch >- Run updatedatabase > Note: the existing letters will all be set to the > currnet date). >- Go to Tools > Notices and slips >- Verify there is a new column "Last updated" in the table > Note: The table will always display the newest change date > of the different message transport types. >- Edit any notice >- Verify the "Last updated" is shown for any transport type > with an existing notice definition >- Edit and add a notice >- Verify the dates are correctly stored >- Test the column configuration for the new column works > correctly > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > admin/columns_settings.yml | 2 ++ > .../atomicupdate/bug-25776-letter_updated_on.perl | 12 ++++++++++++ > installer/data/mysql/kohastructure.sql | 1 + > .../intranet-tmpl/prog/en/modules/tools/letter.tt | 9 +++++++++ > tools/letter.pl | 3 ++- > 5 files changed, 26 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug-25776-letter_updated_on.perl > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 96b3a31a68..19e81bbce5 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -1436,6 +1436,8 @@ modules: > columnname: code > - > columnname: name >+ - >+ columnname: updated_on > - > columnname: copy_notice > - >diff --git a/installer/data/mysql/atomicupdate/bug-25776-letter_updated_on.perl b/installer/data/mysql/atomicupdate/bug-25776-letter_updated_on.perl >new file mode 100644 >index 0000000000..802cb55f05 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-25776-letter_updated_on.perl >@@ -0,0 +1,12 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ unless ( column_exists('letter', 'updated_on') ) { >+ $dbh->do( >+ qq{ >+ ALTER TABLE letter ADD COLUMN updated_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER lang >+ } >+ ); >+ } >+ NewVersion( $DBversion, 25776, "Add letter.updated_on"); >+ >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 9dff2f804b..b519c81116 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2495,6 +2495,7 @@ CREATE TABLE `letter` ( -- table for all notice templates in Koha > `content` MEDIUMTEXT, -- body text for the notice or slip > `message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice > `lang` varchar(25) NOT NULL DEFAULT 'default', -- lang of the notice >+ `updated_on` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification > PRIMARY KEY (`module`,`code`, `branchcode`, `message_transport_type`, `lang`), > CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) > REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >index 4bfed8b44c..d2c050695e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >@@ -1,6 +1,7 @@ > [% USE raw %] > [% USE Asset %] > [% USE Koha %] >+[% USE KohaDates %] > [% USE Branches %] > [% USE TablesSettings %] > [% SET footerjs = 1 %] >@@ -142,6 +143,7 @@ > <th>Module</th> > <th>Code</th> > <th>Name</th> >+ <th class="title-string">Last updated</th> > <th class="nosort">Copy notice</th> > <th class="nosort">Actions</th> > </tr> >@@ -175,6 +177,7 @@ > </td> > <td>[% lette.code | html %]</td> > <td>[% lette.name | html %]</td> >+ <td>[% lette.updated_on | $KohaDates with_hours = 1 %]</td> > <td class="actions"> > [% IF !independant_branch || !lette.branchcode %] > <form method="post" action="/cgi-bin/koha/tools/letter.pl"> >@@ -417,6 +420,12 @@ > <fieldset class="rows mtt" id="[% letter.message_transport_type | html %]_[% lang | html %]"> > [% END %] > <ol> >+ [% IF ( letter.updated_on ) %] >+ <li> >+ <label for="updated_on_[% letter.message_transport_type | html %]_[% lang | html %]">Last updated:</label> >+ [% letter.updated_on | $KohaDates with_hours = 1 %] >+ </li> >+ [% END %] > <li> > <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type | html %]" /> > <input type="hidden" name="lang" value="[% lang | html %]" /> >diff --git a/tools/letter.pl b/tools/letter.pl >index eb2cd98e63..7af71dda2a 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -207,6 +207,7 @@ sub add_form { > $letters{ $lang }{templates}{$mtt} = { > message_transport_type => $letter->{message_transport_type}, > is_html => $letter->{is_html}, >+ updated_on => $letter->{updated_on}, > title => $letter->{title}, > content => $letter->{content} // '', > }; >@@ -367,7 +368,7 @@ sub retrieve_letters { > > my $dbh = C4::Context->dbh; > my ($sql, @where, @args); >- $sql = "SELECT branchcode, module, code, name, branchname >+ $sql = "SELECT branchcode, module, code, name, branchname, MAX(updated_on) as updated_on > FROM letter > LEFT OUTER JOIN branches USING (branchcode) > "; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25776
:
109303
|
109304
|
109305
|
109382
|
109383
|
109384
|
110236
|
110237
|
110238
|
110242
| 110243 |
110244
|
110245