Lines 104-109
BEGIN {
Link Here
|
104 |
&ModBiblio |
104 |
&ModBiblio |
105 |
&ModBiblioframework |
105 |
&ModBiblioframework |
106 |
&ModZebra |
106 |
&ModZebra |
|
|
107 |
&UpdateTotalIssues |
107 |
); |
108 |
); |
108 |
|
109 |
|
109 |
# To delete something |
110 |
# To delete something |
Lines 3825-3830
sub prepare_host_field {
Link Here
|
3825 |
return; |
3826 |
return; |
3826 |
} |
3827 |
} |
3827 |
|
3828 |
|
|
|
3829 |
|
3830 |
=head2 UpdateTotalIssues |
3831 |
|
3832 |
UpdateTotalIssues($biblionumber, $increase, [$value]) |
3833 |
|
3834 |
Update the total issue count for a particular bib record. |
3835 |
|
3836 |
=over 4 |
3837 |
|
3838 |
=item C<$biblionumber> is the biblionumber of the bib to update |
3839 |
|
3840 |
=item C<$increase> is the amount to increase (or decrease) the total issues count by |
3841 |
|
3842 |
=item C<$value> is the absolute value that total issues count should be set to. If provided, C<$increase> is ignored. |
3843 |
|
3844 |
=back |
3845 |
|
3846 |
=cut |
3847 |
|
3848 |
sub UpdateTotalIssues { |
3849 |
my ($biblionumber, $increase, $value) = @_; |
3850 |
my $totalissues; |
3851 |
|
3852 |
my $data = GetBiblioData($biblionumber); |
3853 |
|
3854 |
if (defined $value) { |
3855 |
$totalissues = $value; |
3856 |
} else { |
3857 |
$totalissues = $data->{'totalissues'} + $increase; |
3858 |
} |
3859 |
my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $data->{'frameworkcode'}); |
3860 |
|
3861 |
my $record = GetMarcBiblio($biblionumber); |
3862 |
|
3863 |
my $field = $record->field($totalissuestag); |
3864 |
if (defined $field) { |
3865 |
$field->update( $totalissuessubfield => $totalissues ); |
3866 |
} else { |
3867 |
$field = MARC::Field->new($totalissuestag, '0', '0', |
3868 |
$totalissuessubfield => $totalissues); |
3869 |
$record->insert_grouped_field($field); |
3870 |
} |
3871 |
|
3872 |
ModBiblio($record, $biblionumber, $data->{'frameworkcode'}); |
3873 |
return; |
3874 |
} |
3875 |
|
3828 |
1; |
3876 |
1; |
3829 |
|
3877 |
|
3830 |
|
3878 |
|