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

(-)a/Koha/Acquisition/Order.pm (+15 lines)
Lines 33-38 use Koha::Biblios; Link Here
33
use Koha::Holds;
33
use Koha::Holds;
34
use Koha::Items;
34
use Koha::Items;
35
use Koha::Number::Price;
35
use Koha::Number::Price;
36
use Koha::Patrons;
36
use Koha::Subscriptions;
37
use Koha::Subscriptions;
37
38
38
use base qw(Koha::Object);
39
use base qw(Koha::Object);
Lines 400-405 sub claimed_date { Link Here
400
    return $last_claim->claimed_on;
401
    return $last_claim->claimed_on;
401
}
402
}
402
403
404
=head3 creator
405
406
my $creator = $order->creator;
407
408
Retrieves patron that created this order.
409
410
=cut
411
412
sub creator {
413
    my ( $self )  = @_;
414
    my $creator_rs = $self->_result->creator;
415
    return Koha::Patron->_new_from_dbic( $creator_rs );
416
}
417
403
=head3 duplicate_to
418
=head3 duplicate_to
404
419
405
    my $duplicated_order = $order->duplicate_to($basket, [$default_values]);
420
    my $duplicated_order = $order->duplicate_to($basket, [$default_values]);
(-)a/Koha/REST/V1/Acquisitions/Orders.pm (-1 / +1 lines)
Lines 193-199 sub list { Link Here
193
193
194
        return $c->render(
194
        return $c->render(
195
            status  => 200,
195
            status  => 200,
196
            openapi => $orders->to_api({ embed => $embed })
196
            openapi => $c->objects->to_api($orders)
197
        );
197
        );
198
    }
198
    }
199
    catch {
199
    catch {
(-)a/Koha/Schema/Result/Aqorder.pm (+20 lines)
Lines 860-865 __PACKAGE__->belongs_to( Link Here
860
  },
860
  },
861
);
861
);
862
862
863
=head2 creator
864
865
Type: belongs_to
866
867
Related object: L<Koha::Schema::Result::Borrower>
868
869
=cut
870
871
__PACKAGE__->belongs_to(
872
  "creator",
873
  "Koha::Schema::Result::Borrower",
874
  { borrowernumber => "created_by" },
875
  {
876
    is_deferrable => 1,
877
    join_type     => "LEFT",
878
    on_delete     => "SET NULL",
879
    on_update     => "CASCADE",
880
  },
881
);
882
863
__PACKAGE__->belongs_to(
883
__PACKAGE__->belongs_to(
864
  "subscription",
884
  "subscription",
865
  "Koha::Schema::Result::Subscription",
885
  "Koha::Schema::Result::Subscription",
(-)a/acqui/orderreceive.pl (-43 / +53 lines)
Lines 85-90 my $invoice = GetInvoice($invoiceid); Link Here
85
my $booksellerid   = $invoice->{booksellerid};
85
my $booksellerid   = $invoice->{booksellerid};
86
my $freight      = $invoice->{shipmentcost};
86
my $freight      = $invoice->{shipmentcost};
87
my $ordernumber  = $input->param('ordernumber');
87
my $ordernumber  = $input->param('ordernumber');
88
my $multiple_orders = $input->param('multiple_orders');
88
89
89
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
90
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
90
my $order = Koha::Acquisition::Orders->find( $ordernumber );
91
my $order = Koha::Acquisition::Orders->find( $ordernumber );
Lines 98-110 my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( Link Here
98
    }
99
    }
99
);
100
);
100
101
101
unless ( $order ) {
102
unless ( $order || $multiple_orders ) {
102
    output_html_with_http_headers $input, $cookie, $template->output;
103
    output_html_with_http_headers $input, $cookie, $template->output;
103
    exit;
104
    exit;
104
}
105
}
105
106
106
# prepare the form for receiving
107
my $budget;
107
my $basket = $order->basket;
108
if ($order) {
109
110
    # prepare the form for receiving
111
    my $creator = Koha::Patrons->find( $order->created_by );
112
113
    $budget = GetBudget( $order->budget_id );
114
115
    my $datereceived = $order->datereceived || dt_from_string;
116
117
    my $order_internalnote = $order->order_internalnote;
118
    my $order_vendornote   = $order->order_vendornote;
119
    if ( $order->subscriptionid ) {
120
121
        # Order from a subscription, we will display an history of what has been received
122
        my $orders = Koha::Acquisition::Orders->search(
123
            {
124
                subscriptionid     => $order->subscriptionid,
125
                parent_ordernumber => $order->ordernumber,
126
                ordernumber        => { '!=' => $order->ordernumber }
127
            }
128
        );
129
        if ( $order->parent_ordernumber != $order->ordernumber ) {
130
            my $parent_order = Koha::Acquisition::Orders->find( $order->parent_ordernumber );
131
            $order_internalnote = $parent_order->order_internalnote;
132
            $order_vendornote   = $parent_order->order_vendornote;
133
        }
134
        $template->param( orders => $orders, );
135
    }
136
137
    my $suggestion = GetSuggestionInfoFromBiblionumber( $order->biblionumber );
138
139
    if ($suggestion) {
140
        $template->param( suggestion => $suggestion );
141
    }
142
143
    $template->param(
144
        order              => $order,
145
        creator            => $creator,
146
        bookfund           => $budget->{budget_name},
147
        datereceived       => $datereceived,
148
        order_internalnote => $order_internalnote,
149
        order_vendornote   => $order_vendornote,
150
    );
151
}
152
153
if ($multiple_orders) {
154
    $template->param( multiple_orders => $multiple_orders );
155
}
156
108
my $currencies = Koha::Acquisition::Currencies->search;
157
my $currencies = Koha::Acquisition::Currencies->search;
109
my $active_currency = $currencies->get_active;
158
my $active_currency = $currencies->get_active;
110
159
Lines 114-174 unless($acq_fw) { Link Here
114
    $template->param('NoACQframework' => 1);
163
    $template->param('NoACQframework' => 1);
115
}
164
}
116
165
117
118
my $creator = Koha::Patrons->find( $order->created_by );
119
120
my $budget = GetBudget( $order->budget_id );
121
122
my $datereceived = $order->datereceived || dt_from_string;
123
124
# get option values for TaxRates syspref
166
# get option values for TaxRates syspref
125
my @gst_values = map {
167
my @gst_values = map {
126
    option => $_ + 0.0
168
    option => $_ + 0.0
127
}, split( '\|', C4::Context->preference("TaxRates") );
169
}, split( '\|', C4::Context->preference("TaxRates") );
128
170
129
my $order_internalnote = $order->order_internalnote;
130
my $order_vendornote   = $order->order_vendornote;
131
if ( $order->subscriptionid ) {
132
    # Order from a subscription, we will display an history of what has been received
133
    my $orders = Koha::Acquisition::Orders->search(
134
        {
135
            subscriptionid     => $order->subscriptionid,
136
            parent_ordernumber => $order->ordernumber,
137
            ordernumber        => { '!=' => $order->ordernumber }
138
        }
139
    );
140
    if ( $order->parent_ordernumber != $order->ordernumber ) {
141
        my $parent_order = Koha::Acquisition::Orders->find($order->parent_ordernumber);
142
        $order_internalnote = $parent_order->order_internalnote;
143
        $order_vendornote   = $parent_order->order_vendornote;
144
    }
145
    $template->param(
146
        orders => $orders,
147
    );
148
}
149
150
$template->param(
171
$template->param(
151
    order                 => $order,
152
    freight               => $freight,
172
    freight               => $freight,
153
    name                  => $bookseller->name,
173
    name                  => $bookseller->name,
154
    active_currency       => $active_currency,
174
    active_currency       => $active_currency,
155
    currencies            => $currencies->search({ rate => { '!=' => 1 } }),
175
    currencies            => $currencies->search({ rate => { '!=' => 1 } }),
156
    invoiceincgst         => $bookseller->invoiceincgst,
176
    invoiceincgst         => $bookseller->invoiceincgst,
157
    bookfund              => $budget->{budget_name},
158
    creator               => $creator,
159
    invoiceid             => $invoice->{invoiceid},
177
    invoiceid             => $invoice->{invoiceid},
160
    invoice               => $invoice->{invoicenumber},
178
    invoice               => $invoice->{invoicenumber},
161
    datereceived          => $datereceived,
162
    order_internalnote    => $order_internalnote,
163
    order_vendornote      => $order_vendornote,
164
    gst_values            => \@gst_values,
179
    gst_values            => \@gst_values,
165
);
180
);
166
181
167
my $suggestion = GetSuggestionInfoFromBiblionumber($order->biblionumber);
168
if ( $suggestion ) {
169
    $template->param( suggestion => $suggestion );
170
}
171
172
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
182
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
173
my %budget_loops;
183
my %budget_loops;
174
my $budgets = GetBudgetHierarchy( undef, undef, undef, 1 );
184
my $budgets = GetBudgetHierarchy( undef, undef, undef, 1 );
Lines 185-191 foreach my $budget (@{$budgets}) { Link Here
185
        b_sort1_authcat => $budget->{'sort1_authcat'},
195
        b_sort1_authcat => $budget->{'sort1_authcat'},
186
        b_sort2_authcat => $budget->{'sort2_authcat'},
196
        b_sort2_authcat => $budget->{'sort2_authcat'},
187
        b_active => $budget->{budget_period_active},
197
        b_active => $budget->{budget_period_active},
188
        b_sel => ( $budget->{budget_id} == $order->budget_id ) ? 1 : 0,
198
        # b_sel => ( $budget->{budget_id} == $order->budget_id ) ? 1 : 0,
189
        b_level => $budget->{budget_level},
199
        b_level => $budget->{budget_level},
190
    };
200
    };
191
}
201
}
(-)a/api/v1/swagger/definitions/order.yaml (+5 lines)
Lines 259-262 properties: Link Here
259
    type:
259
    type:
260
      - object
260
      - object
261
      - "null"
261
      - "null"
262
  creator:
263
    type:
264
      - object
265
      - "null"
266
    description: Patron that created the order
262
additionalProperties: false
267
additionalProperties: false
(-)a/api/v1/swagger/paths/acquisitions_orders.yaml (+5 lines)
Lines 59-68 Link Here
59
            - biblio.holds+count
59
            - biblio.holds+count
60
            - biblio.items+count
60
            - biblio.items+count
61
            - biblio.suggestions.suggester
61
            - biblio.suggestions.suggester
62
            - creator
62
            - fund
63
            - fund
64
            - fund.budget
63
            - current_item_level_holds+count
65
            - current_item_level_holds+count
64
            - invoice
66
            - invoice
65
            - items
67
            - items
68
            - items.home_branch
69
            - items.holding_branch
70
            - items.itemtype
66
            - items+strings
71
            - items+strings
67
            - subscription
72
            - subscription
68
        collectionFormat: csv
73
        collectionFormat: csv
