Lines 106-112
elsif ( $op eq 'add_validate' ) {
Link Here
|
106 |
my $number = $cgi->param('number'); |
106 |
my $number = $cgi->param('number'); |
107 |
|
107 |
|
108 |
my $success = 1; |
108 |
my $success = 1; |
109 |
for my $lang ( @lang ) { |
109 |
for my $lang ( sort {$a ne 'default'} @lang ) { # Process 'default' first |
110 |
my $title = shift @title; |
110 |
my $title = shift @title; |
111 |
my $content = shift @content; |
111 |
my $content = shift @content; |
112 |
my $additional_content = Koha::AdditionalContents->find( |
112 |
my $additional_content = Koha::AdditionalContents->find( |
Lines 160-166
elsif ( $op eq 'add_validate' ) {
Link Here
|
160 |
my $additional_content = Koha::AdditionalContent->new( |
160 |
my $additional_content = Koha::AdditionalContent->new( |
161 |
{ |
161 |
{ |
162 |
category => $category, |
162 |
category => $category, |
163 |
code => $code, |
163 |
code => $code || 'tmp_code', |
164 |
location => $location, |
164 |
location => $location, |
165 |
branchcode => $branchcode, |
165 |
branchcode => $branchcode, |
166 |
title => $title, |
166 |
title => $title, |
Lines 172-178
elsif ( $op eq 'add_validate' ) {
Link Here
|
172 |
borrowernumber => $borrowernumber, |
172 |
borrowernumber => $borrowernumber, |
173 |
} |
173 |
} |
174 |
)->store; |
174 |
)->store; |
175 |
eval { $additional_content->store; }; |
175 |
eval { |
|
|
176 |
$additional_content->store; |
177 |
unless ($code) { |
178 |
$additional_content->discard_changes; |
179 |
$code = $category eq 'news' |
180 |
? 'News_' . $additional_content->idnew |
181 |
: $location . '_' . $additional_content->idnew; |
182 |
$additional_content->code($code)->store; |
183 |
} |
184 |
}; |
176 |
if ($@) { |
185 |
if ($@) { |
177 |
$success = 0; |
186 |
$success = 0; |
178 |
push @messages, { type => 'error', code => 'error_on_insert' }; |
187 |
push @messages, { type => 'error', code => 'error_on_insert' }; |
179 |
- |
|
|