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