Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d29df0d0

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID d29df0d02cfb6a0ac8b2ce68d4f8606f00ee9123
  • Vorgänger 04aa4647
  • Nachfolger af08a0a8

Telefonnotizen in HTML: DB-Upgrade

Unterschiede anzeigen:

sql/Pg-upgrade2/phone_notes_convert_to_html.pl
1
# @tag: phone_notes_convert_to_html
2
# @description: Telefonnotizen zu html konvertieren
3
# @depends: release_3_6_1
4
package SL::DBUpgrade2::phone_notes_convert_to_html;
5

  
6
use strict;
7
use utf8;
8

  
9
use parent qw(SL::DBUpgrade2::Base);
10

  
11
use SL::HTML::Util;
12

  
13
sub run {
14
  my ($self) = @_;
15

  
16
  my $q_fetch = <<SQL;
17
    SELECT id, body FROM notes WHERE trans_module LIKE 'oe'
18
SQL
19

  
20
  my $q_update_column = <<SQL;
21
    UPDATE notes SET body = ? WHERE id = ?
22
SQL
23

  
24
  my $h_fetch = $self->dbh->prepare($q_fetch);
25
  $h_fetch->execute || $::form->dberror($q_fetch);
26

  
27
  my $h_update_column = $self->dbh->prepare($q_update_column);
28

  
29
  while (my $entry = $h_fetch->fetchrow_hashref) {
30
    $entry->{body} //= '';
31
    my $html_value = SL::HTML::Util->plain_text_to_html($entry->{body});
32
    $h_update_column->execute($html_value, $entry->{id}) || $::form->dberror($q_update_column);
33
  }
34
  $h_update_column->finish;
35
  $h_fetch->finish;
36

  
37
  return 1;
38
}
39

  
40
1;

Auch abrufbar als: Unified diff