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 (-2 / +10 lines)
Lines 1-4 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
use Koha::Holds;
2
3
3
return {
4
return {
4
    bug_number => "31086",
5
    bug_number => "31086",
Lines 7-15 return { Link Here
7
        my ($args) = @_;
8
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
11
        my $holds_no_branch = Koha::Holds->search({ branchcode => undef });
12
        if( $holds_no_branch->count > 0 ){
13
            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 ){
15
                say $out "Please review hold for borrowernumber " . $hnb->borrowernumber . " on biblionumber " . $hnb->biblionumber . " to correct pickup branch if necessary";
16
            }
17
        }
18
10
        # Ensure we have no NULL's in the branchcode field
19
        # Ensure we have no NULL's in the branchcode field
11
        $dbh->do(q{
20
        $dbh->do(q{
12
            UPDATE reserves SET branchcode = ( SELECT branchcode FROM branches LIMIT 1) WHERE branchode IS NULL;
21
            UPDATE reserves SET branchcode = ( SELECT branchcode FROM branches LIMIT 1) WHERE branchcode IS NULL;
13
        });
22
        });
14
23
15
        # Set the NOT NULL configuration
24
        # Set the NOT NULL configuration
16
- 

Return to bug 31086