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

(-)a/installer/data/mysql/atomicupdate/bug_31086_do_not_allow_null_branchcode_in_reserves.pl (-5 / +15 lines)
Lines 8-18 return { Link Here
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        my ($dbh, $out) = @$args{qw(dbh out)};
10
10
11
        my $holds_no_branch = Koha::Holds->search({ branchcode => undef });
11
        my $sth = $dbh->prepare(q{
12
        if( $holds_no_branch->count > 0 ){
12
            SELECT borrowernumber, biblionumber
13
            FROM reserves
14
	        WHERE branchcode IS NULL;
15
        });
16
        $sth->execute;
17
        my $holds_no_branch = $sth->fetchall_arrayref( {} );
18
19
        if ( scalar @{$holds_no_branch} > 0 ) {
13
            say $out "Holds with no branchcode were found and will be updated to the first branch in the system";
20
            say $out "Holds with no branchcode were found and will be updated to the first branch in the system";
14
            while ( my $hnb = $holds_no_branch->next ){
21
            foreach my $hnb ( @{$holds_no_branch} ) {
15
                say $out "Please review hold for borrowernumber " . $hnb->borrowernumber . " on biblionumber " . $hnb->biblionumber . " to correct pickup branch if necessary";
22
                say $out "Please review hold for borrowernumber "
23
                  . $hnb->{borrowernumber}
24
                  . " on biblionumber "
25
                  . $hnb->{biblionumber}
26
                  . " to correct pickup branch if necessary";
16
            }
27
            }
17
        }
28
        }
18
29
19
- 

Return to bug 31086