From 0e6f26ac6e1337f8c5756832d04410338d4be60e Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Mon, 28 Sep 2015 16:29:16 +0200 Subject: [PATCH] BZ7677 [Follow-up]: New areas in subscriptions and new functions when receiving. - Various fixes. --- C4/Items.pm | 4 +++ C4/Serials.pm | 26 +++++++++++++++++++- installer/data/mysql/updatedatabase.pl | 2 +- .../prog/en/modules/admin/preferences/serials.pref | 2 +- .../prog/en/modules/serials/subscription-add.tt | 2 +- serials/serials-edit.pl | 8 +----- 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index fe6905c..a9a2c02 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -3031,6 +3031,10 @@ sub PrepareItemrecordDisplay { push @authorised_values, $itemtype; $authorised_lib{$itemtype} = $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} ); diff --git a/C4/Serials.pm b/C4/Serials.pm index b491ee8..d43fe24 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -63,7 +63,7 @@ BEGIN { @EXPORT = qw( &NewSubscription &ModSubscription &DelSubscription &GetSubscription &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber - &SearchSubscriptions + &SearchSubscriptions &GetItemnumberFromSerialId &GetFullSubscriptionsFromBiblionumber &GetFullSubscription &ModSubscriptionHistory &HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire &GetSubscriptionHistoryFromSubscriptionId @@ -181,6 +181,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 diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 199b81f..717ee3f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -10893,7 +10893,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { ADD `previousitemtype` VARCHAR( 10 ) NULL AFTER itemtype }); $dbh->do( - "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('makePreviousSerialAvailable','0','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','','YesNo');" + "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('makePreviousSerialAvailable','0','make 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.','','YesNo');" ); print "Upgrade to $DBversion done (Bug 7677: Adds fields to subscription table and makePreviousSerialAvailable syspref)\n"; SetVersion($DBversion); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref index f68df59..76c89a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref @@ -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. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index afb88d1..6d03543 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -620,7 +620,7 @@ $(document).ready(function() { [%IF makePreviousSerialAvailable %]
  • - +