X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=sql%2FPg-upgrade2%2Fcp_greeting_migration.pl;h=40c1ebdfac56954dffe3b47cee9fdaaa9bd2cb22;hb=dc3d3e707934cd1f26bdc81b8b436f59156b8cc8;hp=1ee6abd61b70a4fdc62de8046d7287044311d7a3;hpb=946324538fb1706eb9f3ff7f98ecad8e27710c95;p=kivitendo-erp.git
diff --git a/sql/Pg-upgrade2/cp_greeting_migration.pl b/sql/Pg-upgrade2/cp_greeting_migration.pl
index 1ee6abd61..40c1ebdfa 100644
--- a/sql/Pg-upgrade2/cp_greeting_migration.pl
+++ b/sql/Pg-upgrade2/cp_greeting_migration.pl
@@ -2,8 +2,12 @@
# @description: Migration of cp_greeting to cp_gender
# @depends: generic_translations
+use strict;
+
die("This script cannot be run from the command line.") unless ($main::form);
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh, $iconv);
sub mydberror {
my ($msg) = @_;
@@ -26,40 +30,40 @@ sub query_result {
# list of all entries where cp_greeting is empty, meaning can't determine gender from parsing Herr/Frau/...
# this assumes cp_greeting still exists, i.e. gender.sql was not run yet
- my $gender_table;
+ my ($gender_table, $mchecked, $fchecked);
my $sql2 = "select cp_id,cp_givenname,cp_name,cp_title,cp_greeting from contacts where not (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%') ";
my $sth2 = $dbh->prepare($sql2) or die $dbh->errstr();
- $sth2->execute() or die $dbh->errstr();
+ $sth2->execute() or die $dbh->errstr();
- my $i = 1;
+ my $i = 1;
$gender_table .= '
";
$main::form->{gender_table} = $gender_table;
my $title_table;
-
+
my $sql3 = "select cp_id,cp_givenname,cp_name,cp_title,cp_greeting from contacts where not ( (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%')) and not (cp_greeting like ''); ";
my $sth3 = $dbh->prepare($sql3) or die $dbh->errstr();
- $sth3->execute() or die $dbh->errstr();
+ $sth3->execute() or die $dbh->errstr();
$title_table = '