Bug 7047: Storing subscription renewal note in suggestion to be displayed on the...
authorAlex Buckley <alexbuckley@catalyst.net.nz>
Mon, 4 Dec 2017 00:35:01 +0000 (13:35 +1300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 23 Dec 2019 12:06:28 +0000 (12:06 +0000)
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 <maksim@inlibro.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Serials.pm
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
serials/subscription-renew.pl
suggestion/suggestion.pl

index 7d88513..66e6521 100644 (file)
@@ -1476,7 +1476,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|
@@ -1496,8 +1497,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,
             }
         );
     }
index 9826464..cfba7c3 100644 (file)
                <ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% subscription.numberlength | html %]" /></li>
                <li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% subscription.weeklength | html %]" /></li>
                <li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% subscription.monthlength | html %]" /></li></ol></fieldset></li>
+
+<li><label for="branchcode">Library:</label>
+ <select name="branchcode" id="branchcode" style="width: 20em;">
+     [% UNLESS ( Independentbranches ) %]
+        <option value="">None</option>
+     [% END %]
+     [% IF CAN_user_serials_superserials %]
+        [% FOREACH library IN libraries %]
+             <option value="[% library.branchcode %]"> [% library.branchname %] </option>
+        [% END %]
+     [% END %]
+</select> (select a library)
+</li>
+
                <li><label for="note">Note for the librarian that will manage your renewal request: </label>
                <textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
                <fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
index 38e5410..1d22fbe 100644 (file)
                 <th class="NoSort">&nbsp;</th>
                 <th class="anti-the">Suggestion</th>
                 <th>Suggested by - on</th>
+                <th>Suggestion note</th>
                 <th>Managed by - on</th>
                 <th>Library</th>
                 <th>Fund</th>
                     <br />
                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate | html %] [% END %]
                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %]
-                        [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<div class="note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>[% END %]
+                        [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />
                 </td>
                 <td>
                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamesuggestedby | html %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby | html %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby | html %])[% END %]</a>
                 </td>
                 <td>
                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamemanagedby | html %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby | html %][% END %]</a>
+                <td>
+                    [% IF ( suggestions_loo.note ) %]<div class="note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>[% END %]
+                </td>
                     [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
                 </td>
                 <td>
index ccfbad2..1e6f85b 100755 (executable)
@@ -61,6 +61,7 @@ my $dbh   = C4::Context->dbh;
 my $mode           = $query->param('mode') || q{};
 my $op             = $query->param('op') || 'display';
 my @subscriptionids = $query->multi_param('subscriptionid');
+my $branchcode     = $query->param('branchcode');
 my $done = 0;    # for after form has been submitted
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
@@ -83,7 +84,7 @@ if ( $op eq "renew" ) {
         $subscriptionid, $loggedinuser,
         $startdate, scalar $query->param('numberlength'),
         scalar $query->param('weeklength'), scalar $query->param('monthlength'),
-        scalar $query->param('note')
+        scalar $query->param('note'), $branchcode
     );
 } elsif ( $op eq 'multi_renew' ) {
     for my $subscriptionid ( @subscriptionids ) {
@@ -113,8 +114,11 @@ if ( $op eq "renew" ) {
     );
 }
 
+my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
+
 $template->param(
     op => $op,
+    libraries      => $libraries,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
index 8c3056e..e98bbd9 100755 (executable)
@@ -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;