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

(-)a/admin/branches.pl (-4 / +16 lines)
Lines 90-96 if ( $op eq 'add_form' ) { Link Here
90
    if ($is_a_modif) {
90
    if ($is_a_modif) {
91
        my $library = Koha::Libraries->find($branchcode);
91
        my $library = Koha::Libraries->find($branchcode);
92
        for my $field (@fields) {
92
        for my $field (@fields) {
93
            $library->$field( scalar $input->param($field) );
93
            if ( $field eq 'pickup_location' ) {
94
                # Don't fallback to undef/NULL, default is 1 in DB
95
                $library->$field( scalar $input->param($field) );
96
            } else {
97
                $library->$field( scalar $input->param($field) || undef );
98
            }
94
        }
99
        }
95
100
96
        try {
101
        try {
Lines 118-129 if ( $op eq 'add_form' ) { Link Here
118
        }
123
        }
119
        catch {
124
        catch {
120
            push @messages, { type => 'alert', code => 'error_on_update' };
125
            push @messages, { type => 'alert', code => 'error_on_update' };
121
        }
126
        };
122
    } else {
127
    } else {
123
        $branchcode =~ s|\s||g;
128
        $branchcode =~ s|\s||g;
124
        my $library = Koha::Library->new(
129
        my $library = Koha::Library->new(
125
            {   branchcode => $branchcode,
130
            {
126
                ( map { $_ => scalar $input->param($_) || undef } @fields )
131
                branchcode => $branchcode,
132
                (
133
                    map {
134
                        $_ eq 'pickup_location' # Don't fallback to undef/NULL, default is 1 in DB
135
                          ? ( $_ => scalar $input->param($_) || undef )
136
                          : ( $_ => scalar $input->param($_) )
137
                    } @fields
138
                )
127
            }
139
            }
128
        );
140
        );
129
141
(-)a/installer/data/mysql/atomicupdate/bug_28567.perl (-1 / +35 lines)
Line 0 Link Here
0
- 
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    my @fields = qw(
5
      branchname
6
      branchaddress1
7
      branchaddress2
8
      branchaddress3
9
      branchzip
10
      branchcity
11
      branchstate
12
      branchcountry
13
      branchphone
14
      branchfax
15
      branchemail
16
      branchillemail
17
      branchreplyto
18
      branchreturnpath
19
      branchurl
20
      issuing
21
      branchip
22
      branchnotes
23
      opac_info
24
      marcorgcode
25
    );
26
    for my $f ( @fields ) {
27
        $dbh->do(qq{
28
            UPDATE branches
29
            SET $f = NULL
30
            WHERE $f = ""
31
        });
32
    }
33
34
    NewVersion( $DBversion, 28567, "Set to NULL empty branches fields");
35
}

Return to bug 28567