(-)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 23-28 Link Here
23
[% Asset.css("lib/bootstrap/bootstrap-theme.min.css") | $raw %]
23
[% Asset.css("lib/bootstrap/bootstrap-theme.min.css") | $raw %]
24
[% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
24
[% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
25
[% Asset.css("lib/datatables/datatables.min.css") | $raw %]
25
[% Asset.css("lib/datatables/datatables.min.css") | $raw %]
26
[% Asset.css("lib/datatables/select.dataTables.min.css") | $raw %]
26
[% Asset.css("css/print.css", { media = "print" }) | $raw %]
27
[% Asset.css("css/print.css", { media = "print" }) | $raw %]
27
[% INCLUDE intranetstylesheet.inc %]
28
[% INCLUDE intranetstylesheet.inc %]
28
[% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %]
29
[% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-544 / +1150 lines)
Lines 27-35 Link Here
27
        [% END %]
27
        [% END %]
28
        [% WRAPPER breadcrumb_item bc_active= 1 %]
28
        [% WRAPPER breadcrumb_item bc_active= 1 %]
29
            [% IF ( invoice ) %]
29
            [% IF ( invoice ) %]
30
                <span>Receive items from: [% name | html %] [[% invoice | html %]] (order #[% order.ordernumber | html %])</span>
30
                <span>Receive items from: [% name | html %] [[% invoice | html %]] (order #[% multiple_orders | html %])</span>
31
            [% ELSE %]
31
            [% ELSE %]
32
                <span>Receive items from: [% name | html %] (order #[% order.ordernumber | html %])</span>
32
                <span>Receive items from: [% name | html %] (order #[% multiple_orders | html %])</span>
33
            [% END %]
33
            [% END %]
34
        [% END %]
34
        [% END %]
35
    [% END #/ WRAPPER breadcrumbs %]
35
    [% END #/ WRAPPER breadcrumbs %]
Lines 37-459 Link Here
37
37
38
<div class="main container-fluid">
38
<div class="main container-fluid">
39
    <div class="row">
39
    <div class="row">
40
    [% AcqCreateItem = order.basket.effective_create_items %]
41
        <div class="col-sm-10 col-sm-push-2">
40
        <div class="col-sm-10 col-sm-push-2">
42
            <main>
41
            <main>
43
42
44
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber | html %])</h1>
43
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% multiple_orders | html %])</h1>
45
44
46
[% IF ( order ) %]
45
[% IF multiple_orders %]
47
    <form id="f" action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
46
    <table id="multiple_orders" class="table table-bordered table-striped">
48
<div class="row">
47
        <thead>
49
<div class="col-sm-6">
48
            <tr>
50
    <div class="dialog alert order_error" style="display:none"></div>
49
                <th>Order</td>
51
50
                <th>Title</th>
52
    <fieldset class="rows">
51
                <th>Author</th>
53
    <legend>Catalog details</legend>
52
                <th>ISBN</th>
54
    <ol>
53
                <th>Date received</th>
55
        <li>
54
                <th>Fund</th>
56
            <span class="label">Title: </span>
55
                <th>Quantity</th>
57
            [% INCLUDE 'biblio-title.inc' biblio=order.biblio link = 1 %]
56
                <th>&nbsp;</th>
58
        </li>
57
            </tr>
59
    <li> <span class="label">Author: </span>
58
        </thead>
60
        [% order.biblio.author | html %]</li>
59
    </table>
61
    <li><span class="label">Copyright: </span>
60
62
        [% order.biblio.copyrightdate | html %]</li>
61
    <div class="col">
63
    <li> <span class="label">ISBN: </span>
62
        <fieldset class="action">
64
        [% order.biblio.biblioitem.isbn | html %]</li>
63
            <button class="save btn btn-primary" disabled>Save</button>
65
    <li> <span class="label">Series: </span>
64
            <a class="cancel btn btn-default" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a>
66
        [% order.biblio.seriestitle | html %]</li>
67
    </ol>
68
	</fieldset>
69
70
    [% IF suggestion %]
71
        <fieldset class="rows">
72
        <legend>Suggestion</legend>
73
        <ol>
74
          <li>
75
            <span class="label">Suggested by: </span>
76
            [% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&amp;op=show">suggestion #[% suggestion.suggestionid | html %]</a>)
77
            [% IF suggestion.reason %]
78
                <li>
79
                    <span class="label">Reason:</span>
80
                    [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %]
81
                    [% SET other_reason = 1 %]
82
                    <select class="select-reason" id="reason" name="reason">
83
                        <option value=""> -- Choose a reason -- </option>
84
                        [% FOREACH reason IN suggestion_reasons %]
85
                            [% IF reason.lib == suggestion.reason %]
86
                                <option value="[% reason.lib | html %]" selected="selected">[% reason.lib | html %]</option>
87
                                [% SET other_reason = 0 %]
88
                            [% ELSE %]
89
                                <option value="[% reason.lib | html %]">[% reason.lib | html %]</option>
90
                            [% END %]
91
                        [% END %]
92
                        <option value="other">Others...</option>
93
                    </select>
94
95
                    <span id="other_reason" name="other_reason">
96
                        [% IF other_reason %]
97
                            <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
98
                        [% ELSE %]
99
                            <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
100
                        [% END %]
101
                        <a href="#back">Cancel</a>
102
                    </span>
103
104
                    <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
105
                </li>
106
            [% END %]
107
          </li>
108
        </ol>
109
        </fieldset>
110
    [% END %]
111
112
    [% IF order.subscriptionid and orders.count %]
113
        <fieldset class="rows">
114
            <legend>Receipt history for this subscription</legend>
115
            <table id="orders">
116
                <thead>
117
                    <tr>
118
                        <th>Invoice</th>
119
                        <th>Order number</th>
120
                        <th>Creation date</th>
121
                        <th>Receive date</th>
122
                        <th>Quantity received</th>
123
                        <th>Status</th>
124
                        <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
125
                        <th>Internal note</th>
126
                    </tr>
127
                </thead>
128
                <tbody>
129
                [% FOR suborder IN orders %]
130
                    <tr>
131
                        <td>
132
                        [% IF suborder.invoice %]
133
                            [% IF CAN_user_acquisition %]
134
                                <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% suborder.invoiceid | uri %]" title="Invoice detail page">
135
                                   [% suborder.invoice.invoicenumber | html %]</a>
136
                            [% ELSE %]
137
                                [% suborder.invoice.invoicenumber | html %]
138
                            [% END %]
139
                        [% END %]
140
                        </td>
141
                        <td>[% suborder.ordernumber | html %]</td>
142
                        <td data-order="[% suborder.basket.creationdate | uri %]">[% suborder.basket.creationdate | $KohaDates%]</td>
143
                        <td data-order="[% suborder.datereceived | uri %]">
144
                            [% IF suborder.datereceived %]
145
                                [% suborder.datereceived | $KohaDates %]
146
                            [% END %]
147
                        </td>
148
                        <td>[% suborder.quantityreceived | html %]</td>
149
                        [% SWITCH suborder.orderstatus %]
150
                            [%# FIXME We should only see/display Complete here, right? %]
151
                            [% CASE 'new' %]
152
                                <td data-order="status_1">
153
                                    <span>New</span>
154
                            [% CASE 'ordered' %]
155
                                <td data-order="status_2">
156
                                    <span>Ordered</span>
157
                            [% CASE 'partial' %]
158
                                <td data-order="status_3">
159
                                    <span>Partial</span>
160
                            [% CASE 'complete' %]
161
                                <td data-order="status_4">
162
                                    <span>Complete</span>
163
                            [% CASE 'cancelled' %]
164
                                <td data-order="status_5">
165
                                    <span>Cancelled</span>
166
                          [% END %]
167
                        </td>
168
                        <td>
169
                            [% IF suborder.datereceived %][%# FIXME Should only be true, right? %]
170
                                [%# FIXME What if unitprice has not been filled? %]
171
                                [% suborder.unitprice_tax_excluded * suborder.quantity | $Price %] / [% suborder.unitprice_tax_included * suborder.quantity | $Price %]
172
                            [% END %]
173
                        </td>
174
                        <td>[% suborder.order_internalnote | html %]</td>
175
                    </tr>
176
                [% END %]
177
                </tbody>
178
            </table>
179
        </fieldset>
65
        </fieldset>
180
    [% ELSIF (AcqCreateItem == 'receiving') %]
66
        <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
181
        <div id="items_list" style="display:none">
67
    </div>
182
            <p><strong>Items list</strong></p>
183
            <div style="width:100%;overflow:auto;">
184
                <table>
185
                    <thead>
186
                        <tr>
187
                            <th class="noExport">Actions</th>
188
                            <th>Barcode</th>
189
                            <th>Home library</th>
190
                            <th>Holding library</th>
191
                            <th>Not for loan</th>
192
                            <th>Restricted</th>
193
                            <th>Location</th>
194
                            <th>Call number</th>
195
                            <th>Copy number</th>
196
                            <th>Inventory number</th>
197
                            <th>Collection</th>
198
                            <th>Item type</th>
199
                            <th>Materials</th>
200
                            <th>Notes</th>
201
                        </tr>
202
                    </thead>
203
                    <tbody>
204
                    </tbody>
205
                </table>
206
            </div>
207
        </div>
208
68
209
        [% UNLESS order.subscriptionid %]
69
    <div class="modal fade" id="order_edit" tabindex="-1" role="dialog" aria-labelledby="Order edit">
210
          <fieldset class="rows" id="itemfieldset">
70
        <div id="receive-modal" class="modal-dialog modal-lg" role="document">
211
              <legend>Item</legend>
71
            <div class="modal-content modal-lg">
212
              [% IF ( NoACQframework ) %]
72
                <div class="modal-header row">
213
                  <p class="required">
73
                    <h4 class="col-md-11 modal-title"></h4>
214
                      No ACQ framework, using default. You should create a
74
                    <button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
215
                      framework with code ACQ, the items framework would be
75
                </div>
216
                      used
76
                <div class="modal-body">
217
                  </p>
77
                    <div class="hide" id="loading">Loading ...</div>
218
              [% END %]
78
                    <div id="modal-order-main row">
219
              <div id="outeritemblock"></div>
79
                        <!--ul>
220
          </fieldset>
80
                            <li><a href="#info-panel">Info</a></li>
221
        [% END %]
81
                            <li><a href="#accounting-panel">Accounting</a></li>
222
    [% ELSIF (AcqCreateItem == 'ordering') %]
82
                            <li><a href="#history-panel">Receipt history</a></li>
223
        [% IF (order.items) %]
83
                            <li><a href="#items-panel">Items</a></li>
224
            <div class="page-section" style="width:100%;overflow:auto">
84
                        </ul-->
225
                <h2>Items</h2>
85
226
                <table>
86
                        <div class="col-md-12 col-lg-6">
227
                    <thead>
87
                            <div id="info-panel" class="page-section">
228
                        <tr>
88
                                <div>
229
                            <th>Receive?</th>
89
                                    <h4>Catalog details</h4>
230
                            <th>&nbsp;</th>
90
231
                            <th>Barcode</th>
91
                                    <div class="row"> <span class="lbl col-sm-4">Title: </span><span class="col-sm-8" id="biblio_title"></span></div>
232
                            <th>Home library</th>
92
                                    <div class="row"> <span class="lbl col-sm-4">Author: </span><span class="col-sm-8" id="biblio_author"></span></div>
233
                            <th>Current library</th>
93
                                    <div class="row"> <span class="lbl col-sm-4">Copyright: </span><span class="col-sm-8" id="biblio_copyright_date"></span></div>
234
                            <th>Not for loan</th>
94
                                    <div class="row"> <span class="lbl col-sm-4">ISBN: </span><span class="col-sm-8" id="biblio_isbn"></span></div>
235
                            <th>Restricted</th>
95
                                    <div class="row"> <span class="lbl col-sm-4">Series: </span><span class="col-sm-8" id="biblio_series_title"></span></div>
236
                            <th>Location</th>
96
237
                            <th>Call number</th>
97
                                </div>
238
                            <th>Copy number</th>
98
                                <div id="suggestion_fieldset">
239
                            <th>Inventory number</th>
99
                                    <h4>Suggestion</h4>
240
                            <th>Collection</th>
100
                                    <div class="row">
241
                            <th>Item type</th>
101
                                        <span class="lbl col-sm-4">Suggested by: </span> <span class="col-sm-8" id="biblio_suggestion_suggester"></span>
242
                            <th>Materials</th>
102
                                    </div>
243
                            <th>Notes</th>
103
                                    <div class="row" id="suggestion_reason">
244
                        </tr>
104
                                        <span class="lbl col-sm-4">Reason:</span>
245
                    </thead>
105
                                        <div class="col-sm-8">
246
                    <tbody>
106
                                            [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %]
247
                        [% FOREACH item IN order.items %]
107
                                            <select class="select-reason" id="reason" name="reason">
248
                            <tr id="item_[% item.itemnumber | html %]">
108
                                                <option value=""> -- Choose a reason -- </option>
249
                                <td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td>
109
                                                [% FOREACH reason IN suggestion_reasons %]
250
                                <td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td>
110
                                                <option value="[% reason.lib | html %]">[% reason.lib | html %]</option>
251
                                <td>[% item.barcode | html %]</td>
111
                                                [% END %]
252
                                <td>[% Branches.GetName( item.homebranch ) | html %]</td>
112
                                                <option value="other">Others...</option>
253
                                <td>[% Branches.GetName( item.holdingbranch ) | html %]</td>
113
                                            </select>
254
                                <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]</td>
114
255
                                <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]</td>
115
                                            <span id="other_reason" name="other_reason">
256
                                <td><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]</span></td>
116
                                                <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
257
                                <td>[% item.itemcallnumber | html %]</td>
117
                                                <a href="#back">Cancel</a>
258
                                <td>[% item.copynumber | html %]</td>
118
                                            </span>
259
                                <td>[% item.stocknumber | html %]</td>
119
                                        </div>
260
                                <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>
120
                                    </div>
261
                                <td>[% ItemTypes.GetDescription( item.itype ) | html %]</td>
121
                                </div>
262
                                <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.materials', authorised_value => item.materials ) | html %]</td>
122
                            </div>
263
                                <td>[% item.itemnotes | html %]</td>
123
                            <div id="history-panel" class="page-section">
264
                            </tr>
124
                                <div id="child_orders">
265
                        [% END %]
125
                                    <h4>Receipt history for this subscription</h4>
266
                    </tbody>
126
                                    <table id="child_orders_table">
267
                </table>
127
                                        <thead>
128
                                            <tr>
129
                                                <th>Invoice</th>
130
                                                <th>Order number</th>
131
                                                <th>Creation date</th>
132
                                                <th>Receive date</th>
133
                                                <th>Quantity received</th>
134
                                                <th>Status</th>
135
                                                <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
136
                                                <th>Internal note</th>
137
                                            </tr>
138
                                        </thead>
139
                                    </table>
140
                                </div>
141
                            </div>
142
                            <div id="items-panel" class="page-section">
143
                                <div id="acq-create-receiving">
144
                                    <div id="items_list" style="display: none">
145
                                        <h4>Items list</h4>
146
                                        <div style="width:100%;overflow:auto;">
147
                                            <table>
148
                                                <thead>
149
                                                    <tr>
150
                                                        <th>Actions</th>
151
                                                        <th>Barcode</th>
152
                                                        <th>Home library</th>
153
                                                        <th>Holding library</th>
154
                                                        <th>Not for loan</th>
155
                                                        <th>Restricted</th>
156
                                                        <th>Location</th>
157
                                                        <th>Call number</th>
158
                                                        <th>Copy number</th>
159
                                                        <th>Inventory number</th>
160
                                                        <th>Collection</th>
161
                                                        <th>Item type</th>
162
                                                        <th>Materials</th>
163
                                                        <th>Notes</th>
164
                                                    </tr>
165
                                                </thead>
166
                                                <tbody>
167
                                                </tbody>
168
                                            </table>
169
                                        </div>
170
                                    </div>
171
172
                                    <div id="itemfieldset">
173
                                        <h4>Item</h4>
174
                                        [% IF ( NoACQframework ) %]
175
                                            <p class="required">
176
                                                No ACQ framework, using default. You should create a
177
                                                framework with code ACQ, the items framework would be
178
                                                used
179
                                            </p>
180
                                        [% END %]
181
                                        <div id="outeritemblock"></div>
182
                                    </div>
183
                                </div>
184
                                <div id="acq-create-ordering">
185
                                    <h4>Items</h4>
186
                                    <div style="width:100%;overflow:auto">
187
                                        <table>
188
                                            <thead>
189
                                                <tr>
190
                                                    <th>Receive?</th>
191
                                                    <th>&nbsp;</th>
192
                                                    <th>Barcode</th>
193
                                                    <th>Home library</th>
194
                                                    <th>Current library</th>
195
                                                    <th>Not for loan</th>
196
                                                    <th>Restricted</th>
197
                                                    <th>Location</th>
198
                                                    <th>Call number</th>
199
                                                    <th>Copy number</th>
200
                                                    <th>Inventory number</th>
201
                                                    <th>Collection</th>
202
                                                    <th>Item type</th>
203
                                                    <th>Materials</th>
204
                                                    <th>Notes</th>
205
                                                </tr>
206
                                            </thead>
207
                                            <tbody>
208
                                            </tbody>
209
                                        </table>
210
                                    </div>
211
                                </div>
212
                            </div>
213
                        </div>
214
                        <div class="col-md-12 col-lg-6">
215
                            <div id="accounting-panel" class="page-section">
216
                                <h4>Accounting details</h4>
217
                                <ol>
218
                                    <li>
219
                                        <label for="datereceived">Date received: </label>
220
                                        <input type="text" size="10" id="datereceived" name="datereceived" class="datepicker" />
221
                                    </li>
222
                                    <li>
223
                                        <label for="bookfund">Fund: </label>
224
                                        <select id="bookfund" name="bookfund">
225
                                            <option value=""></option>
226
                                            [% FOREACH period IN budget_loop %]
227
                                            <optgroup label="[% period.description | html %]">
228
                                            [% FOREACH fund IN period.funds %]
229
                                                <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option>
230
                                            [% END %]
231
                                            </optgroup>
232
                                            [% END %]
233
                                        </select>
234
                                    </li>
235
                                    <li>
236
                                        <label>&nbsp;</label>
237
                                        <span id="current-fund"></span>
238
                                    </li>
239
                                    <li>
240
                                        <label for="creator">Ordered by: </label>
241
                                        <span id="creator"></span>
242
                                    </li>
243
                                    <li>
244
                                        <label for="quantity_to_receive">Quantity ordered: </label>
245
                                        <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" />
246
                                    </li>
247
                                    <li>
248
                                        <label for="quantity">Quantity received: </label>
249
                                        <input type="text" size="20" name="quantityrec" id="quantity" />
250
                                        <div id="qtyrecerror" style="display:none">
251
                                            <p class="error">Warning, you have entered more items than expected.
252
                                            Items will not be created.</p>
253
                                        </div>
254
                                    </li>
255
256
                                    [% IF ( gst_values ) %]
257
                                    <li>
258
                                        <label for="tax_rate">Tax rate: </label>
259
                                        <select name="tax_rate" id="tax_rate">
260
                                        [% FOREACH gst IN gst_values %]
261
                                            <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
262
                                        [% END %]
263
                                        </select>
264
                                    </li>
265
                                    [% END %]
266
267
                                    <li>
268
                                        <label for="rrp">Retail price: </label>
269
                                        <span id="rrp"></span>
270
                                    <li>
271
                                        <label for="replacementprice">Replacement price:</label>
272
                                        <input type="text" size="20" name="replacementprice" id="replacementprice" />
273
                                    </li>
274
                                    <li>
275
                                        <label for="ecost">Budgeted cost: </label>
276
                                        <span id="ecost"></span>
277
                                    </li>
278
                                    <li>
279
                                        <label for="unitprice">Actual cost:</label>
280
                                        <input type="text" size="20" name="unitprice" id="unitprice" />
281
                                        <span id="unitprice_hint" class="hint"></span>
282
                                        <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
283
                                    </li>
284
                                    <li id="select_currency">
285
                                        <label for="unitprice_currency"></label>
286
                                        <input type="text" size="20" name="unitprice_currency" id="unitprice_currency" value="" />
287
                                        [% IF currencies.count %]
288
                                        <select name="currency">
289
                                            <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
290
                                            [% FOR currency IN currencies %]
291
                                            <option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
292
                                            [% END %]
293
                                        </select>
294
                                        [% END %]
295
                                    </li>
296
                                    <li>
297
                                        <label for="order_internalnote">Internal note: </label>
298
                                        <textarea name="order_internalnote" id="order_internalnote" width="40" rows="8" ></textarea>
299
                                    </li>
300
                                    <li>
301
                                        <label for="order_vendornote">Vendor note: </label>
302
                                        <span id="order_vendornote"></span>
303
                                    </li>
304
                                </ol>
305
                            </div>
306
                        </div>
307
                    </div>
308
                </div>
309
                <div class="modal-footer">
310
                    <button type="button" class="btn btn-defualt modal-prev">Previous order</button>
311
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
312
                    <button type="button" class="btn btn-primary modal-save">Save changes</button>
313
                    <button type="button" class="btn btn-defualt modal-next">Next order</button>
314
                </div>
268
            </div>
315
            </div>
269
        [% END %]
316
        </div>
270
    [% END %]
317
    </div>
271
    <input type="hidden" name="biblionumber" value="[% order.biblionumber | html %]" />
318
    <div class="modal fade" id="modal_messages" tabindex="-1" role="dialog" aria-labelledby="Order edit">
272
    <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
319
        <div class="modal-dialog" role="document">
273
    <input type="hidden" name="ordernumber" value="[% order.ordernumber | html %]" />
320
            <div class="modal-content">
274
    <input type="hidden" name="booksellerid" value="[% order.basket.booksellerid | html %]" />
321
                <div class="modal-header">
275
	</div>
322
                    <h4 class="col-md-11 modal-title"></h4>
276
    <div class="col-sm-6">
323
                    <button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
277
    <fieldset class="rows">
324
                </div>
278
    <legend>Accounting details</legend>
325
                <div class="modal-body">
279
        <ol>
326
                    <ul></ul>
280
            <li>
327
                </div>
281
                <label for="datereceived">Date received: </label>
328
                <div class="modal-footer">
282
                <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | html %]" class="flatpickr" />
329
                    <button type="button" class="btn btn-primary accept">Accept</button>
283
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
330
                    <button type="button" class="btn btn-default cancel">Cancel</button>
284
            </li>
331
                </div>
285
       <li>
286
            <label class="required" for="bookfund">Fund: </label>
287
            [% active_count = 0 %]
288
            [% IF !ordernumber %]
289
                [% FOREACH budget_period IN budget_loops.keys %]
290
                    [% FOREACH fund IN budget_loops.$budget_period.funds %]
291
                        [% active_count= active_count + fund.b_active %]
292
                    [% END %]
293
                [% END %]
294
            [% END %]
295
            <select class="select2" id="bookfund" name="bookfund">
296
                <optgroup label="Current">
297
                        <option value="[% order.fund.budget.id | html %]" selected="selected" data-sort1-authcat="[% order.fund.sort1_authcat | html %]" data-sort2-authcat="[% order.fund.sort2_authcat | html %]">
298
                            Keep current ([% order.fund.budget_name | html %])</option>
299
                </optgroup>
300
            [% FOREACH budget_period_id IN budget_loops.keys %]
301
                [% SET budget_period = budget_loops.$budget_period_id %]
302
                [% IF budget_period.active %]
303
                    <optgroup label="[% budget_period.description | html %]">
304
                [% ELSE %]
305
                    <optgroup class="inactive_budget" label="[% budget_period.description | html %] (Inactive)">
306
                [% END %]
307
                [% FOREACH budget_loo IN budget_period.funds %]
308
                   [% level_indent_cnt = 0 %]
309
                    [% level_indent = "" %]
310
                    [% WHILE level_indent_cnt < budget_loo.b_level %]
311
                        [% level_indent = level_indent _ " -- " %]
312
                        [% level_indent_cnt = level_indent_cnt +1 %]
313
                    [% END %]
314
315
                    [% IF ( budget_loo.b_sel ) %]
316
                        [% active_count = 0 #select no other fund %]
317
                        <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">
318
                    [% ELSIF active_count==1 && budget_loo.b_active %]
319
                        <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">
320
                    [% ELSE %]
321
                        [% bdgclass=budget_loo.b_active? "": "inactive_budget" | html %]
322
                        <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">
323
                    [% END %]
324
                        [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
325
                    </option>
326
                [% END %]
327
                </optgroup>
328
            [% END %]
329
            </select>
330
            <span class="required">Required</span>
331
            <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
332
            <input type="checkbox" id="showallbudgets" />
333
       </li>
334
       <li><label>&nbsp;</label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li>
335
       <li>
336
        <label for="creator">Ordered by: </label>
337
        <span>
338
            [% INCLUDE 'patron-title.inc' patron = creator %]
339
        </span>
340
       </li>
341
       <li><label for="quantity_to_receive">Quantity ordered: </label><span class="label">
342
           [% IF edit or order.subscriptionid %]
343
               <input type="text" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" />
344
           [% ELSE%]
345
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" />
346
           [% END %]
347
           </span></li>
348
        <li><label for="quantity">Quantity received: </label>
349
          [% IF order.subscriptionid %]
350
              <input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% order.quantity | html %]" />
351
              <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
352
          [% ELSIF AcqCreateItem == 'receiving' %]
353
              <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
354
          [% ELSE %]
355
            [% IF ( order.quantityreceived ) %]
356
                [% IF ( edit ) %]
357
                    <input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived | html %]" />
358
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
359
                [% ELSE %]
360
                    [% IF ( order.items.count ) %]
361
                        <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" />
362
                    [% ELSE %]
363
                        <input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" />
364
                    [% END %]
365
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
366
                [% END %]
367
            [% ELSE %]
368
                <input type="text" inputmode="numeric" pattern="[0-9]*" id="quantity" size="20" name="quantityrec" value="1" />
369
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
370
            [% END %]
371
            <div id="qtyrecerror" style="display:none">
372
                <p class="error">Warning, you have entered more items than expected.
373
                Items will not be created.</p>
374
            </div>
332
            </div>
375
          [% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItem == 'receiving' ) %]
333
        </div>
376
		</li>
334
    </div>
377
378
        [% IF ( gst_values ) %]
379
            <li>
380
                <label for="tax_rate">Tax rate: </label>
381
                <select name="tax_rate" id="tax_rate">
382
                [% tax_rate = order.tax_rate_on_receiving || order.tax_rate_on_ordering %]
383
                [% tax_rate = tax_rate + 0 %]
384
                [% FOREACH gst IN gst_values %]
385
                    [% IF gst.option == tax_rate %]
386
                        <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
387
                    [% ELSE %]
388
                        <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
389
                    [% END %]
390
                [% END %]
391
                </select>
392
            </li>
393
        [% ELSE %]
394
            <input type="hidden" name="tax_rate" value="0" />
395
        [% END %]
396
397
        <li><label for="rrp">Retail price: </label>
398
            [% IF (invoiceincgst == 1) %]
399
                [% order.rrp_tax_included | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax inclusive)</span></li>
400
            [% ELSE %]
401
                [% order.rrp_tax_excluded | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax exclusive)</span></li>
402
            [% END %]
403
        <li>
404
            <label for="replacementprice">Replacement price:</label>
405
            <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% order.replacementprice | $Price on_editing => 1 %]" />
406
        </li>
407
        <li>
408
            [% IF (invoiceincgst) %]
409
                <label for="ecost">Budgeted cost: </label>[% order.ecost_tax_included | $Price %] <span class="hint">(tax inclusive)</span>
410
            [% ELSE %]
411
                <label for="ecost">Budgeted cost: </label>[% order.ecost_tax_excluded | $Price %] <span class="hint">(tax exclusive)</span>
412
            [% END %]
413
            </li>
414
        <li>
415
            <label for="unitprice">Actual cost:</label>
416
            [% IF (invoiceincgst) %]
417
                [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_included : order.ecost_tax_included %]
418
                <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span>
419
            [% ELSE %]
420
                [% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_excluded : order.ecost_tax_excluded %]
421
                <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span>
422
            [% END %]
423
            <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
424
        </li>
425
        <li id="select_currency">
426
            <label for="invoice_unitprice"></label>
427
            <input type="text" size="20" name="invoice_unitprice" id="invoice_unitprice" value="[% order.invoice_unitprice | $Price on_editing => 1 %]" />
428
            [% IF currencies.count %]
429
                <select name="invoice_currency">
430
                    [% IF order.invoice_currency == active_currency.currency %]
431
                        <option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
432
                    [% ELSE %]
433
                        <option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
434
                    [% END %]
435
                    [% FOR currency IN currencies %]
436
                        [% IF order.invoice_currency == currency.currency %]
437
                            <option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]" selected="selected">[% currency.currency | html %] ([% currency.symbol | html %])</option>
