Bugzilla – Attachment 151026 Details for
Bug 8179
Receiving multiple order lines at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8179: Receive multiple orders
Bug-8179-Receive-multiple-orders.patch (text/plain), 133.73 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-05-10 17:27:20 UTC
(
hide
)
Description:
Bug 8179: Receive multiple orders
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-05-10 17:27:20 UTC
Size:
133.73 KB
patch
obsolete
>From 4ac486f4746bf2368fd19aa369981c864e0791b8 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 9 Oct 2020 17:15:31 -0300 >Subject: [PATCH] Bug 8179: Receive multiple orders > >This patch implements the code to allow a patron to receive multiple >orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page > >To test: >1. apply all patches >2. updatedatabase >3. Go to system preferences and allow AcqReceiveMultipleOrderLines >4. In acquisitions module, create a vendor if you don't have one and add > 3 baskets.. one with create items on ordering, one with create items > on receiving and finally one with create items when cataloguing >5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods. >6. Close all baskets and receive shipment. >CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected" >7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page >8. Check some of the checkboxes >CHECK => "Receive selected" button shows how many rows are selected >9. Go to the next page and select some more rows >CHECK => Changing page does not modify how many rows where selected >10. Go back to previous page >CHECK => Previously selected rows are still selected >11. Reload the page to deselect all rows >12. Select only one row and click on "Receive selected" button >CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked. >13. Click on cancel to go back to parcel.pl page >14. Select all rows (even the ones from the next page of the table) and > click on "Receive selected" >CHECH => In orderreceive.pl page there is a table with all selected rows >15. Ensure table has more than one page, as in step 7 >16. Click on the "edit" link in the last row of the current page >CHECK => A modal window is displayed with 4 tabs within: Info, >Accounting, Receipt history and Items >CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos >order, 'Cancel' to close the modal without keeping modifications, 'Save' >to close modal keeping modifications and 'Next' to go to the next order >CHECK => Even that we are at the end of the current page, 'Next' button >is still available >17. Click on 'Next' button >CHECK => The table behind the modal now displays the next page, and the modal was not closed >18. Click on 'Previous' >CHECK => The table behind the modal went back to the first page, and the modal was not closed >19. Click on 'Previous' button till you reach the first row of the first > page >CHECK => Only when you reach the first row of the first page 'Previous' >button gets disabled >20. Click on 'Next' button till you reach the last row of the last page >CHECK => Only when you reach the last button of the last page 'Next' >button gets disabled >21. Check that behaviour for the different types of order are still the > same > a. For orders that where created through suggestion, check that the >suggestion info is present in Info tab. If when suggestion was accepted >you set a reason, a dropdown to change the reason shoul display also. > b. For orders that where created through subscriptions, check that >the Items tab is disabled, and the Receipt history is enabled. On >accounting tab you should be able to change quantity ordered. If there >were less items received than ordered, the next time you receive this >order the child order generated from this one shoul appear in receipt >history. > c. For orders that don't come from subscription and creates there items on ordering, Receipt history >should be disabled, and a table with prefilled items shold appear in the >Items tab. You can edit them and the changes should appear in the item's >row. > d. For orders that don't come from subscription and creates there >items on receiving, Receipt history should be disabled, and a form to >create the items should appear in Items tab. When you add an item a >table should appear. > e. For orders that don't come from subscription and creates there >ites on cataloguing, Receipt history and Items tabs should be disabled. > f. Any changes made in quantity (received or ordered) or funds in the modal should be >reflected in the table if you click save from the modal. >22. Once you've done all you checking and verifications click save >23. While saving a progress bar should appear >24. If no error was detected, you should be redirected back to parcel.pl > page >25. If an error or warning was detected (like there is an order with 0 > items to receive) the save button should be disabled and warnings >are dispayed. >26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t > >Sponsored-by: Virginia Polytechnic Institute and State University >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> >--- > Koha/Acquisition/Order.pm | 15 + > Koha/REST/V1/Acquisitions/Orders.pm | 2 +- > Koha/Schema/Result/Aqorder.pm | 20 + > acqui/orderreceive.pl | 96 +- > api/v1/swagger/definitions/order.yaml | 5 + > api/v1/swagger/paths/acquisitions_orders.yaml | 5 + > .../lib/datatables/dataTables.select.min.js | 38 + > .../lib/datatables/select.dataTables.min.css | 1 + > .../prog/en/includes/datatables.inc | 1 + > .../prog/en/includes/doc-head-close.inc | 1 + > .../prog/en/modules/acqui/orderreceive.tt | 1694 +++++++++++------ > .../prog/en/modules/acqui/parcel.tt | 57 +- > .../admin/preferences/acquisitions.pref | 1 - > t/db_dependent/Koha/Acquisition/Fund.t | 15 +- > t/db_dependent/Koha/Acquisition/Order.t | 17 +- > t/db_dependent/Koha/Item.t | 5 + > 16 files changed, 1378 insertions(+), 595 deletions(-) > mode change 100755 => 100644 acqui/orderreceive.pl > create mode 100644 koha-tmpl/intranet-tmpl/lib/datatables/dataTables.select.min.js > create mode 100644 koha-tmpl/intranet-tmpl/lib/datatables/select.dataTables.min.css > mode change 100755 => 100644 t/db_dependent/Koha/Item.t > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index a365f3163ab..0f69d6eb18b 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -33,6 +33,7 @@ use Koha::Biblios; > use Koha::Holds; > use Koha::Items; > use Koha::Number::Price; >+use Koha::Patrons; > use Koha::Subscriptions; > > use base qw(Koha::Object); >@@ -400,6 +401,20 @@ sub claimed_date { > return $last_claim->claimed_on; > } > >+=head3 creator >+ >+my $creator = $order->creator; >+ >+Retrieves patron that created this order. >+ >+=cut >+ >+sub creator { >+ my ( $self ) = @_; >+ my $creator_rs = $self->_result->creator; >+ return Koha::Patron->_new_from_dbic( $creator_rs ); >+} >+ > =head3 duplicate_to > > my $duplicated_order = $order->duplicate_to($basket, [$default_values]); >diff --git a/Koha/REST/V1/Acquisitions/Orders.pm b/Koha/REST/V1/Acquisitions/Orders.pm >index d5a0fe73c6e..bb12ed0a536 100644 >--- a/Koha/REST/V1/Acquisitions/Orders.pm >+++ b/Koha/REST/V1/Acquisitions/Orders.pm >@@ -193,7 +193,7 @@ sub list { > > return $c->render( > status => 200, >- openapi => $orders->to_api({ embed => $embed }) >+ openapi => $c->objects->to_api($orders) > ); > } > catch { >diff --git a/Koha/Schema/Result/Aqorder.pm b/Koha/Schema/Result/Aqorder.pm >index bbe8def42ba..a1cb7a29d58 100644 >--- a/Koha/Schema/Result/Aqorder.pm >+++ b/Koha/Schema/Result/Aqorder.pm >@@ -860,6 +860,26 @@ __PACKAGE__->belongs_to( > }, > ); > >+=head2 creator >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "creator", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "created_by" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "SET NULL", >+ on_update => "CASCADE", >+ }, >+); >+ > __PACKAGE__->belongs_to( > "subscription", > "Koha::Schema::Result::Subscription", >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >old mode 100755 >new mode 100644 >index 17c7280ea37..e0b6096797c >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -85,6 +85,7 @@ my $invoice = GetInvoice($invoiceid); > my $booksellerid = $invoice->{booksellerid}; > my $freight = $invoice->{shipmentcost}; > my $ordernumber = $input->param('ordernumber'); >+my $multiple_orders = $input->param('multiple_orders'); > > my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); > my $order = Koha::Acquisition::Orders->find( $ordernumber ); >@@ -98,13 +99,61 @@ my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( > } > ); > >-unless ( $order ) { >+unless ( $order || $multiple_orders ) { > output_html_with_http_headers $input, $cookie, $template->output; > exit; > } > >-# prepare the form for receiving >-my $basket = $order->basket; >+my $budget; >+if ($order) { >+ >+ # prepare the form for receiving >+ my $creator = Koha::Patrons->find( $order->created_by ); >+ >+ $budget = GetBudget( $order->budget_id ); >+ >+ my $datereceived = $order->datereceived || dt_from_string; >+ >+ my $order_internalnote = $order->order_internalnote; >+ my $order_vendornote = $order->order_vendornote; >+ if ( $order->subscriptionid ) { >+ >+ # Order from a subscription, we will display an history of what has been received >+ my $orders = Koha::Acquisition::Orders->search( >+ { >+ subscriptionid => $order->subscriptionid, >+ parent_ordernumber => $order->ordernumber, >+ ordernumber => { '!=' => $order->ordernumber } >+ } >+ ); >+ if ( $order->parent_ordernumber != $order->ordernumber ) { >+ my $parent_order = Koha::Acquisition::Orders->find( $order->parent_ordernumber ); >+ $order_internalnote = $parent_order->order_internalnote; >+ $order_vendornote = $parent_order->order_vendornote; >+ } >+ $template->param( orders => $orders, ); >+ } >+ >+ my $suggestion = GetSuggestionInfoFromBiblionumber( $order->biblionumber ); >+ >+ if ($suggestion) { >+ $template->param( suggestion => $suggestion ); >+ } >+ >+ $template->param( >+ order => $order, >+ creator => $creator, >+ bookfund => $budget->{budget_name}, >+ datereceived => $datereceived, >+ order_internalnote => $order_internalnote, >+ order_vendornote => $order_vendornote, >+ ); >+} >+ >+if ($multiple_orders) { >+ $template->param( multiple_orders => $multiple_orders ); >+} >+ > my $currencies = Koha::Acquisition::Currencies->search; > my $active_currency = $currencies->get_active; > >@@ -114,61 +163,22 @@ unless($acq_fw) { > $template->param('NoACQframework' => 1); > } > >- >-my $creator = Koha::Patrons->find( $order->created_by ); >- >-my $budget = GetBudget( $order->budget_id ); >- >-my $datereceived = $order->datereceived || dt_from_string; >- > # get option values for TaxRates syspref > my @gst_values = map { > option => $_ + 0.0 > }, split( '\|', C4::Context->preference("TaxRates") ); > >-my $order_internalnote = $order->order_internalnote; >-my $order_vendornote = $order->order_vendornote; >-if ( $order->subscriptionid ) { >- # Order from a subscription, we will display an history of what has been received >- my $orders = Koha::Acquisition::Orders->search( >- { >- subscriptionid => $order->subscriptionid, >- parent_ordernumber => $order->ordernumber, >- ordernumber => { '!=' => $order->ordernumber } >- } >- ); >- if ( $order->parent_ordernumber != $order->ordernumber ) { >- my $parent_order = Koha::Acquisition::Orders->find($order->parent_ordernumber); >- $order_internalnote = $parent_order->order_internalnote; >- $order_vendornote = $parent_order->order_vendornote; >- } >- $template->param( >- orders => $orders, >- ); >-} >- > $template->param( >- order => $order, > freight => $freight, > name => $bookseller->name, > active_currency => $active_currency, > currencies => $currencies->search({ rate => { '!=' => 1 } }), > invoiceincgst => $bookseller->invoiceincgst, >- bookfund => $budget->{budget_name}, >- creator => $creator, > invoiceid => $invoice->{invoiceid}, > invoice => $invoice->{invoicenumber}, >- datereceived => $datereceived, >- order_internalnote => $order_internalnote, >- order_vendornote => $order_vendornote, > gst_values => \@gst_values, > ); > >-my $suggestion = GetSuggestionInfoFromBiblionumber($order->biblionumber); >-if ( $suggestion ) { >- $template->param( suggestion => $suggestion ); >-} >- > my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; > my %budget_loops; > my $budgets = GetBudgetHierarchy( undef, undef, undef, 1 ); >@@ -185,7 +195,7 @@ foreach my $budget (@{$budgets}) { > b_sort1_authcat => $budget->{'sort1_authcat'}, > b_sort2_authcat => $budget->{'sort2_authcat'}, > b_active => $budget->{budget_period_active}, >- b_sel => ( $budget->{budget_id} == $order->budget_id ) ? 1 : 0, >+ # b_sel => ( $budget->{budget_id} == $order->budget_id ) ? 1 : 0, > b_level => $budget->{budget_level}, > }; > } >diff --git a/api/v1/swagger/definitions/order.yaml b/api/v1/swagger/definitions/order.yaml >index 2b53ad12dd8..61aaae480d9 100644 >--- a/api/v1/swagger/definitions/order.yaml >+++ b/api/v1/swagger/definitions/order.yaml >@@ -259,4 +259,9 @@ properties: > type: > - object > - "null" >+ creator: >+ type: >+ - object >+ - "null" >+ description: Patron that created the order > additionalProperties: false >diff --git a/api/v1/swagger/paths/acquisitions_orders.yaml b/api/v1/swagger/paths/acquisitions_orders.yaml >index 3f3d5e4a935..17ea883d5cc 100644 >--- a/api/v1/swagger/paths/acquisitions_orders.yaml >+++ b/api/v1/swagger/paths/acquisitions_orders.yaml >@@ -59,10 +59,15 @@ > - biblio.holds+count > - biblio.items+count > - biblio.suggestions.suggester >+ - creator > - fund >+ - fund.budget > - current_item_level_holds+count > - invoice > - items >+ - items.home_branch >+ - items.holding_branch >+ - items.itemtype > - items+strings > - subscription > collectionFormat: csv >diff --git a/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.select.min.js b/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.select.min.js >new file mode 100644 >index 00000000000..3765f6ce5d2 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.select.min.js >@@ -0,0 +1,38 @@ >+/*! >+ Copyright 2015-2019 SpryMedia Ltd. >+ >+ This source file is free software, available under the following license: >+ MIT license - http://datatables.net/license/mit >+ >+ This source file is distributed in the hope that it will be useful, but >+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY >+ or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. >+ >+ For details please refer to: http://www.datatables.net/extensions/select >+ Select for DataTables 1.3.1 >+ 2015-2019 SpryMedia Ltd - datatables.net/license/mit >+*/ >+(function(f){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(k){return f(k,window,document)}):"object"===typeof exports?module.exports=function(k,p){k||(k=window);p&&p.fn.dataTable||(p=require("datatables.net")(k,p).$);return f(p,k,k.document)}:f(jQuery,window,document)})(function(f,k,p,h){function z(a,b,c){var d=function(c,b){if(c>b){var d=b;b=c;c=d}var e=!1;return a.columns(":visible").indexes().filter(function(a){a===c&&(e=!0);return a===b?(e=!1,!0):e})};var e= >+function(c,b){var d=a.rows({search:"applied"}).indexes();if(d.indexOf(c)>d.indexOf(b)){var e=b;b=c;c=e}var f=!1;return d.filter(function(a){a===c&&(f=!0);return a===b?(f=!1,!0):f})};a.cells({selected:!0}).any()||c?(d=d(c.column,b.column),c=e(c.row,b.row)):(d=d(0,b.column),c=e(0,b.row));c=a.cells(c,d).flatten();a.cells(b,{selected:!0}).any()?a.cells(c).deselect():a.cells(c).select()}function v(a){var b=a.settings()[0]._select.selector;f(a.table().container()).off("mousedown.dtSelect",b).off("mouseup.dtSelect", >+b).off("click.dtSelect",b);f("body").off("click.dtSelect"+a.table().node().id.replace(/[^a-zA-Z0-9\-_]/g,"-"))}function A(a){var b=f(a.table().container()),c=a.settings()[0],d=c._select.selector,e;b.on("mousedown.dtSelect",d,function(a){if(a.shiftKey||a.metaKey||a.ctrlKey)b.css("-moz-user-select","none").one("selectstart.dtSelect",d,function(){return!1});k.getSelection&&(e=k.getSelection())}).on("mouseup.dtSelect",d,function(){b.css("-moz-user-select","")}).on("click.dtSelect",d,function(c){var b= >+a.select.items();if(e){var d=k.getSelection();if((!d.anchorNode||f(d.anchorNode).closest("table")[0]===a.table().node())&&d!==e)return}d=a.settings()[0];var l=f.trim(a.settings()[0].oClasses.sWrapper).replace(/ +/g,".");if(f(c.target).closest("div."+l)[0]==a.table().container()&&(l=a.cell(f(c.target).closest("td, th")),l.any())){var g=f.Event("user-select.dt");m(a,g,[b,l,c]);g.isDefaultPrevented()||(g=l.index(),"row"===b?(b=g.row,w(c,a,d,"row",b)):"column"===b?(b=l.index().column,w(c,a,d,"column", >+b)):"cell"===b&&(b=l.index(),w(c,a,d,"cell",b)),d._select_lastCell=g)}});f("body").on("click.dtSelect"+a.table().node().id.replace(/[^a-zA-Z0-9\-_]/g,"-"),function(b){!c._select.blurable||f(b.target).parents().filter(a.table().container()).length||0===f(b.target).parents("html").length||f(b.target).parents("div.DTE").length||r(c,!0)})}function m(a,b,c,d){if(!d||a.flatten().length)"string"===typeof b&&(b+=".dt"),c.unshift(a),f(a.table().node()).trigger(b,c)}function B(a){var b=a.settings()[0];if(b._select.info&& >+b.aanFeatures.i&&"api"!==a.select.style()){var c=a.rows({selected:!0}).flatten().length,d=a.columns({selected:!0}).flatten().length,e=a.cells({selected:!0}).flatten().length,l=function(b,c,d){b.append(f('<span class="select-item"/>').append(a.i18n("select."+c+"s",{_:"%d "+c+"s selected",0:"",1:"1 "+c+" selected"},d)))};f.each(b.aanFeatures.i,function(b,a){a=f(a);b=f('<span class="select-info"/>');l(b,"row",c);l(b,"column",d);l(b,"cell",e);var g=a.children("span.select-info");g.length&&g.remove(); >+""!==b.text()&&a.append(b)})}}function D(a){var b=new g.Api(a);a.aoRowCreatedCallback.push({fn:function(b,d,e){d=a.aoData[e];d._select_selected&&f(b).addClass(a._select.className);b=0;for(e=a.aoColumns.length;b<e;b++)(a.aoColumns[b]._select_selected||d._selected_cells&&d._selected_cells[b])&&f(d.anCells[b]).addClass(a._select.className)},sName:"select-deferRender"});b.on("preXhr.dt.dtSelect",function(){var a=b.rows({selected:!0}).ids(!0).filter(function(b){return b!==h}),d=b.cells({selected:!0}).eq(0).map(function(a){var c= >+b.row(a.row).id(!0);return c?{row:c,column:a.column}:h}).filter(function(b){return b!==h});b.one("draw.dt.dtSelect",function(){b.rows(a).select();d.any()&&d.each(function(a){b.cells(a.row,a.column).select()})})});b.on("draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt",function(){B(b)});b.on("destroy.dtSelect",function(){v(b);b.off(".dtSelect")})}function C(a,b,c,d){var e=a[b+"s"]({search:"applied"}).indexes();d=f.inArray(d,e);var g=f.inArray(c,e);if(a[b+"s"]({selected:!0}).any()|| >+-1!==d){if(d>g){var u=g;g=d;d=u}e.splice(g+1,e.length);e.splice(0,d)}else e.splice(f.inArray(c,e)+1,e.length);a[b](c,{selected:!0}).any()?(e.splice(f.inArray(c,e),1),a[b+"s"](e).deselect()):a[b+"s"](e).select()}function r(a,b){if(b||"single"===a._select.style)a=new g.Api(a),a.rows({selected:!0}).deselect(),a.columns({selected:!0}).deselect(),a.cells({selected:!0}).deselect()}function w(a,b,c,d,e){var f=b.select.style(),g=b.select.toggleable(),h=b[d](e,{selected:!0}).any();if(!h||g)"os"===f?a.ctrlKey|| >+a.metaKey?b[d](e).select(!h):a.shiftKey?"cell"===d?z(b,e,c._select_lastCell||null):C(b,d,e,c._select_lastCell?c._select_lastCell[d]:null):(a=b[d+"s"]({selected:!0}),h&&1===a.flatten().length?b[d](e).deselect():(a.deselect(),b[d](e).select())):"multi+shift"==f?a.shiftKey?"cell"===d?z(b,e,c._select_lastCell||null):C(b,d,e,c._select_lastCell?c._select_lastCell[d]:null):b[d](e).select(!h):b[d](e).select(!h)}function t(a,b){return function(c){return c.i18n("buttons."+a,b)}}function x(a){a=a._eventNamespace; >+return"draw.dt.DT"+a+" select.dt.DT"+a+" deselect.dt.DT"+a}function E(a,b){return-1!==f.inArray("rows",b.limitTo)&&a.rows({selected:!0}).any()||-1!==f.inArray("columns",b.limitTo)&&a.columns({selected:!0}).any()||-1!==f.inArray("cells",b.limitTo)&&a.cells({selected:!0}).any()?!0:!1}var g=f.fn.dataTable;g.select={};g.select.version="1.3.1";g.select.init=function(a){var b=a.settings()[0],c=b.oInit.select,d=g.defaults.select;c=c===h?d:c;d="row";var e="api",l=!1,u=!0,k=!0,m="td, th",p="selected",n=!1; >+b._select={};!0===c?(e="os",n=!0):"string"===typeof c?(e=c,n=!0):f.isPlainObject(c)&&(c.blurable!==h&&(l=c.blurable),c.toggleable!==h&&(u=c.toggleable),c.info!==h&&(k=c.info),c.items!==h&&(d=c.items),e=c.style!==h?c.style:"os",n=!0,c.selector!==h&&(m=c.selector),c.className!==h&&(p=c.className));a.select.selector(m);a.select.items(d);a.select.style(e);a.select.blurable(l);a.select.toggleable(u);a.select.info(k);b._select.className=p;f.fn.dataTable.ext.order["select-checkbox"]=function(b,a){return this.api().column(a, >+{order:"index"}).nodes().map(function(a){return"row"===b._select.items?f(a).parent().hasClass(b._select.className):"cell"===b._select.items?f(a).hasClass(b._select.className):!1})};!n&&f(a.table().node()).hasClass("selectable")&&a.select.style("os")};f.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(a,b){g.ext.selector[b.type].push(function(a,d,e){d=d.selected;var c=[];if(!0!==d&&!1!==d)return e;for(var f=0,g=e.length;f<g;f++){var h=a[b.prop][e[f]];(!0===d&&!0===h._select_selected|| >+!1===d&&!h._select_selected)&&c.push(e[f])}return c})});g.ext.selector.cell.push(function(a,b,c){b=b.selected;var d=[];if(b===h)return c;for(var e=0,f=c.length;e<f;e++){var g=a.aoData[c[e].row];(!0===b&&g._selected_cells&&!0===g._selected_cells[c[e].column]||!(!1!==b||g._selected_cells&&g._selected_cells[c[e].column]))&&d.push(c[e])}return d});var n=g.Api.register,q=g.Api.registerPlural;n("select()",function(){return this.iterator("table",function(a){g.select.init(new g.Api(a))})});n("select.blurable()", >+function(a){return a===h?this.context[0]._select.blurable:this.iterator("table",function(b){b._select.blurable=a})});n("select.toggleable()",function(a){return a===h?this.context[0]._select.toggleable:this.iterator("table",function(b){b._select.toggleable=a})});n("select.info()",function(a){return B===h?this.context[0]._select.info:this.iterator("table",function(b){b._select.info=a})});n("select.items()",function(a){return a===h?this.context[0]._select.items:this.iterator("table",function(b){b._select.items= >+a;m(new g.Api(b),"selectItems",[a])})});n("select.style()",function(a){return a===h?this.context[0]._select.style:this.iterator("table",function(b){b._select.style=a;b._select_init||D(b);var c=new g.Api(b);v(c);"api"!==a&&A(c);m(new g.Api(b),"selectStyle",[a])})});n("select.selector()",function(a){return a===h?this.context[0]._select.selector:this.iterator("table",function(b){v(new g.Api(b));b._select.selector=a;"api"!==b._select.style&&A(new g.Api(b))})});q("rows().select()","row().select()",function(a){var b= >+this;if(!1===a)return this.deselect();this.iterator("row",function(b,a){r(b);b.aoData[a]._select_selected=!0;f(b.aoData[a].nTr).addClass(b._select.className)});this.iterator("table",function(a,d){m(b,"select",["row",b[d]],!0)});return this});q("columns().select()","column().select()",function(a){var b=this;if(!1===a)return this.deselect();this.iterator("column",function(b,a){r(b);b.aoColumns[a]._select_selected=!0;a=(new g.Api(b)).column(a);f(a.header()).addClass(b._select.className);f(a.footer()).addClass(b._select.className); >+a.nodes().to$().addClass(b._select.className)});this.iterator("table",function(a,d){m(b,"select",["column",b[d]],!0)});return this});q("cells().select()","cell().select()",function(a){var b=this;if(!1===a)return this.deselect();this.iterator("cell",function(b,a,e){r(b);a=b.aoData[a];a._selected_cells===h&&(a._selected_cells=[]);a._selected_cells[e]=!0;a.anCells&&f(a.anCells[e]).addClass(b._select.className)});this.iterator("table",function(a,d){m(b,"select",["cell",b[d]],!0)});return this});q("rows().deselect()", >+"row().deselect()",function(){var a=this;this.iterator("row",function(a,c){a.aoData[c]._select_selected=!1;f(a.aoData[c].nTr).removeClass(a._select.className)});this.iterator("table",function(b,c){m(a,"deselect",["row",a[c]],!0)});return this});q("columns().deselect()","column().deselect()",function(){var a=this;this.iterator("column",function(a,c){a.aoColumns[c]._select_selected=!1;var b=new g.Api(a),e=b.column(c);f(e.header()).removeClass(a._select.className);f(e.footer()).removeClass(a._select.className); >+b.cells(null,c).indexes().each(function(b){var c=a.aoData[b.row],d=c._selected_cells;!c.anCells||d&&d[b.column]||f(c.anCells[b.column]).removeClass(a._select.className)})});this.iterator("table",function(b,c){m(a,"deselect",["column",a[c]],!0)});return this});q("cells().deselect()","cell().deselect()",function(){var a=this;this.iterator("cell",function(a,c,d){c=a.aoData[c];c._selected_cells[d]=!1;c.anCells&&!a.aoColumns[d]._select_selected&&f(c.anCells[d]).removeClass(a._select.className)});this.iterator("table", >+function(b,c){m(a,"deselect",["cell",a[c]],!0)});return this});var y=0;f.extend(g.ext.buttons,{selected:{text:t("selected","Selected"),className:"buttons-selected",limitTo:["rows","columns","cells"],init:function(a,b,c){var d=this;c._eventNamespace=".select"+y++;a.on(x(c),function(){d.enable(E(a,c))});this.disable()},destroy:function(a,b,c){a.off(c._eventNamespace)}},selectedSingle:{text:t("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(a,b,c){var d=this;c._eventNamespace= >+".select"+y++;a.on(x(c),function(){var b=a.rows({selected:!0}).flatten().length+a.columns({selected:!0}).flatten().length+a.cells({selected:!0}).flatten().length;d.enable(1===b)});this.disable()},destroy:function(a,b,c){a.off(c._eventNamespace)}},selectAll:{text:t("selectAll","Select all"),className:"buttons-select-all",action:function(){this[this.select.items()+"s"]().select()}},selectNone:{text:t("selectNone","Deselect all"),className:"buttons-select-none",action:function(){r(this.settings()[0], >+!0)},init:function(a,b,c){var d=this;c._eventNamespace=".select"+y++;a.on(x(c),function(){var b=a.rows({selected:!0}).flatten().length+a.columns({selected:!0}).flatten().length+a.cells({selected:!0}).flatten().length;d.enable(0<b)});this.disable()},destroy:function(a,b,c){a.off(c._eventNamespace)}}});f.each(["Row","Column","Cell"],function(a,b){var c=b.toLowerCase();g.ext.buttons["select"+b+"s"]={text:t("select"+b+"s","Select "+c+"s"),className:"buttons-select-"+c+"s",action:function(){this.select.items(c)}, >+init:function(a){var b=this;a.on("selectItems.dt.DT",function(a,d,e){b.active(e===c)})}}});f(p).on("preInit.dt.dtSelect",function(a,b){"dt"===a.namespace&&g.select.init(new g.Api(b))});return g.select}); >diff --git a/koha-tmpl/intranet-tmpl/lib/datatables/select.dataTables.min.css b/koha-tmpl/intranet-tmpl/lib/datatables/select.dataTables.min.css >new file mode 100644 >index 00000000000..2f5623a9b04 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/lib/datatables/select.dataTables.min.css >@@ -0,0 +1 @@ >+table.dataTable tbody>tr.selected,table.dataTable tbody>tr>.selected{background-color:#B0BED9}table.dataTable.stripe tbody>tr.odd.selected,table.dataTable.stripe tbody>tr.odd>.selected,table.dataTable.display tbody>tr.odd.selected,table.dataTable.display tbody>tr.odd>.selected{background-color:#acbad4}table.dataTable.hover tbody>tr.selected:hover,table.dataTable.hover tbody>tr>.selected:hover,table.dataTable.display tbody>tr.selected:hover,table.dataTable.display tbody>tr>.selected:hover{background-color:#aab7d1}table.dataTable.order-column tbody>tr.selected>.sorting_1,table.dataTable.order-column tbody>tr.selected>.sorting_2,table.dataTable.order-column tbody>tr.selected>.sorting_3,table.dataTable.order-column tbody>tr>.selected,table.dataTable.display tbody>tr.selected>.sorting_1,table.dataTable.display tbody>tr.selected>.sorting_2,table.dataTable.display tbody>tr.selected>.sorting_3,table.dataTable.display tbody>tr>.selected{background-color:#acbad5}table.dataTable.display tbody>tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody>tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody>tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody>tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody>tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody>tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody>tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody>tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody>tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody>tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody>tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody>tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody>tr.odd>.selected,table.dataTable.order-column.stripe tbody>tr.odd>.selected{background-color:#a6b4cd}table.dataTable.display tbody>tr.even>.selected,table.dataTable.order-column.stripe tbody>tr.even>.selected{background-color:#acbad5}table.dataTable.display tbody>tr.selected:hover>.sorting_1,table.dataTable.order-column.hover tbody>tr.selected:hover>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody>tr.selected:hover>.sorting_2,table.dataTable.order-column.hover tbody>tr.selected:hover>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody>tr.selected:hover>.sorting_3,table.dataTable.order-column.hover tbody>tr.selected:hover>.sorting_3{background-color:#a5b2cb}table.dataTable.display tbody>tr:hover>.selected,table.dataTable.display tbody>tr>.selected:hover,table.dataTable.order-column.hover tbody>tr:hover>.selected,table.dataTable.order-column.hover tbody>tr>.selected:hover{background-color:#a2aec7}table.dataTable tbody td.select-checkbox,table.dataTable tbody th.select-checkbox{position:relative}table.dataTable tbody td.select-checkbox:before,table.dataTable tbody td.select-checkbox:after,table.dataTable tbody th.select-checkbox:before,table.dataTable tbody th.select-checkbox:after{display:block;position:absolute;top:1.2em;left:50%;width:12px;height:12px;box-sizing:border-box}table.dataTable tbody td.select-checkbox:before,table.dataTable tbody th.select-checkbox:before{content:' ';margin-top:-6px;margin-left:-6px;border:1px solid black;border-radius:3px}table.dataTable tr.selected td.select-checkbox:after,table.dataTable tr.selected th.select-checkbox:after{content:'\2714';margin-top:-11px;margin-left:-4px;text-align:center;text-shadow:1px 1px #B0BED9, -1px -1px #B0BED9, 1px -1px #B0BED9, -1px 1px #B0BED9}div.dataTables_wrapper span.select-info,div.dataTables_wrapper span.select-item{margin-left:0.5em}@media screen and (max-width: 640px){div.dataTables_wrapper span.select-info,div.dataTables_wrapper span.select-item{margin-left:0;display:block}} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc >index a545868ce7d..b411a7b60e5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc >@@ -2,4 +2,5 @@ > [% USE Asset %] > [% INCLUDE 'format_price.inc' %] > [% Asset.js("lib/datatables/datatables.min.js") | $raw %] >+[% Asset.js("lib/datatables/dataTables.select.min.js") | $raw %] > [% Asset.js("js/datatables.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index e4be83f1667..b27f0541325 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -23,6 +23,7 @@ > [% Asset.css("lib/bootstrap/bootstrap-theme.min.css") | $raw %] > [% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %] > [% Asset.css("lib/datatables/datatables.min.css") | $raw %] >+[% Asset.css("lib/datatables/select.dataTables.min.css") | $raw %] > [% Asset.css("css/print.css", { media = "print" }) | $raw %] > [% INCLUDE intranetstylesheet.inc %] > [% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 05dd6915205..c4eb69f02fc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -27,9 +27,9 @@ > [% END %] > [% WRAPPER breadcrumb_item bc_active= 1 %] > [% IF ( invoice ) %] >- <span>Receive items from: [% name | html %] [[% invoice | html %]] (order #[% order.ordernumber | html %])</span> >+ <span>Receive items from: [% name | html %] [[% invoice | html %]] (order #[% multiple_orders | html %])</span> > [% ELSE %] >- <span>Receive items from: [% name | html %] (order #[% order.ordernumber | html %])</span> >+ <span>Receive items from: [% name | html %] (order #[% multiple_orders | html %])</span> > [% END %] > [% END %] > [% END #/ WRAPPER breadcrumbs %] >@@ -37,423 +37,301 @@ > > <div class="main container-fluid"> > <div class="row"> >- [% AcqCreateItem = order.basket.effective_create_items %] > <div class="col-sm-10 col-sm-push-2"> > <main> > >-<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber | html %])</h1> >- >-[% IF ( order ) %] >- <form id="f" action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);"> >-<div class="row"> >-<div class="col-sm-6"> >- <div class="dialog alert order_error" style="display:none"></div> >- >- <fieldset class="rows"> >- <legend>Catalog details</legend> >- <ol> >- <li> >- <span class="label">Title: </span> >- [% INCLUDE 'biblio-title.inc' biblio=order.biblio link = 1 %] >- </li> >- <li> <span class="label">Author: </span> >- [% order.biblio.author | html %]</li> >- <li><span class="label">Copyright: </span> >- [% order.biblio.copyrightdate | html %]</li> >- <li> <span class="label">ISBN: </span> >- [% order.biblio.biblioitem.isbn | html %]</li> >- <li> <span class="label">Series: </span> >- [% order.biblio.seriestitle | html %]</li> >- </ol> >- </fieldset> >- >- [% IF suggestion %] >- <fieldset class="rows"> >- <legend>Suggestion</legend> >- <ol> >- <li> >- <span class="label">Suggested by: </span> >- [% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&op=show">suggestion #[% suggestion.suggestionid | html %]</a>) >- [% IF suggestion.reason %] >- <li> >- <span class="label">Reason:</span> >- [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %] >- [% SET other_reason = 1 %] >- <select class="select-reason" id="reason" name="reason"> >- <option value=""> -- Choose a reason -- </option> >- [% FOREACH reason IN suggestion_reasons %] >- [% IF reason.lib == suggestion.reason %] >- <option value="[% reason.lib | html %]" selected="selected">[% reason.lib | html %]</option> >- [% SET other_reason = 0 %] >- [% ELSE %] >- <option value="[% reason.lib | html %]">[% reason.lib | html %]</option> >- [% END %] >- [% END %] >- <option value="other">Others...</option> >- </select> >- >- <span id="other_reason" name="other_reason"> >- [% IF other_reason %] >- <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/> >- [% ELSE %] >- <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." /> >- [% END %] >- <a href="#back">Cancel</a> >- </span> >- >- <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" /> >- </li> >- [% END %] >- </li> >- </ol> >- </fieldset> >- [% END %] >- >- [% IF order.subscriptionid and orders.count %] >- <fieldset class="rows"> >- <legend>Receipt history for this subscription</legend> >- <table id="orders"> >- <thead> >- <tr> >- <th>Invoice</th> >- <th>Order number</th> >- <th>Creation date</th> >- <th>Receive date</th> >- <th>Quantity received</th> >- <th>Status</th> >- <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th> >- <th>Internal note</th> >- </tr> >- </thead> >- <tbody> >- [% FOR suborder IN orders %] >- <tr> >- <td> >- [% IF suborder.invoice %] >- [% IF CAN_user_acquisition %] >- <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% suborder.invoiceid | uri %]" title="Invoice detail page"> >- [% suborder.invoice.invoicenumber | html %]</a> >- [% ELSE %] >- [% suborder.invoice.invoicenumber | html %] >- [% END %] >- [% END %] >- </td> >- <td>[% suborder.ordernumber | html %]</td> >- <td data-order="[% suborder.basket.creationdate | uri %]">[% suborder.basket.creationdate | $KohaDates%]</td> >- <td data-order="[% suborder.datereceived | uri %]"> >- [% IF suborder.datereceived %] >- [% suborder.datereceived | $KohaDates %] >- [% END %] >- </td> >- <td>[% suborder.quantityreceived | html %]</td> >- [% SWITCH suborder.orderstatus %] >- [%# FIXME We should only see/display Complete here, right? %] >- [% CASE 'new' %] >- <td data-order="status_1"> >- <span>New</span> >- [% CASE 'ordered' %] >- <td data-order="status_2"> >- <span>Ordered</span> >- [% CASE 'partial' %] >- <td data-order="status_3"> >- <span>Partial</span> >- [% CASE 'complete' %] >- <td data-order="status_4"> >- <span>Complete</span> >- [% CASE 'cancelled' %] >- <td data-order="status_5"> >- <span>Cancelled</span> >- [% END %] >- </td> >- <td> >- [% IF suborder.datereceived %][%# FIXME Should only be true, right? %] >- [%# FIXME What if unitprice has not been filled? %] >- [% suborder.unitprice_tax_excluded * suborder.quantity | $Price %] / [% suborder.unitprice_tax_included * suborder.quantity | $Price %] >- [% END %] >- </td> >- <td>[% suborder.order_internalnote | html %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> >+<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% multiple_orders | html %])</h1> >+ >+[% IF multiple_orders %] >+ <table id="multiple_orders" class="table table-bordered table-striped"> >+ <thead> >+ <tr> >+ <th>Order</td> >+ <th>Title</th> >+ <th>Author</th> >+ <th>ISBN</th> >+ <th>Date received</th> >+ <th>Fund</th> >+ <th>Quantity</th> >+ <th> </th> >+ </tr> >+ </thead> >+ </table> >+ >+ <div class="col"> >+ <fieldset class="action"> >+ <button class="save btn btn-primary" disabled>Save</button> >+ <a class="cancel btn btn-default" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a> > </fieldset> >- [% ELSIF (AcqCreateItem == 'receiving') %] >- <div id="items_list" style="display:none"> >- <p><strong>Items list</strong></p> >- <div style="width:100%;overflow:auto;"> >- <table> >- <thead> >- <tr> >- <th class="noExport">Actions</th> >- <th>Barcode</th> >- <th>Home library</th> >- <th>Holding library</th> >- <th>Not for loan</th> >- <th>Restricted</th> >- <th>Location</th> >- <th>Call number</th> >- <th>Copy number</th> >- <th>Inventory number</th> >- <th>Collection</th> >- <th>Item type</th> >- <th>Materials</th> >- <th>Notes</th> >- </tr> >- </thead> >- <tbody> >- </tbody> >- </table> >- </div> >- </div> >+ <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div> >+ </div> > >- [% UNLESS order.subscriptionid %] >- <fieldset class="rows" id="itemfieldset"> >- <legend>Item</legend> >- [% IF ( NoACQframework ) %] >- <p class="required"> >- No ACQ framework, using default. You should create a >- framework with code ACQ, the items framework would be >- used >- </p> >- [% END %] >- <div id="outeritemblock"></div> >- </fieldset> >- [% END %] >- [% ELSIF (AcqCreateItem == 'ordering') %] >- [% IF (order.items) %] >- <div class="page-section" style="width:100%;overflow:auto"> >- <h2>Items</h2> >- <table> >- <thead> >- <tr> >- <th>Receive?</th> >- <th> </th> >- <th>Barcode</th> >- <th>Home library</th> >- <th>Current library</th> >- <th>Not for loan</th> >- <th>Restricted</th> >- <th>Location</th> >- <th>Call number</th> >- <th>Copy number</th> >- <th>Inventory number</th> >- <th>Collection</th> >- <th>Item type</th> >- <th>Materials</th> >- <th>Notes</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH item IN order.items %] >- <tr id="item_[% item.itemnumber | html %]"> >- <td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td> >- <td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td> >- <td>[% item.barcode | html %]</td> >- <td>[% Branches.GetName( item.homebranch ) | html %]</td> >- <td>[% Branches.GetName( item.holdingbranch ) | html %]</td> >- <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]</td> >- <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]</td> >- <td><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]</span></td> >- <td>[% item.itemcallnumber | html %]</td> >- <td>[% item.copynumber | html %]</td> >- <td>[% item.stocknumber | html %]</td> >- <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td> >- <td>[% ItemTypes.GetDescription( item.itype ) | html %]</td> >- <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.materials', authorised_value => item.materials ) | html %]</td> >- <td>[% item.itemnotes | html %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> >+ <div class="modal fade" id="order_edit" tabindex="-1" role="dialog" aria-labelledby="Order edit"> >+ <div id="receive-modal" class="modal-dialog modal-lg" role="document"> >+ <div class="modal-content modal-lg"> >+ <div class="modal-header row"> >+ <h4 class="col-md-11 modal-title"></h4> >+ <button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ </div> >+ <div class="modal-body"> >+ <div class="hide" id="loading">Loading ...</div> >+ <div id="modal-order-main row"> >+ <!--ul> >+ <li><a href="#info-panel">Info</a></li> >+ <li><a href="#accounting-panel">Accounting</a></li> >+ <li><a href="#history-panel">Receipt history</a></li> >+ <li><a href="#items-panel">Items</a></li> >+ </ul--> >+ >+ <div class="col-md-12 col-lg-6"> >+ <div id="info-panel" class="page-section"> >+ <div> >+ <h4>Catalog details</h4> >+ >+ <div class="row"> <span class="lbl col-sm-4">Title: </span><span class="col-sm-8" id="biblio_title"></span></div> >+ <div class="row"> <span class="lbl col-sm-4">Author: </span><span class="col-sm-8" id="biblio_author"></span></div> >+ <div class="row"> <span class="lbl col-sm-4">Copyright: </span><span class="col-sm-8" id="biblio_copyright_date"></span></div> >+ <div class="row"> <span class="lbl col-sm-4">ISBN: </span><span class="col-sm-8" id="biblio_isbn"></span></div> >+ <div class="row"> <span class="lbl col-sm-4">Series: </span><span class="col-sm-8" id="biblio_series_title"></span></div> >+ >+ </div> >+ <div id="suggestion_fieldset"> >+ <h4>Suggestion</h4> >+ <div class="row"> >+ <span class="lbl col-sm-4">Suggested by: </span> <span class="col-sm-8" id="biblio_suggestion_suggester"></span> >+ </div> >+ <div class="row" id="suggestion_reason"> >+ <span class="lbl col-sm-4">Reason:</span> >+ <div class="col-sm-8"> >+ [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %] >+ <select class="select-reason" id="reason" name="reason"> >+ <option value=""> -- Choose a reason -- </option> >+ [% FOREACH reason IN suggestion_reasons %] >+ <option value="[% reason.lib | html %]">[% reason.lib | html %]</option> >+ [% END %] >+ <option value="other">Others...</option> >+ </select> >+ >+ <span id="other_reason" name="other_reason"> >+ <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." /> >+ <a href="#back">Cancel</a> >+ </span> >+ </div> >+ </div> >+ </div> >+ </div> >+ <div id="history-panel" class="page-section"> >+ <div id="child_orders"> >+ <h4>Receipt history for this subscription</h4> >+ <table id="child_orders_table"> >+ <thead> >+ <tr> >+ <th>Invoice</th> >+ <th>Order number</th> >+ <th>Creation date</th> >+ <th>Receive date</th> >+ <th>Quantity received</th> >+ <th>Status</th> >+ <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th> >+ <th>Internal note</th> >+ </tr> >+ </thead> >+ </table> >+ </div> >+ </div> >+ <div id="items-panel" class="page-section"> >+ <div id="acq-create-receiving"> >+ <div id="items_list" style="display: none"> >+ <h4>Items list</h4> >+ <div style="width:100%;overflow:auto;"> >+ <table> >+ <thead> >+ <tr> >+ <th>Actions</th> >+ <th>Barcode</th> >+ <th>Home library</th> >+ <th>Holding library</th> >+ <th>Not for loan</th> >+ <th>Restricted</th> >+ <th>Location</th> >+ <th>Call number</th> >+ <th>Copy number</th> >+ <th>Inventory number</th> >+ <th>Collection</th> >+ <th>Item type</th> >+ <th>Materials</th> >+ <th>Notes</th> >+ </tr> >+ </thead> >+ <tbody> >+ </tbody> >+ </table> >+ </div> >+ </div> >+ >+ <div id="itemfieldset"> >+ <h4>Item</h4> >+ [% IF ( NoACQframework ) %] >+ <p class="required"> >+ No ACQ framework, using default. You should create a >+ framework with code ACQ, the items framework would be >+ used >+ </p> >+ [% END %] >+ <div id="outeritemblock"></div> >+ </div> >+ </div> >+ <div id="acq-create-ordering"> >+ <h4>Items</h4> >+ <div style="width:100%;overflow:auto"> >+ <table> >+ <thead> >+ <tr> >+ <th>Receive?</th> >+ <th> </th> >+ <th>Barcode</th> >+ <th>Home library</th> >+ <th>Current library</th> >+ <th>Not for loan</th> >+ <th>Restricted</th> >+ <th>Location</th> >+ <th>Call number</th> >+ <th>Copy number</th> >+ <th>Inventory number</th> >+ <th>Collection</th> >+ <th>Item type</th> >+ <th>Materials</th> >+ <th>Notes</th> >+ </tr> >+ </thead> >+ <tbody> >+ </tbody> >+ </table> >+ </div> >+ </div> >+ </div> >+ </div> >+ <div class="col-md-12 col-lg-6"> >+ <div id="accounting-panel" class="page-section"> >+ <h4>Accounting details</h4> >+ <ol> >+ <li> >+ <label for="datereceived">Date received: </label> >+ <input type="text" size="10" id="datereceived" name="datereceived" class="datepicker" /> >+ </li> >+ <li> >+ <label for="bookfund">Fund: </label> >+ <select id="bookfund" name="bookfund"> >+ <option value=""></option> >+ [% FOREACH period IN budget_loop %] >+ <optgroup label="[% period.description | html %]"> >+ [% FOREACH fund IN period.funds %] >+ <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option> >+ [% END %] >+ </optgroup> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label> </label> >+ <span id="current-fund"></span> >+ </li> >+ <li> >+ <label for="creator">Ordered by: </label> >+ <span id="creator"></span> >+ </li> >+ <li> >+ <label for="quantity_to_receive">Quantity ordered: </label> >+ <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" /> >+ </li> >+ <li> >+ <label for="quantity">Quantity received: </label> >+ <input type="text" size="20" name="quantityrec" id="quantity" /> >+ <div id="qtyrecerror" style="display:none"> >+ <p class="error">Warning, you have entered more items than expected. >+ Items will not be created.</p> >+ </div> >+ </li> >+ >+ [% IF ( gst_values ) %] >+ <li> >+ <label for="tax_rate">Tax rate: </label> >+ <select name="tax_rate" id="tax_rate"> >+ [% FOREACH gst IN gst_values %] >+ <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option> >+ [% END %] >+ </select> >+ </li> >+ [% END %] >+ >+ <li> >+ <label for="rrp">Retail price: </label> >+ <span id="rrp"></span> >+ <li> >+ <label for="replacementprice">Replacement price:</label> >+ <input type="text" size="20" name="replacementprice" id="replacementprice" /> >+ </li> >+ <li> >+ <label for="ecost">Budgeted cost: </label> >+ <span id="ecost"></span> >+ </li> >+ <li> >+ <label for="unitprice">Actual cost:</label> >+ <input type="text" size="20" name="unitprice" id="unitprice" /> >+ <span id="unitprice_hint" class="hint"></span> >+ <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label> >+ </li> >+ <li id="select_currency"> >+ <label for="unitprice_currency"></label> >+ <input type="text" size="20" name="unitprice_currency" id="unitprice_currency" value="" /> >+ [% IF currencies.count %] >+ <select name="currency"> >+ <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> >+ [% FOR currency IN currencies %] >+ <option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option> >+ [% END %] >+ </select> >+ [% END %] >+ </li> >+ <li> >+ <label for="order_internalnote">Internal note: </label> >+ <textarea name="order_internalnote" id="order_internalnote" width="40" rows="8" ></textarea> >+ </li> >+ <li> >+ <label for="order_vendornote">Vendor note: </label> >+ <span id="order_vendornote"></span> >+ </li> >+ </ol> >+ </div> >+ </div> >+ </div> >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-defualt modal-prev">Previous order</button> >+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> >+ <button type="button" class="btn btn-primary modal-save">Save changes</button> >+ <button type="button" class="btn btn-defualt modal-next">Next order</button> >+ </div> > </div> >- [% END %] >- [% END %] >- <input type="hidden" name="biblionumber" value="[% order.biblionumber | html %]" /> >- <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" /> >- <input type="hidden" name="ordernumber" value="[% order.ordernumber | html %]" /> >- <input type="hidden" name="booksellerid" value="[% order.basket.booksellerid | html %]" /> >- </div> >- <div class="col-sm-6"> >- <fieldset class="rows"> >- <legend>Accounting details</legend> >- <ol> >- <li> >- <label for="datereceived">Date received: </label> >- <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | html %]" class="flatpickr" /> >- <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >- </li> >- <li> >- <label class="required" for="bookfund">Fund: </label> >- [% active_count = 0 %] >- [% IF !ordernumber %] >- [% FOREACH budget_period IN budget_loops.keys %] >- [% FOREACH fund IN budget_loops.$budget_period.funds %] >- [% active_count= active_count + fund.b_active %] >- [% END %] >- [% END %] >- [% END %] >- <select class="select2" id="bookfund" name="bookfund"> >- <optgroup label="Current"> >- <option value="[% order.fund.budget.id | html %]" selected="selected" data-sort1-authcat="[% order.fund.sort1_authcat | html %]" data-sort2-authcat="[% order.fund.sort2_authcat | html %]"> >- Keep current ([% order.fund.budget_name | html %])</option> >- </optgroup> >- [% FOREACH budget_period_id IN budget_loops.keys %] >- [% SET budget_period = budget_loops.$budget_period_id %] >- [% IF budget_period.active %] >- <optgroup label="[% budget_period.description | html %]"> >- [% ELSE %] >- <optgroup class="inactive_budget" label="[% budget_period.description | html %] (Inactive)"> >- [% END %] >- [% FOREACH budget_loo IN budget_period.funds %] >- [% level_indent_cnt = 0 %] >- [% level_indent = "" %] >- [% WHILE level_indent_cnt < budget_loo.b_level %] >- [% level_indent = level_indent _ " -- " %] >- [% level_indent_cnt = level_indent_cnt +1 %] >- [% END %] >- >- [% IF ( budget_loo.b_sel ) %] >- [% active_count = 0 #select no other fund %] >- <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >- [% ELSIF active_count==1 && budget_loo.b_active %] >- <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >- [% ELSE %] >- [% bdgclass=budget_loo.b_active? "": "inactive_budget" | html %] >- <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >- [% END %] >- [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %] >- </option> >- [% END %] >- </optgroup> >- [% END %] >- </select> >- <span class="required">Required</span> >- <label for="showallbudgets" style="float:none;"> Show inactive:</label> >- <input type="checkbox" id="showallbudgets" /> >- </li> >- <li><label> </label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li> >- <li> >- <label for="creator">Ordered by: </label> >- <span> >- [% INCLUDE 'patron-title.inc' patron = creator %] >- </span> >- </li> >- <li><label for="quantity_to_receive">Quantity ordered: </label><span class="label"> >- [% IF edit or order.subscriptionid %] >- <input type="text" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" /> >- [% ELSE%] >- <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" /> >- [% END %] >- </span></li> >- <li><label for="quantity">Quantity received: </label> >- [% IF order.subscriptionid %] >- <input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% order.quantity | html %]" /> >- <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> >- [% ELSIF AcqCreateItem == 'receiving' %] >- <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" /> >- [% ELSE %] >- [% IF ( order.quantityreceived ) %] >- [% IF ( edit ) %] >- <input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived | html %]" /> >- <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> >- [% ELSE %] >- [% IF ( order.items.count ) %] >- <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" /> >- [% ELSE %] >- <input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" /> >- [% END %] >- <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> >- [% END %] >- [% ELSE %] >- <input type="text" inputmode="numeric" pattern="[0-9]*" id="quantity" size="20" name="quantityrec" value="1" /> >- <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" /> >- [% END %] >- <div id="qtyrecerror" style="display:none"> >- <p class="error">Warning, you have entered more items than expected. >- Items will not be created.</p> >+ </div> >+ </div> >+ <div class="modal fade" id="modal_messages" tabindex="-1" role="dialog" aria-labelledby="Order edit"> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h4 class="col-md-11 modal-title"></h4> >+ <button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ </div> >+ <div class="modal-body"> >+ <ul></ul> >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-primary accept">Accept</button> >+ <button type="button" class="btn btn-default cancel">Cancel</button> >+ </div> > </div> >- [% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItem == 'receiving' ) %] >- </li> >- >- [% IF ( gst_values ) %] >- <li> >- <label for="tax_rate">Tax rate: </label> >- <select name="tax_rate" id="tax_rate"> >- [% tax_rate = order.tax_rate_on_receiving || order.tax_rate_on_ordering %] >- [% tax_rate = tax_rate + 0 %] >- [% FOREACH gst IN gst_values %] >- [% IF gst.option == tax_rate %] >- <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option> >- [% ELSE %] >- <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option> >- [% END %] >- [% END %] >- </select> >- </li> >- [% ELSE %] >- <input type="hidden" name="tax_rate" value="0" /> >- [% END %] >- >- <li><label for="rrp">Retail price: </label> >- [% IF (invoiceincgst == 1) %] >- [% order.rrp_tax_included | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax inclusive)</span></li> >- [% ELSE %] >- [% order.rrp_tax_excluded | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax exclusive)</span></li> >- [% END %] >- <li> >- <label for="replacementprice">Replacement price:</label> >- <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% order.replacementprice | $Price on_editing => 1 %]" /> >- </li> >- <li> >- [% IF (invoiceincgst) %] >- <label for="ecost">Budgeted cost: </label>[% order.ecost_tax_included | $Price %] <span class="hint">(tax inclusive)</span> >- [% ELSE %] >- <label for="ecost">Budgeted cost: </label>[% order.ecost_tax_excluded | $Price %] <span class="hint">(tax exclusive)</span> >- [% END %] >- </li> >- <li> >- <label for="unitprice">Actual cost:</label> >- [% IF (invoiceincgst) %] >- [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_included : order.ecost_tax_included %] >- <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span> >- [% ELSE %] >- [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_excluded : order.ecost_tax_excluded %] >- <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span> >- [% END %] >- <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label> >- </li> >- <li id="select_currency"> >- <label for="invoice_unitprice"></label> >- <input type="text" size="20" name="invoice_unitprice" id="invoice_unitprice" value="[% order.invoice_unitprice | $Price on_editing => 1 %]" /> >- [% IF currencies.count %] >- <select name="invoice_currency"> >- [% IF order.invoice_currency == active_currency.currency %] >- <option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> >- [% ELSE %] >- <option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> >- [% END %] >- [% FOR currency IN currencies %] >- [% IF order.invoice_currency == currency.currency %] >- <option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]" selected="selected">[% currency.currency | html %] ([% currency.symbol | html %])</option> >- [% ELSE %] >- <option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option> >- [% END %] >- [% END %] >- </select> >- [% END %] >- </li> >- <li><label for="order_internalnote">Internal note: </label><textarea name="order_internalnote" width="40" rows="8" >[% order_internalnote | html %]</textarea></li> >- [% IF order_vendornote %] >- <li><label for="order_vendornote">Vendor note: </label><span>[% order_vendornote | html %]</span></li> >- [% END %] >- </ol> >- </fieldset> >- >-</div> >-</div><div class="row"><fieldset class="action"> >- <input type="submit" value="Save" class="btn btn-primary" accesskey="w" /> >- <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]">Cancel</a> >-</fieldset></div> </form> >+ </div> >+ </div> > [% ELSE %] > This ordernumber does not exist. > [% END %] >@@ -469,182 +347,910 @@ > </div> <!-- /.row --> > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] >-[% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'calendar.inc' %] > [% Asset.js("js/additem.js") | $raw %] > [% Asset.js("js/cataloging.js") | $raw %] > [% INCLUDE 'select2.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'js-date-format.inc' %] >+ [% INCLUDE 'format_price.inc' %] >+ [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] >+ <style> >+ @media (min-width: 1200px) { >+ #receive-modal, #receive-modal .modal-content { >+ width: 1150px; >+ } >+ } >+ #receive-modal .modal-body { >+ background-color: #F3F4F4; >+ } >+ >+ .lbl { >+ font-weight: 700; >+ text-align: right; >+ } >+ .modal-body ol { >+ list-style-type: none; >+ } >+ >+ .modal-body ol li { >+ list-style-type: none; >+ padding-bottom: 1em; >+ width: 100%; >+ } >+ >+ .modal-body h4 { >+ margin-left: 1em; >+ padding: .2em .5em; >+ margin-bottom: 17px; >+ } >+ >+ .modal-body label { >+ margin-right: 1em; >+ text-align: right; >+ width: 11em; >+ display: inline-block; >+ font-weight: 700; >+ } >+ >+ .modal-body textarea { >+ vertical-align: text-top; >+ } >+ </style> > <script> >- function Check(form) { >- [% IF (AcqCreateItem == 'receiving') %] >- var total_errors = CheckMandatorySubfields(form); >- if (total_errors != 0) { >- var alertString = _("Form not submitted because of the following problem(s)"); >- alertString += "\n------------------------------------------------------------------------------------\n"; >- alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors); >- alert(alertString); >- return false; >+ function display_string(key, strings, fallback) { >+ if ( strings.hasOwnProperty(key) ) { >+ return strings[key].str && escape_str(strings[key].str) || ''; >+ } >+ return fallback != null ? fallback : ''; >+ } >+ >+ var _build_item = function(item, tr) { >+ var chb = $('<input type="checkbox" name="items_to_receive" value="'+item.item_id+'" />') >+ .prop('checked', item._checked) >+ .change(function() { >+ item._checked = $(this).prop('checked'); >+ }); >+ tr.append($('<td style="text-align:center"></td>').append(chb)); >+ tr.append('<td><a style="cursor:pointer" onclick="PopupEditPage('+item.biblio_id+', '+item.item_id+');">'+EDIT[0].toUpperCase()+EDIT.substr(1).toLowerCase()+'</a></td>'); >+ tr.append('<td>'+(item.external_id||'')+'</td>'); >+ tr.append('<td>'+display_string( 'home_library_id', item._strings, item.home_library_id ) || ''+'</td>'); >+ tr.append('<td>'+display_string( 'holding_library_id', item._strings, item.holding_library_id )+'</td>'); >+ tr.append('<td>'+display_string( 'not_for_loan_status', item._strings, item.not_for_loan_status )+'</td>'); >+ tr.append('<td>'+display_string( 'restricted_status', item._strings, item.restricted_status )+'</td>'); >+ tr.append('<td><span class="shelvingloc">'+display_string( 'location', item._strings, item.location )+'</span></td>'); >+ tr.append('<td>'+(item.callnumber||'')+'</td>'); >+ tr.append('<td>'+(item.copy_number||'')+'</td>'); >+ tr.append('<td>'+(item.inventory_number||'')+'</td>'); >+ tr.append('<td>'+display_string( 'collection', item._strings, item.collection )+'</td>'); >+ tr.append('<td>'+display_string( 'item_type_id', item._strings, item.item_type_id )+'</td>'); >+ tr.append('<td>'+display_string( 'materials_notes', item._strings, item.materials_notes )+'</td>'); >+ tr.append('<td>'+(item.public_notes||'')+'</td>'); >+ }; >+ >+ var items_columns = [null, null, 'external_id', 'home_library_id', >+ 'holding_library_id', 'not_for_loan_status', 'restricted_status', 'location', >+ 'callnumber', 'copy_number', 'inventory_number', 'collection_code', >+ 'item_type', 'materials_notes', 'public_notes']; >+ >+ function PopupEditPage(biblionumber, itemnumber) { >+ var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=" >+ + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem"; >+ var w = window.open(url); >+ var watchClose = setInterval(function() { >+ if (w.closed) { >+ clearTimeout(watchClose); >+ $.ajax({ >+ dataType: "json", >+ headers: { >+ "x-koha-embed": "+strings" >+ }, >+ url: '/api/v1/items/'+itemnumber, >+ success: function(item) { >+ var tr = $("#item_"+itemnumber); >+ tr.html(''); >+ _build_item(item, tr); >+ } >+ }); > } >+ }, 500); >+ } > >- if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){ >- alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); >- return false; >- }; >+ var periods={}; >+ var funds={}; >+ var funds_tree = []; >+ >+ var QTY_TOTAL = _("Receiving %0$s out of %1$s"); >+ var EDIT = _("edit"); >+ var MOD_TITLE = _("Edit %s"); >+ var SUGGESTION = _("suggestion #%s"); >+ var FUND_KEEP = _("Keep current (%0$s - %1$s)"); >+ var FUNC_CUR = _("(Current: %0$s - %1$s)"); >+ var ADJ_TAX_INC = _("(adjusted for %s, tax inclusive)"); >+ var ADJ_TAX_EXC = _("(adjusted for %s, tax exclusive)"); >+ var TAX_INC = _("(tax inclusive)"); >+ var TAX_EXC = _("(tax exclusive)"); >+ var SAVE_WARNING = _("Order %s: Warning, you have entered more items than expected. Extra items will not be created."); >+ var SAVE_WARNING_NO_ITEMS = _("Order %s: No quantity to receive set. No items will be created."); >+ var SAVE_ERROR = _("Order %s: An error occurred while saving"); >+ var SAVE_WARNING_TITLE = _("Warning"); >+ var SAVE_ERROR_TITLE = _("Error"); >+ >+ >+ var CAN_user_acquisition = "[% CAN_user_acquisition | html %]"; >+ var AcqCreateItem = "[% Koha.Preference('AcqCreateItem') | html %]"; >+ var edit_mode = "[% edit | html %]"; >+ var invoiceincgst = "[% invoiceincgst | html %]"; >+ var active_currency = "[% active_currency.currency | html %]"; >+ var invoice_id = "[% invoiceid | html %]"; > >- // Remove last itemblock if it is not in items_list >- var lastitemblock = $("#outeritemblock > div:last"); >- var tobedeleted = true; >- var listitems = $("#items_list tr"); >- $(listitems).each(function(){ >- if($(this).attr('idblock') == $(lastitemblock).attr('id')){ >- tobedeleted = false; >+ $(document).ready(function(){ >+ var base_query = { "order_id": {"in": [[% multiple_orders | html %]]}}; >+ var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1"; >+ var options = { >+ "ajax": { >+ "url": pending_orders_url + "&q=" + encodeURI(JSON.stringify(base_query)) >+ }, >+ "embed": [ >+ "basket", >+ "biblio.suggestions.suggester", >+ "fund.budget", >+ "items+strings", >+ "creator" >+ ], >+ 'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', >+ "columns": [ >+ { >+ "data": "order_id", >+ "searchable": true, >+ "orderable": true >+ }, >+ { >+ "data": "biblio.title", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ if ( data == null ) { >+ return ""; >+ } >+ else { >+ return data; >+ } >+ } >+ }, >+ { >+ "data": "biblio.author", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ if ( data == null ) { >+ return ""; >+ } >+ else { >+ return data; >+ } >+ } >+ }, >+ { >+ "data": "biblio.isbn", >+ "searchable": true, >+ "orderable": true, >+ "render": function(data, type, row, meta) { >+ if ( data == null ) { >+ return ""; >+ } >+ else { >+ return data; >+ } >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": function(row, type, val, meta) { >+ return $date(row.date_received||new Date().toISOString()); >+ } >+ }, >+ { >+ "data": "fund.name", >+ "searchable": true, >+ "orderable": false, >+ "render": function(data, type, row, meta) { >+ return row.fund.budget.budget_period_description+" - "+row.fund.name; >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": true, >+ "data": "quantity_received", >+ "render": function(data, type, row, meta) { >+ var data = $("#order_edit").data(); >+ return QTY_TOTAL.format(row.subscription_id&&(!data.saved||!data.saved.hasOwnProperty(row.order_id))?row.quantity:row.quantity_received, row.quantity); >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "render": function(data, type, row, meta) { >+ return '<a data-toggle="modal" href="#order_edit" data-row="'+meta.row+'" class="order_edit_toggle">'+EDIT+'</a>'; >+ } > } >- }); >- if(tobedeleted){ >- $(lastitemblock).remove(); >- } >+ ] >+ }; >+ var orders_table = $("#multiple_orders").kohaTable(options); >+ var api = orders_table.api(); > >- if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){ >- alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); >- if(tobedeleted) { >- $(lastitemblock).appendTo("#outeritemblock"); >+ api.on('preDraw', function() { >+ var saved = $("#order_edit").data('saved'); >+ if(saved) { >+ var data = api.data(); >+ for(var i = 0; i<data.length; i++) { >+ var row = data[i]; >+ var srow = saved[row.order_id]; >+ if(srow) { >+ if(row.fund_id != srow.fund_id) { >+ row.fund.budget.budget_period_description = $("#bookfund option[value="+srow.fund_id+"]").parent().attr('label'); >+ row.fund.name = $("#bookfund option[value="+srow.fund_id+"]").html(); >+ } >+ row.date_received = srow.date_received; >+ row.quantity = srow.quantity; >+ row.quantity_received = srow.quantity_received; >+ } > } >- return false; >- }; >- [% END %] >+ } >+ }); > >- if( $("#quantity").val() < 1 ) { >- alert(_("You must receive at least one item")); >- return false; >- } >+ var _doSave = function(params) { >+ $.ajax($.extend({ >+ method: 'POST', >+ url: '/cgi-bin/koha/acqui/finishreceive.pl' >+ }, params)); >+ }; > >- return true; >- } >+ var _transform_row = function(row, origrec) { >+ var params = {}; >+ params['biblionumber'] = row.biblio_id; >+ params['invoiceid'] = invoice_id; >+ params['ordernumber'] = row.order_id; >+ params['booksellerid'] = row.basket.vendor_id; > >- [% IF (AcqCreateItem == 'ordering') %] >- var items_columns = [null, null, 'barcode', 'homebranchname', >- 'holdingbranchname', 'notforloan', 'restricted', 'location', >- 'itemcallnumber', 'copynumber', 'stocknumber', 'collection', >- 'itemtype', 'materials', 'itemnotes']; >- >- function PopupEditPage(biblionumber, itemnumber) { >- var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=" >- + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem"; >- var w = window.open(url); >- var watchClose = setInterval(function() { >- if (w.closed) { >- clearTimeout(watchClose); >- $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl', >- { >- 'itemnumber': itemnumber >+ if(row.biblio.suggestions.length && row.biblio.suggestions[0].reason) { >+ params["suggestionid"] = row.biblio.suggestions[0].suggestion_id; >+ if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) { >+ params['reason'] = row.biblio.suggestions[0].reason; >+ } else { >+ params['reason'] = 'other'; >+ params['other_reason'] = row.biblio.suggestions[0].reason; >+ } >+ } >+ params['datereceived'] = row.date_received; >+ params['bookfund'] = row.fund_id; >+ params['quantity'] = row.quantity; >+ params['quantityrec'] = row.quantity_received; >+ params['origquantityrec'] = origrec; >+ var effective_create_items = row.basket.create_items || AcqCreateItem; >+ params['tax_rate'] = (effective_create_items == 'receiving')?row.tax_rate_on_receiving:row.tax_rate_on_ordering; >+ params['replacementprice'] = row.replacement_price; >+ params['unitprice'] = invoiceincgst=="1"?row.unit_price_tax_included:row.unit_price_tax_excluded; >+ params['order_internalnote'] = row.internal_note; >+ if(effective_create_items == 'receiving') { >+ Object.keys(row.items).forEach(function(key) { >+ var item = row.items[key]; >+ Object.keys(item).forEach(function(key) { >+ var field = item[key]; >+ Object.keys(field).forEach(function(key) { >+ if(!params[key]) params[key] = []; >+ params[key].push(item[key]); >+ }); >+ }); >+ }); >+ } else if(effective_create_items == 'ordering') { >+ params['items_to_receive'] = (row.items||[]) >+ .filter(function(item) { >+ return item._checked >+ }) >+ .map(function(item) { >+ item.item_id; >+ }) >+ } >+ return params; >+ }; >+ >+ var save_rows = function(rows, data) { >+ if(rows.length) { >+ $('#jobpanel, #jobstatus').show(); >+ errors = [] >+ var loopRows = function(i) { >+ var row = rows[i]; >+ if(!row) { >+ if(!errors.length) { >+ location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id >+ } else { >+ $('#modal_messages .modal-header h4').html(SAVE_ERROR_TITLE); >+ $('#modal_messages .modal-body ul').html(''); >+ errors.forEach(function(error) { >+ $('#modal_messages .modal-body ul').append('<li>'+error+'</li>'); >+ }); >+ $('#modal_messages .modal-footer .cancel').hide(); >+ $('#modal_messages .modal-footer .accept').html(_("Accept")); >+ $('#modal_messages .modal-footer .accept').one('click', function() { >+ location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id >+ }); >+ $('#modal_messages').modal('show'); >+ } >+ return; >+ } >+ if(data.saved && data.saved[row.order_id]) { >+ row = data.saved[row.order_id]; >+ var origrec = data.origrec[row.order_id]; >+ } else { >+ var origrec = row.quantity_received; >+ } >+ var _set_percentage = function() { >+ var percentage = Math.round(( (i+1) / rows.length) * 100); >+ var bgproperty = (parseInt(percentage*2)-300)+"px 0px"; >+ $("#jobprogress").css("background-position",bgproperty); >+ $("#jobprogresspercent").text(percentage); >+ } >+ _doSave({ >+ data: _transform_row(row, origrec), >+ success: function() { >+ _set_percentage(); >+ loopRows(i+1); > }, >- function(item) { >- var tds = $("#item_"+itemnumber+" td"); >- for(var i=2; i<tds.length; i++) { >- var column = items_columns[i]; >- var text = item[column]; >- if ( text == null ) text = ''; >- $(tds[i]).text(text); >- } >+ error: function() { >+ _set_percentage() >+ errors.push(SAVE_ERROR.format(row.order_id)); >+ loopRows(i+1); > } >- ); >+ }); >+ }; >+ loopRows(0) >+ } >+ }; >+ >+ var get_warnings = function(rows) { >+ var warnings = []; >+ rows.forEach(function(row) { >+ if(row.quantity_received > row.quantity) { >+ warnings.push(SAVE_WARNING.format(row.order_id)); >+ row.quantity_received = row.quantity; > } >- }, 500); >+ if(row.quantity_received == '0') { >+ warnings.push(SAVE_WARNING_NO_ITEMS.format(row.order_id)); >+ } >+ }) >+ return warnings; > } > >- function CalcQtyToReceive() { >- var qty = $("input[name='items_to_receive']:checked").length; >- $("#quantity").val(qty); >- } >+ $('#modal_messages .modal-footer .cancel').on('click', function() { >+ $('#modal_messages .modal-footer .accept').off('click'); >+ $('#modal_messages').modal('hide'); >+ }) >+ $('.save').click(function() { >+ var data = $("#order_edit").data(); >+ var rows = api.rows().data().toArray(); >+ var redirect = true; >+ var warnings = get_warnings(rows); >+ if(warnings.length) { >+ $('#modal_messages .modal-header h4').html(SAVE_WARNING_TITLE); >+ $('#modal_messages .modal-body ul').html(''); >+ warnings.forEach(function(warning) { >+ $('#modal_messages .modal-body ul').append('<li>'+warning+'</li>'); >+ }); >+ $('#modal_messages .modal-footer .cancel').show(); >+ $('#modal_messages .modal-footer .accept').html(_("Continue")); >+ $('#modal_messages .modal-footer .accept').one('click', function() { >+ $('#modal_messages').modal('hide'); >+ save_rows(rows, data); >+ }); >+ $('#modal_messages').modal('show'); >+ } else { >+ save_rows(rows, data); >+ } >+ }); > >- function CheckNItems(n) { >- $("input[name='items_to_receive']").each(function() { >- $(this).prop('checked', false); >- }); >- $("input[name='items_to_receive']:lt("+n+")").each(function () { >- $(this).prop('checked', true); >- }); >- } >- [% END %] > >- $(document).ready(function() { >+ $("#order_edit").on("change", "#reason", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ if(val == 'other') { >+ $("#other_reason").show(); >+ $(this).hide(); >+ } else { >+ row.biblio.suggestions[0].reason = val; >+ } >+ }); >+ >+ $("#order_edit").on("change", "#select-other_reason", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.biblio.suggestions[0].reason = val; >+ }); > >- //keep a copy of all budgets before removing the inactives >- disabledBudgetsCopy = $('#bookfund').html(); >- $('#bookfund .inactive_budget').remove(); >+ $("#order_edit").on("click", "#other_reason a", function() { >+ $("#other_reason").hide(); >+ $("#reason").val(null).show(); >+ }); > >- $('#showallbudgets').click(function() { >- if ($(this).is(":checked")) { >- $('#bookfund').html(disabledBudgetsCopy); //Puts back all the funds >- } >- else { >- $('#bookfund .inactive_budget').remove(); >+ $("#order_edit").on("change", "#datereceived", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.date_received = val; >+ }); >+ >+ $("#order_edit").on("change", "#bookfund", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.fund_id = val; >+ }); >+ >+ $("#order_edit").on("change", "#quantity_to_receive", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.quantity = val; >+ if(row.subscription_id) { >+ $("#quantity").val(val).change(); > } > }); > >- [% IF (AcqCreateItem == 'receiving') %] >- cloneItemBlock(0, '[% Koha.Preference('UniqueItemFields') | html %]'); >- [% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %] >- $("input[name='items_to_receive']").change(function() { >- CalcQtyToReceive(); >+ $("#order_edit").on("change", "#quantity", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.quantity_received = val; >+ var qtyto = parseInt($("#quantity_to_receive").val()); >+ if(parseInt(val) > qtyto) { >+ $("#qtyrecerror").show(); >+ } else { >+ $("#qtyrecerror").hide(); >+ } >+ $("input[name='items_to_receive']").each(function() { >+ $(this).prop('checked', false).change(); > }); >- CalcQtyToReceive(); >- $("#quantity").keyup(function() { >- var qty = parseInt($("#quantity").val()); >- var qtyto = parseInt($("#quantity_to_receive").val()); >- if(qty > qtyto) { >- $("#qtyrecerror").show(); >- } else { >- $("#qtyrecerror").hide(); >- } >- CheckNItems($(this).val()); >+ $("input[name='items_to_receive']:lt("+val+")").each(function () { >+ $(this).prop('checked', true).change(); > }); >- [% END %] >+ }); >+ >+ $("#order_edit").on("change", "input[name='items_to_receive']", function() { >+ var qty = $("input[name='items_to_receive']:checked").length; >+ $("#quantity").val(qty); >+ var row = $("#order_edit").data('row'); >+ row.quantity_received = qty; >+ }) >+ >+ $("#order_edit").on("change", "#tax_rate", function() { >+ var val = $(this).val(); >+ if(val === null) $(this).val($('option:first-child', this).attr('value')); >+ val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ var effective_create_items = row.basket.create_items || AcqCreateItem; >+ if(effective_create_items == 'receiving') { >+ row.tax_rate_on_receiving = val; >+ } else { >+ row.tax_rate_on_ordering = val; >+ } >+ >+ }); > >- $("input[name='change_currency']").on("change", function(){ >+ $("#order_edit").on("change", "#unitprice", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ if(invoiceincgst == "1") { >+ row.unit_price_tax_included = val; >+ } else { >+ row.unit_price_tax_excluded = val; >+ } >+ >+ }); >+ >+ $("#order_edit").on("change", "input[name='change_currency']", function(){ > if ( $(this).is(":checked") ) { > $("#select_currency").show(); > $("#unitprice").prop("readonly", "true"); > } else { > $("#select_currency").hide(); >- $("#invoice_unitprice").val(""); // Empty to not store the values >- $("#invoice_currency").val(""); > $("#unitprice").prop("readonly", ""); > } > }); > >- [% IF order.invoice_unitprice %] >- $("input[name='change_currency']").click(); >- [% ELSE %] >- $("input[name='change_currency']").trigger('change'); >- [% END %] >- >- function update_unitprice() { >- var rate = Number($("select[name='invoice_currency'] option:selected").data('rate')); >- var unitprice = $("#invoice_unitprice").val(); >+ function _update_unitprice() { >+ var rate = Number($("select[name='currency'] option:selected").val()); >+ var unitprice = $("#unitprice_currency").val(); > var new_unitprice = Number( unitprice * rate ).toFixed(2); >- $("#unitprice").val(new_unitprice); >+ $("#unitprice").val(new_unitprice).change(); > } >- $("select[name='invoice_currency']").on("change", function(){update_unitprice()} ); >- $("#invoice_unitprice").on("change", function(){update_unitprice()} ); >+ $("#order_edit").on("change", "select[name='currency']", _update_unitprice ); >+ $("#order_edit").on("change", "#unitprice_currency", _update_unitprice ); > >- [% IF other_reason %] >- $(".select-reason").hide(); >- $(".select-reason").find("option[value='other']").attr("selected","selected"); >- $("#other_reason").show(); >- [% ELSE %] >- $("#other_reason").hide(); >- [% END %] >- $(".select-reason").change(function(){ >- if($(this).val() == "other"){ >- $(this).hide(); >- $("#other_reason").show(); >+ $("#order_edit").on("change", "#replacementprice", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.replacement_price = val; >+ }); >+ >+ $("#order_edit").on("change", "#order_internalnote", function() { >+ var val = $(this).val(); >+ var row = $("#order_edit").data('row'); >+ row.internal_note = val; >+ >+ }); >+ >+ var keep_row = function() { >+ var row = $("#order_edit").data('row'); >+ var kept = $("#order_edit").data('kept')||{}; >+ if($('#items_list tbody tr').length) { >+ row.items = []; >+ $('#items_list tbody tr').each(function() { >+ var item = {}; >+ $('#'+$(this).attr('idblock')).find('*[name=kohafield]').each(function() { >+ var kf = $(this).val(); >+ var obj = {}; >+ $(this).parent().find('*[name]').each(function() { >+ obj[$(this).prop('name')] = $(this).val(); >+ }); >+ item[kf] = obj; >+ }); >+ row.items.push(item); >+ }); >+ } >+ kept[row.order_id] = row; >+ $("#order_edit").data('kept', kept); >+ }; >+ >+ var save_row = function() { >+ keep_row(); >+ var saved = $("#order_edit").data('saved')||{}; >+ var kept = $("#order_edit").data('kept'); >+ var saved_rows = $.extend(saved, kept); >+ $("#order_edit").data('saved', saved_rows); >+ api.draw(); >+ return saved_rows; >+ } >+ >+ var set_modal_buttons = function() { >+ var n = $("#order_edit").data('n'); >+ var info = api.page.info(); >+ >+ $('.modal-prev').prop('disabled', info.page == 0 && n == 0); >+ $('.modal-next').prop('disabled', info.pages - 1 == info.page && info.end - info.start - 1 == n); >+ }; >+ >+ var show_subs = function(row) { >+ //$("#child_orders").show(); >+ var had_rows = false; >+ var base_query = { "subscription_id": row.subscription_id, "parent_order_id": row.order_id, "order_id": {"!=": row.order_id}}; >+ var pending_orders_url = "/api/v1/acquisitions/orders"; >+ var options = { >+ "ajax": { >+ "url": pending_orders_url + "?q=" + encodeURI(JSON.stringify(base_query)) >+ }, >+ "header_filter": true, >+ "embed": [ >+ "invoice", >+ "basket" >+ ], >+ "order": [[1, 'asc']], >+ 'dom': 'C<"top pager"ilpfB>tr<"bottom pager"ip>', >+ "columns": [ >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": function(row, type, val, meta) { >+ if(row.invoice) { >+ if(CAN_user_acquisition) { >+ return '<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid='+row.invoice_id+'" title="Invoice detail page">'+row.invoice.invoice_number+"</a>"; >+ } >+ return row.invoice.invoice_number; >+ } >+ } >+ }, >+ { >+ "data": "order_id", >+ "searchable": false, >+ "orderable": false >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": "basket.creation_date", >+ "render": function(data, type, row, meta) { >+ return $date(row.basket.creation_date); >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": function(row, type, val, meta) { >+ return $date(row.date_received); >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": function(row, type, val, meta) { >+ return row.quantity_received; >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": true, >+ "data": function(row, type, val, meta) { >+ if(!row.status) return; >+ var first_letter = row.status[0].toUpperCase(); >+ return first_letter+row.status.substr(1).toLowerCase(); >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": function(row, type, val, meta) { >+ if(!row.date_received) return; >+ return Number(row.unit_price_tax_excluded * row.quantity_received).format_price()+' / '+Number(row.unit_price_tax_included * row.quantity_received).format_price() >+ } >+ }, >+ { >+ "searchable": false, >+ "orderable": false, >+ "data": function(row, type, val, meta) { >+ return row.internal_note; >+ } >+ } >+ ] >+ }; >+ var child_orders_table = $("#child_orders_table").api(options); >+ var child_api = child_orders_table.api(); >+ child_api.on('preDraw', function() { >+ if(!child_api.data().length && !had_rows) return; >+ $("#history-panel").show(); >+ had_rows = true; >+ }); >+ }; >+ >+ var set_editor = function() { >+ var modal = $("#order_edit"); >+ var row = modal.data('row'); >+ var origrec = $("#order_edit").data('origrec')||{}; >+ if(!origrec.hasOwnProperty(row.order_id)) { >+ origrec[row.order_id] = row.quantity_received; >+ $("#order_edit").data('origrec', origrec); >+ } >+ if(row.subscription_id) { >+ row.quantity_received = row.quantity; >+ } >+ var keep = $("#order_edit").data('kept'); >+ if(keep && keep[row.order_id]) { >+ row = keep[row.order_id]; >+ modal.data('row', row); >+ } >+ $('input, select, textarea', '.modal-body').val(null) >+ modal.find(".modal-title").text(MOD_TITLE.format(row.biblio.title)); >+ ["title", "author", "copyright_date", "isbn", "series_title"].forEach(function(key){ >+ var o = modal.find(".modal-body #biblio_"+key); >+ if(row.biblio[key] !== null) { >+ o.parent().show(); >+ o.html(row.biblio[key]); >+ } else { >+ o.parent().hide(); >+ } >+ }); >+ if(row.biblio.suggestions.length) { >+ $("#suggestion_fieldset").show(); >+ if(row.biblio.suggestions[0].suggester) { >+ $("#biblio_suggestion_suggester").parent().show(); >+ $("#biblio_suggestion_suggester") >+ .html( >+ [row.biblio.suggestions[0].suggester.surname, row.biblio.suggestions[0].suggester.firstname] >+ .filter(function(name){ >+ return name >+ }) >+ .join(', ')+' (<a href="http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='+row.biblio.suggestions[0].suggestionid+'&op=show">'+SUGGESTION.format(row.biblio.suggestions[0].suggestionid)+'</a>)' >+ ); >+ } else { >+ $("#biblio_suggestion_suggester").parent().hide(); >+ } >+ if(row.biblio.suggestions[0].reason) { >+ $("#suggestion_reason").show(); >+ if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) { >+ $("#other_reason a").click(); >+ $("#reason").val(row.biblio.suggestions[0].reason); >+ $("#select-other_reason").val(null); >+ } else { >+ $("#reason").val("other").change(); >+ $("#select-other_reason").val(row.biblio.suggestions[0].reason); >+ } >+ >+ } else { >+ $("#suggestion_reason").hide(); >+ } >+ } else { >+ $("#suggestion_fieldset").hide(); >+ } >+ >+ var effective_create_items = row.basket.create_items || AcqCreateItem; >+ $("#datereceived").val(row.date_received||$date(new Date().toISOString())).change(); >+ $("#bookfund option[value='']").html(FUND_KEEP.format(row.fund.budget.budget_period_description, row.fund.name)); >+ if(row.fund_id != row.fund.fund_id) { >+ $("#bookfund").val(row.fund_id); >+ } >+ $("#current-fund").html(FUNC_CUR.format(row.fund.budget.budget_period_description, row.fund.name)); >+ $("#creator").html([row.creator.surname, row.creator.firstname].filter(function(name){return name}).join(', ')+" ("+row.creator.patron_id+')') >+ $("#quantity_to_receive").val(row.quantity).prop('readonly', !row.subscription_id); >+ $("#quantity").val(row.quantity_received).prop('readonly', !row.subscription_id && effective_create_items == 'receiving'); >+ $('#qtyrecerror').hide(); >+ var tax_rate = row.tax_rate_on_receiving || row.tax_rate_on_ordering; >+ $("#tax_rate").val(tax_rate).change(); >+ var rrp_txt; >+ var ecost_txt; >+ if(invoiceincgst == "1") { >+ rrp_txt = Number(row.rrp_tax_included).format_price()+'<span class="hint">'+ADJ_TAX_INC.format(active_currency)+"</span>"; >+ ecost_txt = Number(row.ecost_tax_included).format_price()+'<span class="hint">'+TAX_INC+"</span>"; >+ $("#unitprice").val(row.unit_price_tax_included); >+ $("#unitprice_hint").html(TAX_INC); >+ } else { >+ rrp_txt = Number(row.rrp_tax_excluded).format_price()+'<span class="hint">'+ADJ_TAX_EXC.format(active_currency)+"</span>"; >+ ecost_txt = Number(row.ecost_tax_excluded).format_price()+'<span class="hint">'+TAX_EXC+"</span>"; >+ $("#unitprice").val(row.unit_price_tax_excluded); >+ $("#unitprice_hint").html(TAX_EXC); >+ } >+ $("#rrp").html(rrp_txt); >+ $("#replacementprice").val(row.replacement_price); >+ $("#ecost").html(ecost_txt); >+ $("#order_internalnote").val(row.internal_note); >+ if(row.vendor_note) { >+ $("#order_vendornote").html(row.vendor_note); >+ $("#order_vendornote").parent().show(); >+ } else { >+ $("#order_vendornote").parent().hide(); >+ } >+ >+ >+ $("#history-panel").hide(); >+ >+ $('#items_list tbody tr, #outeritemblock > *, #acq-create-ordering tbody tr').remove(); >+ $('#items_list').hide(); >+ if(row.subscription_id) { >+ $('#modal-order-main #items-panel').removeClass('show').addClass('hide'); >+ $('#modal-order-main #history-panel').removeClass('hide').addClass('show'); >+ /*$('#modal-order-main').tabs("disable", "#items-panel"); >+ $('#modal-order-main').tabs("enable", "#history-panel"); >+ if($('#modal-order-main').tabs( "option", "active" ) == 3) { >+ $('#modal-order-main').tabs( "option", "active", 0); >+ }*/ >+ } else { >+ $('#modal-order-main #history-panel').removeClass('show').addClass('hide'); >+ $('#modal-order-main #items-panel').removeClass('hide').addClass('show'); >+ /*$('#modal-order-main').tabs("enable", "#items-panel"); >+ $('#modal-order-main').tabs("disable", "#history-panel"); >+ if($('#modal-order-main').tabs( "option", "active" ) == 2) { >+ $('#modal-order-main').tabs( "option", "active", 0); >+ }*/ >+ if(effective_create_items == 'receiving') { >+ $("#acq-create-receiving").show(); >+ $("#acq-create-ordering").hide(); >+ if(row.items && row.items.length) { >+ row.items.forEach(function(item, index) { >+ cloneItemBlock(index, '[% UniqueItemFields | html %]', function(block_id) { >+ var block = $('#'+block_id).hide(); >+ Object.keys(item).forEach(function(key) { >+ block >+ .find('*[name=kohafield][value="'+key+'"]') >+ .parent() >+ .find('*[name=field_value]') >+ .val(item[key].field_value); >+ }); >+ addItemInList(block_id, '[% UniqueItemFields | html %]'); >+ block.find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) ); >+ block.find("input[name='buttonPlusMulti']").remove(); >+ block.find("input[name='multiValue']").remove(); >+ }); >+ }); >+ } >+ cloneItemBlock((row.items && row.items.length) || 0, '[% UniqueItemFields | html %]'); >+ } else if (effective_create_items == 'ordering') { >+ $("#acq-create-receiving").hide(); >+ $("#acq-create-ordering").show(); >+ if(row.items.length) { >+ $("#acq-create-ordering tbody").append( >+ row.items.map(function(item) { >+ var tr = $('<tr id="item_'+item.item_id+'"/>'); >+ _build_item(item, tr); >+ return tr; >+ }) >+ ); >+ } >+ } else { >+ $('#modal-order-main #items-panel').removeClass('show').addClass('hide'); >+ /* >+ if($('#modal-order-main').tabs( "option", "active" ) == 3) { >+ $('#modal-order-main').tabs( "option", "active", 0); >+ } >+ $('#modal-order-main').tabs("disable", "#items-panel"); >+ */ >+ } >+ } >+ $("#select_currency").hide(); >+ $("#unitprice").prop("readonly", ""); >+ $("input[name='change_currency']").prop('checked', false); >+ set_modal_buttons(); >+ }; >+ >+ $('.modal-prev').click(function() { >+ var modal = $("#order_edit"); >+ keep_row(); >+ var n = modal.data('n'); >+ if(n > 0) { >+ n--; >+ modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); >+ modal.data('n', n); >+ set_editor(); >+ } else { >+ $('.modal-next, .modal-prev').prop('disabled', true); >+ orders_table.one('draw.dt', function() { >+ var info = api.page.info(); >+ n = info.end - info.start - 1; >+ modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); >+ modal.data('n', n); >+ set_editor(); >+ }); >+ api.page('previous').draw( 'page' ); > } > }); >- $("a[href*=back]").click(function(){ >- $(".select-reason").show().find("option[value='']").attr("selected","selected"); >- $("#other_reason").hide(); >+ >+ $('.modal-next').click(function() { >+ var modal = $("#order_edit"); >+ keep_row(); >+ var n = modal.data('n'); >+ var info = api.page.info(); >+ if(n < info.end - info.start - 1) { >+ n++; >+ modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); >+ modal.data('n', n); >+ set_editor(); >+ } else { >+ $('.modal-next, .modal-prev').prop('disabled', true); >+ orders_table.one('draw.dt', function() { >+ var info = api.page.info(); >+ n = 0; >+ modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); >+ modal.data('n', n); >+ set_editor(); >+ }); >+ api.page('next').draw( 'page' ); >+ } >+ }); >+ >+ $('.modal-save').click(function() { >+ var saved_rows = save_row(); >+ if(Object.keys(saved_rows).length) $('.save').prop('disabled', false); >+ $("#order_edit").modal('hide'); >+ }) >+ >+ /*$('#modal-order-main').tabs({ >+ activate: function(event, ui) { >+ var active = ui.newPanel.attr('id') >+ if(active == 'history-panel') { >+ show_subs($("#order_edit").data('row')); >+ } >+ } >+ });*/ >+ >+ $("#order_edit").on("show.bs.modal", function (event) { >+ var anchor = $(event.relatedTarget); >+ var n = anchor.data("row"); >+ var row = api.row(n).data(); >+ >+ var modal = $(this); >+ modal.data('row', JSON.parse(JSON.stringify(row))); >+ modal.data('n', n); >+ modal.data('keep', modal.data('saved')||{}); >+ //$('#modal-order-main').tabs("option", "active", 0); >+ set_editor(); > }); > >+ $("#order_edit").on("hide.bs.modal", function() { >+ $("#child_orders_table").DataTable().off('preDraw').destroy(); >+ }); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index 5ec656850f8..6d2cc561956 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -114,6 +114,7 @@ > <table id="pending_orders" class="table table-bordered table-striped"> > <thead> > <tr> >+ <th><!--input type="checkbox" id="selectAll"/--></th> > <th>Basket</th> > <th>Basket group</th> > <th>Order line</th> >@@ -129,6 +130,9 @@ > </tr> > </thead> > </table> >+ <fieldset class="action"> >+ <button id="select_multiple" class="btn btn-primary"></button> >+ </fieldset> > </div> > [% ELSE %] > <p> >@@ -341,8 +345,10 @@ > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] >+ <style>fieldset.action { margin-bottom: 20px }</style> > <script> > dt_overwrite_html_sorting_localeCompare(); >+ var PENDING_MULTI_SELECTION = _("Receive selected (%s)"); > var columns_filter = {}; > > $(document).ready(function(){ >@@ -374,7 +380,7 @@ > })); > } > >- var pending_orders_table = $("#pending_orders").kohaTable({ >+ var options = { > "ajax": { > "url": '/api/v1/acquisitions/orders?only_active=1' > }, >@@ -401,7 +407,7 @@ > }, > "columns": [ > { "data": "basket.name", >- "searchable": true, >+ "searchable": true, > "orderable": true, > "render": function(data, type, row, meta) { > if (type != 'display') return escape_str(data); >@@ -565,7 +571,7 @@ > { > "data": "", > "render": function(data, type, row, meta) { >- return '<a href="orderreceive.pl?ordernumber=' >+ return '<a href="orderreceive.pl?multiple_orders=' > + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">' > + _("Receive") + '</a><br/>' > + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">' >@@ -638,7 +644,50 @@ > "searchable": false > } > ] >- }, null, 1, {"basket.vendor_id": [% booksellerid | html %]}); >+ }; >+ >+ var selected_rows = {}; >+ $('#select_multiple').click(function() { >+ var ids = Object.keys(selected_rows); >+ if(!ids.length) return; >+ location.href = 'orderreceive.pl?multiple_orders='+ids.join(',')+ '&invoiceid=[% invoiceid | uri %]'; >+ }).html(PENDING_MULTI_SELECTION.format('0')) >+ options.select = { >+ style: 'api' >+ }; >+ options.order = [[1, 'asc']]; >+ options.columns.unshift({ >+ "data": function(row, type, val, meta) { >+ return '<input type="checkbox" class="selOrder" />'; >+ }, >+ "searchable": false, >+ "orderable": false >+ }); >+ >+ var pending_orders_table = $("#pending_orders").kohaTable(options, {}, 1, {"basket.vendor_id": [% booksellerid | html %]}); >+ >+ var api = pending_orders_table.api(); >+ api.on('draw', function() { >+ api.rows().every(function() { >+ var row = this; >+ var data = row.data(); >+ $('.selOrder', row.node()).on('click', function(event) { >+ if($(this).prop('checked')) { >+ row.select(); >+ selected_rows[data.order_id] = data; >+ } else { >+ row.deselect(); >+ delete selected_rows[data.order_id]; >+ } >+ $('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length)); >+ }); >+ if(selected_rows[data.order_id]) { >+ row.select(); >+ $('.selOrder', row.node()).prop('checked', true); >+ } >+ }); >+ }); >+ > > $(".previewData").on("click", function(e){ > e.preventDefault(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index 3f0560aac56..4e2c18512e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -113,7 +113,6 @@ Acquisitions: > - '<br>If you choose <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EmailAddressForSuggestions">EmailAddressForSuggestions</a> you have to enter a valid email address:' > - pref: EmailAddressForSuggestions > class: email >- > Printing: > - > - Use the >diff --git a/t/db_dependent/Koha/Acquisition/Fund.t b/t/db_dependent/Koha/Acquisition/Fund.t >index 38dae6297a3..80c4e4e65a1 100755 >--- a/t/db_dependent/Koha/Acquisition/Fund.t >+++ b/t/db_dependent/Koha/Acquisition/Fund.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > > use t::lib::TestBuilder; > >@@ -43,6 +43,19 @@ subtest 'to_api() tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'budget ()' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $budget = $builder->build_object({ class => 'Koha::Acquisition::Budgets' }); >+ my $fund = $builder->build_object({ class => 'Koha::Acquisition::Funds', value => { budget_period_id => $budget->budget_period_id } }); >+ >+ is($budget->budget_period_id, $fund->budget->budget_period_id, 'Fund\'s budget retrieved correctly'); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'budget' => sub { > plan tests => 1; > >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 784acd11cbf..1d280915ba1 100755 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 12; >+use Test::More tests => 13; > use Test::Exception; > > use t::lib::TestBuilder; >@@ -638,6 +638,21 @@ subtest 'filter_by_current & filter_by_cancelled' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'creator ()' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $order = $builder->build_object({ class => 'Koha::Acquisition::Orders', value => { created_by => $patron->borrowernumber } }); >+ >+ my $creator = $order->creator; >+ >+ is($creator->borrowernumber, $patron->borrowernumber, 'Patron is order creator'); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'cancel() tests' => sub { > > plan tests => 54; >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >old mode 100755 >new mode 100644 >index 75edcb42754..7bd4267f1d8 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -33,6 +33,7 @@ use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Old::Items; > use Koha::Recalls; >+use Koha::AuthorisedValues; > > use List::MoreUtils qw(all); > >@@ -1475,6 +1476,8 @@ subtest 'columns_to_str' => sub { > } > ); > >+ Koha::Caches->get_instance->flush_all; >+ > $item = $item->get_from_storage; > > my $s = $item->columns_to_str; >@@ -1620,6 +1623,8 @@ subtest 'strings_map() tests' => sub { > } > )->store(); > >+ Koha::Caches->get_instance->flush_all; >+ > $item->set( > { > cn_source => $class_source->id, >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8179
:
9881
|
111437
|
111438
|
111439
|
111440
|
112554
|
112555
|
112556
|
112558
|
112588
|
112643
|
112644
|
112645
|
112646
|
112744
|
112745
|
112746
|
112747
|
114688
|
114689
|
114690
|
114691
|
116582
|
116583
|
116584
|
116585
|
116588
|
116589
|
116590
|
116591
|
116681
|
116682
|
116683
|
116684
|
116942
|
116943
|
116944
|
116945
|
119178
|
119179
|
119180
|
119181
|
120620
|
120621
|
120622
|
120623
|
148215
|
148216
|
148217
|
148218
|
148233
|
148284
|
148285
|
148286
|
148287
|
148288
|
148521
|
148522
|
148523
|
148524
|
148525
|
148526
|
148685
|
148981
|
148982
|
148983
|
148984
|
148985
|
148986
|
151026
|
151086
|
151087
|
151088
|
151089
|
151092
|
151093
|
151137
|
151138
|
151139
|
151140
|
151141
|
151142
|
151143
|
151144
|
151145
|
151163
|
151250
|
151367
|
151431