Bug 13024 - Nonpublic note not appearing in the staff client
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 24 Apr 2015 14:41:58 +0000 (10:41 -0400)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 4 Dec 2015 14:47:57 +0000 (14:47 +0000)
The nonpublic note for items is not displayed in the staff client. It
should be displayed in the following areas:
1) Checkouts (circulation.pl)
2) Checkins (returns.pl)
3) Record details ( moredetail.pl )

Test Plan:
1) Ensure your non-public note field is mapped to the
   items.itemnotes_nonpublic database column
2) Edit an item, add a test nonpublic note
3) Check out the item, verify the note is visible in the checkouts table
4) Check in the item, verify the note is visible in the checkins table
5) View the item details, verify the note is visible and editable
   if your account has the rights to edit items

Followed test plan, works as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

catalogue/updateitem.pl
circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
svc/checkouts

index db37803..90c6de6 100755 (executable)
@@ -37,6 +37,7 @@ my $itemnumber=$cgi->param('itemnumber');
 my $biblioitemnumber=$cgi->param('biblioitemnumber');
 my $itemlost=$cgi->param('itemlost');
 my $itemnotes=$cgi->param('itemnotes');
+my $itemnotes_nonpublic=$cgi->param('itemnotes_nonpublic');
 my $withdrawn=$cgi->param('withdrawn');
 my $damaged=$cgi->param('damaged');
 