438
                        [% ELSE %]
439
                            <option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
440
                        [% END %]
441
                    [% END %]
442
                </select>
443
            [% END %]
444
        </li>
445
        <li><label for="order_internalnote">Internal note: </label><textarea name="order_internalnote" width="40" rows="8" >[% order_internalnote | html %]</textarea></li>
446
        [% IF order_vendornote %]
447
            <li><label for="order_vendornote">Vendor note: </label><span>[% order_vendornote | html %]</span></li>
448
        [% END %]
449
        </ol>
450
    </fieldset>
451
452
</div>
453
</div><div class="row"><fieldset class="action">
454
        <input type="submit" value="Save" class="btn btn-primary" accesskey="w" />
455
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]">Cancel</a>
456
</fieldset></div>    </form>
457
[% ELSE %]
335
[% ELSE %]
458
    This ordernumber does not exist.
336
    This ordernumber does not exist.
459
[% END %]
337
[% END %]
Lines 469-650 Link Here
469
</div> <!-- /.row -->
347
</div> <!-- /.row -->
470
[% MACRO jsinclude BLOCK %]
348
[% MACRO jsinclude BLOCK %]
471
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
349
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
472
[% INCLUDE 'calendar.inc' %]
350
    [% INCLUDE 'calendar.inc' %]
