Permalink
Browse files

Merge pull request #46 from hgq/07_05_pt13091533_head

[Fixes #13091533] autoBarcode off: do blank barcode on Add+Duplicate
  • Loading branch information...
2 parents 621c211 + 5e23776 commit 376165071f174cfa1b7267bf87205ace2dec58eb @ctfliblime ctfliblime committed Jun 30, 2011
Showing with 22 additions and 15 deletions.
  1. +22 −15 cataloguing/additem.pl
View
@@ -70,6 +70,8 @@
my $today_iso = C4::Dates->today('iso');
$template->param(today_iso => $today_iso);
+my $bctype = C4::Context->preference('autoBarcode') // '';
+$bctype = '' if lc($bctype) eq 'off';
my $tagslib = &GetMarcStructure(1,$frameworkcode);
my $record = GetMarcBiblio($biblionumber);
my $oldrecord = TransformMarcToKoha($dbh,$record);
@@ -143,20 +145,24 @@
# If we have to add & duplicate
if ($add_duplicate_submit) {
-
- # We try to get the next barcode
- use C4::Barcodes;
- my $barcodeobj = C4::Barcodes->new;
- my $barcodevalue = $barcodeobj->next_value($addedolditem->{'barcode'}) if $barcodeobj;
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
- if ($record->field($tagfield)->subfield($tagsubfield)) {
- # If we got the next codebar value, we put it in the record
- if ($barcodevalue) {
- $record->field($tagfield)->update($tagsubfield => $barcodevalue);
- # If not, we delete the recently inserted barcode from the record (so the user can input a barcode himself)
- } else {
- $record->field($tagfield)->update($tagsubfield => '');
- }
+ if ($bctype) {
+ # We try to get the next barcode
+ use C4::Barcodes;
+ my $barcodeobj = C4::Barcodes->new;
+ my $barcodevalue = $barcodeobj->next_value($addedolditem->{'barcode'}) if $barcodeobj;
+ if ($record->field($tagfield)->subfield($tagsubfield)) {
+ # If we got the next codebar value, we put it in the record
+ if ($barcodevalue) {
+ $record->field($tagfield)->update($tagsubfield => $barcodevalue);
+ # If not, we delete the recently inserted barcode from the record (so the user can input a barcode himself)
+ } else {
+ $record->field($tagfield)->update($tagsubfield => '');
+ }
+ }
+ }
+ else {
+ $record->field($tagfield)->update($tagsubfield => '');
}
$itemrecord = $record;
}
@@ -235,8 +241,6 @@
'items.notforloan','items.issues','items.renewals','items.reserves','items.restricted','items.onloan',
'items.materials','items.copynumber');
@today_fields=('items.datelastseen','items.dateaccessioned');
-
-
$nextop="additem";
#-------------------------------------------------------------------------------
} elsif ($op eq "delitem") {
@@ -492,6 +496,9 @@
C4::Context->preference('AllowHoldsOnDamagedItems')
);
}
+# elsif (($$_{subfield} eq 'p') && !$bctype) {
+# $$_{marc_value} =~ s/(value\=\")([^\"]*)(\")/$1$3/s;
+# }
}
## reset subfield's marc_lib
$$_{marc_lib} =~ s/^(<span id\=\"error)(\d+)/$1$i/;

0 comments on commit 3761650

Please sign in to comment.