|
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 |
|