473
    [% Asset.js("js/additem.js") | $raw %]
351
    [% Asset.js("js/additem.js") | $raw %]
474
    [% Asset.js("js/cataloging.js") | $raw %]
352
    [% Asset.js("js/cataloging.js") | $raw %]
475
    [% INCLUDE 'select2.inc' %]
353
    [% INCLUDE 'select2.inc' %]
354
    [% INCLUDE 'datatables.inc' %]
355
    [% INCLUDE 'js-date-format.inc' %]
356
    [% INCLUDE 'format_price.inc' %]
357
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
358
    <style>
359
        @media (min-width: 1200px) {
360
            #receive-modal, #receive-modal .modal-content {
361
                width: 1150px;
362
            }
363
        }
364
        #receive-modal .modal-body {
365
            background-color: #F3F4F4;
366
        }
367
368
        .lbl {
369
            font-weight: 700;
370
            text-align: right;
371
        }
372
        .modal-body ol {
373
            list-style-type: none;
374
        }
375
376
        .modal-body ol li {
377
            list-style-type: none;
378
            padding-bottom: 1em;
379
            width: 100%;
380
        }
381
382
        .modal-body h4 {
383
            margin-left: 1em;
384
            padding: .2em .5em;
385
            margin-bottom: 17px;
386
        }
387
388
        .modal-body label {
389
            margin-right: 1em;
390
            text-align: right;
391
            width: 11em;
392
            display: inline-block;
393
            font-weight: 700;
394
        }
395
396
        .modal-body textarea {
397
            vertical-align: text-top;
398
        }
399
    </style>
476
    <script>
400
    <script>
477
        function Check(form) {
401
        function display_string(key, strings, fallback) {
478
            [% IF (AcqCreateItem == 'receiving') %]
402
            if ( strings.hasOwnProperty(key) ) {
479
                var total_errors = CheckMandatorySubfields(form);
403
                return strings[key].str && escape_str(strings[key].str) || '';
480
                if (total_errors != 0) {
404
            }
481
                    var alertString = _("Form not submitted because of the following problem(s)");
405
            return fallback != null ? fallback : '';
482
                    alertString += "\n------------------------------------------------------------------------------------\n";
406
        }
483
                    alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
407
484
                    alert(alertString);
408
        var _build_item = function(item, tr) {
485
                    return false;
409
            var chb = $('<input type="checkbox" name="items_to_receive" value="'+item.item_id+'" />')
410
                .prop('checked', item._checked)
411
                .change(function() {
412
                    item._checked = $(this).prop('checked');
413
                });
414
            tr.append($('<td style="text-align:center"></td>').append(chb));
415
            tr.append('<td><a style="cursor:pointer" onclick="PopupEditPage('+item.biblio_id+', '+item.item_id+');">'+EDIT[0].toUpperCase()+EDIT.substr(1).toLowerCase()+'</a></td>');
416
            tr.append('<td>'+(item.external_id||'')+'</td>');
417
            tr.append('<td>'+display_string( 'home_library_id', item._strings, item.home_library_id ) || ''+'</td>');
418
            tr.append('<td>'+display_string( 'holding_library_id', item._strings, item.holding_library_id )+'</td>');
419
            tr.append('<td>'+display_string( 'not_for_loan_status', item._strings, item.not_for_loan_status )+'</td>');
420
            tr.append('<td>'+display_string( 'restricted_status', item._strings, item.restricted_status )+'</td>');
421
            tr.append('<td><span class="shelvingloc">'+display_string( 'location', item._strings, item.location )+'</span></td>');
422
            tr.append('<td>'+(item.callnumber||'')+'</td>');
423
            tr.append('<td>'+(item.copy_number||'')+'</td>');
424
            tr.append('<td>'+(item.inventory_number||'')+'</td>');
425
            tr.append('<td>'+display_string( 'collection', item._strings, item.collection )+'</td>');
426
            tr.append('<td>'+display_string( 'item_type_id', item._strings, item.item_type_id )+'</td>');
427
            tr.append('<td>'+display_string( 'materials_notes', item._strings, item.materials_notes )+'</td>');
428
            tr.append('<td>'+(item.public_notes||'')+'</td>');
429
        };
430
431
        var items_columns = [null, null, 'external_id', 'home_library_id',
432
                'holding_library_id', 'not_for_loan_status', 'restricted_status', 'location',
433
                'callnumber', 'copy_number', 'inventory_number', 'collection_code',
434
                'item_type', 'materials_notes', 'public_notes'];
435
436
        function PopupEditPage(biblionumber, itemnumber) {
437
            var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
438
                + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
439
            var w = window.open(url);
440
            var watchClose = setInterval(function() {
441
                if (w.closed) {
442
                    clearTimeout(watchClose);
443
                    $.ajax({
444
                        dataType: "json",
445
                        headers: {
446
                            "x-koha-embed": "+strings"
447
                        },
448
                        url: '/api/v1/items/'+itemnumber,
449
                        success: function(item) {
450
                            var tr = $("#item_"+itemnumber);
451
                            tr.html('');
452
                            _build_item(item, tr);
453
                        }
454
                    });
486
                }
455
                }
456
            }, 500);
457
        }
487
458
488
                if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){
459
        var periods={};
489
                    alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
460
        var funds={};
490
                    return false;
461
        var funds_tree = [];
491
                };
462
463
        var QTY_TOTAL = _("Receiving %0$s out of %1$s");
464
        var EDIT = _("edit");
465
        var MOD_TITLE = _("Edit %s");
466
        var SUGGESTION = _("suggestion #%s");
467
        var FUND_KEEP = _("Keep current (%0$s - %1$s)");
468
        var FUNC_CUR = _("(Current: %0$s - %1$s)");
469
        var ADJ_TAX_INC = _("(adjusted for %s, tax inclusive)");
470
        var ADJ_TAX_EXC = _("(adjusted for %s, tax exclusive)");
471
        var TAX_INC = _("(tax inclusive)");
472
        var TAX_EXC = _("(tax exclusive)");
473
        var SAVE_WARNING = _("Order %s: Warning, you have entered more items than expected. Extra items will not be created.");
474
        var SAVE_WARNING_NO_ITEMS = _("Order %s: No quantity to receive set. No items will be created.");
475
        var SAVE_ERROR = _("Order %s: An error occurred while saving");
476
        var SAVE_WARNING_TITLE = _("Warning");
477
        var SAVE_ERROR_TITLE = _("Error");
478
479
480
        var CAN_user_acquisition = "[% CAN_user_acquisition | html %]";
481
        var AcqCreateItem = "[% Koha.Preference('AcqCreateItem') | html %]";
482
        var edit_mode = "[% edit | html %]";
483
        var invoiceincgst = "[% invoiceincgst | html %]";
484
        var active_currency = "[% active_currency.currency | html %]";
485
        var invoice_id = "[% invoiceid | html %]";
492
486
493
                // Remove last itemblock if it is not in items_list
487
        $(document).ready(function(){
494
                var lastitemblock = $("#outeritemblock > div:last");
488
            var base_query = { "order_id": {"in": [[% multiple_orders | html %]]}};
495
                var tobedeleted = true;
489
            var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1";
496
                var listitems = $("#items_list tr");
490
            var options = {
497
                $(listitems).each(function(){
491
                "ajax": {
498
                    if($(this).attr('idblock') == $(lastitemblock).attr('id')){
492
                    "url": pending_orders_url + "&q=" + encodeURI(JSON.stringify(base_query))
499
                        tobedeleted = false;
493
                },
494
                "embed": [
495
                    "basket",
496
                    "biblio.suggestions.suggester",
497
                    "fund.budget",
498
                    "items+strings",
499
                    "creator"
500
                ],
501
                'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
502
                "columns": [
503
                    {
504
                        "data": "order_id",
505
                        "searchable": true,
506
                        "orderable": true
507
                    },
508
                    {
509
                        "data": "biblio.title",
510
                        "searchable": true,
511
                        "orderable": true,
512
                        "render": function(data, type, row, meta) {
513
                            if ( data == null ) {
514
                                return "";
515
                            }
516
                            else {
517
                                return data;
518
                            }
519
                        }
520
                    },
521
                    {
522
                        "data": "biblio.author",
523
                        "searchable": true,
524
                        "orderable": true,
525
                        "render": function(data, type, row, meta) {
526
                            if ( data == null ) {
527
                                return "";
528
                            }
529
                            else {
530
                                return data;
531
                            }
532
                        }
533
                    },
534
                    {
535
                        "data": "biblio.isbn",
536
                        "searchable": true,
537
                        "orderable": true,
538
                        "render": function(data, type, row, meta) {
539
                            if ( data == null ) {
540
                                return "";
541
                            }
542
                            else {
543
                                return data;
544
                            }
545
                        }
546
                    },
547
                    {
548
                        "searchable": false,
549
                        "orderable": false,
550
                        "data": function(row, type, val, meta) {
551
                            return $date(row.date_received||new Date().toISOString());
552
                        }
553
                    },
554
                    {
555
                        "data": "fund.name",
556
                        "searchable": true,
557
                        "orderable": false,
558
                        "render": function(data, type, row, meta) {
559
                            return row.fund.budget.budget_period_description+" - "+row.fund.name;
560
                        }
561
                    },
562
                    {
563
                        "searchable": false,
564
                        "orderable": true,
565
                        "data": "quantity_received",
566
                        "render": function(data, type, row, meta) {
567
                            var data = $("#order_edit").data();
568
                            return QTY_TOTAL.format(row.subscription_id&&(!data.saved||!data.saved.hasOwnProperty(row.order_id))?row.quantity:row.quantity_received, row.quantity);
569
                        }
570
                    },
571
                    {
572
                        "searchable": false,
573
                        "orderable": false,
574
                        "render": function(data, type, row, meta) {
575
                            return '<a data-toggle="modal" href="#order_edit" data-row="'+meta.row+'" class="order_edit_toggle">'+EDIT+'</a>';
576
                        }
500
                    }
577
                    }
501
                });
578
                ]
502
                if(tobedeleted){
579
            };
503
                    $(lastitemblock).remove();
580
            var orders_table = $("#multiple_orders").kohaTable(options);
504
                }
581
            var api = orders_table.api();
505
582
506
                if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){
583
            api.on('preDraw', function() {
507
                    alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
584
                var saved = $("#order_edit").data('saved');
508
                    if(tobedeleted) {
585
                if(saved) {
509
                        $(lastitemblock).appendTo("#outeritemblock");
586
                    var data = api.data();
587
                    for(var i = 0; i<data.length; i++) {
588
                        var row = data[i];
589
                        var srow = saved[row.order_id];
590
                        if(srow) {
591
                            if(row.fund_id != srow.fund_id) {
592
                                row.fund.budget.budget_period_description = $("#bookfund option[value="+srow.fund_id+"]").parent().attr('label');
593
                                row.fund.name = $("#bookfund option[value="+srow.fund_id+"]").html();
594
                            }
595
                            row.date_received = srow.date_received;
596
                            row.quantity = srow.quantity;
597
                            row.quantity_received = srow.quantity_received;
598
                        }
510
                    }
599
                    }
511
                    return false;
600
                }
512
                };
601
            });
513
            [% END %]
514
602
515
            if( $("#quantity").val() < 1 ) {
603
            var _doSave = function(params) {
516
                alert(_("You must receive at least one item"));
604
                $.ajax($.extend({
517
                return false;
605
                    method: 'POST',
518
            }
606
                    url: '/cgi-bin/koha/acqui/finishreceive.pl'
607
                }, params));
608
            };
519
609
520
            return true;
610
            var _transform_row = function(row, origrec) {
521
        }
611
                var params = {};
612
                params['biblionumber'] = row.biblio_id;
613
                params['invoiceid'] = invoice_id;
614
                params['ordernumber'] = row.order_id;
615
                params['booksellerid'] = row.basket.vendor_id;
522
616
523
        [% IF (AcqCreateItem == 'ordering') %]
617
                if(row.biblio.suggestions.length && row.biblio.suggestions[0].reason) {
524
            var items_columns = [null, null, 'barcode', 'homebranchname',
618
                    params["suggestionid"] = row.biblio.suggestions[0].suggestion_id;
525
                'holdingbranchname', 'notforloan', 'restricted', 'location',
619
                    if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) {
526
                'itemcallnumber', 'copynumber', 'stocknumber', 'collection',
620
                        params['reason'] =  row.biblio.suggestions[0].reason;
527
                'itemtype', 'materials', 'itemnotes'];
621
                    } else {
528
622
                        params['reason'] = 'other';
529
            function PopupEditPage(biblionumber, itemnumber) {
623
                        params['other_reason'] = row.biblio.suggestions[0].reason;
530
                var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
624
                    }
531
                    + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
625
                }
532
                var w = window.open(url);
626
                params['datereceived'] = row.date_received;
533
                var watchClose = setInterval(function() {
627
                params['bookfund'] = row.fund_id;
534
                    if (w.closed) {
628
                params['quantity'] = row.quantity;
535
                        clearTimeout(watchClose);
629
                params['quantityrec'] = row.quantity_received;
536
                        $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl',
630
                params['origquantityrec'] = origrec;
537
                            {
631
                var effective_create_items = row.basket.create_items || AcqCreateItem;
538
                                'itemnumber': itemnumber
632
                params['tax_rate'] = (effective_create_items == 'receiving')?row.tax_rate_on_receiving:row.tax_rate_on_ordering;
633
                params['replacementprice'] = row.replacement_price;
634
                params['unitprice'] = invoiceincgst=="1"?row.unit_price_tax_included:row.unit_price_tax_excluded;
635
                params['order_internalnote'] = row.internal_note;
636
                if(effective_create_items == 'receiving') {
637
                    Object.keys(row.items).forEach(function(key) {
638
                        var item = row.items[key];
639
                        Object.keys(item).forEach(function(key) {
640
                            var field = item[key];
641
                            Object.keys(field).forEach(function(key) {
642
                                if(!params[key]) params[key] = [];
643
                                params[key].push(item[key]);
644
                            });
645
                        });
646
                    });
647
                } else if(effective_create_items == 'ordering') {
648
                    params['items_to_receive'] = (row.items||[])
649
                        .filter(function(item) {
650
                            return item._checked
651
                        })
652
                        .map(function(item) {
653
                            item.item_id;
654
                        })
655
                }
656
                return params;
657
            };
658
659
            var save_rows = function(rows, data) {
660
                if(rows.length) {
661
                    $('#jobpanel, #jobstatus').show();
662
                    errors = []
663
                    var loopRows = function(i) {
664
                        var row = rows[i];
665
                        if(!row) {
666
                            if(!errors.length) {
667
                                location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id
668
                            } else {
669
                                $('#modal_messages .modal-header h4').html(SAVE_ERROR_TITLE);
670
                                $('#modal_messages .modal-body ul').html('');
671
                                errors.forEach(function(error) {
672
                                    $('#modal_messages .modal-body ul').append('<li>'+error+'</li>');
673
                                });
674
                                $('#modal_messages .modal-footer .cancel').hide();
675
                                $('#modal_messages .modal-footer .accept').html(_("Accept"));
676
                                $('#modal_messages .modal-footer .accept').one('click', function() {
677
                                    location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id
678
                                });
679
                                $('#modal_messages').modal('show');
680
                            }
681
                            return;
682
                        }
683
                        if(data.saved && data.saved[row.order_id]) {
684
                            row = data.saved[row.order_id];
685
                            var origrec = data.origrec[row.order_id];
686
                        } else {
687
                            var origrec = row.quantity_received;
688
                        }
689
                        var _set_percentage = function() {
690
                            var percentage = Math.round(( (i+1) / rows.length) * 100);
691
                            var bgproperty = (parseInt(percentage*2)-300)+"px 0px";
692
                            $("#jobprogress").css("background-position",bgproperty);
693
                            $("#jobprogresspercent").text(percentage);
694
                        }
695
                        _doSave({
696
                            data: _transform_row(row, origrec),
697
                            success: function() {
698
                                _set_percentage();
699
                                loopRows(i+1);
539
                            },
700
                            },
540
                            function(item) {
701
                            error: function() {
541
                                var tds = $("#item_"+itemnumber+" td");
702
                                _set_percentage()
542
                                for(var i=2; i<tds.length; i++) {
703
                                errors.push(SAVE_ERROR.format(row.order_id));
543
                                    var column = items_columns[i];
704
                                loopRows(i+1);
544
                                    var text = item[column];
545
                                    if ( text == null ) text = '';
546
                                    $(tds[i]).text(text);
547
                                }
548
                            }
705
                            }
549
                        );
706
                        });
707
                    };
708
                    loopRows(0)
709
                }
710
            };
711
712
            var get_warnings = function(rows) {
713
                var warnings = [];
714
                rows.forEach(function(row) {
715
                    if(row.quantity_received > row.quantity) {
716
                        warnings.push(SAVE_WARNING.format(row.order_id));
717
                        row.quantity_received = row.quantity;
550
                    }
718
                    }
551
                }, 500);
719
                    if(row.quantity_received == '0') {
720
                        warnings.push(SAVE_WARNING_NO_ITEMS.format(row.order_id));
721
                    }
722
                })
