Bug 7235: Add order date and checks for permissions
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Sun, 19 Feb 2012 23:12:13 +0000 (00:12 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 20 Mar 2012 15:11:44 +0000 (16:11 +0100)
- Adds order date above vendor
- Reordered fields to reflect history of the item
- Order information (order date, vendor) is only shown, when an order exists
- Accession date is only linked, when item was received in acquisition
- Links to basket and invoice are only shown when user has the correct permission
  - order date: manage_order
  - accession date: receive_shipment for invoice
- Changes all dates to use the KohaDates TT plugin
- Corrects display of rental price, removing additional zeros

To test:
1) Create a record with
- 1 item created in cataloguing
- 1 item ordered
- 1 item ordered and received
- 1 item checked out
2) Verify the correct information is shown for each
3) Verify links on the dates work correctly
4) Toggle permissions for the user

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>

Followed the test plan and all tests pass.

Signed-off-by: Marijana Glavica <mglavica@ffzg.hr>

changed supplierid to booksellerid

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>

catalogue/moredetail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt

index d75e36f..c9d202c 100755 (executable)
@@ -31,7 +31,6 @@ use C4::Bookseller qw(GetBookSellerFromId);
 use C4::Output;             # contains gettemplate
 use C4::Auth;
 use C4::Serials;
-use C4::Dates qw/format_date/;
 use C4::Circulation;  # to use itemissues
 use C4::Members; # to use GetMember
 use C4::Search;                # enabled_staff_search_views
@@ -120,7 +119,7 @@ my $ccodes= GetKohaAuthorisedValues('items.ccode',$fw);
 my $itemtypes = GetItemTypes;
 
 $data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'description'};
-
+$data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} );
 foreach ( keys %{$data} ) {
     $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
 }
