View | Details | Raw Unified | Return to bug 8179
Collapse All | Expand All

(-)a/Koha/Acquisition/Fund.pm (+15 lines)
Lines 18-23 package Koha::Acquisition::Fund; Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Koha::Database;
20
use Koha::Database;
21
use Koha::Acquisition::Budget;
21
22
22
use base qw(Koha::Object);
23
use base qw(Koha::Object);
23
24
Lines 29-34 Koha::Acquisition::Fund object class Link Here
29
30
30
=head2 Class methods
31
=head2 Class methods
31
32
33
=head3 budget
34
35
    my $budget =  $fund->budget;
36
37
Returns budget this fund belongs to
38
39
=cut
40
41
sub budget {
42
    my ( $self )  = @_;
43
    my $budget_rs = $self->_result->budget;
44
    return Koha::Acquisition::Budget->_new_from_dbic( $budget_rs );
45
}
46
32
=head3 to_api
47
=head3 to_api
33
48
34
    my $json = $fund->to_api;
49
    my $json = $fund->to_api;
(-)a/Koha/Acquisition/Order.pm (+15 lines)
Lines 32-37 use Koha::Exceptions::Object; Link Here
32
use Koha::Biblios;
32
use Koha::Biblios;
33
use Koha::Holds;
33
use Koha::Holds;
34
use Koha::Items;
34
use Koha::Items;
35
use Koha::Patron;
35
use Koha::Subscriptions;
36
use Koha::Subscriptions;
36
37
37
use base qw(Koha::Object);
38
use base qw(Koha::Object);
Lines 394-399 sub claimed_date { Link Here
394
    return $last_claim->claimed_on;
395
    return $last_claim->claimed_on;
395
}
396
}
396
397
398
=head3 creator
399
400
my $creator = $order->creator;
401
402
Retrieves patron that created this order.
403
404
=cut
405
406
sub creator {
407
    my ( $self )  = @_;
408
    my $creator_rs = $self->_result->creator;
409
    return Koha::Patron->_new_from_dbic( $creator_rs );
410
}
411
397
=head3 duplicate_to
412
=head3 duplicate_to
398
413
399
    my $duplicated_order = $order->duplicate_to($basket, [$default_values]);
414
    my $duplicated_order = $order->duplicate_to($basket, [$default_values]);
(-)a/Koha/Item.pm (+27 lines)
Lines 45-50 use Koha::Plugins; Link Here
45
use Koha::Libraries;
45
use Koha::Libraries;
46
use Koha::StockRotationItem;
46
use Koha::StockRotationItem;
47
use Koha::StockRotationRotas;
47
use Koha::StockRotationRotas;
48
use Koha::MarcSubfieldStructures;
49
use Koha::AuthorisedValues;
48
50
49
use base qw(Koha::Object);
51
use base qw(Koha::Object);
50
52
Lines 1006-1011 sub _after_item_action_hooks { Link Here
1006
    );
1008
    );
1007
}
1009
}
1008
1010
1011
=head3 _fetch_authorised_values
1012
1013
Retrieves for each column name the unblessed authorised value.
1014
1015
=cut
1016
1017
sub _fetch_authorised_values {
1018
    my ($self, $av_expand) = @_;
1019
1020
    my $columns_info = $self->_result->result_source->columns_info;
1021
    my $framworkcode = $self->biblio->frameworkcode;
1022
    # Handle not null and default values for integers and dates
1023
    my $avs = {};
1024
    foreach my $col ( keys %{$columns_info} ) {
1025
        next unless defined $self->$col;
1026
        my $field = $self->_result->result_source->name.'.'.$col;
1027
        my $mss = Koha::MarcSubfieldStructures->find({frameworkcode => $framworkcode, kohafield => $field});
1028
        if ($mss && $mss->authorised_value) {
1029
            my $av = Koha::AuthorisedValues->find({category => $mss->authorised_value, authorised_value => $self->$col});
1030
            $avs->{$col} = $av->unblessed if $av;
1031
        };
1032
    }
1033
    return $avs;
1034
}
1035
1009
=head3 _type
1036
=head3 _type
1010
1037
1011
=cut
1038
=cut
(-)a/Koha/REST/V1/Acquisitions/Orders.pm (-1 / +1 lines)
Lines 159-165 sub list { Link Here
159
159
160
        return $c->render(
160
        return $c->render(
161
            status  => 200,
161
            status  => 200,
162
            openapi => $orders->to_api({ embed => $embed })
162
            openapi => $orders->to_api({ embed => $embed, av_expand => $c->req->headers->header('x-koha-av') })
163
        );
163
        );
164
    }
164
    }
165
    catch {
165
    catch {
(-)a/Koha/REST/V1/Items.pm (-2 / +5 lines)
Lines 66-81 sub get { Link Here
66
    my $c = shift->openapi->valid_input or return;
66
    my $c = shift->openapi->valid_input or return;
67
67
68
    try {
68
    try {
69
        my $item = Koha::Items->find($c->validation->param('item_id'));
69
        my $items_set = Koha::Items->new;
70
        my $id = $c->validation->param('item_id');
71
        my $item = $c->objects->find( $items_set, $id );
70
        unless ( $item ) {
72
        unless ( $item ) {
71
            return $c->render(
73
            return $c->render(
72
                status => 404,
74
                status => 404,
73
                openapi => { error => 'Item not found'}
75
                openapi => { error => 'Item not found'}
74
            );
76
            );
75
        }
77
        }
76
        return $c->render( status => 200, openapi => $item->to_api );
78
        return $c->render( status => 200, openapi => $item );
77
    }
79
    }
78
    catch {
80
    catch {
81
        print $_->message;
79
        $c->unhandled_exception($_);
82
        $c->unhandled_exception($_);
80
    };
83
    };
81
}
84
}
(-)a/Koha/Schema/Result/Aqorder.pm (+20 lines)
Lines 706-711 __PACKAGE__->belongs_to( Link Here
706
  },
706
  },
