Lines 8593-8599
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
8593 |
foreach my $subscription (@subscriptions) { |
8593 |
foreach my $subscription (@subscriptions) { |
8594 |
my $number_pattern = $subscription->numberpattern(); |
8594 |
my $number_pattern = $subscription->numberpattern(); |
8595 |
|
8595 |
|
8596 |
my @splits = split( /\{[XYZ]\}/, $number_pattern->numberingmethod() ); |
8596 |
my $numbering_method = $number_pattern->numberingmethod(); |
|
|
8597 |
# Get all the data between the enumeration values, we need |
8598 |
# to split each enumeration string based on these values. |
8599 |
my @splits = split( /\{[XYZ]\}/, $numbering_method ); |
8600 |
# Get the order in which the X Y and Z values are used |
8601 |
my %indexes; |
8602 |
foreach my $i (qw(X Y Z)) { |
8603 |
$indexes{$i} = index( $numbering_method, "{$i}" ); |
8604 |
delete $indexes{$i} if $indexes{$i} == -1; |
8605 |
} |
8606 |
my @indexes = sort { $indexes{$a} <=> $indexes{$b} } keys(%indexes); |
8597 |
|
8607 |
|
8598 |
my @serials = |
8608 |
my @serials = |
8599 |
$schema->resultset('Serial') |
8609 |
$schema->resultset('Serial') |
Lines 8601-8624
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
8601 |
|
8611 |
|
8602 |
foreach my $serial (@serials) { |
8612 |
foreach my $serial (@serials) { |
8603 |
my $serialseq = $serial->serialseq(); |
8613 |
my $serialseq = $serial->serialseq(); |
8604 |
my ( $x, $y, $z ); |
8614 |
my %enumeration_data; |
8605 |
|
8615 |
|
8606 |
## We cannot split on multiple values at once, |
8616 |
## We cannot split on multiple values at once, |
8607 |
## so let's replace each of those values with __SPLIT__ |
8617 |
## so let's replace each of those values with __SPLIT__ |
8608 |
if (@splits) { |
8618 |
if (@splits) { |
8609 |
map( $serialseq =~ s/$_/__SPLIT__/, @splits ); |
8619 |
map( $serialseq =~ s/$_/__SPLIT__/, @splits ); |
8610 |
( undef, $x, $y, $z ) = split( /__SPLIT__/, $serialseq ); |
8620 |
( |
|
|
8621 |
undef, |
8622 |
$enumeration_data{ $indexes[0] }, |
8623 |
$enumeration_data{ $indexes[1] }, |
8624 |
$enumeration_data{ $indexes[2] } |
8625 |
) = split( /__SPLIT__/, $serialseq ); |
8611 |
} |
8626 |
} |
8612 |
else |
8627 |
else |
8613 |
{ ## Nothing to split on means the only thing in serialseq is {X} |
8628 |
{ ## Nothing to split on means the only thing in serialseq is a single placeholder e.g. {X} |
8614 |
$x = $serialseq; |
8629 |
$enumeration_data{ $indexes[0] } = $serialseq; |
8615 |
} |
8630 |
} |
8616 |
|
8631 |
|
8617 |
$serial->update( |
8632 |
$serial->update( |
8618 |
{ |
8633 |
{ |
8619 |
serialseq_x => $x, |
8634 |
serialseq_x => $enumeration_data{'X'}, |
8620 |
serialseq_y => $y, |
8635 |
serialseq_y => $enumeration_data{'Y'}, |
8621 |
serialseq_z => $z, |
8636 |
serialseq_z => $enumeration_data{'Z'}, |
8622 |
} |
8637 |
} |
8623 |
); |
8638 |
); |
8624 |
} |
8639 |
} |
8625 |
- |
|
|