@@ -55,7 +56,13 @@ for ($damaged,$itemlost,$withdrawn) {
 
 # modify MARC item if input differs from items table.
 my $item_changes = {};
-if (defined $itemnotes) { # i.e., itemnotes parameter passed from form
+if (defined $itemnotes_nonpublic) { # i.e., itemnotes_nonpublic parameter passed from form
+    checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet');
+    if ((not defined  $item_data_hashref->{'itemnotes_nonpublic'}) or $itemnotes_nonpublic ne $item_data_hashref->{'itemnotes_nonpublic'}) {
+        $item_changes->{'itemnotes_nonpublic'} = $itemnotes_nonpublic;
+    }
+}
+elsif (defined $itemnotes) { # i.e., itemnotes parameter passed from form
     checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet');
     if ((not defined  $item_data_hashref->{'itemnotes'}) or $itemnotes ne $item_data_hashref->{'itemnotes'}) {
         $item_changes->{'itemnotes'} = $itemnotes;
index 4039c75..893accd 100755 (executable)
@@ -577,17 +577,18 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
         my $item   = GetItem( GetItemnumberFromBarcode($bar_code) );
         # fix up item type for display
         $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
-        $ri{itembiblionumber} = $biblio->{'biblionumber'};
-        $ri{itemtitle}        = $biblio->{'title'};
-        $ri{itemauthor}       = $biblio->{'author'};
-        $ri{itemcallnumber}   = $biblio->{'itemcallnumber'};
-        $ri{itemtype}         = $biblio->{'itemtype'};
-        $ri{itemnote}         = $biblio->{'itemnotes'};
-        $ri{ccode}            = $biblio->{'ccode'};
-        $ri{itemnumber}       = $biblio->{'itemnumber'};
-        $ri{barcode}          = $bar_code;
-        $ri{homebranch}       = $item->{'homebranch'};
-        $ri{holdingbranch}    = $item->{'holdingbranch'};
+        $ri{itembiblionumber}    = $biblio->{'biblionumber'};
+        $ri{itemtitle}           = $biblio->{'title'};
+        $ri{itemauthor}          = $biblio->{'author'};
+        $ri{itemcallnumber}      = $biblio->{'itemcallnumber'};
+        $ri{itemtype}            = $biblio->{'itemtype'};
+        $ri{itemnote}            = $biblio->{'itemnotes'};
+        $ri{itemnotes_nonpublic} = $item->{'itemnotes_nonpublic'};
+        $ri{ccode}               = $biblio->{'ccode'};
+        $ri{itemnumber}          = $biblio->{'itemnumber'};
+        $ri{barcode}             = $bar_code;
+        $ri{homebranch}          = $item->{'homebranch'};
+        $ri{holdingbranch}       = $item->{'holdingbranch'};
 
         $ri{location}         = $biblio->{'location'};
         my $shelfcode = $ri{'location'};
index b4b676b..db7c8b1 100644 (file)
@@ -241,6 +241,14 @@ $(document).ready(function() {
                             title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
                         }
 
+                        if ( oObj.itemnotes_nonpublic ) {
+                            var span_class = "";
+                            if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+                                span_class = "circ-hlt";
+                            }
+                            title += " - <span class='" + span_class + "'>" + oObj.itemnotes_nonpublic + "</span>"
+                        }
+
                         var onsite_checkout = '';
                         if ( oObj.onsite_checkout == 1 ) {
                             onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>";
index 1ddc952..ac6ab11 100644 (file)
                 [% IF ( ITEM_DAT.card1 ) %]<li><span class="label">Previous borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower1 %]">[% ITEM_DAT.card1 %]</a>&nbsp;</li>[% END %]
                 [% IF ( ITEM_DAT.card2 ) %]<li><span class="label">Previous borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower2 %]">[% ITEM_DAT.card2 %]</a>&nbsp;</li>[% END %]
                 [% IF ( ITEM_DAT.paidfor ) %]<li><span class="label">Paid for?:</span> [% ITEM_DAT.paidfor %]&nbsp;</li>[% END %]
+
                 [% IF ( ITEM_DAT.enumchron ) %]<li><span class="label">Serial enumeration:</span> [% ITEM_DAT.enumchron %]&nbsp;</li>[% END %]
-                <li><span class="label">Public note:</span>
-                [% IF ( CAN_user_editcatalogue_edit_items ) %]
-                <form class="inline" action="updateitem.pl" method="post"><input type="hidden" name="biblionumber" value="[% ITEM_DAT.biblionumber %]" />
-                    <input type="hidden" name="biblioitemnumber" value="[% ITEM_DAT.biblioitemnumber %]" /><input type="hidden" name="itemnumber" value="[% ITEM_DAT.itemnumber %]" />
-                    <textarea name="itemnotes" rows="2" cols="30">[% ITEM_DAT.itemnotes %]</textarea><input type="submit" name="submit" class="submit" value="Update" />
-                </form>
-                [% ELSE %]
-                    [% ITEM_DAT.itemnotes %]
-                    &nbsp;
-                [% END %]
-            </li>
+
+                <li>
+                    <span class="label">Public note:</span>
+                    [% IF ( CAN_user_editcatalogue_edit_items ) %]
+                    <form class="inline" action="updateitem.pl" method="post"><input type="hidden" name="biblionumber" value="[% ITEM_DAT.biblionumber %]" />
+                        <input type="hidden" name="biblioitemnumber" value="[% ITEM_DAT.biblioitemnumber %]" /><input type="hidden" name="itemnumber" value="[% ITEM_DAT.itemnumber %]" />
+                        <textarea name="itemnotes" rows="2" cols="30">[% ITEM_DAT.itemnotes %]</textarea><input type="submit" name="submit" class="submit" value="Update" />
+                    </form>
+                    [% ELSE %]
+                        [% ITEM_DAT.itemnotes %]
+                        &nbsp;
+                    [% END %]
+                </li>
+
+                <li>
+                    <span class="label">Non-public note:</span>
+                    [% IF ( CAN_user_editcatalogue_edit_items ) %]
+                    <form class="inline" action="updateitem.pl" method="post"><input type="hidden" name="biblionumber" value="[% ITEM_DAT.biblionumber %]" />
+                        <input type="hidden" name="biblioitemnumber" value="[% ITEM_DAT.biblioitemnumber %]" /><input type="hidden" name="itemnumber" value="[% ITEM_DAT.itemnumber %]" />
+                        <textarea name="itemnotes_nonpublic" rows="2" cols="30">[% ITEM_DAT.itemnotes_nonpublic %]</textarea><input type="submit" name="submit" class="submit" value="Update" />
+                    </form>
+                    [% ELSE %]
+                        [% ITEM_DAT.itemnotes_nonpublic %]
+                        &nbsp;
+                    [% END %]
+                </li>
             </ol>
             </div>
 </div>
index ca23a94..fab2402 100644 (file)
@@ -593,8 +593,10 @@ $(document).ready(function () {
                     [% riloo.borsurname %], [% riloo.borfirstname %] ([% riloo.borcategorycode %])
                 </a>
             [% ELSE %]Not checked out[% END %]</td>
-            <td class="ci-note">[% IF ( riloo.bornote ) %]<span class="circ-hlt">[% riloo.bornote %]<br /></span>[% END %]
-            [% IF ( riloo.itemnote ) %]<span class="circ-hlt">[% riloo.itemnote %]</span>[% END %]
+            <td class="ci-note">
+                [% IF ( riloo.bornote ) %]<p><span class="circ-hlt">[% riloo.bornote %]</p></span>[% END %]
+                [% IF ( riloo.itemnote ) %]<p><span class="circ-hlt">[% riloo.itemnote %]</p></span>[% END %]
+                [% IF ( riloo.itemnotes_nonpublic ) %]<p><span class="circ-hlt">[% riloo.itemnotes_nonpublic %]</p></span>[% END %]
             </td>
            </tr>
         [% END %]
index 6ecfd09..cff2561 100755 (executable)
@@ -76,6 +76,7 @@ my $sql = '
         itemnumber,
         barcode,
         itemnotes,
+        itemnotes_nonpublic,
         itemcallnumber,
         replacementprice,
 
@@ -143,16 +144,17 @@ while ( my $c = $sth->fetchrow_hashref() ) {
 
     my $itemtype = C4::Koha::getitemtypeinfo( $item_level_itypes ? $c->{itype} : $c->{itemtype} );
     my $checkout = {
-        DT_RowId   => $c->{itemnumber} . '-' . $c->{borrowernumber},
-        title      => $c->{title},
-        author     => $c->{author},
-        barcode    => $c->{barcode},
-        itemtype   => $item_level_itypes ? $c->{itype} : $c->{itemtype},
+        DT_RowId             => $c->{itemnumber} . '-' . $c->{borrowernumber},
+        title                => $c->{title},
+        author               => $c->{author},
+        barcode              => $c->{barcode},
+        itemtype             => $item_level_itypes ? $c->{itype} : $c->{itemtype},
         itemtype_description => $itemtype->{translated_description},
-        location   => $c->{location} ? GetAuthorisedValueByCode( 'LOC', $c->{location} ) : q{},
-        itemnotes  => $c->{itemnotes},
-        branchcode => $c->{branchcode},
-        branchname => $c->{branchname},
+        location             => $c->{location} ? GetAuthorisedValueByCode( 'LOC', $c->{location} ) : q{},
+        itemnotes            => $c->{itemnotes},
+        itemnotes_nonpublic  => $c->{itemnotes_nonpublic},
+        branchcode           => $c->{branchcode},
+        branchname           => $c->{branchname},
         itemcallnumber => $c->{itemcallnumber}   || q{},
         charge         => $charge,
         fine           => $fine,
@@ -167,7 +169,7 @@ while ( my $c = $sth->fetchrow_hashref() ) {
         date_due            => $c->{date_due},
         date_due_overdue    => $c->{date_due_overdue} ? JSON::true : JSON::false,
         timestamp           => $c->{timestamp},
-        onsite_checkout         => $c->{onsite_checkout},
+        onsite_checkout     => $c->{onsite_checkout},
         renewals_count      => $renewals_count,
         renewals_allowed    => $renewals_allowed,
         renewals_remaining  => $renewals_remaining,
@@ -183,13 +185,10 @@ while ( my $c = $sth->fetchrow_hashref() ) {
                 as_due_date => 1
             }
         ),
-        subtitle => GetRecordValue(
-            'subtitle',
-            GetMarcBiblio( $c->{biblionumber} ),
-            GetFrameworkCode( $c->{biblionumber} )
-        ),
-        lost => $c->{itemlost} ? GetAuthorisedValueByCode( 'LOST', $c->{itemlost} ) : undef,
-        damaged => $c->{damaged} ? GetAuthorisedValueByCode( 'DAMAGED', $c->{damaged} ) : undef,
+        subtitle =>
+          GetRecordValue( 'subtitle', GetMarcBiblio( $c->{biblionumber} ), GetFrameworkCode( $c->{biblionumber} ) ),
+        lost    => $c->{itemlost} ? GetAuthorisedValueByCode( 'LOST',    $c->{itemlost} ) : undef,
+        damaged => $c->{damaged}  ? GetAuthorisedValueByCode( 'DAMAGED', $c->{damaged} )  : undef,
         borrower => {
             surname    => $c->{surname},
             firstname  => $c->{firstname},