707
);
707
);
708
708
709
=head2 creator
710
711
Type: belongs_to
712
713
Related object: L<Koha::Schema::Result::Borrower>
714
715
=cut
716
717
__PACKAGE__->belongs_to(
718
  "creator",
719
  "Koha::Schema::Result::Borrower",
720
  { borrowernumber => "created_by" },
721
  {
722
    is_deferrable => 1,
723
    join_type     => "LEFT",
724
    on_delete     => "SET NULL",
725
    on_update     => "CASCADE",
726
  },
727
);
728
709
__PACKAGE__->belongs_to(
729
__PACKAGE__->belongs_to(
710
  "subscription",
730
  "subscription",
711
  "Koha::Schema::Result::Subscription",
731
  "Koha::Schema::Result::Subscription",
(-)a/acqui/finishreceive.pl (+2 lines)
Lines 73-78 if (C4::Context->preference("CurrencyFormat") eq 'FR') { Link Here
73
$unitprice = Koha::Number::Price->new( $unitprice )->unformat();
73
$unitprice = Koha::Number::Price->new( $unitprice )->unformat();
74
$replacementprice = Koha::Number::Price->new( $replacementprice )->unformat();
74
$replacementprice = Koha::Number::Price->new( $replacementprice )->unformat();
75
my $order_obj = Koha::Acquisition::Orders->find( $ordernumber );
75
my $order_obj = Koha::Acquisition::Orders->find( $ordernumber );
76
76
my $basket = $order_obj->basket;
77
my $basket = $order_obj->basket;
77
78
78
#need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME
79
#need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME
Lines 116-121 if ($quantityrec > $origquantityrec ) { Link Here
116
            # Quantity can only be modified if linked to a subscription
117
            # Quantity can only be modified if linked to a subscription
117
            $order->{quantity} = $quantity; # quantityrec will be deduced from this value in ModReceiveOrder
118
            $order->{quantity} = $quantity; # quantityrec will be deduced from this value in ModReceiveOrder
118
        }
119
        }
120
119
        ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
121
        ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
120
            {
122
            {
121
                biblionumber     => $biblionumber,
123
                biblionumber     => $biblionumber,
(-)a/acqui/orderreceive.pl (-44 / +54 lines)
Lines 87-92 my $invoice = GetInvoice($invoiceid); Link Here
87
my $booksellerid   = $invoice->{booksellerid};
87
my $booksellerid   = $invoice->{booksellerid};
88
my $freight      = $invoice->{shipmentcost};
88
my $freight      = $invoice->{shipmentcost};
89
my $ordernumber  = $input->param('ordernumber');
89
my $ordernumber  = $input->param('ordernumber');
90
my $multiple_orders = $input->param('multiple_orders');
90
91
91
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
92
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
92
my $order = Koha::Acquisition::Orders->find( $ordernumber );
93
my $order = Koha::Acquisition::Orders->find( $ordernumber );
Lines 101-113 my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( Link Here
101
    }
102
    }
102
);
103
);
103
104
104
unless ( $order ) {
105
unless ( $order || $multiple_orders ) {
105
    output_html_with_http_headers $input, $cookie, $template->output;
106
    output_html_with_http_headers $input, $cookie, $template->output;
106
    exit;
107
    exit;
107
}
108
}
108
109
109
# prepare the form for receiving
110
my $budget;
110
my $basket = $order->basket;
111
if( $order ) {
112
    # prepare the form for receiving
113
    my $creator = Koha::Patrons->find( $order->created_by );
114
115
    $budget = GetBudget( $order->budget_id );
116
117
    my $datereceived = $order->datereceived ? dt_from_string( $order->datereceived ) : dt_from_string;
118
119
    my $order_internalnote = $order->order_internalnote;
120
    my $order_vendornote   = $order->order_vendornote;
121
    if ( $order->subscriptionid ) {
122
        # Order from a subscription, we will display an history of what has been received
123
        my $orders = Koha::Acquisition::Orders->search(
124
            {
125
                subscriptionid     => $order->subscriptionid,
126
                parent_ordernumber => $order->ordernumber,
127
                ordernumber        => { '!=' => $order->ordernumber }
128
            }
129
        );
130
        if ( $order->parent_ordernumber != $order->ordernumber ) {
131
            my $parent_order = Koha::Acquisition::Orders->find($order->parent_ordernumber);
132
            $order_internalnote = $parent_order->order_internalnote;
133
            $order_vendornote   = $parent_order->order_vendornote;
134
        }
135
        $template->param(
136
            orders => $orders,
137
        );
138
    }
139
140
    my $suggestion = GetSuggestionInfoFromBiblionumber($order->biblionumber);
141
142
    if ( $suggestion ) {
143
        $template->param( suggestion => $suggestion );
144
    }
145
146
    $template->param(
147
        order                 => $order,
148
        creator               => $creator,
149
        bookfund              => $budget->{budget_name},
150
        datereceived          => $datereceived,
151
        order_internalnote    => $order_internalnote,
152
        order_vendornote      => $order_vendornote,
153
    );
154
}
155
156
if( $multiple_orders ) {
157
    $template->param(multiple_orders => $multiple_orders);
158
}
159
111
my $currencies = Koha::Acquisition::Currencies->search;
160
my $currencies = Koha::Acquisition::Currencies->search;
112
my $active_currency = $currencies->get_active;
161
my $active_currency = $currencies->get_active;
113
162
Lines 117-182 unless($acq_fw) { Link Here
117
    $template->param('NoACQframework' => 1);
166
    $template->param('NoACQframework' => 1);
118
}
167
}
119
168
120
121
my $creator = Koha::Patrons->find( $order->created_by );
122
123
my $budget = GetBudget( $order->budget_id );
124
125
my $datereceived = $order->datereceived ? dt_from_string( $order->datereceived ) : dt_from_string;
126
127
# get option values for gist syspref
169
# get option values for gist syspref
128
my @gst_values = map {
170
my @gst_values = map {
129
    option => $_ + 0.0
171
    option => $_ + 0.0
130
}, split( '\|', C4::Context->preference("gist") );
172
}, split( '\|', C4::Context->preference("gist") );
131
173
132
my $order_internalnote = $order->order_internalnote;
133
my $order_vendornote   = $order->order_vendornote;
134
if ( $order->subscriptionid ) {
135
    # Order from a subscription, we will display an history of what has been received
136
    my $orders = Koha::Acquisition::Orders->search(
137
        {
138
            subscriptionid     => $order->subscriptionid,
139
            parent_ordernumber => $order->ordernumber,
140
            ordernumber        => { '!=' => $order->ordernumber }
141
        }
142
    );
143
    if ( $order->parent_ordernumber != $order->ordernumber ) {
144
        my $parent_order = Koha::Acquisition::Orders->find($order->parent_ordernumber);
145
        $order_internalnote = $parent_order->order_internalnote;
146
        $order_vendornote   = $parent_order->order_vendornote;
147
    }
148
    $template->param(
149
        orders => $orders,
150
    );
151
}
152
153
$template->param(
174
$template->param(
154
    order                 => $order,
155
    freight               => $freight,
175
    freight               => $freight,
156
    name                  => $bookseller->name,
176
    name                  => $bookseller->name,
157
    active_currency       => $active_currency,
177
    active_currency       => $active_currency,
158
    currencies            => scalar $currencies->search({ rate => { '!=' => 1 } }),
178
    currencies            => scalar $currencies->search({ rate => { '!=' => 1 } }),
159
    invoiceincgst         => $bookseller->invoiceincgst,
179
    invoiceincgst         => $bookseller->invoiceincgst,
160
    bookfund              => $budget->{budget_name},
161
    creator               => $creator,
162
    invoiceid             => $invoice->{invoiceid},
180
    invoiceid             => $invoice->{invoiceid},
163
    invoice               => $invoice->{invoicenumber},
181
    invoice               => $invoice->{invoicenumber},
164
    datereceived          => $datereceived,
165
    order_internalnote    => $order_internalnote,
166
    order_vendornote      => $order_vendornote,
167
    gst_values            => \@gst_values,
182
    gst_values            => \@gst_values,
168
);
183
);
169
184
170
my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
171
if ( $suggestion ) {
172
    $template->param( suggestion => $suggestion );
173
}
174
175
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
185
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
176
my @budget_loop;
186
my @budget_loop;
177
my $periods = GetBudgetPeriods( );
187
my $periods = GetBudgetPeriods( );
178
foreach my $period (@$periods) {
188
foreach my $period (@$periods) {
179
    if ($period->{'budget_period_id'} == $budget->{'budget_period_id'}) {
189
    if ($budget && $period->{'budget_period_id'} == $budget->{'budget_period_id'}) {
180
        $template->{'VARS'}->{'budget_period_description'} = $period->{'budget_period_description'};
190
        $template->{'VARS'}->{'budget_period_description'} = $period->{'budget_period_description'};
181
    }
191
    }
182
    next if $period->{'budget_period_locked'} || !$period->{'budget_period_description'};
192
    next if $period->{'budget_period_locked'} || !$period->{'budget_period_description'};
Lines 191-197 foreach my $period (@$periods) { Link Here
191
          {
201
          {
192
            b_id  => $r->{budget_id},
202
            b_id  => $r->{budget_id},
193
            b_txt => $r->{budget_name},
203
            b_txt => $r->{budget_name},
194
            b_sel => ( $r->{budget_id} == $order->{budget_id} ) ? 1 : 0,
204
            b_sel => ( $order && $r->{budget_id} == $order->{budget_id} ) ? 1 : 0,
195
          };
205
          };
196
    }
206
    }
197
207
(-)a/api/v1/swagger/definitions/item.json (+12 lines)
Lines 180-185 Link Here
180
    "exclude_from_local_holds_priority": {
180
    "exclude_from_local_holds_priority": {
181
      "type": "boolean",
181
      "type": "boolean",
182
      "description": "Exclude this item from local holds priority."
182
      "description": "Exclude this item from local holds priority."
183
    },
184
    "home_branch": {
185
      "type": ["object", "null"]
186
    },
187
    "holding_branch": {
188
      "type": ["object", "null"]
189
    },
190
    "itemtype": {
191
      "type": ["object", "null"]
192
    },
193
    "_authorised_values": {
194
      "type": ["object", "null"]
183
    }
195
    }
184
  },
196
  },
185
  "additionalProperties": false,
197
  "additionalProperties": false,
(-)a/api/v1/swagger/definitions/order.json (+9 lines)
Lines 329-334 Link Here
329
                "object",
329
                "object",
330
                "null"
330
                "null"
331
            ]
331
            ]
332
        },
333
        "creator": {
334
            "type": [
335
                "object",
336
                "null"
337
            ]
338
        },
339
        "_authorised_values": {
340
            "type": "object"
332
        }
341
        }
333
    },
342
    },
334
    "additionalProperties": false
343
    "additionalProperties": false
(-)a/api/v1/swagger/paths/acquisitions_orders.json (-1 / +6 lines)
Lines 124-133 Link Here
124
                "biblio.items+count",
124
                "biblio.items+count",
125
                "biblio.suggestions.suggester",
125
                "biblio.suggestions.suggester",
126
                "fund",
126
                "fund",
127
                "fund.budget",
127
                "current_item_level_holds+count",
128
                "current_item_level_holds+count",
128
                "invoice",
129
                "invoice",
129
                "items",
130
                "items",
130
                "subscription"
131
                "items.home_branch",
132
                "items.holding_branch",
133
                "items.itemtype",
134
                "subscription",
135
                "creator"
131
            ]
136
            ]
132
        },
137
        },
133
        "post": {
138
        "post": {
(-)a/api/v1/swagger/paths/items.json (-1 / +6 lines)
Lines 122-128 Link Here
122
        "permissions": {
122
        "permissions": {
123
          "catalogue": "1"
123
          "catalogue": "1"
124
        }
124
        }
125
      }
125
      },
126
      "x-koha-embed": [
127
        "itemtype",
128
        "home_branch",
129
        "holding_branch"
130
      ]
126
    }
131
    }
127
  }
132
  }
128
}
133
}
(-)a/koha-tmpl/intranet-tmpl/lib/datatables/dataTables.select.min.js (+38 lines)
Line 0 Link Here
1
/*!
2
   Copyright 2015-2019 SpryMedia Ltd.
3
4
 This source file is free software, available under the following license:
5
   MIT license - http://datatables.net/license/mit
6
7
 This source file is distributed in the hope that it will be useful, but
8
 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9
 or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
10
11
 For details please refer to: http://www.datatables.net/extensions/select
12
 Select for DataTables 1.3.1
13
 2015-2019 SpryMedia Ltd - datatables.net/license/mit
14
*/
15
(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=
16
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",
17
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=
18
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",
19
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&&
20
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();
21
""!==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=
22
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()||
23
-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||
24
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;
25
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;
26
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,
27
{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||
28
!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()",
29
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=
30
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=
31
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);
32
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()",
33
"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);
34
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",
35
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=
36
".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],
37
!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)},
38
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});
(-)a/koha-tmpl/intranet-tmpl/lib/datatables/select.dataTables.min.css (+1 lines)
Line 0 Link Here
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}}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc (+1 lines)
Lines 2-5 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% INCLUDE 'format_price.inc' %]
3
[% INCLUDE 'format_price.inc' %]
4
[% Asset.js("lib/datatables/datatables.min.js") | $raw %]
4
[% Asset.js("lib/datatables/datatables.min.js") | $raw %]
5
[% Asset.js("lib/datatables/dataTables.select.min.js") | $raw %]
5
[% Asset.js("js/datatables.js") | $raw %]
6
[% Asset.js("js/datatables.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+1 lines)
Lines 18-23 Link Here
18
[% Asset.css("lib/bootstrap/bootstrap-theme.min.css") | $raw %]
18
[% Asset.css("lib/bootstrap/bootstrap-theme.min.css") | $raw %]
19
[% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
19
[% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
20
[% Asset.css("lib/datatables/datatables.min.css") | $raw %]
20
[% Asset.css("lib/datatables/datatables.min.css") | $raw %]
21
[% Asset.css("lib/datatables/select.dataTables.min.css") | $raw %]
21
[% Asset.css("css/print.css", { media = "print" }) | $raw %]
22
[% Asset.css("css/print.css", { media = "print" }) | $raw %]
22
[% INCLUDE intranetstylesheet.inc %]
23
[% INCLUDE intranetstylesheet.inc %]
23
[% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %]
24
[% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-6 / +1123 lines)
Lines 15-31 Link Here
15
[% INCLUDE 'header.inc' %]
15
[% INCLUDE 'header.inc' %]
16
[% INCLUDE 'acquisitions-search.inc' %]
16
[% INCLUDE 'acquisitions-search.inc' %]
17
17
18
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.basket.booksellerid | html %]">[% name | html %]</a> &rsaquo; Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% order.ordernumber | html %])</div>
18
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.basket.booksellerid | html %]">[% name | html %]</a> &rsaquo; Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% order.ordernumber || multiple_orders | html %])</div>
19
19
20
<div class="main container-fluid">
20
<div class="main container-fluid">
21
    <div class="row">
21
    <div class="row">
22
    [% AcqCreateItem = order.basket.effective_create_items %]
23
        <div class="col-sm-10 col-sm-push-2">
22
        <div class="col-sm-10 col-sm-push-2">
24
            <main>
23
            <main>
25
24
26
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber | html %])</h1>
25
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber || multiple_orders | html %])</h1>
27
26
28
[% IF ( order ) %]
27
[% IF ( order ) %]
28
    [% AcqCreateItem = order.basket.effective_create_items %]
29
    <form action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
29
    <form action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
30
<div class="row">
30
<div class="row">
31
<div class="col-sm-6">
31
<div class="col-sm-6">
Lines 289-295 Link Here
289
                    [% IF ( order.items.count ) %]
289
                    [% IF ( order.items.count ) %]
290
                        <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" />
290
                        <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" />
291
                    [% ELSE %]
291
                    [% ELSE %]
292
                        <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" />
292
                        <input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" />
293
                    [% END %]
293
                    [% END %]
294
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
294
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
295
                [% END %]
295
                [% END %]
Lines 350-356 Link Here
350
        </li>
350
        </li>
351
        <li id="select_currency">
351
        <li id="select_currency">
352
            <label for="unitprice_currency"></label>
352
            <label for="unitprice_currency"></label>
353
            <input type="text" size="20" name="unitprice" id="unitprice_currency" value="" />
353
            <input type="text" size="20" name="unitprice_currency" id="unitprice_currency" value="" />
354
            [% IF currencies.count %]
354
            [% IF currencies.count %]
355
                <select name="currency">
355
                <select name="currency">
356
                    <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
356
                    <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
Lines 372-377 Link Here
372
        <input type="submit"  value="Save" class="button" accesskey="w" />
372
        <input type="submit"  value="Save" class="button" accesskey="w" />
373
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a>
373
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a>
374
</fieldset></div>    </form>
374
</fieldset></div>    </form>
375
[% ELSIF multiple_orders %]
376
    <table id="multiple_orders" class="table table-bordered table-striped">
377
        <thead>
378
            <tr>
379
                <th>Order</td>
380
                <th>Title</th>
381
                <th>Author</th>
382
                <th>ISBN</th>
383
                <th>Date received</th>
384
                <th>Fund</th>
385
                <th>Quantity</th>
386
                <th>&nbsp;</th>
387
            </tr>
388
        </thead>
389
    </table>
390
391
    <div class="col">
392
        <fieldset class="action">
393
            <button class="save">Save</button>
394
            <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Return</a>
395
        </fieldset>
396
        <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
397
        <div id="jobfailed"></div>
398
    </div>
399
400
    <div class="modal fade" id="order_edit" tabindex="-1" role="dialog" aria-labelledby="Order edit">
401
        <div class="modal-dialog" role="document">
402
            <div class="modal-content modal-lg">
403
                <div class="modal-header row">
404
                    <h4 class="col-md-11 modal-title"></h4>
405
                    <button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
406
                </div>
407
                <div class="modal-body">
408
                    <div class="hide" id="loading">Loading ...</div>
409
                    <div id="modal-order-main">
410
                        <ul>
411
                            <li><a href="#info-panel">Info</a></li>
412
                            <li><a href="#accounting-panel">Accounting</a></li>
413
                            <li><a href="#history-panel">Receipt history</a></li>
414
                            <li><a href="#items-panel">Items</a></li>
415
                        </ul>
416
417
418
                        <div id="info-panel">
419
                            <div>
420
                                <h4>Catalog details</h4>
421
422
                                <div class="row"> <span class="lbl col-sm-4">Title: </span><span class="col-sm-8" id="biblio_title"></span></div>
423
                                <div class="row"> <span class="lbl col-sm-4">Author: </span><span class="col-sm-8" id="biblio_author"></span></div>
424
                                <div class="row"> <span class="lbl col-sm-4">Copyright: </span><span class="col-sm-8" id="biblio_copyright_date"></span></div>
425
                                <div class="row"> <span class="lbl col-sm-4">ISBN: </span><span class="col-sm-8" id="biblio_isbn"></span></div>
426
                                <div class="row"> <span class="lbl col-sm-4">Series: </span><span class="col-sm-8" id="biblio_series_title"></span></div>
427
428
                            </div>
429
                            <div id="suggestion_fieldset">
430
                                <h4>Suggestion</h4>
431
                                <div class="row">
432
                                    <span class="lbl col-sm-4">Suggested by: </span> <span class="col-sm-8" id="biblio_suggestion_suggester"></span>
433
                                </div>
434
                                <div class="row" id="suggestion_reason">
435
                                    <span class="lbl col-sm-4">Reason:</span>
436
                                    <div class="col-sm-8">
437
                                        [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %]
438
                                        <select class="select-reason" id="reason" name="reason">
439
                                            <option value=""> -- Choose a reason -- </option>
440
                                            [% FOREACH reason IN suggestion_reasons %]
441
                                            <option value="[% reason.lib | html %]">[% reason.lib | html %]</option>
442
                                            [% END %]
443
                                            <option value="other">Others...</option>
444
                                        </select>
445
446
                                        <span id="other_reason" name="other_reason">
447
                                            <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
448
                                            <a href="#back">Cancel</a>
449
                                        </span>
450
                                    </div>
451
                                </div>
452
                            </div>
453
                        </div>
454
                        <div id="history-panel">
455
                            <div id="child_orders">
456
                                <h4>Receipt history for this subscription</h4>
457
                                <table id="child_orders_table">
458
                                    <thead>
459
                                        <tr>
460
                                            <th>Invoice</th>
461
                                            <th>Order number</th>
462
                                            <th class="title-string">Creation date</th>
463
                                            <th class="title-string">Receive date</th>
464
                                            <th>Quantity received</th>
465
                                            <th class="title-string">Status</th>
466
                                            <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
467
                                            <th>Internal note</th>
468
                                        </tr>
469
                                    </thead>
470
                                </table>
471
                            </div>
472
                        </div>
473
                        <div id="items-panel">
474
                            <div id="acq-create-receiving">
475
                                <div id="items_list" style="display: none">
476
                                    <h4>Items list</h4>
477
                                    <div style="width:100%;overflow:auto;">
478
                                        <table>
479
                                            <thead>
480
                                                <tr>
481
                                                    <th>Actions</th>
482
                                                    <th>Barcode</th>
483
                                                    <th>Home library</th>
484
                                                    <th>Holding library</th>
485
                                                    <th>Not for loan</th>
486
                                                    <th>Restricted</th>
487
                                                    <th>Location</th>
488
                                                    <th>Call number</th>
489
                                                    <th>Copy number</th>
490
                                                    <th>Inventory number</th>
491
                                                    <th>Collection</th>
492
                                                    <th>Item type</th>
493
                                                    <th>Materials</th>
494
                                                    <th>Notes</th>
495
                                                </tr>
496
                                            </thead>
497
                                            <tbody>
498
                                            </tbody>
499
                                        </table>
500
                                    </div>
501
                                </div>
502
503
                                <div id="itemfieldset">
504
                                    <h4>Item</h4>
505
                                    [% IF ( NoACQframework ) %]
506
                                        <p class="required">
507
                                            No ACQ framework, using default. You should create a
508
                                            framework with code ACQ, the items framework would be
509
                                            used
510
                                        </p>
511
                                    [% END %]
512
                                    <div id="outeritemblock"></div>
513
                                </div>
514
                            </div>
515
                            <div id="acq-create-ordering">
516
                                <h4>Items</h4>
517
                                <div style="width:100%;overflow:auto">
518
                                    <table>
519
                                        <thead>
520
                                            <tr>
521
                                                <th>Receive?</th>
522
                                                <th>&nbsp;</th>
523
                                                <th>Barcode</th>
524
                                                <th>Home library</th>
525
                                                <th>Current library</th>
526
                                                <th>Not for loan</th>
527
                                                <th>Restricted</th>
528
                                                <th>Location</th>
529
                                                <th>Call number</th>
530
                                                <th>Copy number</th>
531
                                                <th>Inventory number</th>
532
                                                <th>Collection</th>
533
                                                <th>Item type</th>
534
                                                <th>Materials</th>
535
                                                <th>Notes</th>
536
                                            </tr>
537
                                        </thead>
538
                                        <tbody>
539
                                        </tbody>
540
                                    </table>
541
                                </div>
542
                            </div>
543
                        </div>
544
                        <div id="accounting-panel">
545
                            <h4>Accounting details</h4>
546
                            <ol>
547
                                <li>
548
                                    <label for="datereceived">Date received: </label>
549
                                    <input type="text" size="10" id="datereceived" name="datereceived" class="datepicker" />
550
                                </li>
551
                                <li>
552
                                    <label for="bookfund">Fund: </label>
553
                                    <select id="bookfund" name="bookfund">
554
                                        <option value=""></option>
555
                                        [% FOREACH period IN budget_loop %]
556
                                        <optgroup label="[% period.description | html %]">
557
                                        [% FOREACH fund IN period.funds %]
558
                                            <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option>
559
                                        [% END %]
560
                                        </optgroup>
561
                                        [% END %]
562
                                    </select>
563
                                </li>
564
                                <li>
565
                                    <label>&nbsp;</label>
566
                                    <span id="current-fund"></span>
567
                                </li>
568
                                <li>
569
                                    <label for="creator">Ordered by: </label>
570
                                    <span id="creator"></span>
571
                                </li>
572
                                <li>
573
                                    <label for="quantity_to_receive">Quantity ordered: </label>
574
                                    <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" />
575
                                </li>
576
                                <li>
577
                                    <label for="quantity">Quantity received: </label>
578
                                    <input type="text" size="20" name="quantityrec" id="quantity" />
579
                                    <div id="qtyrecerror" style="display:none">
580
                                        <p class="error">Warning, you have entered more items than expected.
581
                                        Items will not be created.</p>
582
                                    </div>
583
                                </li>
584
585
                                [% IF ( gst_values ) %]
586
                                <li>
587
                                    <label for="tax_rate">Tax rate: </label>
588
                                    <select name="tax_rate" id="tax_rate">
589
                                    [% FOREACH gst IN gst_values %]
590
                                        <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
591
                                    [% END %]
592
                                    </select>
593
                                </li>
594
                                [% END %]
595
596
                                <li>
597
                                    <label for="rrp">Retail price: </label>
598
                                    <span id="rrp"></span>
599
                                <li>
600
                                    <label for="replacementprice">Replacement price:</label>
601
                                    <input type="text" size="20" name="replacementprice" id="replacementprice" />
602
                                </li>
603
                                <li>
604
                                    <label for="ecost">Budgeted cost: </label>
605
                                    <span id="ecost"></span>
606
                                </li>
607
                                <li>
608
                                    <label for="unitprice">Actual cost:</label>
609
                                    <input type="text" size="20" name="unitprice" id="unitprice" />
610
                                    <span id="unitprice_hint" class="hint"></span>
611
                                    <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
612
                                </li>
613
                                <li id="select_currency">
614
                                    <label for="unitprice_currency"></label>
615
                                    <input type="text" size="20" name="unitprice_currency" id="unitprice_currency" value="" />
616
                                    [% IF currencies.count %]
617
                                    <select name="currency">
618
                                        <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
619
                                        [% FOR currency IN currencies %]
620
                                        <option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
621
                                        [% END %]
622
                                    </select>
623
                                    [% END %]
624
                                </li>
625
                                <li>
626
                                    <label for="order_internalnote">Internal note: </label>
627
                                    <textarea name="order_internalnote" id="order_internalnote" width="40" rows="8" ></textarea>
628
                                </li>
629
                                <li>
630
                                    <label for="order_vendornote">Vendor note: </label>
631
                                    <span id="order_vendornote"></span>
632
                                </li>
633
                            </ol>
634
                        </div>
635
                    </div>
636
                </div>
637
                <div class="modal-footer">
638
                    <button type="button" class="btn btn-defualt modal-prev">Previous</button>
639
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
640
                    <button type="button" class="btn btn-primary modal-save">Save changes</button>
641
                    <button type="button" class="btn btn-defualt modal-next">Next</button>
642
                </div>
643
            </div>
644
        </div>
645
    </div>
375
[% ELSE %]
646
[% ELSE %]
376
    This ordernumber does not exist.
647
    This ordernumber does not exist.
377
[% END %]
648
[% END %]
Lines 387-396 Link Here
387
</div> <!-- /.row -->
658
</div> <!-- /.row -->
388
[% MACRO jsinclude BLOCK %]
659
[% MACRO jsinclude BLOCK %]
389
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
660
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
390
[% INCLUDE 'calendar.inc' %]
661
    [% INCLUDE 'calendar.inc' %]
391
    [% Asset.js("js/additem.js") | $raw %]
662
    [% Asset.js("js/additem.js") | $raw %]
392
    [% Asset.js("js/cataloging.js") | $raw %]
663
    [% Asset.js("js/cataloging.js") | $raw %]
664
    [% INCLUDE 'datatables.inc' %]
665
    [% INCLUDE 'js-date-format.inc' %]
666
    [% INCLUDE 'format_price.inc' %]
667
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
668
    <style>
669
        .lbl {
670
            font-weight: 700;
671
            text-align: right;
672
        }
673
        .modal-body ol {
674
            list-style-type: none;
675
        }
676
677
        .modal-body ol li {
678
            list-style-type: none;
679
            padding-bottom: 1em;
680
            width: 100%;
681
        }
682
683
        .modal-body h4 {
684
            margin-left: 1em;
685
            padding: .2em .5em;
686
            margin-bottom: 17px;
687
        }
688
689
        .modal-body label {
690
            margin-right: 1em;
691
            text-align: right;
692
            width: 11em;
693
            display: inline-block;
694
            font-weight: 700;
695
        }
696
697
        .modal-body textarea {
698
            vertical-align: text-top;
699
        }
700
    </style>
393
    <script>
701
    <script>
702
        [% IF order %]
394
        function Check(form) {
703
        function Check(form) {
395
            [% IF (AcqCreateItem == 'receiving') %]
704
            [% IF (AcqCreateItem == 'receiving') %]
396
                var total_errors = CheckMandatorySubfields(form);
705
                var total_errors = CheckMandatorySubfields(form);
Lines 541-546 Link Here
541
            });
850
            });
542
851
543
        });
852
        });
853
        [% ELSIF multiple_orders %]
854
855
        var _build_item = function(item, tr) {
856
            var chb = $('<input type="checkbox" name="items_to_receive" value="'+item.item_id+'" />')
857
                .prop('checked', item._checked)
858
                .change(function() {
859
                    item._checked = $(this).prop('checked');
860
                });
861
            tr.append($('<td style="text-align:center"></td>').append(chb));
862
            tr.append('<td><a style="cursor:pointer" onclick="PopupEditPage('+item.biblio_id+', '+item.item_id+');">'+EDIT[0].toUpperCase()+EDIT.substr(1).toLowerCase()+'</a></td>');
863
            tr.append('<td>'+(item.external_id||'')+'</td>');
864
            tr.append('<td>'+(item.home_branch && item.home_branch.name||'')+'</td>');
865
            tr.append('<td>'+(item.holding_branch && item.holding_branch.name||'')+'</td>');
866
            tr.append('<td>'+(item._authorised_values.not_for_loan_status && item._authorised_values.not_for_loan_status.lib||'')+'</td>');
867
            tr.append('<td>'+(item._authorised_values.restricted_status && item._authorised_values.restricted_status.lib||'')+'</td>');
868
            tr.append('<td><span class="shelvingloc">'+(item._authorised_values.location && item._authorised_values.location.lib||'')+'</span></td>');
869
            tr.append('<td>'+(item.callnumber||'')+'</td>');
870
            tr.append('<td>'+(item.copy_number||'')+'</td>');
871
            tr.append('<td>'+(item.inventory_number||'')+'</td>');
872
            tr.append('<td>'+(item._authorised_values.collection_code && item._authorised_values.collection_code.lib||'')+'</td>');
873
            tr.append('<td>'+(item.itemtype && item.itemtype.description || '')+'</td>');
874
            tr.append('<td>'+(item._authorised_values.materials_notes && item._authorised_values.materials_notes.lib||'')+'</td>')
875
            tr.append('<td>'+(item.public_notes||'')+'</td>');
876
        };
877
878
        var items_columns = [null, null, 'external_id', 'home_library_id',
879
                'holding_library_id', 'not_for_loan_status', 'restricted_status', 'location',
880
                'callnumber', 'copy_number', 'inventory_number', 'collection_code',
881
                'item_type', 'materials_notes', 'public_notes'];
882
883
        function PopupEditPage(biblionumber, itemnumber) {
884
            var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
885
                + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
886
            var w = window.open(url);
887
            var watchClose = setInterval(function() {
888
                if (w.closed) {
889
                    clearTimeout(watchClose);
890
                    $.ajax({
891
                        dataType: "json",
892
                        headers: {
893
                            "x-koha-embed": "home_branch,holding_branch,itemtype",
894
                            "x-koha-av": "1"
895
                        },
896
                        url: '/api/v1/items/'+itemnumber,
897
                        success: function(item) {
898
                            var tr = $("#item_"+itemnumber);
899
                            tr.html('');
900
                            _build_item(item, tr);
901
                        }
902
                    });
903
                }
904
            }, 500);
905
        }
906
907
        var periods={};
908
        var funds={};
909
        var funds_tree = [];
910
911
        var QTY_TOTAL = _("Receiving %0$s out of %1$s");
912
        var EDIT = _("edit");
913
        var MOD_TITLE = _("Edit %s");
914
        var SUGGESTION = _("suggestion #%s");
915
        var FUND_KEEP = _("Keep current (%0$s - %1$s)");
916
        var FUNC_CUR = _("(Current: %0$s - %1$s)");
917
        var ADJ_TAX_INC = _("(adjusted for %s, tax inclusive)");
918
        var ADJ_TAX_EXC = _("(adjusted for %s, tax exclusive)");
919
        var TAX_INC = _("(tax inclusive)");
920
        var TAX_EXC = _("(tax exclusive)");
921
        var SAVE_WARNING = _("Order %s: Warning, you have entered more items than expected. Items will not be created.");
922
        var SAVE_WARNING_NO_ITEMS = _("Order %s: No quantity to receive setted. No items will be created.");
923
        var SAVE_ERROR = _("Order %s: An error cocurred while saving");
924
925
926
        var CAN_user_acquisition = "[% CAN_user_acquisition | html %]";
927
        var AcqCreateItem = "[% Koha.Preference('AcqCreateItem') | html %]";
928
        var edit_mode = "[% edit | html %]";
929
        var invoiceincgst = "[% invoiceincgst | html %]";
930
        var active_currency = "[% active_currency.currency | html %]";
931
        var invoice_id = "[% invoiceid | html %]";
932
933
        $(document).ready(function(){
934
            var base_query = { "order_id": {"in": [[% multiple_orders | html %]]}};
935
            var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1";
936
            var options = {
937
                "ajax": {
938
                    "url": pending_orders_url + "&q=" + encodeURI(JSON.stringify(base_query)),
939
                    "headers": {
940
                        'x-koha-av': '1'
941
                    }
942
                },
943
                "header_filter": true,
944
                "embed": [
945
                    "basket",
946
                    "biblio.suggestions.suggester",
947
                    "fund.budget",
948
                    "items.home_branch",
949
                    "items.holding_branch",
950
                    "items.itemtype",
951
                    "creator"
952
                ],
953
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
954
                "columns": [
955
                    {
956
                        "data": "order_id",
957
                        "searchable": true,
958
                        "orderable": true
959
                    },
960
                    {
961
                        "data": "biblio.title",
962
                        "searchable": true,
963
                        "orderable": true,
964
                        "render": function(data, type, row, meta) {
965
                            if ( data == null ) {
966
                                return "";
967
                            }
968
                            else {
969
                                return data;
970
                            }
971
                        }
972
                    },
973
                    {
974
                        "data": "biblio.author",
975
                        "searchable": true,
976
                        "orderable": true,
977
                        "render": function(data, type, row, meta) {
978
                            if ( data == null ) {
979
                                return "";
980
                            }
981
                            else {
982
                                return data;
983
                            }
984
                        }
985
                    },
986
                    {
987
                        "data": "biblio.isbn",
988
                        "searchable": true,
989
                        "orderable": true,
990
                        "render": function(data, type, row, meta) {
991
                            if ( data == null ) {
992
                                return "";
993
                            }
994
                            else {
995
                                return data;
996
                            }
997
                        }
998
                    },
999
                    {
1000
                        "searchable": false,
1001
                        "orderable": false,
1002
                        "data": function(row, type, val, meta) {
1003
                            return $date(row.date_received||new Date().toISOString());
1004
                        }
1005
                    },
1006
                    {
1007
                        "data": "fund.name",
1008
                        "searchable": true,
1009
                        "orderable": false,
1010
                        "render": function(data, type, row, meta) {
1011
                            return row.fund.budget.budget_period_description+" - "+row.fund.name;
1012
                        }
1013
                    },
1014
                    {
1015
                        "searchable": false,
1016
                        "orderable": true,
1017
                        "data": "quantity_received",
1018
                        "render": function(data, type, row, meta) {
1019
                            return QTY_TOTAL.format(row.subscription_id?row.quantity:row.quantity_received, row.quantity);
1020
                        }
1021
                    },
1022
                    {
1023
                        "searchable": false,
1024
                        "orderable": false,
1025
                        "render": function(data, type, row, meta) {
1026
                            return '<a data-toggle="modal" href="#order_edit" data-row="'+meta.row+'" class="order_edit_toggle">'+EDIT+'</a>';
1027
                        }
1028
                    }
1029
                ]
1030
            };
1031
            var orders_table = $("#multiple_orders").api(options);
1032
            var api = orders_table.api();
1033
1034
            api.on('preDraw', function() {
1035
                var saved = $("#order_edit").data('saved');
1036
                if(saved) {
1037
                    var data = api.data();
1038
                    for(var i = 0; i<data.length; i++) {
1039
                        var row = data[i];
1040
                        var srow = saved[row.order_id];
1041
                        if(srow) {
1042
                            if(row.fund_id != srow.fund_id) {
1043
                                row.fund.budget.budget_period_description = $("#bookfund option[value="+srow.fund_id+"]").parent().attr('label');
1044
                                row.fund.name = $("#bookfund option[value="+srow.fund_id+"]").html();
1045
                            }
1046
                            row.date_received = srow.date_received;
1047
                            row.quantity = srow.quantity;
1048
                            row.quantity_received = srow.quantity_received;
1049
                        }
1050
                    }
1051
                }
1052
            });
1053
1054
            var _doSave = function(params) {
1055
                $.ajax($.extend({
1056
                    method: 'POST',
1057
                    url: '/cgi-bin/koha/acqui/finishreceive.pl'
1058
                }, params));
1059
            };
1060
1061
            var _set_error = function(error) {
1062
                if($('#jobfailed').html() == '') $('#jobfailed').append('<ul/>');
1063
                $('#jobfailed ul').append('<li>'+error+'</li>');
1064
            };
1065
1066
            var _transform_row = function(row, origrec) {
1067
                var params = {};
1068
                params['biblionumber'] = row.biblio_id;
1069
                params['invoiceid'] = invoice_id;
1070
                params['ordernumber'] = row.order_id;
1071
                params['booksellerid'] = row.basket.vendor_id;
1072
1073
                if(row.biblio.suggestions.length && row.biblio.suggestions[0].reason) {
1074
                    params["suggestionid"] = row.biblio.suggestions[0].suggestion_id;
1075
                    if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) {
1076
                        params['reason'] =  row.biblio.suggestions[0].reason;
1077
                    } else {
1078
                        params['reason'] = 'other';
1079
                        params['other_reason'] = row.biblio.suggestions[0].reason;
1080
                    }
1081
                }
1082
                params['datereceived'] = row.date_received;
1083
                params['bookfund'] = row.fund_id;
1084
                params['quantity'] = row.quantity;
1085
                params['quantityrec'] = row.quantity_received;
1086
                params['origquantityrec'] = origrec;
1087
                var effective_create_items = row.basket.create_items || AcqCreateItem;
1088
                params['tax_rate'] = (effective_create_items == 'receiving')?row.tax_rate_on_receiving:row.tax_rate_on_ordering;
1089
                params['replacementprice'] = row.replacement_price;
1090
                params['unitprice'] = invoiceincgst?row.unit_price_tax_included:row.unit_price_tax_excluded;
1091
                params['order_internalnote'] = row.internal_note;
1092
                if(effective_create_items == 'receiving') {
1093
                    Object.keys(row.items).forEach(function(key) {
1094
                        var item = row.items[key];
1095
                        Object.keys(item).forEach(function(key) {
1096
                            var field = item[key];
1097
                            Object.keys(field).forEach(function(key) {
1098
                                if(!params[key]) params[key] = [];
1099
                                params[key].push(item[key]);
1100
                            });
1101
                        });
1102
                    });
1103
                } else if(effective_create_items == 'ordering') {
1104
                    params['items_to_receive'] = (row.items||[])
1105
                        .filter(function(item) {
1106
                            return item._checked
1107
                        })
1108
                        .map(function(item) {
1109
                            item.item_id;
1110
                        })
1111
                }
1112
                return params;
1113
            };
1114
1115
            $('.save').click(function() {
1116
                var data = $("#order_edit").data();
1117
                var rows = api.rows().data();
1118
                $('this').prop('disabled', true);
1119
                var redirect = true;
1120
                if(rows.length) {
1121
                    $('#jobfailed, #jobpanel, #jobstatus').show();
1122
1123
                    var loopRows = function(i) {
1124
                        var row = rows[i];
1125
                        if(!row) {
1126
                            if(redirect) {
1127
                                location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id+"&sticky_filters=1"
1128
                            }
1129
                            return;
1130
                        }
1131
                        if(data.saved && data.saved[row.order_id]) {
1132
                            row = data.saved[row.order_id];
1133
                            var origrec = data.origrec[row.order_id];
1134
                        } else {
1135
                            var origrec = row.quantity_received;
1136
                        }
1137
                        if(row.subscription_id) row.quantity_received = row.quantity;
1138
                        var _set_percentage = function() {
1139
                            var percentage = ( (i+1) / rows.length) * 100;
1140
                            var bgproperty = (parseInt(percentage*2)-300)+"px 0px";
1141
                            $("#jobprogress").css("background-position",bgproperty);
1142
                            $("#jobprogresspercent").text(percentage);
1143
                        }
1144
                        if(row.quantity_received > row.quantity) {
1145
                            _set_error(SAVE_WARNING.format(row.order_id));
1146
                            row.quantity_received = row.quantity;
1147
                        }
1148
                        if(row.quantity_received == '0') {
1149
                            _set_error(SAVE_WARNING_NO_ITEMS.format(row.order_id));
1150
                        }
1151
                        _doSave({
1152
                            data: _transform_row(row, origrec),
1153
                            success: function() {
1154
                                _set_percentage();
1155
                                loopRows(i+1);
1156
                            },
1157
                            error: function() {
1158
                                _set_percentage()
1159
                                _set_error(SAVE_ERROR.format(row.order_id));
1160
                                redirect = false;
1161
                                loopRows(i+1);
1162
                            }
1163
                        });
1164
                    };
1165
                    loopRows(0)
1166
                }
1167
            });
1168
1169
            $("#order_edit").on("change", "#reason", function() {
1170
                var val = $(this).val();
1171
                var row = $("#order_edit").data('row');
1172
                if(val == 'other') {
1173
                    $("#other_reason").show();
1174
                    $(this).hide();
1175
                } else {
1176
                    row.biblio.suggestions[0].reason = val;
1177
                }
1178
            });
1179
1180
            $("#order_edit").on("change", "#select-other_reason", function() {
1181
                var val = $(this).val();
1182
                var row = $("#order_edit").data('row');
1183
                row.biblio.suggestions[0].reason = val;
1184
            });
1185
1186
            $("#order_edit").on("click", "#other_reason a", function() {
1187
                $("#other_reason").hide();
1188
                $("#reason").val(null).show();
1189
            });
1190
1191
            $("#order_edit").on("change", "#datereceived", function() {
1192
                var val = $(this).val();
1193
                var row = $("#order_edit").data('row');
1194
                row.date_received = val;
1195
            });
1196
1197
            $("#order_edit").on("change", "#bookfund", function() {
1198
                var val = $(this).val();
1199
                var row = $("#order_edit").data('row');
1200
                row.fund_id = val;
1201
            });
1202
1203
            $("#order_edit").on("change", "#quantity_to_receive", function() {
1204
                var val = $(this).val();
1205
                var row = $("#order_edit").data('row');
1206
                row.quantity = val;
1207
                if(row.subscription_id) {
1208
                    $("#quantity").val(val).change();
1209
                }
1210
            });
1211
1212
            $("#order_edit").on("change", "#quantity", function() {
1213
                var val = $(this).val();
1214
                var row = $("#order_edit").data('row');
1215
                row.quantity_received = val;
1216
                var qtyto = parseInt($("#quantity_to_receive").val());
1217
                if(parseInt(val) > qtyto) {
1218
                    $("#qtyrecerror").show();
1219
                } else {
1220
                    $("#qtyrecerror").hide();
1221
                }
1222
                $("input[name='items_to_receive']").each(function() {
1223
                    $(this).prop('checked', false).change();
1224
                });
1225
                $("input[name='items_to_receive']:lt("+val+")").each(function () {
1226
                    $(this).prop('checked', true).change();
1227
                });
1228
            });
1229
1230
            $("#order_edit").on("change", "input[name='items_to_receive']", function() {
1231
                var qty = $("input[name='items_to_receive']:checked").length;
1232
                $("#quantity").val(qty);
1233
                var row = $("#order_edit").data('row');
1234
                row.quantity_received = qty;
1235
            })
1236
1237
            $("#order_edit").on("change", "#tax_rate", function() {
1238
                var val = $(this).val();
1239
                var row = $("#order_edit").data('row');
1240
                var effective_create_items = row.basket.create_items || AcqCreateItem;
1241
                if(effective_create_items == 'receiving') {
1242
                    row.tax_rate_on_receiving = val;
1243
                } else {
1244
                    row.tax_rate_on_ordering = val;
1245
                }
1246
1247
            });
1248
1249
            $("#order_edit").on("change", "#unitprice", function() {
1250
                var val = $(this).val();
1251
                var row = $("#order_edit").data('row');
1252
                if(invoiceincgst) {
1253
                    row.unit_price_tax_included = val;
1254
                } else {
1255
                    row.unit_price_tax_excluded = val;
1256
                }
1257
1258
            });
1259
1260
            $("#order_edit").on("change", "input[name='change_currency']", function(){
1261
                if ( $(this).is(":checked") ) {
1262
                    $("#select_currency").show();
1263
                    $("#unitprice").prop("readonly", "true");
1264
                } else {
1265
                    $("#select_currency").hide();
1266
                    $("#unitprice").prop("readonly", "");
1267
                }
1268
            });
1269
1270
            function _update_unitprice() {
1271
                var rate = Number($("select[name='currency'] option:selected").val());
1272
                var unitprice = $("#unitprice_currency").val();
1273
                var new_unitprice = Number( unitprice * rate ).toFixed(2);
1274
                $("#unitprice").val(new_unitprice).change();
1275
            }
1276
            $("#order_edit").on("change", "select[name='currency']", _update_unitprice );
1277
            $("#order_edit").on("change", "#unitprice_currency", _update_unitprice );
1278
1279
            $("#order_edit").on("change", "#replacementprice", function() {
1280
                var val = $(this).val();
1281
                var row = $("#order_edit").data('row');
1282
                row.replacement_price = val;
1283
            });
1284
1285
            $("#order_edit").on("change", "#order_internalnote", function() {
1286
                var val = $(this).val();
1287
                var row = $("#order_edit").data('row');
1288
                row.internal_note = val;
1289
1290
            });
1291
1292
            var keep_row = function() {
1293
                var row = $("#order_edit").data('row');
1294
                var kept = $("#order_edit").data('kept')||{};
1295
                if($('#items_list tbody tr').length) {
1296
                    row.items = [];
1297
                    $('#items_list tbody tr').each(function() {
1298
                        var item = {};
1299
                        $('#'+$(this).attr('idblock')).find('*[name=kohafield]').each(function() {
1300
                            var kf = $(this).val();
1301
                            var obj = {};
1302
                            $(this).parent().find('*[name]').each(function() {
1303
                                obj[$(this).prop('name')] = $(this).val();
1304
                            });
1305
                            item[kf] = obj;
1306
                        });
1307
                        row.items.push(item);
1308
                    });
1309
                }
1310
                kept[row.order_id] = row;
1311
                $("#order_edit").data('kept', kept);
1312
            };
1313
1314
            var save_row = function() {
1315
                keep_row();
1316
                var saved = $("#order_edit").data('saved')||{};
1317
                var kept = $("#order_edit").data('kept');
1318
                $("#order_edit").data('saved', $.extend(saved, kept));
1319
                api.draw();
1320
            }
1321
1322
            var set_modal_buttons = function() {
1323
                var n = $("#order_edit").data('n');
1324
                var info = api.page.info();
1325
1326
                $('.modal-prev').prop('disabled', info.page == 0 && n == 0);
1327
                $('.modal-next').prop('disabled', info.pages - 1 == info.page && info.end - info.start - 1 == n);
1328
            };
1329
1330
            var show_subs = function(row) {
1331
                //$("#child_orders").show();
1332
                var had_rows = false;
1333
                var base_query = { "subscription_id": row.subscription_id, "parent_order_id": row.order_id, "order_id": {"!=": row.order_id}};
1334
                var pending_orders_url = "/api/v1/acquisitions/orders";
1335
                var options = {
1336
                    "ajax": {
1337
                        "url": pending_orders_url + "?q=" + encodeURI(JSON.stringify(base_query))
1338
                    },
1339
                    "header_filter": true,
1340
                    "embed": [
1341
                        "invoice",
1342
                        "basket"
1343
                    ],
1344
                    "order": [[1, 'asc']],
1345
                    'dom': 'C<"top pager"ilpfB>tr<"bottom pager"ip>',
1346
                    "columns": [
1347
                        {
1348
                            "searchable": false,
1349
                            "orderable": false,
1350
                            "data": function(row, type, val, meta) {
1351
                                if(row.invoice) {
1352
                                    if(CAN_user_acquisition) {
1353
                                        return '<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid='+row.invoice_id+'" title="Invoice detail page">'+row.invoice.invoice_number+"</a>";
1354
                                    }
1355
                                    return row.invoice.invoice_number;
1356
                                }
1357
                            }
1358
                        },
1359
                        {
1360
                            "data": "order_id",
1361
                            "searchable": false,
1362
                            "orderable": false
1363
                        },
1364
                        {
1365
                            "searchable": false,
1366
                            "orderable": false,
1367
                            "data": "basket.creation_date",
1368
                            "render": function(data, type, row, meta) {
1369
                                return $date(row.basket.creation_date);
1370
                            }
1371
                        },
1372
                        {
1373
                            "searchable": false,
1374
                            "orderable": false,
1375
                            "data": function(row, type, val, meta) {
1376
                                return $date(row.date_received);
1377
                            }
1378
                        },
1379
                        {
1380
                            "searchable": false,
1381
                            "orderable": false,
1382
                            "data": function(row, type, val, meta) {
1383
                                return row.quantity_received;
1384
                            }
1385
                        },
1386
                        {
1387
                            "searchable": false,
1388
                            "orderable": true,
1389
                            "data": function(row, type, val, meta) {
1390
                                if(!row.status) return;
1391
                                var first_letter = row.status[0].toUpperCase();
1392
                                return first_letter+row.status.substr(1).toLowerCase();
1393
                            }
1394
                        },
1395
                        {
1396
                            "searchable": false,
1397
                            "orderable": false,
1398
                            "data": function(row, type, val, meta) {
1399
                                if(!row.date_received) return;
1400
                                return Number(row.unit_price_tax_excluded * row.quantity_received).format_price()+' / '+Number(row.unit_price_tax_included * row.quantity_received).format_price()
1401
                            }
1402
                        },
1403
                        {
1404
                            "searchable": false,
1405
                            "orderable": false,
1406
                            "data": function(row, type, val, meta) {
1407
                                return row.internal_note;
1408
                            }
1409
                        }
1410
                    ]
1411
                };
1412
                var child_orders_table = $("#child_orders_table").api(options);
1413
                var child_api = child_orders_table.api();
1414
                child_api.on('preDraw', function() {
1415
                    if(!child_api.data().length && !had_rows) return;
1416
                    $("#child_orders").show();
1417
                    had_rows = true;
1418
                });
1419
            };
1420
1421
            var set_editor = function() {
1422
                var modal = $("#order_edit");
1423
                var row = modal.data('row');
1424
                var origrec = $("#order_edit").data('origrec')||{};
1425
                if(!origrec.hasOwnProperty(row.order_id)) {
1426
                    origrec[row.order_id] = row.quantity_received;
1427
                    $("#order_edit").data('origrec', origrec);
1428
                }
1429
                if(row.subscription_id) {
1430
                    row.quantity_received = row.quantity;
1431
                }
1432
                var keep = $("#order_edit").data('kept');
1433
                if(keep && keep[row.order_id]) {
1434
                    row = keep[row.order_id];
1435
                    modal.data('row', row);
1436
                }
1437
                $('input, select, textarea', '.modal-body').val(null)
1438
                modal.find(".modal-title").text(MOD_TITLE.format(row.biblio.title));
1439
                ["title", "author", "copyright_date", "isbn", "series_title"].forEach(function(key){
1440
                    var o = modal.find(".modal-body #biblio_"+key);
1441
                    if(row.biblio[key] !== null) {
1442
                        o.parent().show();
1443
                        o.html(row.biblio[key]);
1444
                    } else {
1445
                        o.parent().hide();
1446
                    }
1447
                });
1448
                if(row.biblio.suggestions.length) {
1449
                    $("#suggestion_fieldset").show();
1450
                    if(row.biblio.suggestions[0].suggester) {
1451
                        $("#biblio_suggestion_suggester").parent().show();
1452
                        $("#biblio_suggestion_suggester")
1453
                            .html(
1454
                                [row.biblio.suggestions[0].suggester.surname, row.biblio.suggestions[0].suggester.firstname]
1455
                                    .filter(function(name){
1456
                                        return name
1457
                                    })
1458
                                    .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>)'
1459
                            );
1460
                    } else {
1461
                        $("#biblio_suggestion_suggester").parent().hide();
1462
                    }
1463
                    if(row.biblio.suggestions[0].reason) {
1464
                        $("#suggestion_reason").show();
1465
                        if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) {
1466
                             $("#other_reason a").click();
1467
                            $("#reason").val(row.biblio.suggestions[0].reason);
1468
                            $("#select-other_reason").val(null);
1469
                        } else {
1470
                            $("#reason").val("other").change();
1471
                            $("#select-other_reason").val(row.biblio.suggestions[0].reason);
1472
                        }
1473
1474
                    } else {
1475
                        $("#suggestion_reason").hide();
1476
                    }
1477
                } else {
1478
                    $("#suggestion_fieldset").hide();
1479
                }