723
                return warnings;
552
            }
724
            }
553
725
554
            function CalcQtyToReceive() {
726
            $('#modal_messages .modal-footer .cancel').on('click', function() {
555
                var qty = $("input[name='items_to_receive']:checked").length;
727
                $('#modal_messages .modal-footer .accept').off('click');
556
                $("#quantity").val(qty);
728
                $('#modal_messages').modal('hide');
557
            }
729
            })
730
            $('.save').click(function() {
731
                var data = $("#order_edit").data();
732
                var rows = api.rows().data().toArray();
733
                var redirect = true;
734
                var warnings = get_warnings(rows);
735
                if(warnings.length) {
736
                    $('#modal_messages .modal-header h4').html(SAVE_WARNING_TITLE);
737
                    $('#modal_messages .modal-body ul').html('');
738
                    warnings.forEach(function(warning) {
739
                        $('#modal_messages .modal-body ul').append('<li>'+warning+'</li>');
740
                    });
741
                    $('#modal_messages .modal-footer .cancel').show();
742
                    $('#modal_messages .modal-footer .accept').html(_("Continue"));
743
                    $('#modal_messages .modal-footer .accept').one('click', function() {
744
                        $('#modal_messages').modal('hide');
745
                        save_rows(rows, data);
746
                    });
747
                    $('#modal_messages').modal('show');
748
                } else {
749
                    save_rows(rows, data);
750
                }
751
            });
558
752
559
            function CheckNItems(n) {
560
                $("input[name='items_to_receive']").each(function() {
561
                    $(this).prop('checked', false);
562
                });
563
                $("input[name='items_to_receive']:lt("+n+")").each(function () {
564
                    $(this).prop('checked', true);
565
                });
566
            }
567
        [% END %]
