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

(-)a/installer/data/mysql/atomicupdate/bug_29509.pl (-11 / +10 lines)
Lines 30-39 return { Link Here
30
        my $sth3 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'manage_bookings'");
30
        my $sth3 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'manage_bookings'");
31
        $sth3->execute();
31
        $sth3->execute();
32
        my @manage_bookings = map { $_->[0] } @{ $sth3->fetchall_arrayref };
32
        my @manage_bookings = map { $_->[0] } @{ $sth3->fetchall_arrayref };
33
        my $sth3_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<1)");
33
        my $sth3_1          = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<1)");
34
        $sth3_1->execute();
34
        $sth3_1->execute();
35
        my @circulate = map { $_->[0] } @{ $sth3_1->fetchall_arrayref };
35
        my @circulate = map { $_->[0] } @{ $sth3_1->fetchall_arrayref };
36
        my @bookings = (@manage_bookings, @circulate);
36
        my @bookings  = ( @manage_bookings, @circulate );
37
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @bookings, @exclusions ) );
37
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @bookings, @exclusions ) );
38
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
38
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
39
        say $out "list_borrowers added to all users with manage_bookings";
39
        say $out "list_borrowers added to all users with manage_bookings";
Lines 42-51 return { Link Here
42
        my $sth4 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'label_creator'");
42
        my $sth4 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'label_creator'");
43
        $sth4->execute();
43
        $sth4->execute();
44
        my @label_creator = map { $_->[0] } @{ $sth4->fetchall_arrayref };
44
        my @label_creator = map { $_->[0] } @{ $sth4->fetchall_arrayref };
45
        my $sth4_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<13)");
45
        my $sth4_1        = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<13)");
46
        $sth4_1->execute();
46
        $sth4_1->execute();
47
        my @tools = map { $_->[0] } @{ $sth4_1->fetchall_arrayref };
47
        my @tools  = map { $_->[0] } @{ $sth4_1->fetchall_arrayref };
48
        my @labels = (@label_creator, @tools);
48
        my @labels = ( @label_creator, @tools );
49
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @labels, @exclusions ) );
49
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @labels, @exclusions ) );
50
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
50
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
51
        say $out "list_borrowers added to all users with label_creator";
51
        say $out "list_borrowers added to all users with label_creator";
Lines 54-63 return { Link Here
54
        my $sth5 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'routing'");
54
        my $sth5 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'routing'");
55
        $sth5->execute();
55
        $sth5->execute();
56
        my @routing = map { $_->[0] } @{ $sth5->fetchall_arrayref };
56
        my @routing = map { $_->[0] } @{ $sth5->fetchall_arrayref };
57
        my $sth5_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<15)");
57
        my $sth5_1  = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<15)");
58
        $sth5_1->execute();
58
        $sth5_1->execute();
59
        my @serials = map { $_->[0] } @{ $sth5_1->fetchall_arrayref };
59
        my @serials       = map { $_->[0] } @{ $sth5_1->fetchall_arrayref };
60
        my @routing_lists = (@routing, @serials);
60
        my @routing_lists = ( @routing, @serials );
61
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @routing_lists, @exclusions ) );
61
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @routing_lists, @exclusions ) );
62
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
62
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
63
        say $out "list_borrowers added to all users with routing";
63
        say $out "list_borrowers added to all users with routing";
Lines 66-75 return { Link Here
66
        my $sth6 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'order_manage'");
66
        my $sth6 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'order_manage'");
67
        $sth6->execute();
67
        $sth6->execute();
68
        my @order_manage = map { $_->[0] } @{ $sth6->fetchall_arrayref };
68
        my @order_manage = map { $_->[0] } @{ $sth6->fetchall_arrayref };
69
        my $sth6_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<11)");
69
        my $sth6_1       = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<11)");
70
        $sth6_1->execute();
70
        $sth6_1->execute();
71
        my @acquisitions = map { $_->[0] } @{ $sth6_1->fetchall_arrayref };
71
        my @acquisitions = map { $_->[0] } @{ $sth6_1->fetchall_arrayref };
72
        my @orders = (@order_manage, @acquisitions);
72
        my @orders       = ( @order_manage, @acquisitions );
73
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @orders, @exclusions ) );
73
        @rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @orders, @exclusions ) );
74
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
74
        foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); }
75
        say $out "list_borrowers added to all users with order_manage";
75
        say $out "list_borrowers added to all users with order_manage";
76
- 

Return to bug 29509