View | Details | Raw Unified | Return to bug 25776
Collapse All | Expand All

(-)a/admin/columns_settings.yml (+2 lines)
Lines 1436-1441 modules: Link Here
1436
              columnname: code
1436
              columnname: code
1437
            -
1437
            -
1438
              columnname: name
1438
              columnname: name
1439
            -
1440
              columnname: updated_on
1439
            -
1441
            -
1440
              columnname: copy_notice
1442
              columnname: copy_notice
1441
            -
1443
            -
(-)a/installer/data/mysql/atomicupdate/bug-25776-letter_updated_on.perl (+12 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    unless ( column_exists('letter', 'updated_on') ) {
4
        $dbh->do(
5
            qq{
6
                ALTER TABLE letter ADD COLUMN updated_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER lang
7
              }
8
        );
9
    }
10
    NewVersion( $DBversion, 25776, "Add letter.updated_on");
11
12
}
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2495-2500 CREATE TABLE `letter` ( -- table for all notice templates in Koha Link Here
2495
  `content` MEDIUMTEXT, -- body text for the notice or slip
2495
  `content` MEDIUMTEXT, -- body text for the notice or slip
2496
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice
2496
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice
2497
  `lang` varchar(25) NOT NULL DEFAULT 'default', -- lang of the notice
2497
  `lang` varchar(25) NOT NULL DEFAULT 'default', -- lang of the notice
2498
  `updated_on` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification
2498
  PRIMARY KEY  (`module`,`code`, `branchcode`, `message_transport_type`, `lang`),
2499
  PRIMARY KEY  (`module`,`code`, `branchcode`, `message_transport_type`, `lang`),
2499
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`)
2500
  CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`)
2500
  REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
2501
  REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+9 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
[% USE Branches %]
5
[% USE Branches %]
5
[% USE TablesSettings %]
6
[% USE TablesSettings %]
6
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
Lines 142-147 Link Here
142
                                    <th>Module</th>
143
                                    <th>Module</th>
143
                                    <th>Code</th>
144
                                    <th>Code</th>
144
                                    <th>Name</th>
145
                                    <th>Name</th>
146
                                    <th class="title-string">Last updated</th>
145
                                    <th class="nosort">Copy notice</th>
147
                                    <th class="nosort">Copy notice</th>
146
                                    <th class="nosort">Actions</th>
148
                                    <th class="nosort">Actions</th>
147
                                </tr>
149
                                </tr>
Lines 175-180 Link Here
175
                                        </td>
177
                                        </td>
176
                                        <td>[% lette.code | html %]</td>
178
                                        <td>[% lette.code | html %]</td>
177
                                        <td>[% lette.name | html %]</td>
179
                                        <td>[% lette.name | html %]</td>
180
                                        <td>[% lette.updated_on | $KohaDates with_hours = 1 %]</td>
178
                                        <td class="actions">
181
                                        <td class="actions">
179
                                            [% IF !independant_branch || !lette.branchcode %]
182
                                            [% IF !independant_branch || !lette.branchcode %]
180
                                                <form method="post" action="/cgi-bin/koha/tools/letter.pl">
183
                                                <form method="post" action="/cgi-bin/koha/tools/letter.pl">
Lines 417-422 Link Here
417
                                        <fieldset class="rows mtt" id="[% letter.message_transport_type | html %]_[% lang | html %]">
420
                                        <fieldset class="rows mtt" id="[% letter.message_transport_type | html %]_[% lang | html %]">
418
                                    [% END %]
421
                                    [% END %]
419
                                        <ol>
422
                                        <ol>
423
                                            [% IF ( letter.updated_on ) %]
424
                                                <li>
425
                                                    <label for="updated_on_[% letter.message_transport_type | html %]_[% lang | html %]">Last updated:</label>
426
                                                    [% letter.updated_on | $KohaDates with_hours = 1 %]
427
                                                </li>
428
                                            [% END %]
420
                                            <li>
429
                                            <li>
421
                                                <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type | html %]" />
430
                                                <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type | html %]" />
422
                                                <input type="hidden" name="lang" value="[% lang | html %]" />
431
                                                <input type="hidden" name="lang" value="[% lang | html %]" />
(-)a/tools/letter.pl (-2 / +2 lines)
Lines 207-212 sub add_form { Link Here
207
            $letters{ $lang }{templates}{$mtt} = {
207
            $letters{ $lang }{templates}{$mtt} = {
208
                message_transport_type => $letter->{message_transport_type},
208
                message_transport_type => $letter->{message_transport_type},
209
                is_html    => $letter->{is_html},
209
                is_html    => $letter->{is_html},
210
                updated_on => $letter->{updated_on},
210
                title      => $letter->{title},
211
                title      => $letter->{title},
211
                content    => $letter->{content} // '',
212
                content    => $letter->{content} // '',
212
            };
213
            };
Lines 367-373 sub retrieve_letters { Link Here
367
368
368
    my $dbh = C4::Context->dbh;
369
    my $dbh = C4::Context->dbh;
369
    my ($sql, @where, @args);
370
    my ($sql, @where, @args);
370
    $sql = "SELECT branchcode, module, code, name, branchname
371
    $sql = "SELECT branchcode, module, code, name, branchname, MAX(updated_on) as updated_on
371
            FROM letter
372
            FROM letter
372
            LEFT OUTER JOIN branches USING (branchcode)
373
            LEFT OUTER JOIN branches USING (branchcode)
373
    ";
374
    ";
374
- 

Return to bug 25776