X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=sql%2FPg-upgrade2%2Fauth_enable_sales_all_edit.pl;h=c6101e664624a460323c2a980fab61478b06edac;hb=37ffd321a8511ad03a0ce80bfe5680481767f0e6;hp=e223cd859e5942c76690cba092de63e150eb1623;hpb=c9e93ded8a5ca6f8a9212c5e64a99616889b5aac;p=kivitendo-erp.git
diff --git a/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl b/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl
index e223cd859..c6101e664 100644
--- a/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl
+++ b/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl
@@ -3,6 +3,7 @@
# @depends: release_2_6_0
# @charset: utf-8
+use utf8;
use strict;
use Data::Dumper;
die("This script cannot be run from the command line.") unless ($main::form);
@@ -13,38 +14,35 @@ sub mydberror {
"
$msg
" . $DBI::errstr);
}
-sub do_query {
- my ($query, $may_fail) = @_;
+sub do_update {
+ my $dbh = $main::auth->dbconnect();
+ my $query = <do($query)) {
- mydberror($query) unless ($may_fail);
- $dbh->rollback();
- $dbh->begin_work();
+ $sth->finish();
+ $dbh->commit();
}
-}
-sub do_update {
- my @queries;
-
-# do_query("ALTER TABLE project ADD PRIMARY KEY (id);", 1);
-# map({ do_query($_, 0); } @queries);
-# print "hieryy";
-# print (Dumper($main::form));
- my $dbh = $main::auth->dbconnect();
- my $query = qq|SELECT distinct group_id from auth.user_group|;
- my $sth_all_groups = prepare_execute_query($form, $dbh, $query);
- while (my $hash_ref = $sth_all_groups->fetchrow_hashref()) { # Schleife
- push @queries, "INSERT INTO auth.group_rights (group_id, \"right\", granted) VALUES (" . $hash_ref->{group_id} . ", 'sales_all_edit', 't')";
-}
-# if in doubt use brute force ;-) jb
- foreach my $query (@queries){
-# print "hier:" . $query;
- my $dbh = $main::auth->dbconnect();
- my $sth = prepare_query($form, $dbh, $query);
- do_statement($form,$sth,$query);
- $sth->finish();
- $dbh ->commit();
-}
return 1;
}