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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
27a086b91e
commit
a551cb47ea
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ sub list {
|
|||
|
||||
return $c->render(
|
||||
status => 200,
|
||||
openapi => $orders->to_api({ embed => $embed })
|
||||
openapi => $c->objects->to_api($orders)
|
||||
);
|
||||
}
|
||||
catch {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,4 +259,9 @@ properties:
|
|||
type:
|
||||
- object
|
||||
- "null"
|
||||
creator:
|
||||
type:
|
||||
- object
|
||||
- "null"
|
||||
description: Patron that created the order
|
||||
additionalProperties: false
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
|
|
@ -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}}
|
||||
|
|
@ -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 %]
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue