Bug 7677 [Follow-up]: New areas in subscriptions and new functions when receiving.
authorMatthias Meusburger <matthias.meusburger@biblibre.com>
Mon, 28 Sep 2015 14:29:16 +0000 (16:29 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 12 Sep 2016 09:13:56 +0000 (09:13 +0000)
 - Various fixes.

Test plan:

Once the makePreviousSerialAvailable syspref is enabled, receive a serial, and then another, then check that:

 - the first received itemtype has been set to the "previous item type" value (set in the subscription).

 - the first received has been made available.

 - the last received serial itemtype has been set to the "item type" value (set in the subscription).

 - 995$l is automatically prefilled.

Configure the serialsFieldsToAV syspref. When creating or editing a subscription, check that:

 - the domain and/or origin and/or support fields are correctly displaying the authorized values configured in the syspref.

Signed-off-by: Chris <chris@bigballofwax.co.nz>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

C4/Items.pm
C4/Serials.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
serials/serials-edit.pl

index 6df6b15..71b1619 100644 (file)
@@ -3005,6 +3005,10 @@ sub PrepareItemrecordDisplay {
                             push @authorised_values, $itemtype->{itemtype};
                             $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
                         }
+                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
+                            $defaultvalue = $defaultvalues->{'itemtype'};
+                        }
+
                         #---- class_sources
                     } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) {
                         push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
index 18d315c..3408c47 100644 (file)
@@ -66,7 +66,7 @@ BEGIN {
     @EXPORT = qw(
       &NewSubscription    &ModSubscription    &DelSubscription
       &GetSubscription    &CountSubscriptionFromBiblionumber      &GetSubscriptionsFromBiblionumber
-      &SearchSubscriptions
+      &SearchSubscriptions &GetItemnumberFromSerialId
       &GetFullSubscriptionsFromBiblionumber   &GetFullSubscription &ModSubscriptionHistory
       &HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire
       &GetSubscriptionHistoryFromSubscriptionId
@@ -183,6 +183,30 @@ sub GetSerialStatusFromSerialId {
     return $dbh->prepare($query);
 }
 
+=head2 GetItemnumberFromSerialId
+
+$itemnumber = GetSerialInformation($serialid);
+this function returns the itemnumber, given a serialid in parameter
+return : itemnumber
+
+=cut
+
+sub GetItemnumberFromSerialId {
+    my ($serialid) = @_;
+    my $dbh   = C4::Context->dbh;
+    my $query = qq|
+        SELECT itemnumber
+        FROM   serialitems
+        WHERE  serialid = ?
+    |;
+    my $sth = $dbh->prepare($query);
+    $sth->execute($serialid);
+    my ($result) = $sth->fetchrow;
+    return ($result);
+}
+
+
+
 =head2 GetSerialInformation
 
 
index f68df59..76c89a8 100644 (file)
@@ -55,4 +55,4 @@ Serials:
           choices:
             yes: Make
             no: Do not make
-        - previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.
+        - previous serial automatically available when receiving a new serial issue. The previous issue can also be set to another item type when receiving a new one. Please note that the item-level_itypes syspref must be set to specific item.
index 44d55c2..ff918b0 100644 (file)
@@ -666,7 +666,7 @@ $(document).ready(function() {
                                 </li>
                                 [%IF makePreviousSerialAvailable %]
                                 <li>
-                                    <label for="previousitemtype">Previous item type:</label>
+                                    <label for="previousitemtype">item type for older issues:</label>
                                     <select name="previousitemtype" id="previousitemtype">
                                             <option value=""></option>
                                         [% FOREACH previous IN previoustypeloop %]
index e28fd59..125c701 100755 (executable)
@@ -256,13 +256,7 @@ if ( $op and $op eq 'serialchangestatus' ) {
             my $previous = GetPreviousSerialid($subscriptionids[$i]);
             if ($previous) {
 
-                # Getting the itemnumber matching the serialid
-                my $query = "SELECT itemnumber FROM serialitems WHERE serialid=?";
-                my $sth = $dbh->prepare($query);
-                $sth->execute($previous);
-                my @row = $sth->fetchrow_array;
-                if ($row[0]) {
-                    my $itemnumber = $row[0];
+                if (my $itemnumber = GetItemnumberFromSerialId($previous)) {
 
                     # Getting the itemtype to set from the database
                     my $subscriptioninfos = GetSubscription($subscriptionids[$i]);