568
753
569
        $(document).ready(function() {
754
            $("#order_edit").on("change", "#reason", function() {
755
                var val = $(this).val();
756
                var row = $("#order_edit").data('row');
757
                if(val == 'other') {
758
                    $("#other_reason").show();
759
                    $(this).hide();
760
                } else {
761
                    row.biblio.suggestions[0].reason = val;
762
                }
763
            });
764
765
            $("#order_edit").on("change", "#select-other_reason", function() {
766
                var val = $(this).val();
767
                var row = $("#order_edit").data('row');
768
                row.biblio.suggestions[0].reason = val;
769
            });
570
770
571
            //keep a copy of all budgets before removing the inactives
771
            $("#order_edit").on("click", "#other_reason a", function() {
572
            disabledBudgetsCopy = $('#bookfund').html();
772
                $("#other_reason").hide();
573
            $('#bookfund .inactive_budget').remove();
773
                $("#reason").val(null).show();
774
            });
574
775
575
            $('#showallbudgets').click(function() {
776
            $("#order_edit").on("change", "#datereceived", function() {
576
                if ($(this).is(":checked")) {
777
                var val = $(this).val();
577
                    $('#bookfund').html(disabledBudgetsCopy); //Puts back all the funds
778
                var row = $("#order_edit").data('row');
578
                }
779
                row.date_received = val;
579
                else {
780
            });
580
                    $('#bookfund .inactive_budget').remove();
781
782
            $("#order_edit").on("change", "#bookfund", function() {
783
                var val = $(this).val();
784
                var row = $("#order_edit").data('row');
785
                row.fund_id = val;
786
            });
787
788
            $("#order_edit").on("change", "#quantity_to_receive", function() {
789
                var val = $(this).val();
790
                var row = $("#order_edit").data('row');
791
                row.quantity = val;
792
                if(row.subscription_id) {
793
                    $("#quantity").val(val).change();
581
                }
794
                }
582
            });
795
            });
583
796
584
            [% IF (AcqCreateItem == 'receiving') %]
797
            $("#order_edit").on("change", "#quantity", function() {
585
                cloneItemBlock(0, '[% Koha.Preference('UniqueItemFields') | html %]');
798
                var val = $(this).val();
586
            [% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %]
799
                var row = $("#order_edit").data('row');
587
                $("input[name='items_to_receive']").change(function() {
800
                row.quantity_received = val;
588
                    CalcQtyToReceive();
801
                var qtyto = parseInt($("#quantity_to_receive").val());
802
                if(parseInt(val) > qtyto) {
803
                    $("#qtyrecerror").show();
804
                } else {
805
                    $("#qtyrecerror").hide();
806
                }
807
                $("input[name='items_to_receive']").each(function() {
808
                    $(this).prop('checked', false).change();
589
                });
809
                });
590
                CalcQtyToReceive();
810
                $("input[name='items_to_receive']:lt("+val+")").each(function () {
591
                $("#quantity").keyup(function() {
811
                    $(this).prop('checked', true).change();
592
                    var qty = parseInt($("#quantity").val());
593
                    var qtyto = parseInt($("#quantity_to_receive").val());
594
                    if(qty > qtyto) {
595
                        $("#qtyrecerror").show();
596
                    } else {
597
                        $("#qtyrecerror").hide();
598
                    }
599
                    CheckNItems($(this).val());
600
                });
812
                });
601
            [% END %]
813
            });
814
815
            $("#order_edit").on("change", "input[name='items_to_receive']", function() {
816
                var qty = $("input[name='items_to_receive']:checked").length;
817
                $("#quantity").val(qty);
818
                var row = $("#order_edit").data('row');
819
                row.quantity_received = qty;
820
            })
821
822
            $("#order_edit").on("change", "#tax_rate", function() {
823
                var val = $(this).val();
824
                if(val === null) $(this).val($('option:first-child', this).attr('value'));
825
                val = $(this).val();
826
                var row = $("#order_edit").data('row');
827
                var effective_create_items = row.basket.create_items || AcqCreateItem;
828
                if(effective_create_items == 'receiving') {
829
                    row.tax_rate_on_receiving = val;
830
                } else {
831
                    row.tax_rate_on_ordering = val;
832
                }
833
834
            });
602
835
603
            $("input[name='change_currency']").on("change", function(){
836
            $("#order_edit").on("change", "#unitprice", function() {
837
                var val = $(this).val();
838
                var row = $("#order_edit").data('row');
839
                if(invoiceincgst == "1") {
840
                    row.unit_price_tax_included = val;
841
                } else {
842
                    row.unit_price_tax_excluded = val;
843
                }
844
845
            });
846
847
            $("#order_edit").on("change", "input[name='change_currency']", function(){
604
                if ( $(this).is(":checked") ) {
848
                if ( $(this).is(":checked") ) {
605
                    $("#select_currency").show();
849
                    $("#select_currency").show();
606
                    $("#unitprice").prop("readonly", "true");
850
                    $("#unitprice").prop("readonly", "true");
607
                } else {
851
                } else {
608
                    $("#select_currency").hide();
852
                    $("#select_currency").hide();
609
                    $("#invoice_unitprice").val(""); // Empty to not store the values
610
                    $("#invoice_currency").val("");
611
                    $("#unitprice").prop("readonly", "");
853
                    $("#unitprice").prop("readonly", "");
612
                }
854
                }
613
            });
855
            });
614
856
615
            [% IF order.invoice_unitprice %]
857
            function _update_unitprice() {
616
                $("input[name='change_currency']").click();
858
                var rate = Number($("select[name='currency'] option:selected").val());
617
            [% ELSE %]
859
                var unitprice = $("#unitprice_currency").val();
618
                $("input[name='change_currency']").trigger('change');
619
            [% END %]
620
621
            function update_unitprice() {
622
                var rate = Number($("select[name='invoice_currency'] option:selected").data('rate'));
623
                var unitprice = $("#invoice_unitprice").val();
624
                var new_unitprice = Number( unitprice * rate ).toFixed(2);
860
                var new_unitprice = Number( unitprice * rate ).toFixed(2);
625
                $("#unitprice").val(new_unitprice);
861
                $("#unitprice").val(new_unitprice).change();
626
            }
862
            }
627
            $("select[name='invoice_currency']").on("change", function(){update_unitprice()} );
863
            $("#order_edit").on("change", "select[name='currency']", _update_unitprice );
628
            $("#invoice_unitprice").on("change", function(){update_unitprice()} );
864
            $("#order_edit").on("change", "#unitprice_currency", _update_unitprice );
629
865
630
            [% IF other_reason %]
866
            $("#order_edit").on("change", "#replacementprice", function() {
631
                $(".select-reason").hide();
867
                var val = $(this).val();
632
                $(".select-reason").find("option[value='other']").attr("selected","selected");
868
                var row = $("#order_edit").data('row');
633
                $("#other_reason").show();
869
                row.replacement_price = val;
634
            [% ELSE %]
870
            });
635
                $("#other_reason").hide();
871
636
            [% END %]
872
            $("#order_edit").on("change", "#order_internalnote", function() {
637
            $(".select-reason").change(function(){
873
                var val = $(this).val();
638
                if($(this).val() == "other"){
874
                var row = $("#order_edit").data('row');
639
                    $(this).hide();
875
                row.internal_note = val;
640
                    $("#other_reason").show();
876
877
            });
878
879
            var keep_row = function() {
880
                var row = $("#order_edit").data('row');
881
                var kept = $("#order_edit").data('kept')||{};
882
                if($('#items_list tbody tr').length) {
883
                    row.items = [];
884
                    $('#items_list tbody tr').each(function() {
885
                        var item = {};
886
                        $('#'+$(this).attr('idblock')).find('*[name=kohafield]').each(function() {
887
                            var kf = $(this).val();
888
                            var obj = {};
889
                            $(this).parent().find('*[name]').each(function() {
890
                                obj[$(this).prop('name')] = $(this).val();
891
                            });
892
                            item[kf] = obj;
893
                        });
894
                        row.items.push(item);
895
                    });
896
                }
897
                kept[row.order_id] = row;
898
                $("#order_edit").data('kept', kept);
899
            };
900
901
            var save_row = function() {
902
                keep_row();
903
                var saved = $("#order_edit").data('saved')||{};
904
                var kept = $("#order_edit").data('kept');
905
                var saved_rows = $.extend(saved, kept);
906
                $("#order_edit").data('saved', saved_rows);
907
                api.draw();
908
                return saved_rows;
909
            }
910
911
            var set_modal_buttons = function() {
912
                var n = $("#order_edit").data('n');
913
                var info = api.page.info();
914
915
                $('.modal-prev').prop('disabled', info.page == 0 && n == 0);
916
                $('.modal-next').prop('disabled', info.pages - 1 == info.page && info.end - info.start - 1 == n);
917
            };
918
919
            var show_subs = function(row) {
920
                //$("#child_orders").show();
921
                var had_rows = false;
922
                var base_query = { "subscription_id": row.subscription_id, "parent_order_id": row.order_id, "order_id": {"!=": row.order_id}};
923
                var pending_orders_url = "/api/v1/acquisitions/orders";
924
                var options = {
925
                    "ajax": {
926
                        "url": pending_orders_url + "?q=" + encodeURI(JSON.stringify(base_query))
927
                    },
928
                    "header_filter": true,
929
                    "embed": [
930
                        "invoice",
931
                        "basket"
932
                    ],
933
                    "order": [[1, 'asc']],
934
                    'dom': 'C<"top pager"ilpfB>tr<"bottom pager"ip>',
935
                    "columns": [
936
                        {
937
                            "searchable": false,
938
                            "orderable": false,
939
                            "data": function(row, type, val, meta) {
940
                                if(row.invoice) {
941
                                    if(CAN_user_acquisition) {
942
                                        return '<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid='+row.invoice_id+'" title="Invoice detail page">'+row.invoice.invoice_number+"</a>";
943
                                    }
944
                                    return row.invoice.invoice_number;
945
                                }
946
                            }
947
                        },
948
                        {
949
                            "data": "order_id",
950
                            "searchable": false,
951
                            "orderable": false
952
                        },
953
                        {
954
                            "searchable": false,
955
                            "orderable": false,
956
                            "data": "basket.creation_date",
957
                            "render": function(data, type, row, meta) {
958
                                return $date(row.basket.creation_date);
959
                            }
960
                        },
961
                        {
962
                            "searchable": false,
963
                            "orderable": false,
964
                            "data": function(row, type, val, meta) {
965
                                return $date(row.date_received);
966
                            }
967
                        },
968
                        {
969
                            "searchable": false,
970
                            "orderable": false,
971
                            "data": function(row, type, val, meta) {
972
                                return row.quantity_received;
973
                            }
974
                        },
975
                        {
976
                            "searchable": false,
977
                            "orderable": true,
978
                            "data": function(row, type, val, meta) {
979
                                if(!row.status) return;
980
                                var first_letter = row.status[0].toUpperCase();
981
                                return first_letter+row.status.substr(1).toLowerCase();
982
                            }
983
                        },
984
                        {
985
                            "searchable": false,
986
                            "orderable": false,
987
                            "data": function(row, type, val, meta) {
988
                                if(!row.date_received) return;
989
                                return Number(row.unit_price_tax_excluded * row.quantity_received).format_price()+' / '+Number(row.unit_price_tax_included * row.quantity_received).format_price()
990
                            }
991
                        },
992
                        {
993
                            "searchable": false,
994
                            "orderable": false,
995
                            "data": function(row, type, val, meta) {
996
                                return row.internal_note;
997
                            }
998
                        }
999
                    ]
1000
                };
1001
                var child_orders_table = $("#child_orders_table").api(options);
1002
                var child_api = child_orders_table.api();
1003
                child_api.on('preDraw', function() {
1004
                    if(!child_api.data().length && !had_rows) return;
1005
                    $("#history-panel").show();
1006
                    had_rows = true;
1007
                });
1008
            };
1009
1010
            var set_editor = function() {
1011
                var modal = $("#order_edit");
1012
                var row = modal.data('row');
1013
                var origrec = $("#order_edit").data('origrec')||{};
1014
                if(!origrec.hasOwnProperty(row.order_id)) {
1015
                    origrec[row.order_id] = row.quantity_received;
1016
                    $("#order_edit").data('origrec', origrec);
1017
                }
1018
                if(row.subscription_id) {
1019
                    row.quantity_received = row.quantity;
1020
                }
1021
                var keep = $("#order_edit").data('kept');
1022
                if(keep && keep[row.order_id]) {
1023
                    row = keep[row.order_id];
1024
                    modal.data('row', row);
1025
                }
1026
                $('input, select, textarea', '.modal-body').val(null)
1027
                modal.find(".modal-title").text(MOD_TITLE.format(row.biblio.title));
1028
                ["title", "author", "copyright_date", "isbn", "series_title"].forEach(function(key){
1029
                    var o = modal.find(".modal-body #biblio_"+key);
1030
                    if(row.biblio[key] !== null) {
1031
                        o.parent().show();
1032
                        o.html(row.biblio[key]);
1033
                    } else {
1034
                        o.parent().hide();
1035
                    }
1036
                });
1037
                if(row.biblio.suggestions.length) {
1038
                    $("#suggestion_fieldset").show();
1039
                    if(row.biblio.suggestions[0].suggester) {
1040
                        $("#biblio_suggestion_suggester").parent().show();
1041
                        $("#biblio_suggestion_suggester")
1042
                            .html(
1043
                                [row.biblio.suggestions[0].suggester.surname, row.biblio.suggestions[0].suggester.firstname]
1044
                                    .filter(function(name){
1045
                                        return name
1046
                                    })
1047
                                    .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>)'
1048
                            );
1049
                    } else {
1050
                        $("#biblio_suggestion_suggester").parent().hide();
1051
                    }
1052
                    if(row.biblio.suggestions[0].reason) {
1053
                        $("#suggestion_reason").show();
1054
                        if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) {
1055
                             $("#other_reason a").click();
1056
                            $("#reason").val(row.biblio.suggestions[0].reason);
1057
                            $("#select-other_reason").val(null);
1058
                        } else {
1059
                            $("#reason").val("other").change();
1060
                            $("#select-other_reason").val(row.biblio.suggestions[0].reason);
1061
                        }
1062
1063
                    } else {
1064
                        $("#suggestion_reason").hide();
1065
                    }
1066
                } else {
1067
                    $("#suggestion_fieldset").hide();
1068
                }
1069
1070
                var effective_create_items = row.basket.create_items || AcqCreateItem;
1071
                $("#datereceived").val(row.date_received||$date(new Date().toISOString())).change();
1072
                $("#bookfund option[value='']").html(FUND_KEEP.format(row.fund.budget.budget_period_description, row.fund.name));
1073
                if(row.fund_id != row.fund.fund_id) {
1074
                    $("#bookfund").val(row.fund_id);
1075
                }
1076
                $("#current-fund").html(FUNC_CUR.format(row.fund.budget.budget_period_description, row.fund.name));
1077
                $("#creator").html([row.creator.surname, row.creator.firstname].filter(function(name){return name}).join(', ')+" ("+row.creator.patron_id+')')
1078
                $("#quantity_to_receive").val(row.quantity).prop('readonly', !row.subscription_id);
1079
                $("#quantity").val(row.quantity_received).prop('readonly', !row.subscription_id && effective_create_items == 'receiving');
1080
                $('#qtyrecerror').hide();
1081
                var tax_rate = row.tax_rate_on_receiving || row.tax_rate_on_ordering;
1082
                $("#tax_rate").val(tax_rate).change();
1083
                var rrp_txt;
1084
                var ecost_txt;
1085
                if(invoiceincgst == "1") {
1086
                    rrp_txt = Number(row.rrp_tax_included).format_price()+'<span class="hint">'+ADJ_TAX_INC.format(active_currency)+"</span>";
1087
                    ecost_txt = Number(row.ecost_tax_included).format_price()+'<span class="hint">'+TAX_INC+"</span>";
1088
                    $("#unitprice").val(row.unit_price_tax_included);
1089
                    $("#unitprice_hint").html(TAX_INC);
1090
                } else {
1091
                    rrp_txt = Number(row.rrp_tax_excluded).format_price()+'<span class="hint">'+ADJ_TAX_EXC.format(active_currency)+"</span>";
1092
                    ecost_txt = Number(row.ecost_tax_excluded).format_price()+'<span class="hint">'+TAX_EXC+"</span>";
1093
                    $("#unitprice").val(row.unit_price_tax_excluded);
1094
                    $("#unitprice_hint").html(TAX_EXC);
1095
                }
1096
                $("#rrp").html(rrp_txt);
1097
                $("#replacementprice").val(row.replacement_price);
1098
                $("#ecost").html(ecost_txt);
1099
                $("#order_internalnote").val(row.internal_note);
1100
                if(row.vendor_note) {
1101
                    $("#order_vendornote").html(row.vendor_note);
1102
                    $("#order_vendornote").parent().show();
1103
                } else {
1104
                    $("#order_vendornote").parent().hide();
1105
                }
1106
1107
1108
                $("#history-panel").hide();
1109
1110
                $('#items_list tbody tr, #outeritemblock > *, #acq-create-ordering tbody tr').remove();
1111
                $('#items_list').hide();
1112
                if(row.subscription_id) {
1113
                    $('#modal-order-main #items-panel').removeClass('show').addClass('hide');
1114
                    $('#modal-order-main #history-panel').removeClass('hide').addClass('show');
1115
                    /*$('#modal-order-main').tabs("disable", "#items-panel");
1116
                    $('#modal-order-main').tabs("enable", "#history-panel");
1117
                    if($('#modal-order-main').tabs( "option", "active" ) == 3) {
1118
                        $('#modal-order-main').tabs( "option", "active", 0);
1119
                    }*/
1120
                } else {
1121
                    $('#modal-order-main #history-panel').removeClass('show').addClass('hide');
1122
                    $('#modal-order-main #items-panel').removeClass('hide').addClass('show');
1123
                    /*$('#modal-order-main').tabs("enable", "#items-panel");
1124
                    $('#modal-order-main').tabs("disable", "#history-panel");
1125
                    if($('#modal-order-main').tabs( "option", "active" ) == 2) {
1126
                        $('#modal-order-main').tabs( "option", "active", 0);
1127
                    }*/
1128
                    if(effective_create_items == 'receiving') {
1129
                        $("#acq-create-receiving").show();
1130
                        $("#acq-create-ordering").hide();
1131
                        if(row.items && row.items.length) {
1132
                            row.items.forEach(function(item, index) {
1133
                                cloneItemBlock(index, '[% UniqueItemFields | html %]', function(block_id) {
1134
                                    var block = $('#'+block_id).hide();
1135
                                    Object.keys(item).forEach(function(key) {
1136
                                        block
1137
                                            .find('*[name=kohafield][value="'+key+'"]')
1138
                                            .parent()
1139
                                            .find('*[name=field_value]')
1140
                                            .val(item[key].field_value);
1141
                                    });
1142
                                    addItemInList(block_id, '[% UniqueItemFields | html %]');
1143
                                    block.find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) );
1144
                                    block.find("input[name='buttonPlusMulti']").remove();
1145
                                    block.find("input[name='multiValue']").remove();
1146
                                });
1147
                            });
1148
                        }
1149
                        cloneItemBlock((row.items && row.items.length) || 0, '[% UniqueItemFields | html %]');
1150
                    } else if (effective_create_items == 'ordering') {
1151
                        $("#acq-create-receiving").hide();
1152
                        $("#acq-create-ordering").show();
1153
                        if(row.items.length) {
1154
                            $("#acq-create-ordering tbody").append(
1155
                                row.items.map(function(item) {
1156
                                    var tr = $('<tr id="item_'+item.item_id+'"/>');
1157
                                    _build_item(item, tr);
1158
                                    return tr;
1159
                                })
1160
                            );
1161
                        }
1162
                    } else {
1163
                        $('#modal-order-main #items-panel').removeClass('show').addClass('hide');
1164
                        /*
1165
                        if($('#modal-order-main').tabs( "option", "active" ) == 3) {
1166
                            $('#modal-order-main').tabs( "option", "active", 0);
1167
                        }
1168
                        $('#modal-order-main').tabs("disable", "#items-panel");
1169
                        */
1170
                    }
1171
                }
1172
                $("#select_currency").hide();
1173
                $("#unitprice").prop("readonly", "");
1174
                $("input[name='change_currency']").prop('checked', false);
1175
                set_modal_buttons();
1176
            };
1177
1178
            $('.modal-prev').click(function() {
1179
                var modal = $("#order_edit");
1180
                keep_row();
1181
                var n = modal.data('n');
1182
                if(n > 0) {
1183
                    n--;
1184
                    modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1185
                    modal.data('n', n);
1186
                    set_editor();
1187
                } else {
1188
                    $('.modal-next, .modal-prev').prop('disabled', true);
1189
                    orders_table.one('draw.dt', function() {
1190
                        var info = api.page.info();
1191
                        n = info.end - info.start - 1;
1192
                        modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1193
                        modal.data('n', n);
1194
                        set_editor();
1195
                    });
1196
                    api.page('previous').draw( 'page' );
641
                }
1197
                }
642
            });
