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