Lines 9672-9678
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
9672 |
foreach my $subscription (@subscriptions) { |
9672 |
foreach my $subscription (@subscriptions) { |
9673 |
my $number_pattern = $subscription->numberpattern(); |
9673 |
my $number_pattern = $subscription->numberpattern(); |
9674 |
|
9674 |
|
9675 |
my @splits = split( /\{[XYZ]\}/, $number_pattern->numberingmethod() ); |
9675 |
my $numbering_method = $number_pattern->numberingmethod(); |
|
|
9676 |
# Get all the data between the enumeration values, we need |
9677 |
# to split each enumeration string based on these values. |
9678 |
my @splits = split( /\{[XYZ]\}/, $numbering_method ); |
9679 |
# Get the order in which the X Y and Z values are used |
9680 |
my %indexes; |
9681 |
foreach my $i (qw(X Y Z)) { |
9682 |
$indexes{$i} = index( $numbering_method, "{$i}" ); |
9683 |
delete $indexes{$i} if $indexes{$i} == -1; |
9684 |
} |
9685 |
my @indexes = sort { $indexes{$a} <=> $indexes{$b} } keys(%indexes); |
9676 |
|
9686 |
|
9677 |
my @serials = |
9687 |
my @serials = |
9678 |
$schema->resultset('Serial') |
9688 |
$schema->resultset('Serial') |
Lines 9680-9703
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
9680 |
|
9690 |
|
9681 |
foreach my $serial (@serials) { |
9691 |
foreach my $serial (@serials) { |
9682 |
my $serialseq = $serial->serialseq(); |
9692 |
my $serialseq = $serial->serialseq(); |
9683 |
my ( $x, $y, $z ); |
9693 |
my %enumeration_data; |
9684 |
|
9694 |
|
9685 |
## We cannot split on multiple values at once, |
9695 |
## We cannot split on multiple values at once, |
9686 |
## so let's replace each of those values with __SPLIT__ |
9696 |
## so let's replace each of those values with __SPLIT__ |
9687 |
if (@splits) { |
9697 |
if (@splits) { |
9688 |
map( $serialseq =~ s/$_/__SPLIT__/, @splits ); |
9698 |
map( $serialseq =~ s/$_/__SPLIT__/, @splits ); |
9689 |
( undef, $x, $y, $z ) = split( /__SPLIT__/, $serialseq ); |
9699 |
( |
|
|
9700 |
undef, |
9701 |
$enumeration_data{ $indexes[0] }, |
9702 |
$enumeration_data{ $indexes[1] }, |
9703 |
$enumeration_data{ $indexes[2] } |
9704 |
) = split( /__SPLIT__/, $serialseq ); |
9690 |
} |
9705 |
} |
9691 |
else |
9706 |
else |
9692 |
{ ## Nothing to split on means the only thing in serialseq is {X} |
9707 |
{ ## Nothing to split on means the only thing in serialseq is a single placeholder e.g. {X} |
9693 |
$x = $serialseq; |
9708 |
$enumeration_data{ $indexes[0] } = $serialseq; |
9694 |
} |
9709 |
} |
9695 |
|
9710 |
|
9696 |
$serial->update( |
9711 |
$serial->update( |
9697 |
{ |
9712 |
{ |
9698 |
serialseq_x => $x, |
9713 |
serialseq_x => $enumeration_data{'X'}, |
9699 |
serialseq_y => $y, |
9714 |
serialseq_y => $enumeration_data{'Y'}, |
9700 |
serialseq_z => $z, |
9715 |
serialseq_z => $enumeration_data{'Z'}, |
9701 |
} |
9716 |
} |
9702 |
); |
9717 |
); |
9703 |
} |
9718 |
} |
9704 |
- |
|
|