1198
            });
643
            $("a[href*=back]").click(function(){
1199
644
                $(".select-reason").show().find("option[value='']").attr("selected","selected");
1200
            $('.modal-next').click(function() {
645
                $("#other_reason").hide();
1201
                var modal = $("#order_edit");
1202
                keep_row();
1203
                var n = modal.data('n');
1204
                var info = api.page.info();
1205
                if(n < info.end - info.start - 1) {
1206
                    n++;
1207
                    modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1208
                    modal.data('n', n);
1209
                    set_editor();
1210
                } else {
1211
                    $('.modal-next, .modal-prev').prop('disabled', true);
1212
                    orders_table.one('draw.dt', function() {
1213
                        var info = api.page.info();
1214
                        n = 0;
1215
                        modal.data('row', JSON.parse(JSON.stringify(api.row(n).data())));
1216
                        modal.data('n', n);
1217
                        set_editor();
1218
                    });
1219
                    api.page('next').draw( 'page' );
1220
                }
1221
            });
1222
1223
            $('.modal-save').click(function() {
1224
                var saved_rows = save_row();
1225
                if(Object.keys(saved_rows).length) $('.save').prop('disabled', false);
1226
                $("#order_edit").modal('hide');
1227
            })
1228
1229
            /*$('#modal-order-main').tabs({
1230
                activate: function(event, ui) {
1231
                    var active = ui.newPanel.attr('id')
1232
                    if(active == 'history-panel') {
1233
                        show_subs($("#order_edit").data('row'));
1234
                    }
1235
                }
1236
            });*/
1237
1238
            $("#order_edit").on("show.bs.modal", function (event) {
1239
                var anchor = $(event.relatedTarget);
1240
                var n = anchor.data("row");
1241
                var row = api.row(n).data();
1242
1243
                var modal = $(this);
1244
                modal.data('row', JSON.parse(JSON.stringify(row)));
1245
                modal.data('n', n);
1246
                modal.data('keep', modal.data('saved')||{});
1247
                //$('#modal-order-main').tabs("option", "active", 0);
1248
                set_editor();
646
            });
1249
            });
647
1250
1251
            $("#order_edit").on("hide.bs.modal", function() {
1252
                $("#child_orders_table").DataTable().off('preDraw').destroy();
1253
            });
648
        });
1254
        });
649
    </script>
1255
    </script>
650
[% END %]
1256
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-4 / +53 lines)
Lines 114-119 Link Here
114
        <table id="pending_orders" class="table table-bordered table-striped">
114
        <table id="pending_orders" class="table table-bordered table-striped">
115
            <thead>
115
            <thead>
116
                <tr>
116
                <tr>
117
                    <th><!--input type="checkbox" id="selectAll"/--></th>
117
                    <th>Basket</th>
118
                    <th>Basket</th>
118
                    <th>Basket group</th>
119
                    <th>Basket group</th>
119
                    <th>Order line</th>
120
                    <th>Order line</th>
Lines 129-134 Link Here
129
                </tr>
130
                </tr>
130
            </thead>
131
            </thead>
131
        </table>
132
        </table>
133
      <fieldset class="action">
134
        <button id="select_multiple" class="btn btn-primary"></button>
135
      </fieldset>
132
    </div>
136
    </div>
133
[% ELSE %]
137
[% ELSE %]
134
    <p>
138
    <p>
Lines 341-348 Link Here
341
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
345
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
342
    [% INCLUDE 'datatables.inc' %]
346
    [% INCLUDE 'datatables.inc' %]
343
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
347
    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
348
    <style>fieldset.action { margin-bottom: 20px }</style>
344
    <script>
349
    <script>
345
        dt_overwrite_html_sorting_localeCompare();
350
        dt_overwrite_html_sorting_localeCompare();
351
        var PENDING_MULTI_SELECTION = _("Receive selected (%s)");
346
        var columns_filter = {};
352
        var columns_filter = {};
347
353
348
        $(document).ready(function(){
354
        $(document).ready(function(){
Lines 374-380 Link Here
374
                }));
380
                }));
375
            }
381
            }
376
382
377
            var pending_orders_table = $("#pending_orders").kohaTable({
383
            var options = {
378
                "ajax": {
384
                "ajax": {
379
                    "url": '/api/v1/acquisitions/orders?only_active=1'
385
                    "url": '/api/v1/acquisitions/orders?only_active=1'
380
                },
386
                },
Lines 401-407 Link Here
401
                },
407
                },
402
                "columns": [
408
                "columns": [
403
                    { "data": "basket.name",
409
                    { "data": "basket.name",
404
                    "searchable": true,
410
                      "searchable": true,
405
                      "orderable": true,
411
                      "orderable": true,
406
                      "render": function(data, type, row, meta) {
412
                      "render": function(data, type, row, meta) {
407
                        if (type != 'display') return escape_str(data);
413
                        if (type != 'display') return escape_str(data);
Lines 565-571 Link Here
565
                    {
571
                    {
566
                        "data": "",
572
                        "data": "",
567
                        "render": function(data, type, row, meta) {
573
                        "render": function(data, type, row, meta) {
568
                            return '<a href="orderreceive.pl?ordernumber='
574
                            return '<a href="orderreceive.pl?multiple_orders='
569
                                    + encodeURIComponent(row.order_id) + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
575
                                    + encodeURIComponent(row.order_id) + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
570
                                    + _("Receive") + '</a><br/>'
576
                                    + _("Receive") + '</a><br/>'
571
                                    + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
577
                                    + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
Lines 638-644 Link Here
638
                        "searchable": false
644
                        "searchable": false
639
                    }
645
                    }
640
                ]
646
                ]
641
            }, null, 1, {"basket.vendor_id": [% booksellerid | html %]});
647
            };
648
649
            var selected_rows = {};
650
            $('#select_multiple').click(function() {
651
              var ids = Object.keys(selected_rows);
652
              if(!ids.length) return;
653
              location.href = 'orderreceive.pl?multiple_orders='+ids.join(',')+ '&invoiceid=[% invoiceid | uri %]';
654
            }).html(PENDING_MULTI_SELECTION.format('0'))
655
            options.select = {
656
              style: 'api'
657
            };
658
            options.order = [[1, 'asc']];
659
            options.columns.unshift({
660
              "data": function(row, type, val, meta) {
661
                  return '<input type="checkbox" class="selOrder" />';
662
              },
663
              "searchable": false,
664
              "orderable": false
665
            });
666
667
            var pending_orders_table = $("#pending_orders").kohaTable(options, {}, 1, {"basket.vendor_id": [% booksellerid | html %]});
668
669
            var api = pending_orders_table.api();
670
            api.on('draw', function() {
671
              api.rows().every(function() {
672
                var row = this;
673
                var data = row.data();
674
                $('.selOrder', row.node()).on('click', function(event) {
675
                  if($(this).prop('checked')) {
676
                    row.select();
677
                    selected_rows[data.order_id] = data;
678
                  } else {
679
                    row.deselect();
680
                    delete selected_rows[data.order_id];
681
                  }
682
                  $('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length));
683
                });
684
                if(selected_rows[data.order_id]) {
685
                  row.select();
686
                  $('.selOrder', row.node()).prop('checked', true);
687
                }
688
              });
689
            });
690
642
691
643
            $(".previewData").on("click", function(e){
692
            $(".previewData").on("click", function(e){
644
                e.preventDefault();
693
                e.preventDefault();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 lines)
Lines 113-119 Acquisitions: Link Here
113
            - '<br>If you choose <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EmailAddressForSuggestions">EmailAddressForSuggestions</a> you have to enter a valid email address:'
113
            - '<br>If you choose <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EmailAddressForSuggestions">EmailAddressForSuggestions</a> you have to enter a valid email address:'
114
            - pref: EmailAddressForSuggestions
114
            - pref: EmailAddressForSuggestions
115
              class: email
115
              class: email
116
117
    Printing:
116
    Printing:
118
        -
117
        -
119
            - Use the
118
            - Use the
(-)a/t/db_dependent/Koha/Acquisition/Fund.t (-1 / +14 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 2;
22
use Test::More tests => 3;
23
23
24
use t::lib::TestBuilder;
24
use t::lib::TestBuilder;
25
25
Lines 43-48 subtest 'to_api() tests' => sub { Link Here
43
    $schema->storage->txn_rollback;
43
    $schema->storage->txn_rollback;
44
};
44
};
45
45
46
subtest 'budget ()' => sub {
47
    plan tests => 1;
48
49
    $schema->storage->txn_begin;
50
51
    my $budget = $builder->build_object({ class => 'Koha::Acquisition::Budgets' });
52
    my $fund = $builder->build_object({ class => 'Koha::Acquisition::Funds', value => { budget_period_id => $budget->budget_period_id } });
53
54
    is($budget->budget_period_id, $fund->budget->budget_period_id, 'Fund\'s budget retrieved correctly');
55
56
    $schema->storage->txn_rollback;
57
};
58
46
subtest 'budget' => sub {
59
subtest 'budget' => sub {
47
    plan tests => 1;
60
    plan tests => 1;
48
61
(-)a/t/db_dependent/Koha/Acquisition/Order.t (-1 / +16 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 12;
22
use Test::More tests => 13;
23
use Test::Exception;
23
use Test::Exception;
24
24
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
Lines 638-643 subtest 'filter_by_current & filter_by_cancelled' => sub { Link Here
638
    $schema->storage->txn_rollback;
638
    $schema->storage->txn_rollback;
639
};
639
};
640
640
641
subtest 'creator ()' => sub {
642
    plan tests => 1;
643
644
    $schema->storage->txn_begin;
645
646
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
647
    my $order = $builder->build_object({ class => 'Koha::Acquisition::Orders', value => { created_by => $patron->borrowernumber } });
648
649
    my $creator = $order->creator;
650
651
    is($creator->borrowernumber, $patron->borrowernumber, 'Patron is order creator');
652
653
    $schema->storage->txn_rollback;
654
};
655
641
subtest 'cancel() tests' => sub {
656
subtest 'cancel() tests' => sub {
642
657
643
    plan tests => 54;
658
    plan tests => 54;
(-)a/t/db_dependent/Koha/Item.t (-1 / +5 lines)
Lines 33-38 use Koha::Database; Link Here
33
use Koha::DateUtils qw( dt_from_string );
33
use Koha::DateUtils qw( dt_from_string );
34
use Koha::Old::Items;
34
use Koha::Old::Items;
35
use Koha::Recalls;
35
use Koha::Recalls;
36
use Koha::AuthorisedValues;
36
37
37
use List::MoreUtils qw(all);
38
use List::MoreUtils qw(all);
38
39
Lines 1475-1480 subtest 'columns_to_str' => sub { Link Here
1475
        }
1476
        }
1476
    );
1477
    );
1477
1478
1479
    Koha::Caches->get_instance->flush_all;
1480
1478
    $item = $item->get_from_storage;
1481
    $item = $item->get_from_storage;
1479
1482
1480
    my $s = $item->columns_to_str;
1483
    my $s = $item->columns_to_str;
Lines 1620-1625 subtest 'strings_map() tests' => sub { Link Here
1620
        }
1623
        }
1621
    )->store();
1624
    )->store();
1622
1625
1626
    Koha::Caches->get_instance->flush_all;
1627
1623
    $item->set(
1628
    $item->set(
1624
        {
1629
        {
1625
            cn_source => $class_source->id,
1630
            cn_source => $class_source->id,
1626
- 

Return to bug 8179