Lines 11464-11470
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
11464 |
foreach my $subscription (@subscriptions) { |
11464 |
foreach my $subscription (@subscriptions) { |
11465 |
my $number_pattern = $subscription->numberpattern(); |
11465 |
my $number_pattern = $subscription->numberpattern(); |
11466 |
|
11466 |
|
11467 |
my @splits = split( /\{[XYZ]\}/, $number_pattern->numberingmethod() ); |
11467 |
my $numbering_method = $number_pattern->numberingmethod(); |
|
|
11468 |
# Get all the data between the enumeration values, we need |
11469 |
# to split each enumeration string based on these values. |
11470 |
my @splits = split( /\{[XYZ]\}/, $numbering_method ); |
11471 |
# Get the order in which the X Y and Z values are used |
11472 |
my %indexes; |
11473 |
foreach my $i (qw(X Y Z)) { |
11474 |
$indexes{$i} = index( $numbering_method, "{$i}" ); |
11475 |
delete $indexes{$i} if $indexes{$i} == -1; |
11476 |
} |
11477 |
my @indexes = sort { $indexes{$a} <=> $indexes{$b} } keys(%indexes); |
11468 |
|
11478 |
|
11469 |
my @serials = |
11479 |
my @serials = |
11470 |
$schema->resultset('Serial') |
11480 |
$schema->resultset('Serial') |
Lines 11472-11495
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
11472 |
|
11482 |
|
11473 |
foreach my $serial (@serials) { |
11483 |
foreach my $serial (@serials) { |
11474 |
my $serialseq = $serial->serialseq(); |
11484 |
my $serialseq = $serial->serialseq(); |
11475 |
my ( $x, $y, $z ); |
11485 |
my %enumeration_data; |
11476 |
|
11486 |
|
11477 |
## We cannot split on multiple values at once, |
11487 |
## We cannot split on multiple values at once, |
11478 |
## so let's replace each of those values with __SPLIT__ |
11488 |
## so let's replace each of those values with __SPLIT__ |
11479 |
if (@splits) { |
11489 |
if (@splits) { |
11480 |
map( $serialseq =~ s/$_/__SPLIT__/, @splits ); |
11490 |
map( $serialseq =~ s/$_/__SPLIT__/, @splits ); |
11481 |
( undef, $x, $y, $z ) = split( /__SPLIT__/, $serialseq ); |
11491 |
( |
|
|
11492 |
undef, |
11493 |
$enumeration_data{ $indexes[0] }, |
11494 |
$enumeration_data{ $indexes[1] }, |
11495 |
$enumeration_data{ $indexes[2] } |
11496 |
) = split( /__SPLIT__/, $serialseq ); |
11482 |
} |
11497 |
} |
11483 |
else |
11498 |
else |
11484 |
{ ## Nothing to split on means the only thing in serialseq is {X} |
11499 |
{ ## Nothing to split on means the only thing in serialseq is a single placeholder e.g. {X} |
11485 |
$x = $serialseq; |
11500 |
$enumeration_data{ $indexes[0] } = $serialseq; |
11486 |
} |
11501 |
} |
11487 |
|
11502 |
|
11488 |
$serial->update( |
11503 |
$serial->update( |
11489 |
{ |
11504 |
{ |
11490 |
serialseq_x => $x, |
11505 |
serialseq_x => $enumeration_data{'X'}, |
11491 |
serialseq_y => $y, |
11506 |
serialseq_y => $enumeration_data{'Y'}, |
11492 |
serialseq_z => $z, |
11507 |
serialseq_z => $enumeration_data{'Z'}, |
11493 |
} |
11508 |
} |
11494 |
); |
11509 |
); |
11495 |
} |
11510 |
} |
11496 |
- |
|
|