1480
1481
                var effective_create_items = row.basket.create_items || AcqCreateItem;
1482
                $("#datereceived").val(row.date_received||$date(new Date().toISOString())).change();
1483
                $("#bookfund option[value='']").html(FUND_KEEP.format(row.fund.budget.budget_period_description, row.fund.name));
1484
                if(row.fund_id != row.fund.fund_id) {
1485
                    $("#bookfund").val(row.fund_id);
1486
                }
1487
                $("#current-fund").html(FUNC_CUR.format(row.fund.budget.budget_period_description, row.fund.name));
1488
                $("#creator").html([row.creator.surname, row.creator.firstname].filter(function(name){return name}).join(', ')+" ("+row.creator.patron_id+')')
1489
                $("#quantity_to_receive").val(row.quantity).prop('readonly', !row.subscription_id);
1490
                $("#quantity").val(row.quantity_received).prop('readonly', !row.subscription_id && effective_create_items == 'receiving');
1491
                $('#qtyrecerror').hide();
1492
                var tax_rate = row.tax_rate_on_receiving || row.tax_rate_on_ordering;
1493
                $("#tax_rate").val(tax_rate).change();
1494
                var rrp_txt;
1495
                var ecost_txt;
1496
                if(invoiceincgst) {
1497
                    rrp_txt = Number(row.rrp_tax_included).format_price()+'<span class="hint">'+ADJ_TAX_INC.format(active_currency)+"</span>";
1498
                    ecost_txt = Number(row.ecost_tax_included).format_price()+'<span class="hint">'+TAX_INC+"</span>";
1499
                    $("#unitprice").val(row.unit_price_tax_included);
1500
                    $("#unitprice_hint").html(TAX_INC);
1501
                } else {
1502
                    rrp_txt = Number(row.rrp_tax_excluded).format_price()+'<span class="hint">'+ADJ_TAX_EXC.format(active_currency)+"</span>";
1503
                    ecost_txt = Number(row.ecost_tax_excluded).format_price()+'<span class="hint">'+TAX_EXC+"</span>";
1504
                    $("#unitprice").val(row.unit_price_tax_excluded);
1505
                    $("#unitprice_hint").html(TAX_EXC);
1506
                }
