diff --git a/C4/Serials.pm b/C4/Serials.pm index a2b56b3e36..f877a7f018 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -325,7 +325,8 @@ sub GetFullSubscription { aqbooksellers.name as aqbooksellername, biblio.title as bibliotitle, subscription.branchcode AS branchcode, - subscription.subscriptionid AS subscriptionid + subscription.subscriptionid AS subscriptionid, + subscription.preselect_issues_in_collections_table AS preselect_issues_in_collections_table FROM serial LEFT JOIN subscription ON (serial.subscriptionid=subscription.subscriptionid ) @@ -370,7 +371,9 @@ sub PrepareSerialsData { foreach my $subs ( @{$lines} ) { $subs->{ "status" . $subs->{'status'} } = 1; - if ( grep { $_ == $subs->{status} } ( EXPECTED, LATE, MISSING_STATUSES, CLAIMED ) ) { + if ( $subs->{preselect_issues_in_collections_table} && grep { $_ == $subs->{status} } + ( EXPECTED, LATE, MISSING_STATUSES, CLAIMED ) ) + { $subs->{"checked"} = 1; } if ($add_itemnumbers) { @@ -470,7 +473,8 @@ sub GetFullSubscriptionsFromBiblionumber { biblio.title as bibliotitle, subscription.branchcode AS branchcode, subscription.subscriptionid AS subscriptionid, - subscription.location AS location + subscription.location AS location, + subscription.preselect_issues_in_collections_table AS preselect_issues_in_collections_table FROM serial LEFT JOIN subscription ON (serial.subscriptionid=subscription.subscriptionid) @@ -1343,58 +1347,59 @@ returns the number of rows affected sub ModSubscription { my ( - $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate, - $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale, - $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1, - $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status, - $biblionumber, $callnumber, $notes, $letter, $manualhistory, - $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, - $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, - $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template + $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate, + $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale, + $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1, + $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status, + $biblionumber, $callnumber, $notes, $letter, $manualhistory, + $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, + $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, + $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template, $preselect_issues_in_collections_table ) = @_; my $subscription = Koha::Subscriptions->find($subscriptionid); $subscription->set( { - librarian => $auser, - branchcode => $branchcode, - aqbooksellerid => $aqbooksellerid, - cost => $cost, - aqbudgetid => $aqbudgetid, - biblionumber => $biblionumber, - startdate => $startdate, - periodicity => $periodicity, - numberlength => $numberlength, - weeklength => $weeklength, - monthlength => $monthlength, - lastvalue1 => $lastvalue1, - innerloop1 => $innerloop1, - lastvalue2 => $lastvalue2, - innerloop2 => $innerloop2, - lastvalue3 => $lastvalue3, - innerloop3 => $innerloop3, - status => $status, - notes => $notes, - letter => $letter, - firstacquidate => $firstacquidate, - irregularity => $irregularity, - numberpattern => $numberpattern, - locale => $locale, - callnumber => $callnumber, - manualhistory => $manualhistory, - internalnotes => $internalnotes, - serialsadditems => $serialsadditems, - staffdisplaycount => $staffdisplaycount, - opacdisplaycount => $opacdisplaycount, - graceperiod => $graceperiod, - location => $location, - enddate => $enddate, - skip_serialseq => $skip_serialseq, - itemtype => $itemtype, - previousitemtype => $previousitemtype, - mana_id => $mana_id, - ccode => $ccode, - published_on_template => $published_on_template, + librarian => $auser, + branchcode => $branchcode, + aqbooksellerid => $aqbooksellerid, + cost => $cost, + aqbudgetid => $aqbudgetid, + biblionumber => $biblionumber, + startdate => $startdate, + periodicity => $periodicity, + numberlength => $numberlength, + weeklength => $weeklength, + monthlength => $monthlength, + lastvalue1 => $lastvalue1, + innerloop1 => $innerloop1, + lastvalue2 => $lastvalue2, + innerloop2 => $innerloop2, + lastvalue3 => $lastvalue3, + innerloop3 => $innerloop3, + status => $status, + notes => $notes, + letter => $letter, + firstacquidate => $firstacquidate, + irregularity => $irregularity, + numberpattern => $numberpattern, + locale => $locale, + callnumber => $callnumber, + manualhistory => $manualhistory, + internalnotes => $internalnotes, + serialsadditems => $serialsadditems, + staffdisplaycount => $staffdisplaycount, + opacdisplaycount => $opacdisplaycount, + graceperiod => $graceperiod, + location => $location, + enddate => $enddate, + skip_serialseq => $skip_serialseq, + itemtype => $itemtype, + previousitemtype => $previousitemtype, + mana_id => $mana_id, + ccode => $ccode, + published_on_template => $published_on_template, + preselect_issues_in_collections_table => $preselect_issues_in_collections_table, } )->store; @@ -1427,58 +1432,59 @@ the id of this new subscription sub NewSubscription { my ( - $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber, - $startdate, $periodicity, $numberlength, $weeklength, $monthlength, - $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, - $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, - $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, - $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, - $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, - $published_on_template, + $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber, + $startdate, $periodicity, $numberlength, $weeklength, $monthlength, + $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, + $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, + $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, + $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, + $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, + $published_on_template, $preselect_issues_in_collections_table ) = @_; my $dbh = C4::Context->dbh; my $subscription = Koha::Subscription->new( { - librarian => $auser, - branchcode => $branchcode, - aqbooksellerid => $aqbooksellerid, - cost => $cost, - aqbudgetid => $aqbudgetid, - biblionumber => $biblionumber, - startdate => $startdate, - periodicity => $periodicity, - numberlength => $numberlength, - weeklength => $weeklength, - monthlength => $monthlength, - lastvalue1 => $lastvalue1, - innerloop1 => $innerloop1, - lastvalue2 => $lastvalue2, - innerloop2 => $innerloop2, - lastvalue3 => $lastvalue3, - innerloop3 => $innerloop3, - status => $status, - notes => $notes, - letter => $letter, - firstacquidate => $firstacquidate, - irregularity => $irregularity, - numberpattern => $numberpattern, - locale => $locale, - callnumber => $callnumber, - manualhistory => $manualhistory, - internalnotes => $internalnotes, - serialsadditems => $serialsadditems, - staffdisplaycount => $staffdisplaycount, - opacdisplaycount => $opacdisplaycount, - graceperiod => $graceperiod, - location => $location, - enddate => $enddate, - skip_serialseq => $skip_serialseq, - itemtype => $itemtype, - previousitemtype => $previousitemtype, - mana_id => $mana_id, - ccode => $ccode, - published_on_template => $published_on_template, + librarian => $auser, + branchcode => $branchcode, + aqbooksellerid => $aqbooksellerid, + cost => $cost, + aqbudgetid => $aqbudgetid, + biblionumber => $biblionumber, + startdate => $startdate, + periodicity => $periodicity, + numberlength => $numberlength, + weeklength => $weeklength, + monthlength => $monthlength, + lastvalue1 => $lastvalue1, + innerloop1 => $innerloop1, + lastvalue2 => $lastvalue2, + innerloop2 => $innerloop2, + lastvalue3 => $lastvalue3, + innerloop3 => $innerloop3, + status => $status, + notes => $notes, + letter => $letter, + firstacquidate => $firstacquidate, + irregularity => $irregularity, + numberpattern => $numberpattern, + locale => $locale, + callnumber => $callnumber, + manualhistory => $manualhistory, + internalnotes => $internalnotes, + serialsadditems => $serialsadditems, + staffdisplaycount => $staffdisplaycount, + opacdisplaycount => $opacdisplaycount, + graceperiod => $graceperiod, + location => $location, + enddate => $enddate, + skip_serialseq => $skip_serialseq, + itemtype => $itemtype, + previousitemtype => $previousitemtype, + mana_id => $mana_id, + ccode => $ccode, + published_on_template => $published_on_template, + preselect_issues_in_collections_table => $preselect_issues_in_collections_table, } )->store; $subscription->discard_changes; diff --git a/Koha/Schema/Result/Subscription.pm b/Koha/Schema/Result/Subscription.pm index 46463ebbb0..5ed0fd2197 100644 --- a/Koha/Schema/Result/Subscription.pm +++ b/Koha/Schema/Result/Subscription.pm @@ -341,6 +341,14 @@ collection code to assign to serial items Template Toolkit syntax to generate the default "Published on (text)" field when receiving an issue this serial +=head2 preselect_issues_in_collections_table + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +yes / no if the subscription should preselect issues in the collections table + =cut __PACKAGE__->add_columns( @@ -434,6 +442,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 80 }, "published_on_template", { data_type => "text", is_nullable => 1 }, + "preselect_issues_in_collections_table", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -586,8 +596,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-11-11 14:57:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1Ht7Nfl870dv1NOs4vr04g +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-05-09 08:07:54 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TZz+AyW1pPFbUMdo2mneuw __PACKAGE__->has_many( "additional_field_values", @@ -604,10 +614,11 @@ __PACKAGE__->has_many( ); __PACKAGE__->add_columns( - '+closed' => { is_boolean => 1 }, - '+manualhistory' => { is_boolean => 1 }, - '+serialsadditems' => { is_boolean => 1 }, - '+skip_serialseq' => { is_boolean => 1 }, + '+closed' => { is_boolean => 1 }, + '+manualhistory' => { is_boolean => 1 }, + '+serialsadditems' => { is_boolean => 1 }, + '+skip_serialseq' => { is_boolean => 1 }, + '+preselect_issues_in_collections_table' => { is_boolean => 1 }, ); 1; diff --git a/installer/data/mysql/atomicupdate/bug_38061-collections_preselect_column.pl b/installer/data/mysql/atomicupdate/bug_38061-collections_preselect_column.pl new file mode 100755 index 0000000000..c741f7530b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_38061-collections_preselect_column.pl @@ -0,0 +1,19 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "38061", + description => + "Add a column to determine whether a subscription's issues should be preselected in the collections table", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( !column_exists( 'subscription', 'preselect_issues_in_collections_table' ) ) { + $dbh->do( + q{ ALTER TABLE subscription ADD COLUMN `preselect_issues_in_collections_table` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription should preselect issues in the collections table' AFTER published_on_template} + ); + say_success( $out, "Added column 'subscription.preselect_issues_in_collections_table'" ); + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 63902a803b..9b33864534 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -6497,6 +6497,7 @@ CREATE TABLE `subscription` ( `mana_id` int(11) DEFAULT NULL, `ccode` varchar(80) DEFAULT NULL COMMENT 'collection code to assign to serial items', `published_on_template` text DEFAULT NULL COMMENT 'Template Toolkit syntax to generate the default "Published on (text)" field when receiving an issue this serial', + `preselect_issues_in_collections_table` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription should preselect issues in the collections table', PRIMARY KEY (`subscriptionid`), KEY `subscription_ibfk_1` (`periodicity`), KEY `subscription_ibfk_2` (`numberpattern`), 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 d294648b5e..b1f3b46b63 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 @@ -286,6 +286,15 @@ [% END %] +