Bugzilla – Attachment 91679 Details for
Bug 23352
Define serial's collection in the subscription
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23352: Template and perl script changes to save subscription defaults
Bug-23352-Template-and-perl-script-changes-to-save.patch (text/plain), 11.24 KB, created by
Alex Buckley
on 2019-07-22 04:01:49 UTC
(
hide
)
Description:
Bug 23352: Template and perl script changes to save subscription defaults
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2019-07-22 04:01:49 UTC
Size:
11.24 KB
patch
obsolete
>From 77b9b6ec3bdec0e71c347a5f08fe0c84e50ac2b5 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Sun, 21 Jul 2019 22:56:54 +0000 >Subject: [PATCH] Bug 23352: Template and perl script changes to save > subscription defaults > >This patch adds the front-end code to save a CCODE in the >serials/subscription-add.pl > >Then when receiving the serial the CCODE (952$8) is pre-populated with >the CCODE set when creating the subscription. > >Test plan: >To come in next commit > >Sponsored-By: Brimbank Library, Australia >--- > C4/Items.pm | 26 ++++++++++++++++++++-- > C4/Serials.pm | 11 ++++----- > .../prog/en/modules/serials/subscription-add.tt | 18 +++++++++++++++ > serials/subscription-add.pl | 9 ++++++-- > 4 files changed, 55 insertions(+), 9 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 797bda6..1f52fa2 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2335,7 +2335,6 @@ The $frameworkcode returns the item for the given frameworkcode, ONLY if bibnum > sub PrepareItemrecordDisplay { > > my ( $bibnum, $itemnum, $defaultvalues, $frameworkcode ) = @_; >- > my $dbh = C4::Context->dbh; > $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum; > my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); >@@ -2422,7 +2421,8 @@ sub PrepareItemrecordDisplay { > $defaultvalue = $defaultvalues->{callnumber}; > } > } >- if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) >+ >+ if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) > && $defaultvalues > && $defaultvalues->{'branchcode'} ) { > if ( $itemrecord and $defaultvalues and not $itemrecord->subfield($tag,$subfield) ) { >@@ -2503,6 +2503,26 @@ sub PrepareItemrecordDisplay { > > $defaultvalue = $default_source; > >+ #---- collection code CCODE >+ } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "CCODE") { >+ $authorised_values_sth->execute( >+ $tagslib->{$tag}->{$subfield}->{authorised_value}, >+ $branch_limit ? $branch_limit : () >+ ); >+ push @authorised_values, "" >+ unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); >+ while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { >+ push @authorised_values, $value; >+ $authorised_lib{$value} = $lib; >+ } >+ >+ # Set the default CCODE to what was set in subscription.ccode >+ if ($itemrecord and $defaultvalues) { >+ $defaultvalue = $defaultvalues->{'ccode'}; >+ } elsif (!$itemrecord and $defaultvalues) { >+ $defaultvalue = $defaultvalues->{'ccode'}; >+ } >+ > #---- "true" authorised value > } else { > $authorised_values_sth->execute( >@@ -2516,6 +2536,7 @@ sub PrepareItemrecordDisplay { > $authorised_lib{$value} = $lib; > } > } >+ > $subfield_data{marc_value} = { > type => 'select', > values => \@authorised_values, >@@ -2534,6 +2555,7 @@ sub PrepareItemrecordDisplay { > if ( $itemrecord and my $field = $itemrecord->field($tag) ) { > $defaultvalue = $field->subfield($subfield); > } >+ > if( !$plugin->errstr ) { > #TODO Move html to template; see report 12176/13397 > my $tab= $plugin->noclick? '-1': ''; >diff --git a/C4/Serials.pm b/C4/Serials.pm >index f2290f4..3cf09cd 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1301,7 +1301,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 $dbh = C4::Context->dbh; >@@ -1314,7 +1314,7 @@ sub ModSubscription { > callnumber=?, notes=?, letter=?, manualhistory=?, > internalnotes=?, serialsadditems=?, staffdisplaycount=?, > opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, >- skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=? >+ skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?, ccode=? > WHERE subscriptionid = ?"; > > my $sth = $dbh->prepare($query); >@@ -1328,7 +1328,7 @@ sub ModSubscription { > $letter, ($manualhistory ? $manualhistory : 0), > $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, > $graceperiod, $location, $enddate, $skip_serialseq, >- $itemtype, $previousitemtype, $mana_id, >+ $itemtype, $previousitemtype, $mana_id, $ccode, > $subscriptionid > ); > my $rows = $sth->rows; >@@ -1345,7 +1345,7 @@ $subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu > $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, > $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, > $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, >- $skip_serialseq, $itemtype, $previousitemtype); >+ $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode); > > Create a new subscription with value given on input args. > >@@ -1362,7 +1362,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; > >@@ -1405,6 +1405,7 @@ sub NewSubscription { > itemtype => $itemtype, > previousitemtype => $previousitemtype, > mana_id => $mana_id, >+ ccode => $ccode, > } > )->store; > $subscription->discard_changes; >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 eff55ae..398043f 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 >@@ -319,6 +319,24 @@ fieldset.rows table { clear: none; margin: 0; } > </select> > <span class="required">Required</span> > </li> >+ <ul> >+ <li> >+ <label for="ccode" class="required">Serial issue Collection code:</label> >+ <select name="ccode" id="ccode"> >+ [% FOREACH ccode_value IN ccode_loop %] >+ [% IF (ccode_value.selected) %] >+ <option value="[% ccode_value.authorised_value | html %]" selected="selected"> >+ [% ELSE %] >+ <option value="[% ccode_value.authorised_value | html %]"> >+ [% END %] >+ [% ccode_value.lib | html %] >+ </option> >+ [% END %] >+ </select> >+ <span class="required">Required</span> >+ </li> >+ >+ </ul> > <li> > <label for="locale">Locale:</label> > <select id="locale" name="locale"> >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index ebc19a0..bbd337e 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -139,9 +139,12 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { > > my $locations_loop = GetAuthorisedValues("LOC"); > >+my $ccode_loop = GetAuthorisedValues("CCODE"); >+ > $template->param( > branchcode => $subs->{branchcode}, > locations_loop=>$locations_loop, >+ ccode_loop => $ccode_loop, > ); > > my @additional_fields = Koha::AdditionalFields->search({ tablename => 'subscription' }); >@@ -349,6 +352,7 @@ sub redirect_add_subscription { > my $itemtype = $query->param('itemtype'); > my $previousitemtype = $query->param('previousitemtype'); > my $skip_serialseq = $query->param('skip_serialseq'); >+ my $ccode = $query->param('ccode'); > > my $mana_id; > if ( $query->param('mana_id') ne "" ) { >@@ -375,7 +379,7 @@ sub redirect_add_subscription { > join(";",@irregularity), $numberpattern, $locale, $callnumber, > $manualhistory, $internalnotes, $serialsadditems, > $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, >- $skip_serialseq, $itemtype, $previousitemtype, $mana_id >+ $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode > ); > if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){ > my $result = Koha::SharedContent::send_entity( $query->param('mana_language') || '', $loggedinuser, $subscriptionid, 'subscription'); >@@ -463,6 +467,7 @@ sub redirect_mod_subscription { > my $itemtype = $query->param('itemtype'); > my $previousitemtype = $query->param('previousitemtype'); > my $skip_serialseq = $query->param('skip_serialseq'); >+ my $ccode = $query->param('ccode'); > > my $mana_id; > if ( $query->param('mana_id') ne "" ) { >@@ -498,7 +503,7 @@ sub redirect_mod_subscription { > $status, $biblionumber, $callnumber, $notes, $letter, > $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, > $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid, >- $skip_serialseq, $itemtype, $previousitemtype, $mana_id >+ $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode > ); > > my @additional_fields; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23352
:
91678
|
91679
|
91901
|
91985
|
91986
|
92149
|
92165
|
92166
|
95662
|
101913
|
101914
|
101916
|
129123
|
129124
|
129125
|
129225
|
129226
|
129227
|
129228
|
131426
|
131427
|
131435
|
131437
|
131438
|
131439
|
132920
|
133679
|
133680
|
133681
|
133682
|
133683
|
133786
|
133787
|
133788
|
133789
|
133790
|
163965