1507
                $("#rrp").html(rrp_txt);
1508
                $("#replacementprice").val(row.replacement_price);
1509
                $("#ecost").html(ecost_txt);
1510
                $("#order_internalnote").val(row.internal_note);
1511
                if(row.vendor_note) {
1512
                    $("#order_vendornote").html(row.vendor_note);
1513
                    $("#order_vendornote").parent().show();
1514
                } else {
1515
                    $("#order_vendornote").parent().hide();
1516
                }
1517
1518
1519
                $("#child_orders").hide();
1520
1521
                $('#items_list tbody tr, #outeritemblock > *, #acq-create-ordering tbody tr').remove();
1522
                $('#items_list').hide();
1523
                if(row.subscription_id) {
1524
                    $('#modal-order-main').tabs("disable", "#items-panel");
1525
                    $('#modal-order-main').tabs("enable", "#history-panel");
1526
                    if($('#modal-order-main').tabs( "option", "active" ) == 3) {
1527
                        $('#modal-order-main').tabs( "option", "active", 0);
1528
                    }
1529
                } else {
1530
                    $('#modal-order-main').tabs("enable", "#items-panel");
1531
                    $('#modal-order-main').tabs("disable", "#history-panel");
1532
                    if($('#modal-order-main').tabs( "option", "active" ) == 2) {
1533
                        $('#modal-order-main').tabs( "option", "active", 0);
1534
                    }
1535
                    if(effective_create_items == 'receiving') {
1536
                        $("#acq-create-receiving").show();
1537
                        $("#acq-create-ordering").hide();
1538
                        if(row.items && row.items.length) {
1539
                            row.items.forEach(function(item, index) {
1540
                                cloneItemBlock(index, '[% UniqueItemFields | html %]', function(block_id) {
1541
                                    var block = $('#'+block_id).hide();
1542
                                    Object.keys(item).forEach(function(key) {
1543
                                        block
1544
                                            .find('*[name=kohafield][value="'+key+'"]')
1545
                                            .parent()
1546
                                            .find('*[name=field_value]')
1547
                                            .val(item[key].field_value);
1548
                                    });
1549
                                    addItemInList(block_id, '[% UniqueItemFields | html %]');
1550
                                    block.find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) );
1551
                                    block.find("input[name='buttonPlusMulti']").remove();
1552
                                    block.find("input[name='multiValue']").remove();
1553
                                });
1554
                            });
1555
                        }
1556
                        cloneItemBlock((row.items && row.items.length) || 0, '[% UniqueItemFields | html %]');
1557
                    } else if (effective_create_items == 'ordering') {
1558
                        $("#acq-create-receiving").hide();
1559
                        $("#acq-create-ordering").show();
1560
                        if(row.items.length) {
1561
                            $("#acq-create-ordering tbody").append(
1562
                                row.items.map(function(item) {
1563
                                    var tr = $('<tr id="item_'+item.item_id+'"/>');
1564
                                    _build_item(item, tr);
1565
                                    return tr;
1566
                                })
1567
                            );
1568
                        }
1569
                    } else {
1570
                        if($('#modal-order-main').tabs( "option", "active" ) == 3) {
1571
                            $('#modal-order-main').tabs( "option", "active", 0);
1572
                        }
1573
                        $('#modal-order-main').tabs("disable", "#items-panel");
1574
                    }
1575
                }
1576
1577
                set_modal_buttons();
1578
            };
1579
1580
            $('.modal-prev').click(function() {
1581
                var modal = $("#order_edit");
1582
                keep_row();
1583
                var n = modal.data('n');
1584
                if(n > 0) {
1585
                    n--;
1586
                    modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1587
                    modal.data('n', n);
1588
                    set_editor();
1589
                } else {
1590
                    $('.modal-next, .modal-prev').prop('disabled', true);
1591
                    orders_table.one('draw.dt', function() {
1592
                        var info = api.page.info();
1593
                        n = info.end - info.start - 1;
1594
                        modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1595
                        modal.data('n', n);
1596
                        set_editor();
1597
                    });
1598
                    api.page('previous').draw( 'page' );
1599
                }
1600
            });
1601
1602
            $('.modal-next').click(function() {
1603
                var modal = $("#order_edit");
1604
                keep_row();
1605
                var n = modal.data('n');
1606
                var info = api.page.info();
1607
                if(n < info.end - info.start - 1) {
1608
                    n++;
1609
                    modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1610
                    modal.data('n', n);
1611
                    set_editor();
1612
                } else {
1613
                    $('.modal-next, .modal-prev').prop('disabled', true);
1614
                    orders_table.one('draw.dt', function() {
1615
                        var info = api.page.info();
1616
                        n = 0;
1617
                        modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1618
                        modal.data('n', n);
1619
                        set_editor();
1620
                    });
1621
                    api.page('next').draw( 'page' );
1622
                }
1623
            });
1624
1625
            $('.modal-save').click(function() {
1626
                save_row();
1627
                $("#order_edit").modal('hide');
1628
            })
1629
1630
            $('#modal-order-main').tabs({
1631
                activate: function(event, ui) {
1632
                    var active = ui.newPanel.attr('id')
1633
                    if(active == 'history-panel') {
1634
                        show_subs($("#order_edit").data('row'));
1635
                    }
1636
                }
1637
            });