@@ -132,10 +131,8 @@ foreach my $item (@items){
     $item->{'collection'}              = $ccodes->{ $item->{ccode} } if ($ccodes);
     $item->{'itype'}                   = $itemtypes->{ $item->{'itype'} }->{'description'};
     $item->{'replacementprice'}        = sprintf( "%.2f", $item->{'replacementprice'} );
-    $item->{$_}                        = format_date( $item->{$_} ) foreach qw/datelastborrowed dateaccessioned datelastseen lastreneweddate/;
     $item->{'copyvol'}                 = $item->{'copynumber'};
 
-
     # item has a host number if its biblio number does not match the current bib
     if ($item->{biblionumber} ne $biblionumber){
         $item->{hostbiblionumber} = $item->{biblionumber};
@@ -148,6 +145,7 @@ foreach my $item (@items){
     $item->{'ordernumber'}             = $order->{'ordernumber'};
     $item->{'basketno'}                = $order->{'basketno'};
     $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
+    $item->{'orderdate'}               = $order->{'entrydate'};
     if ($item->{'basketno'}){
            my $basket = GetBasket($item->{'basketno'});
            my $bookseller = GetBookSellerFromId($basket->{'booksellerid'});
@@ -169,7 +167,6 @@ foreach my $item (@items){
     $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
     $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
     if ($item->{'datedue'}) {
-        $item->{'datedue'} = format_date($item->{'datedue'});
         $item->{'issue'}= 1;
     } else {
         $item->{'issue'}= 0;
index 579265f..e7e25d1 100644 (file)
@@ -4,7 +4,7 @@
 <style type="text/css">h3{padding-top: 1em; border-top: 2px solid #CCCCCC;}</style>
 </head>
 <body>
-
+[% USE KohaDates %]
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
@@ -69,7 +69,7 @@
 
             <ol class="bibliodetails">
             <li><span class="label">Current Location:</span> [% ITEM_DAT.holdingbranchname %]&nbsp;</li>
-            <li><span class="label">Checkout Status:</span> [% IF ( ITEM_DAT.issue ) %]Checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ITEM_DAT.borrowernumber %]">[% ITEM_DAT.cardnumber %]</a>[% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate %][% END %], Due back on [% ITEM_DAT.datedue %][% ELSE %]Not Checked out [% END %]</li>
+            <li><span class="label">Checkout Status:</span> [% IF ( ITEM_DAT.issue ) %]Checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ITEM_DAT.borrowernumber %]">[% ITEM_DAT.cardnumber %]</a>[% IF ( ITEM_DAT.lastreneweddate ) %], Last renewed [% ITEM_DAT.lastreneweddate | $KohaDates %][% END %], Due back on [% ITEM_DAT.datedue | $KohaDates %][% ELSE %]Not Checked out [% END %]</li>
             <li><span class="label">Current Renewals:</span> [% ITEM_DAT.renewals %]&nbsp;</li>
             [% IF ( ITEM_DAT.itemlostloop ) %]
                 <li><span class="label">Lost Status:</span>
             <div class="listgroup"><h4>History</h4>
             <ol class="bibliodetails">
 
-                <li><span class="label">
-                [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
-
-                    Accession Date:</span>
-                    [% IF ( ITEM_DAT.basketno ) %]
-                    <a href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% ITEM_DAT.booksellerid %]&amp;invoice=[% ITEM_DAT.booksellerinvoicenumber %]&amp;datereceived=[% ITEM_DAT.datereceived %]">[% ITEM_DAT.dateaccessioned %]</a>
+            [% IF ITEM_DAT.basketno %]
+                <li><span class="label">Order date:</span>
+                    [% IF ( CAN_user_acquisition_order_manage ) %]
+                        <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% ITEM_DAT.basketno %]">[% ITEM_DAT.orderdate | $KohaDates %]</a>
                     [% ELSE %]
-                    [% ITEM_DAT.dateaccessioned %]
+                        [% ITEM_DAT.orderdate | $KohaDates %]
                     [% END %]
-                [% ELSE %]
-                    [% ITEM_DAT.dateaccessioned %]
-                [% END %]
+                 </li>
+                <li><span class="label">Vendor:</span>
+                    [% ITEM_DAT.vendor %]
                 </li>
-                [% IF ITEM_DAT.vendor %]
-                <li><span class="label">Vendor</span>
-                  [% ITEM_DAT.vendor %]
+            [% END %]
+
+            [% IF ITEM_DAT.dateaccessioned %]
+                <li><span class="label">Accession date:</span>
+                    [% IF ( CAN_user_acquisition_order_receive && ITEM_DAT.booksellerinvoicenumber ) %]
+                        <a href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% ITEM_DAT.booksellerid %]&amp;invoice=[% ITEM_DAT.booksellerinvoicenumber %]&amp;datereceived=[% ITEM_DAT.datereceived %]">[% ITEM_DAT.dateaccessioned | $KohaDates %]</a>
+                    [% ELSE %]
+                        [% ITEM_DAT.dateaccessioned | $KohaDates %]
+                    [% END %]
                 </li>
-                    [% IF ITEM_DAT.booksellerinvoicenumber %]
-                <li><span class="label">Invoice number</span>
-                  [% ITEM_DAT.booksellerinvoicenumber %]
+            [% END %]
+            [% IF ( ITEM_DAT.booksellerinvoicenumber ) %]
+                <li><span class="label">Invoice number:</span>
+                    [% ITEM_DAT.booksellerinvoicenumber %]
                 </li>
-                    [% END %]
-                [% END %]
-                
+            [% END %]
+
                 <li><span class="label">Total Checkouts:</span>[% IF ( ITEM_DAT.issues ) %][% ITEM_DAT.issues %][% ELSE %]0[% END %]  (<a href="/cgi-bin/koha/circ/bookcount.pl?&amp;biblionumber=[% ITEM_DAT.biblionumber %]&amp;bi=[% ITEM_DAT.biblioitemnumber %]&amp;itm=[% ITEM_DAT.itemnumber %]">View item's checkout history</a>)</li>
 
-                <li><span class="label">Last seen:</span> [% ITEM_DAT.datelastseen %]&nbsp;</li>
-                <li><span class="label">Last borrowed:</span> [% ITEM_DAT.datelastborrowed %]&nbsp;</li>
+                <li><span class="label">Last seen:</span> [% ITEM_DAT.datelastseen | $KohaDates %]&nbsp;</li>
+                <li><span class="label">Last borrowed:</span> [% ITEM_DAT.datelastborrowed | $KohaDates %]&nbsp;</li>
                 [% IF ( ITEM_DAT.card0 ) %]<li><span class="label">Last Borrower:</span> <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% ITEM_DAT.borrower0 %]">[% ITEM_DAT.card0 %]</a>&nbsp;</li>[% END %]
                 [% 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.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 %]
                 <li><span class="label">Paid for?:</span> [% ITEM_DAT.paidfor %]&nbsp;</li>
             <li><span class="label">Serial enumeration:</span> [% ITEM_DAT.enumchron %]&nbsp;</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 %]" />
+                <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>
-            </li>
-            </ol>
+                </form>
                 [% ELSE %]
                     [% ITEM_DAT.itemnotes %]
                     &nbsp;
                 [% END %]
+            </li>
+            </ol>
             </div>
 </div>
 [% END %]