@@ -, +, @@
subscription
- Tick the 'Create an item record when receiving this serial' radio
- Select values in the Location, Collection code and Item type dropdowns
- Save the subscription
- Click 'Receive'
- Change the status dropdown from 'Expected' to 'Arrived'
- Confirm the 'Collection Code', 'Shelving location' and 'Koha item
---
C4/Items.pm | 12 ++++++++++++
C4/Serials.pm | 6 ++++--
.../prog/en/modules/serials/subscription-add.tt | 12 ++++++++++++
.../en/modules/serials/subscription-detail.tt | 1 +
serials/subscription-add.pl | 8 ++++++--
serials/subscription-detail.pl | 2 ++
t/db_dependent/Serials.t | 15 ++++++++++++---
7 files changed, 49 insertions(+), 7 deletions(-)
--- a/C4/Items.pm
+++ a/C4/Items.pm
@@ -1673,6 +1673,18 @@ sub PrepareItemrecordDisplay {
$defaultvalue = $defaultvalues->{location};
}
}
+ if ( ( $subfield->{kohafield} eq 'items.ccode' )
+ && $defaultvalues
+ && $defaultvalues->{'ccode'} ) {
+
+ if ( $itemrecord and $defaultvalues and not $itemrecord->subfield($tag,$subfield->{subfield}) ) {
+ # if the item record exists, only use default value if the item has no ccode
+ $defaultvalue = $defaultvalues->{ccode};
+ } elsif ( !$itemrecord and $defaultvalues ) {
+ # if the item record *doesn't* exists, always use the default value
+ $defaultvalue = $defaultvalues->{ccode};
+ }
+ }
if ( $subfield->{authorised_value} ) {
my @authorised_values;
my %authorised_lib;
--- a/C4/Serials.pm
+++ a/C4/Serials.pm
@@ -1318,7 +1318,7 @@ sub ModSubscription {
$biblionumber, $callnumber, $notes, $letter, $manualhistory,
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
- $itemtype, $previousitemtype, $mana_id
+ $itemtype, $previousitemtype, $mana_id, $ccode
) = @_;
my $subscription = Koha::Subscriptions->find($subscriptionid);
@@ -1361,6 +1361,7 @@ sub ModSubscription {
itemtype => $itemtype,
previousitemtype => $previousitemtype,
mana_id => $mana_id,
+ ccode => $ccode,
}
)->store;
# FIXME Must be $subscription->serials
@@ -1398,7 +1399,7 @@ sub NewSubscription {
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
- $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id
+ $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
) = @_;
my $dbh = C4::Context->dbh;
@@ -1441,6 +1442,7 @@ sub NewSubscription {
itemtype => $itemtype,
previousitemtype => $previousitemtype,
mana_id => $mana_id,
+ ccode => $ccode
}
)->store;
$subscription->discard_changes;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
@@ -199,6 +199,18 @@ fieldset.rows table { clear: none; margin: 0; }
[% END %]
+
+
+
+