1638
1639
            $("#order_edit").on("show.bs.modal", function (event) {
1640
                var anchor = $(event.relatedTarget);
1641
                var n = anchor.data("row");
1642
                var row = api.row(n).data();
1643
1644
                var modal = $(this);
1645
                modal.data('row', JSON.parse(JSON.stringify(row)));
1646
                modal.data('n', n);
1647
                modal.data('keep', modal.data('saved')||{});
1648
                $('#modal-order-main').tabs("option", "active", 0);
1649
                set_editor();
1650
            });
1651
/*            $("#order_edit").on("shown.bs.modal", function() {
1652
                var modal = $(this);
1653
1654
                if(modal.data('show_subs')) show_subs(modal.data('row'));
1655
            });*/
1656
            $("#order_edit").on("hide.bs.modal", function() {
1657
                $("#child_orders_table").DataTable().off('preDraw').destroy();
1658
            });
1659
        });
1660
        [% END %]
544
    </script>
1661
    </script>
545
[% END %]
1662
[% END %]
546
1663
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-40 / +116 lines)
Lines 102-107 Link Here
102
        <table id="pending_orders" class="table table-bordered table-striped">
102
        <table id="pending_orders" class="table table-bordered table-striped">
103
            <thead>
103
            <thead>
104
                <tr>
104
                <tr>
105
                    [% IF Koha.Preference('AcqReceiveMultipleOrderLines') %]
106
                    <th><!--input type="checkbox" id="selectAll"/--></th>
107
                    [% END %]
105
                    <th>Basket</th>
108
                    <th>Basket</th>
106
                    <th>Basket group</th>
109
                    <th>Basket group</th>
107
                    <th>Order line</th>
110
                    <th>Order line</th>
Lines 120-125 Link Here
120
                </tr>
123
                </tr>
121
            </thead>
124
            </thead>
122
        </table>
125
        </table>
126
      [% IF Koha.Preference('AcqReceiveMultipleOrderLines') %]
127
      <fieldset class="action">
128
        <button id="select_multiple"></button>
129
      </fieldset>
130
      [% END %]
123
    </div>
131
    </div>
124
[% ELSE %]
132
[% ELSE %]
125
    <p>
133
    <p>
Lines 368-376 Link Here
368
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
376
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
369
    [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
377
    [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
370
    <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
378
    <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
379
    <style>fieldset.action { margin-bottom: 20px }</style>
371
    <script>
380
    <script>
372
        dt_overwrite_html_sorting_localeCompare();
381
        dt_overwrite_html_sorting_localeCompare();
373
        var sticky_filters = [% sticky_filters | html %];
382
        var sticky_filters = [% sticky_filters | html %];
383
        var PENDING_MULTI_SELECTION = _("Receive selected (%s)");
374
384
375
        $(document).ready(function(){
385
        $(document).ready(function(){
376
386
Lines 404-410 Link Here
404
414
405
            var base_query = { "basket.vendor_id": [% booksellerid | html %]  };
415
            var base_query = { "basket.vendor_id": [% booksellerid | html %]  };
406
            var pending_orders_url = '/api/v1/acquisitions/orders?only_active=1';
416
            var pending_orders_url = '/api/v1/acquisitions/orders?only_active=1';
407
            var pending_orders_table = $("#pending_orders").api({
417
            var options = {
408
                "ajax": {
418
                "ajax": {
409
                    "url": pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query))
419
                    "url": pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query))
410
                },
420
                },
Lines 420-457 Link Here
420
                    "items"
430
                    "items"
421
                ],
431
                ],
422
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
432
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
423
                "drawCallback": function (settings) {
424
                    $(".previewData").on("click", function(e){
425
                        e.preventDefault();
426
                        var ltitle = $(this).text();
427
                        var page = $(this).attr("href");
428
                        $("#dataPreviewLabel").text(ltitle);
429
                        $("#dataPreview .modal-body").load(page + " div");
430
                        $('#dataPreview').modal({show:true});
431
                    });
432
                },
433
                "columnDefs": [ {
434
                    "targets": [3,4,5,9],
435
                    "render": function (data, type, row, meta) {
436
                        if ( data != null ) {
437
                            return data.escapeHtml();
438
                        }
439
                        else {
440
                            return "";
441
                        }
442
                    }
443
                },
444
                {
445
                    "targets": [8,10],
446
                    "render": function (data, type, row, meta) {
447
                        if ( data != null ) {
448
                            return data.escapeHtml().format_price();
449
                        }
450
                        else {
451
                            return "";
452
                        }
453
                    }
454
                } ],
455
                "columns": [
433
                "columns": [
456
                    { "data": "basket.name",
434
                    { "data": "basket.name",
457
                      "orderable": true,
435
                      "orderable": true,
Lines 493-511 Link Here
493
                        "data": "biblio.author",
471
                        "data": "biblio.author",
494
                        "visible": false,
472
                        "visible": false,
495
                        "searchable": true,
473
                        "searchable": true,
496
                        "orderable": false
474
                        "orderable": false,
475
                        "render": function (data, type, row, meta) {
476
                            if ( data != null ) {
477
                                return data.escapeHtml();
478
                            }
479
                            else {
480
                                return "";
481
                            }
482
                        }
497
                    },
483
                    },
498
                    {
484
                    {
499
                        "data": "biblio.title",
485
                        "data": "biblio.title",
500
                        "visible": false,
486
                        "visible": false,
501
                        "searchable": true,
487
                        "searchable": true,
502
                        "orderable": false
488
                        "orderable": false,
489
                        "render": function (data, type, row, meta) {
490
                            if ( data != null ) {
491
                                return data.escapeHtml();
492
                            }
493
                            else {
494
                                return "";
495
                            }
496
                        }
503
                    },
497
                    },
504
                    {
498
                    {
505
                        "data": "biblio.isbn",
499
                        "data": "biblio.isbn",
506
                        "visible": false,
500
                        "visible": false,
507
                        "searchable": true,
501
                        "searchable": true,
508
                        "orderable": false
502
                        "orderable": false,
503
                        "render": function (data, type, row, meta) {
504
                            if ( data != null ) {
505
                                return data.escapeHtml();
506
                            }
507
                            else {
508
                                return "";
509
                            }
510
                        }
509
                    },
511
                    },
510
                    {
512
                    {
511
                        "data": function(row, type, val, meta) {
513
                        "data": function(row, type, val, meta) {
Lines 590-603 Link Here
590
                        "orderable": false
592
                        "orderable": false
591
                    },
593
                    },
592
                    {
594
                    {
593
                        "data": "replacement_price"
595
                        "data": "replacement_price",
596
                        "render": function (data, type, row, meta) {
597
                            if ( data != null ) {
598
                                return data.escapeHtml().format_price();
599
                            }
600
                            else {
601
                                return "";
602
                            }
603
                        }
594
                    },
604
                    },
595
                    {
605
                    {
596
                        "data": "quantity",
606
                        "data": "quantity",
597
                        "orderable": true
607
                        "orderable": true,
608
                        "render": function (data, type, row, meta) {
609
                            if ( data != null ) {
610
                                return data.escapeHtml();
611
                            }
612
                            else {
613
                                return "";
614
                            }
615
                        }
598
                    },
616
                    },
599
                    {
617
                    {
600
                        "data": "ecost"
618
                        "data": "ecost",
619
                        "render": function (data, type, row, meta) {
620
                            if ( data != null ) {
621
                                return data.escapeHtml().format_price();
622
                            }
623
                            else {
624
                                return "";
625
                            }
626
                        }
601
                    },
627
                    },
602
                    {
628
                    {
603
                        "data": function ( row, type, val, meta ) {
629
                        "data": function ( row, type, val, meta ) {
Lines 684-690 Link Here
684
                        "orderable": false
710
                        "orderable": false
685
                    }
711
                    }
686
                ]
712
                ]
713
            };
714
715
            [% IF Koha.Preference('AcqReceiveMultipleOrderLines') %]
716
            var selected_rows = {};
717
            $('#select_multiple').click(function() {
718
              var ids = Object.keys(selected_rows);
719
              if(!ids.length) return;
720
              if(ids.length == 1) {
721
                location.href = 'orderreceive.pl?ordernumber='+ids[0]+ '&invoiceid=[% invoiceid | uri %]';
722
              } else {
723
                location.href = 'orderreceive.pl?multiple_orders='+ids.join(',')+ '&invoiceid=[% invoiceid | uri %]';
724
              }
725
            }).html(PENDING_MULTI_SELECTION.format('0'))
726
            options.select = {
727
              style: 'api'
728
            };
729
            options.order = [[1, 'asc']];
730
            options.columns.unshift({
731
              "data": function(row, type, val, meta) {
732
                  return '<input type="checkbox" class="selOrder" />';
733
              },
734
              "searchable": false,
735
              "orderable": false
687
            });
736
            });
737
            [% END %]
738
739
            var pending_orders_table = $("#pending_orders").api(options);
740
741
            [% IF Koha.Preference('AcqReceiveMultipleOrderLines') %]
742
            var api = pending_orders_table.api();
743
            api.on('draw', function() {
744
              api.rows().every(function() {
745
                var row = this;
746
                var data = row.data();
747
                $('.selOrder', row.node()).on('click', function(event) {
748
                  if($(this).prop('checked')) {
749
                    row.select();
750
                    selected_rows[data.order_id] = data;
751
                  } else {
752
                    row.deselect();
753
                    delete selected_rows[data.order_id];
754
                  }
755
                  $('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length));
756
                });
757
                if(selected_rows[data.order_id]) {
758
                  row.select();
759
                  $('.selOrder', row.node()).prop('checked', true);
760
                }
761
              });
762
            });
763
764
            [% END %]
688
765
689
            $("#filterform").on("submit", function(e) {
766
            $("#filterform").on("submit", function(e) {
690
                e.preventDefault();
767
                e.preventDefault();
691
- 

Return to bug 8179