From 305985938e10dc13d78ac9b687dc47703d179c31 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Maksim Sen Signed-off-by: Séverine QUEUNE Signed-off-by: Séverine QUEUNE --- 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 ac21dad..4b1ad7b 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 70b7b0d..ca76e19 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 6f854e7..c0f093f 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 @@ -33,6 +33,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 c793e2d..3931d05 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -460,6 +460,7 @@   Suggestion Suggested by - on + Suggestion note Managed by - on Library Fund @@ -479,13 +480,16 @@
    [% 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 06b03e2..fa4781f 100755 --- a/serials/subscription-renew.pl +++ b/serials/subscription-renew.pl @@ -61,6 +61,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( { @@ -78,7 +79,7 @@ if ( $op eq "renew" ) { $subscriptionid, $loggedinuser, $startdate, $query->param('numberlength'), $query->param('weeklength'), $query->param('monthlength'), - $query->param('note') + $query->param('note'), $branchcode ); } @@ -91,11 +92,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 98fcca4..e6d9bb0 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -28,7 +28,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.7.4