From ec8d66f0dd90005ad27635dda4e67a43867a8e35 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 4 Dec 2017 13:35:01 +1300 Subject: [PATCH] Bug 7047 - Storing subscription renewal note in suggestion to be displayed on the suggestion page. Additionally I have added a library input field in case the librarian wants to set a library branch whilst renewing a subscription. With the use case being they may have ommitted to set the branchcode whilst creating the subscription. Test plan: 1. Create a subscription (if one does not already exist) 2. Set the RenewSerialAddsSuggestion syspref to 'Add' 3. Renew the item making sure to write in a value into the note field 3. Visit the suggestions page and notice that the note is not displayed for the newly created suggestion 4. Apply patch 5. Repeat step 3. Notice that there is now a new branchcode dropdown box. Select one of your libraries and write in the value into the note field 6. Visit suggestions and notice there is now a 'Suggestion note' column in the table containing the note. Also note that the suggestion has the correct branchcode associated with it Sponsored-By: Catalyst IT --- C4/Serials.pm | 8 +++++--- C4/Suggestions.pm | 2 ++ .../prog/en/modules/serials/subscription-renew.tt | 13 +++++++++++++ .../intranet-tmpl/prog/en/modules/suggestion/suggestion.tt | 6 +++++- serials/subscription-renew.pl | 6 +++++- suggestion/suggestion.pl | 1 - 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 45bae8c..2dd4705 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1504,7 +1504,8 @@ this function renew a subscription with values given on input args. =cut sub ReNewSubscription { - my ( $subscriptionid, $user, $startdate, $numberlength, $weeklength, $monthlength, $note ) = @_; + my ( $subscriptionid, $user, $startdate, $numberlength, $weeklength, $monthlength, $note, $branchcode ) = @_; + warn $note; my $dbh = C4::Context->dbh; my $subscription = GetSubscription($subscriptionid); my $query = qq| @@ -1524,8 +1525,9 @@ sub ReNewSubscription { 'title' => $subscription->{bibliotitle}, 'author' => $biblio->{author}, 'publishercode' => $biblio->{publishercode}, - 'note' => $biblio->{note}, - 'biblionumber' => $subscription->{biblionumber} + 'note' => $note, + 'biblionumber' => $subscription->{biblionumber}, + 'branchcode' => $branchcode, } ); } diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 1ea2339..9240615 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -443,7 +443,9 @@ sub NewSuggestion { accepteddate rejectedby rejecteddate + note budgetid + branchcode ) ) { # Set the fields to NULL if not given. $suggestion->{$field} ||= undef; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt index e7eb83d..a69c2f9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt @@ -35,6 +35,19 @@
+
  • + (select a library) +
  • +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 5a8ada6..db5fba3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -627,6 +627,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o   Suggestion Suggested by - on + Suggestion note Managed by - on Library Fund @@ -646,13 +647,16 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
    [% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate |html %] [% END %] [% IF ( suggestions_loo.volumedesc ) %]; Volume:[% suggestions_loo.volumedesc |html %] [% END %] - [% IF ( suggestions_loo.isbn ) %]; ISBN:[% suggestions_loo.isbn |html %] [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode |html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in [% suggestions_loo.publicationyear |html %] [% END %][% IF ( suggestions_loo.place ) %] in [% suggestions_loo.place |html %] [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle |html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) %] [% END %]
    [% IF ( suggestions_loo.note ) %][% suggestions_loo.note |html%][% END %] + [% IF ( suggestions_loo.isbn ) %]; ISBN:[% suggestions_loo.isbn |html %] [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode |html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in [% suggestions_loo.publicationyear |html %] [% END %][% IF ( suggestions_loo.place ) %] in [% suggestions_loo.place |html %] [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle |html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) %] [% END %]
    [% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby %])[% END %] [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %] + [% suggestions_loo.note | html %] + + [% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby %][% END %] [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %] diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl index bbbc8e5..2738ef0 100755 --- a/serials/subscription-renew.pl +++ b/serials/subscription-renew.pl @@ -62,6 +62,7 @@ my $dbh = C4::Context->dbh; my $mode = $query->param('mode') || q{}; my $op = $query->param('op') || 'display'; my $subscriptionid = $query->param('subscriptionid'); +my $branchcode = $query->param('branchcode'); my $done = 0; # for after form has been submitted my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -79,7 +80,7 @@ if ( $op eq "renew" ) { $subscriptionid, $loggedinuser, $startdate, $query->param('numberlength'), $query->param('weeklength'), $query->param('monthlength'), - $query->param('note') + $query->param('note'), $branchcode ); } @@ -92,11 +93,14 @@ if ($subscription->{'cannotedit'}){ my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) or output_pref( { dt => dt_from_string, dateonly => 1 } ); +my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); + $template->param( startdate => $newstartdate, numberlength => $subscription->{numberlength}, weeklength => $subscription->{weeklength}, monthlength => $subscription->{monthlength}, + libraries => $libraries, subscriptionid => $subscriptionid, bibliotitle => $subscription->{bibliotitle}, $op => 1, diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 94e6eab..211a9af 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -29,7 +29,6 @@ use C4::Budgets; use C4::Search; use C4::Members; use C4::Debug; - use Koha::DateUtils qw( dt_from_string ); use Koha::AuthorisedValues; use Koha::Acquisition::Currencies; -- 2.1.4