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

(-)a/C4/Acquisition.pm (-1 / +62 lines)
Lines 58-64 BEGIN { Link Here
58
        &SearchOrder &GetHistory &GetRecentAcqui
58
        &SearchOrder &GetHistory &GetRecentAcqui
59
        &ModReceiveOrder &CancelReceipt &ModOrderBiblioitemNumber
59
        &ModReceiveOrder &CancelReceipt &ModOrderBiblioitemNumber
60
        &GetCancelledOrders
60
        &GetCancelledOrders
61
61
        &GetLastOrderNotReceivedFromSubscriptionid &GetLastOrderReceivedFromSubscriptionid
62
        &NewOrderItem &ModOrderItem &ModItemOrder
62
        &NewOrderItem &ModOrderItem &ModItemOrder
63
63
64
        &GetParcels &GetParcel
64
        &GetParcels &GetParcel
Lines 1006-1011 sub GetOrder { Link Here
1006
    return $data;
1006
    return $data;
1007
}
1007
}
1008
1008
1009
=head3 GetLastOrderNotReceivedFromSubscriptionid
1010
1011
  $order = &GetLastOrderNotReceivedFromSubscriptionid($subscriptionid);
1012
1013
Returns a reference-to-hash describing the last order not received for a subscription.
1014
1015
=cut
1016
1017
sub GetLastOrderNotReceivedFromSubscriptionid {
1018
    my ( $subscriptionid ) = @_;
1019
    my $dbh                = C4::Context->dbh;
1020
    my $query              = qq|
1021
        SELECT * FROM aqorders
1022
        LEFT JOIN subscription
1023
            ON ( aqorders.subscriptionid = subscription.subscriptionid )
1024
        WHERE aqorders.subscriptionid = ?
1025
            AND aqorders.datereceived IS NULL
1026
        LIMIT 1
1027
    |;
1028
    my $sth = $dbh->prepare( $query );
1029
    $sth->execute( $subscriptionid );
1030
    my $order = $sth->fetchrow_hashref;
1031
    return $order;
1032
}
1033
1034
=head3 GetLastOrderReceivedFromSubscriptionid
1035
1036
  $order = &GetLastOrderReceivedFromSubscriptionid($subscriptionid);
1037
1038
Returns a reference-to-hash describing the last order received for a subscription.
1039
1040
=cut
1041
1042
sub GetLastOrderReceivedFromSubscriptionid {
1043
    my ( $subscriptionid ) = @_;
1044
    my $dbh                = C4::Context->dbh;
1045
    my $query              = qq|
1046
        SELECT * FROM aqorders
1047
        LEFT JOIN subscription
1048
            ON ( aqorders.subscriptionid = subscription.subscriptionid )
1049
        WHERE aqorders.subscriptionid = ?
1050
            AND aqorders.datereceived =
1051
                (
1052
                    SELECT MAX( aqorders.datereceived )
1053
                    FROM aqorders
1054
                    LEFT JOIN subscription
1055
                        ON ( aqorders.subscriptionid = subscription.subscriptionid )
1056
                        WHERE aqorders.subscriptionid = ?
1057
                            AND aqorders.datereceived IS NOT NULL
1058
                )
1059
        ORDER BY ordernumber DESC
1060
        LIMIT 1
1061
    |;
1062
    my $sth = $dbh->prepare( $query );
1063
    $sth->execute( $subscriptionid, $subscriptionid );
1064
    my $order = $sth->fetchrow_hashref;
1065
    return $order;
1066
1067
}
1068
1069
1009
#------------------------------------------------------------#
1070
#------------------------------------------------------------#
1010
1071
1011
=head3 NewOrder
1072
=head3 NewOrder
(-)a/C4/Budgets.pm (+23 lines)
Lines 41-46 BEGIN { Link Here
41
        &DelBudget
41
        &DelBudget
42
        &GetBudgetSpent
42
        &GetBudgetSpent
43
        &GetBudgetOrdered
43
        &GetBudgetOrdered
44
        &GetBudgetName
44
        &GetPeriodsCount
45
        &GetPeriodsCount
45
        &GetChildBudgetsSpent
46
        &GetChildBudgetsSpent
46
47
Lines 356-361 sub GetBudgetOrdered { Link Here
356
	return $sum;
357
	return $sum;
357
}
358
}
358
359
360
=head2 GetBudgetName
361
362
  my $budget_name = &GetBudgetName($budget_id);
363
364
get the budget_name for a given budget_id
365
366
=cut
367
368
sub GetBudgetName {
369
    my ( $budget_id ) = @_;
370
    my $dbh         = C4::Context->dbh;
371
    my $sth         = $dbh->prepare(
372
        qq|
373
        SELECT budget_name
374
        FROM aqbudgets
375
        WHERE budget_id = ?
376
    |);
377
378
    $sth->execute($budget_id);
379
    return $sth->fetchrow_array;
380
}
381
359
# -------------------------------------------------------------------
382
# -------------------------------------------------------------------
360
sub GetBudgetAuthCats  {
383
sub GetBudgetAuthCats  {
361
    my ($budget_period_id) = shift;
384
    my ($budget_period_id) = shift;
(-)a/C4/Serials.pm (-1 / +23 lines)
Lines 55-60 BEGIN { Link Here
55
      &CountIssues
55
      &CountIssues
56
      HasItems
56
      HasItems
57
      &GetSubscriptionsFromBorrower
57
      &GetSubscriptionsFromBorrower
58
      &subscriptionCurrentlyOnOrder
58
59
59
    );
60
    );
60
}
61
}
Lines 1422-1428 sub ReNewSubscription { Link Here
1422
    # renew subscription
1423
    # renew subscription
1423
    $query = qq|
1424
    $query = qq|
1424
        UPDATE subscription
1425
        UPDATE subscription
1425
        SET    startdate=?,numberlength=?,weeklength=?,monthlength=?
1426
        SET    startdate=?,numberlength=?,weeklength=?,monthlength=?,reneweddate=NOW()
1426
        WHERE  subscriptionid=?
1427
        WHERE  subscriptionid=?
1427
    |;
1428
    |;
1428
    $sth = $dbh->prepare($query);
1429
    $sth = $dbh->prepare($query);
Lines 2465-2470 sub is_barcode_in_use { Link Here
2465
    return @{$occurences};
2466
    return @{$occurences};
2466
}
2467
}
2467
2468
2469
=head2 subscriptionCurrentlyOnOrder
2470
2471
    $bool = subscriptionCurrentlyOnOrder( $subscriptionid );
2472
2473
Return 1 if subscription is currently on order else 0.
2474
2475
=cut
2476
2477
sub subscriptionCurrentlyOnOrder {
2478
    my ( $subscriptionid ) = @_;
2479
    my $dbh = C4::Context->dbh;
2480
    my $query = qq|
2481
        SELECT COUNT(*) FROM aqorders
2482
        WHERE subscriptionid = ?
2483
            AND datereceived IS NULL
2484
    |;
2485
    my $sth = $dbh->prepare( $query );
2486
    $sth->execute($subscriptionid);
2487
    return $sth->fetchrow_array;
2488
}
2489
2468
1;
2490
1;
2469
__END__
2491
__END__
2470
2492
(-)a/acqui/addorder.pl (+1 lines)
Lines 153-158 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
153
my $orderinfo					= $input->Vars;
153
my $orderinfo					= $input->Vars;
154
$orderinfo->{'list_price'}    ||=  0;
154
$orderinfo->{'list_price'}    ||=  0;
155
$orderinfo->{'uncertainprice'} ||= 0;
155
$orderinfo->{'uncertainprice'} ||= 0;
156
$orderinfo->{subscriptionid} ||= undef;
156
157
157
my $user = $input->remote_user;
158
my $user = $input->remote_user;
158
159
(-)a/acqui/finishreceive.pl (-2 / +1 lines)
Lines 52-58 my $invoiceno = $invoice->{invoicenumber}; Link Here
52
my $datereceived     = $invoice->{shipmentdate};
52
my $datereceived     = $invoice->{shipmentdate};
53
my $booksellerid     = $input->param('booksellerid');
53
my $booksellerid     = $input->param('booksellerid');
54
my $cnt              = 0;
54
my $cnt              = 0;
55
my $error_url_str;
56
my $ecost            = $input->param('ecost');
55
my $ecost            = $input->param('ecost');
57
my $rrp              = $input->param('rrp');
56
my $rrp              = $input->param('rrp');
58
my $note             = $input->param("note");
57
my $note             = $input->param("note");
Lines 93-99 if ($quantityrec > $origquantityrec ) { Link Here
93
            $user,
92
            $user,
94
            $order->{unitprice},
93
            $order->{unitprice},
95
            $order->{ecost},
94
            $order->{ecost},
96
            $invoiceno,
95
            $invoiceid,
97
            $order->{rrp},
96
            $order->{rrp},
98
            undef,
97
            undef,
99
            $datereceived,
98
            $datereceived,
(-)a/acqui/neworderempty.pl (-6 / +28 lines)
Lines 97-110 my $budget_id = $input->param('budget_id') || 0; Link Here
97
my $title           = $input->param('title');
97
my $title           = $input->param('title');
98
my $author          = $input->param('author');
98
my $author          = $input->param('author');
99
my $publicationyear = $input->param('publicationyear');
99
my $publicationyear = $input->param('publicationyear');
100
my $bookseller      = GetBookSellerFromId($booksellerid);	# FIXME: else ERROR!
100
my $ordernumber     = $input->param('ordernumber') || '';
101
my $ordernumber          = $input->param('ordernumber') || '';
102
my $biblionumber    = $input->param('biblionumber');
101
my $biblionumber    = $input->param('biblionumber');
103
my $basketno        = $input->param('basketno');
102
my $basketno        = $input->param('basketno');
104
my $suggestionid    = $input->param('suggestionid');
103
my $suggestionid    = $input->param('suggestionid');
105
my $close           = $input->param('close');
104
my $close           = $input->param('close');
106
my $uncertainprice  = $input->param('uncertainprice');
105
my $uncertainprice  = $input->param('uncertainprice');
107
my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order !
106
my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order !
107
my $subscriptionid  = $input->param('subscriptionid');
108
my $data;
108
my $data;
109
my $new = 'no';
109
my $new = 'no';
110
110
Lines 129-134 if(!$basketno) { Link Here
129
}
129
}
130
130
131
my $basket = GetBasket($basketno);
131
my $basket = GetBasket($basketno);
132
$booksellerid = $basket->{booksellerid} unless $booksellerid;
133
my $bookseller = GetBookSellerFromId($booksellerid);
134
132
my $contract = &GetContract($basket->{contractnumber});
135
my $contract = &GetContract($basket->{contractnumber});
133
136
134
#simple parameters reading (all in one :-)
137
#simple parameters reading (all in one :-)
Lines 186-195 else { #modify order Link Here
186
    $biblionumber = $data->{'biblionumber'};
189
    $biblionumber = $data->{'biblionumber'};
187
    $budget_id = $data->{'budget_id'};
190
    $budget_id = $data->{'budget_id'};
188
191
189
    #get basketno and supplierno. too!
192
    $basket   = GetBasket( $data->{'basketno'} );
190
    my $data2 = GetBasket( $data->{'basketno'} );
193
    $basketno = $basket->{'basketno'};
191
    $basketno     = $data2->{'basketno'};
192
    $booksellerid = $data2->{'booksellerid'};
193
}
194
}
194
195
195
my $suggestion;
196
my $suggestion;
Lines 321-326 if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { Link Here
321
my @itemtypes;
322
my @itemtypes;
322
@itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes');
323
@itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes');
323
324
325
if ( defined $subscriptionid ) {
326
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
327
    if ( defined $lastOrderReceived ) {
328
        $budget_id              = $lastOrderReceived->{budgetid};
329
        $data->{listprice}      = $lastOrderReceived->{listprice};
330
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
331
        $data->{gstrate}        = $lastOrderReceived->{gstrate};
332
        $data->{discount}       = $lastOrderReceived->{discount};
333
        $data->{rrp}            = $lastOrderReceived->{rrp};
334
        $data->{ecost}          = $lastOrderReceived->{ecost};
335
        $data->{quantity}       = $lastOrderReceived->{quantity};
336
        $data->{unitprice}      = $lastOrderReceived->{unitprice};
337
        $data->{notes}          = $lastOrderReceived->{notes};
338
        $data->{sort1}          = $lastOrderReceived->{sort1};
339
        $data->{sort2}          = $lastOrderReceived->{sort2};
340
341
        $basket = GetBasket( $input->param('basketno') );
342
    }
343
}
344
324
# Find the items.barcode subfield for barcode validations
345
# Find the items.barcode subfield for barcode validations
325
my (undef, $barcode_subfield) = GetMarcFromKohaField('items.barcode', '');
346
my (undef, $barcode_subfield) = GetMarcFromKohaField('items.barcode', '');
326
347
Lines 396-401 $template->param( Link Here
396
    publishercode    => $data->{'publishercode'},
417
    publishercode    => $data->{'publishercode'},
397
    barcode_subfield => $barcode_subfield,
418
    barcode_subfield => $barcode_subfield,
398
    import_batch_id  => $import_batch_id,
419
    import_batch_id  => $import_batch_id,
420
    subscriptionid   => $subscriptionid,
399
    (uc(C4::Context->preference("marcflavour"))) => 1
421
    (uc(C4::Context->preference("marcflavour"))) => 1
400
);
422
);
401
423
(-)a/acqui/newordersubscription.pl (+101 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2012 BibLibre
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
use CGI;
22
use C4::Acquisition;
23
use C4::Auth;
24
use C4::Bookseller qw/GetBookSellerFromId/;
25
use C4::Branch;
26
use C4::Context;
27
use C4::Output;
28
use C4::Serials;
29
30
my $query        = new CGI;
31
my $title        = $query->param('title_filter');
32
my $ISSN         = $query->param('ISSN_filter');
33
my $EAN          = $query->param('EAN_filter');
34
my $publisher    = $query->param('publisher_filter');
35
my $supplier     = $query->param('supplier_filter');
36
my $branch       = $query->param('branch_filter');
37
my $routing      = $query->param('routing') || C4::Context->preference("RoutingSerials");
38
my $searched     = $query->param('searched');
39
my $biblionumber = $query->param('biblionumber');
40
41
my $basketno     = $query->param('basketno');
42
my $booksellerid = $query->param('booksellerid');
43
44
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
45
    {   template_name   => "acqui/newordersubscription.tmpl",
46
        query           => $query,
47
        type            => "intranet",
48
        authnotrequired => 0,
49
        flagsrequired   => { acquisition => 'order_manage' },
50
    }
51
);
52
53
my $basket = GetBasket($basketno);
54
$booksellerid = $basket->{booksellerid} unless $booksellerid;
55
my ($bookseller) = GetBookSellerFromId($booksellerid);
56
57
my @subscriptions;
58
if ($searched) {
59
    @subscriptions = SearchSubscriptions($title, $ISSN, $EAN, $publisher, $supplier, $branch);
60
}
61
62
foreach my $sub (@subscriptions) {
63
    $sub->{alreadyOnOrder} = subscriptionCurrentlyOnOrder $sub->{subscriptionid};
64
65
    # to toggle between create or edit routing list options
66
    if ($routing) {
67
        $sub->{routingedit} = check_routing( $sub->{subscriptionid} );
68
    }
69
}
70
71
my $branches = GetBranches();
72
my @branches_loop;
73
foreach (sort keys %$branches){
74
    my $selected = 0;
75
    $selected = 1 if defined $branch && $branch eq $_;
76
    push @branches_loop, {
77
        branchcode  => $_,
78
        branchname  => $branches->{$_}->{branchname},
79
        selected    => $selected,
80
    };
81
}
82
83
$template->param(
84
    subs_loop        => \@subscriptions,
85
    title_filter     => $title,
86
    ISSN_filter      => $ISSN,
87
    EAN_filter       => $EAN,
88
    publisher_filter => $publisher,
89
    supplier_filter  => $supplier,
90
    branch_filter    => $branch,
91
    branches_loop    => \@branches_loop,
92
    done_searched    => $searched,
93
    routing          => $routing,
94
    booksellerid     => $booksellerid,
95
    basketno         => $basket->{basketno},
96
    basketname       => $basket->{basketname},
97
    booksellername   => $bookseller->{name},
98
    dateformat       => C4::Context->preference("dateformat"),
99
);
100
output_html_with_http_headers $query, $cookie, $template->output;
101
(-)a/acqui/orderreceive.pl (+1 lines)
Lines 198-203 if ( $count == 1 ) { Link Here
198
        biblionumber          => $order->{'biblionumber'},
198
        biblionumber          => $order->{'biblionumber'},
199
        ordernumber           => $order->{'ordernumber'},
199
        ordernumber           => $order->{'ordernumber'},
200
        biblioitemnumber      => $order->{'biblioitemnumber'},
200
        biblioitemnumber      => $order->{'biblioitemnumber'},
201
        subscriptionid        => $order->{subscriptionid},
201
        booksellerid          => $order->{'booksellerid'},
202
        booksellerid          => $order->{'booksellerid'},
202
        freight               => $freight,
203
        freight               => $freight,
203
        gstrate               => $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0,
204
        gstrate               => $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0,
(-)a/installer/data/mysql/kohastructure.sql (-3 / +4 lines)
Lines 1918-1923 CREATE TABLE `subscription` ( Link Here
1918
  `opacdisplaycount` VARCHAR(10) NULL,
1918
  `opacdisplaycount` VARCHAR(10) NULL,
1919
  `graceperiod` int(11) NOT NULL default '0',
1919
  `graceperiod` int(11) NOT NULL default '0',
1920
  `enddate` date default NULL,
1920
  `enddate` date default NULL,
1921
  `reneweddate` date default NULL,
1921
  PRIMARY KEY  (`subscriptionid`)
1922
  PRIMARY KEY  (`subscriptionid`)
1922
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1923
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1923
1924
Lines 2782-2789 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2782
  `notes` mediumtext, -- notes related to this order line
2783
  `notes` mediumtext, -- notes related to this order line
2783
  `supplierreference` mediumtext, -- not used? always NULL
2784
  `supplierreference` mediumtext, -- not used? always NULL
2784
  `purchaseordernumber` mediumtext, -- not used? always NULL
2785
  `purchaseordernumber` mediumtext, -- not used? always NULL
2785
  `subscription` tinyint(1) default NULL, -- not used? always NULL
2786
  `serialid` varchar(30) default NULL, -- not used? always NULL
2787
  `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno)
2786
  `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno)
2788
  `biblioitemnumber` int(11) default NULL, -- links this order line the biblioitems table (biblioitems.biblioitemnumber)
2787
  `biblioitemnumber` int(11) default NULL, -- links this order line the biblioitems table (biblioitems.biblioitemnumber)
2789
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
2788
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
Lines 2801-2806 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2801
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2800
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2802
  `claims_count` int(11) default 0, -- count of claim letters generated
2801
  `claims_count` int(11) default 0, -- count of claim letters generated
2803
  `claimed_date` date default NULL, -- last date a claim was generated
2802
  `claimed_date` date default NULL, -- last date a claim was generated
2803
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2804
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2804
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2805
  PRIMARY KEY  (`ordernumber`),
2805
  PRIMARY KEY  (`ordernumber`),
2806
  KEY `basketno` (`basketno`),
2806
  KEY `basketno` (`basketno`),
Lines 2808-2814 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2808
  KEY `budget_id` (`budget_id`),
2808
  KEY `budget_id` (`budget_id`),
2809
  CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2809
  CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2810
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2810
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2811
  CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE
2811
  CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE,
2812
  CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
2812
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2813
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2813
2814
2814
2815
(-)a/installer/data/mysql/updatedatabase.pl (+11 lines)
Lines 6019-6024 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6019
   SetVersion ($DBversion);
6019
   SetVersion ($DBversion);
6020
}
6020
}
6021
6021
6022
$DBversion = "3.09.00.XXX";
6023
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6024
    $dbh->do(q{ALTER TABLE aqorders DROP COLUMN serialid;});
6025
    $dbh->do(q{ALTER TABLE aqorders DROP COLUMN subscription;});
6026
    $dbh->do(q{ALTER TABLE aqorders ADD COLUMN subscriptionid INT(11) DEFAULT NULL;});
6027
    $dbh->do(q{ALTER TABLE aqorders ADD CONSTRAINT aqorders_subscriptionid FOREIGN KEY (subscriptionid) REFERENCES subscription (subscriptionid) ON DELETE CASCADE ON UPDATE CASCADE;});
6028
    $dbh->do(q{ALTER TABLE subscription ADD COLUMN reneweddate DATE DEFAULT NULL;});
6029
    print "Upgrade to $DBversion done (Bug 5343: table aqorders: DROP serialid and subscription fields and ADD subscriptionid, table subscription: ADD reneweddate)\n";
6030
    SetVersion ($DBversion);
6031
}
6032
6022
=head1 FUNCTIONS
6033
=head1 FUNCTIONS
6023
6034
6024
=head2 TableExists($table)
6035
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc (-7 / +12 lines)
Lines 1-17 Link Here
1
<fieldset id="acqui_basket_add">
1
<fieldset id="acqui_basket_add">
2
    <legend>Add order to basket</legend>
2
    <legend>Add order to basket</legend>
3
    [% IF has_budgets %]
3
    [% IF has_budgets %]
4
    <form action="/cgi-bin/koha/acqui/neworderbiblio.pl" method="post">
4
      <ul>
5
        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
5
        <li>
6
        <input type="hidden" name="basketno" value="[% basketno %]" />
6
          <label for="q">From an existing record: </label>
7
        <ul><li><label for="q">From an existing record: </label><input id="q" type="text"  size="25" name="q" />
7
          <form action="/cgi-bin/koha/acqui/neworderbiblio.pl" method="post">
8
        <input type="submit" class="submit" value="Search" /></li>
8
            <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
9
            <input type="hidden" name="basketno" value="[% basketno %]" />
10
            <input id="q" type="text"  size="25" name="q" />
11
            <input type="submit" class="submit" value="Search" />
12
          </form>
13
        </li>
9
        <li><a href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a suggestion</a></li>
14
        <li><a href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a suggestion</a></li>
15
        <li><a href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a subscription</a></li>
10
        <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a new (empty) record</a></li>
16
        <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a new (empty) record</a></li>
11
        <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From an external source</a></li>
17
        <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From an external source</a></li>
12
        <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]"> From a staged file</a></li>
18
        <li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]"> From a staged file</a></li>
13
        </ul>
19
      </ul>
14
    </form>
15
    [% ELSE %]
20
    [% ELSE %]
16
        You can't create any orders unless you first <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget and a fund</a>.
21
        You can't create any orders unless you first <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget and a fund</a>.
17
    [% END %]
22
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc (+55 lines)
Line 0 Link Here
1
<div id="advsearch">
2
    <form action="" method="get">
3
        <fieldset class="brief">
4
            <a id="unfold_advsearch" style="cursor:pointer" onclick="$('#advsearch_form').slideToggle(400);">Advanced search</a>
5
            <div id="advsearch_form" style="display:none">
6
            <ol>
7
              <li>
8
                <label for="issn">ISSN:</label>
9
                <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter %]" />
10
              </li>
11
              <li>
12
                <label for="title">Title:</label>
13
                <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
14
              </li>
15
              <li>
16
                <label for="ean">EAN:</label>
17
                <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
18
              </li>
19
              <li>
20
                <label for="publisher">Publisher:</label>
21
                <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" />
22
              </li>
23
              <li>
24
                <label for="supplier">Supplier:</label>
25
                <input type="text" id="supplier" name="supplier_filter" value="[% supplier_filter %]" />
26
              </li>
27
              <li>
28
                <label for="branch">Branch:</label>
29
                <select id="branch" name="branch_filter">
30
                  <option value="">All</option>
31
                  [% FOREACH branch IN branches_loop %]
32
                    [% IF (branch.selected) %]
33
                      <option selected="branch.selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
34
                    [% ELSE %]
35
                      <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
36
                    [% END %]
37
                  [% END %]
38
                </select>
39
              </li>
40
            </ol>
41
            <input type="hidden" name="searched" value="1" />
42
            [% IF (booksellerid) %]
43
                <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
44
            [% END %]
45
            [% IF (basketno) %]
46
                <input type="hidden" name="basketno" value="[% basketno %]" />
47
            [% END %]
48
            <fieldset class="action">
49
              <input type="submit" value="Search" />
50
            </fieldset>
51
            </div>
52
        </fieldset>
53
    </form>
54
</div>
55
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-45 / +60 lines)
Lines 339-385 $(document).ready(function() Link Here
339
        </fieldset>
339
        </fieldset>
340
    [% END %]
340
    [% END %]
341
341
342
    [% IF (AcqCreateItemOrdering) %]
342
    [% UNLESS subscriptionid %][% # it is a suggestion, we have not items %]
343
343
      [% IF (AcqCreateItemOrdering) %]
344
    <div id="items_list" style="display:none">
344
345
        <p><b>Items list</b></p>
345
      <div id="items_list" style="display:none">
346
        <div style="width:100%;overflow:auto;">
346
          <p><b>Items list</b></p>
347
            <table>
347
          <div style="width:100%;overflow:auto;">
348
                <thead>
348
              <table>
349
                    <tr>
349
                  <thead>
350
                        <th>&nbsp;</th>
350
                      <tr>
351
                        <th>&nbsp;</th>
351
                          <th>&nbsp;</th>
352
                        <th>Barcode</th>
352
                          <th>&nbsp;</th>
353
                        <th>Home branch</th>
353
                          <th>Barcode</th>
354
                        <th>Holding branch</th>
354
                          <th>Home branch</th>
355
                        <th>Not for loan</th>
355
                          <th>Holding branch</th>
356
                        <th>Restricted</th>
356
                          <th>Not for loan</th>
357
                        <th>Location</th>
357
                          <th>Restricted</th>
358
                        <th>Call number</th>
358
                          <th>Location</th>
359
                        <th>Copy number</th>
359
                          <th>Call number</th>
360
                        <th>Stock number</th>
360
                          <th>Copy number</th>
361
                        <th>Collection code</th>
361
                          <th>Stock number</th>
362
                        <th>Item type</th>
362
                          <th>Collection code</th>
363
                        <th>Materials</th>
363
                          <th>Item type</th>
364
                        <th>Notes</th>
364
                          <th>Materials</th>
365
                    </tr>
365
                          <th>Notes</th>
366
                </thead>
366
                      </tr>
367
                <tbody>
367
                  </thead>
368
                </tbody>
368
                  <tbody>
369
            </table>
369
                  </tbody>
370
        </div>
370
              </table>
371
    </div>
371
          </div>
372
372
      </div>
373
    <fieldset class="rows" id="itemfieldset">
373
374
        <legend>Item</legend>
374
      <fieldset class="rows" id="itemfieldset">
375
        [% IF ( NoACQframework ) %]
375
          <legend>Item</legend>
376
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
376
          [% IF ( NoACQframework ) %]
377
        [% END %]
377
              <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
378
378
          [% END %]
379
        <div id="outeritemblock"></div>
379
380
380
          <div id="outeritemblock"></div>
381
    </fieldset>
381
382
    [% END %][%# IF (AcqCreateItemOrdering) %]
382
      </fieldset>
383
      [% END %][%# IF (AcqCreateItemOrdering) %]
384
    [% END %][%# UNLESS subscriptionid %]
383
    <fieldset class="rows">
385
    <fieldset class="rows">
384
        <legend>Accounting Details</legend>
386
        <legend>Accounting Details</legend>
385
        <ol>
387
        <ol>
Lines 390-398 $(document).ready(function() Link Here
390
                [% ELSE %]
392
                [% ELSE %]
391
                    <label class="required" for="quantity">Quantity: </label>
393
                    <label class="required" for="quantity">Quantity: </label>
392
                    [% IF (AcqCreateItemOrdering) %]
394
                    [% IF (AcqCreateItemOrdering) %]
393
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
395
                        [% IF subscriptionid %]
396
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
397
                        [% ELSE %]
398
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
399
                        [% END %]
394
                    [% ELSE %]
400
                    [% ELSE %]
395
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
401
                        [% IF subscriptionid %]
402
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
403
                        [% ELSE %]
404
                            <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
405
                        [% END %]
396
                    [% END %]
406
                    [% END %]
397
                [% END %]
407
                [% END %]
398
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
408
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
Lines 560-573 $(document).ready(function() Link Here
560
                [% END %]
570
                [% END %]
561
                </span>
571
                </span>
562
            </li>
572
            </li>
563
</ol>
573
        </ol>
564
    </fieldset>
574
    </fieldset>
565
    <fieldset class="action">
575
    <fieldset class="action">
576
        <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
566
        <input type="submit" value="Save" />
577
        <input type="submit" value="Save" />
567
        [% IF (suggestionid) %]
578
        [% IF (suggestionid) %]
568
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
579
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
569
        [% ELSE %]
580
        [% ELSE %]
570
            <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
581
            [% IF subscriptionid %]
582
                <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
583
            [% ELSE %]
584
                <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
585
            [% END %]
571
        [% END %]
586
        [% END %]
572
    </fieldset>
587
    </fieldset>
573
</form>
588
</form>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-24 / +26 lines)
Lines 197-213 Link Here
197
            </div>
197
            </div>
198
        </div>
198
        </div>
199
199
200
        <fieldset class="rows" id="itemfieldset">
200
        [% UNLESS subscriptionid %]
201
            <legend>Item</legend>
201
          <fieldset class="rows" id="itemfieldset">
202
            [% IF ( NoACQframework ) %]
202
              <legend>Item</legend>
203
                <p class="required">
203
              [% IF ( NoACQframework ) %]
204
                    No ACQ framework, using default. You should create a
204
                  <p class="required">
205
                    framework with code ACQ, the items framework would be
205
                      No ACQ framework, using default. You should create a
206
                    used
206
                      framework with code ACQ, the items framework would be
207
                </p>
207
                      used
208
            [% END %]
208
                  </p>
209
            <div id="outeritemblock"></div>
209
              [% END %]
210
        </fieldset>
210
              <div id="outeritemblock"></div>
211
          </fieldset>
212
        [% END %]
211
    [% ELSIF (AcqCreateItem == 'ordering') %]
213
    [% ELSIF (AcqCreateItem == 'ordering') %]
212
        [% IF (items.size) %]
214
        [% IF (items.size) %]
213
            <h5>Items</h5>
215
            <h5>Items</h5>
Lines 273-281 Link Here
273
       <li><label for="bookfund">Budget: </label><span> [% bookfund %] </span></li>
275
       <li><label for="bookfund">Budget: </label><span> [% bookfund %] </span></li>
274
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
276
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
275
       <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label">
277
       <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label">
276
           [% IF ( edit ) %]
278
           [% IF ( edit and not subscriptionid) %]
277
               <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
279
               <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
278
           [% ELSE %]
280
           [% ELSE%]
279
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
281
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
280
           [% END %]
282
           [% END %]
281
           </span></li>
283
           </span></li>
Lines 286-307 Link Here
286
            [% IF ( quantityreceived ) %]
288
            [% IF ( quantityreceived ) %]
287
                [% IF ( edit ) %]
289
                [% IF ( edit ) %]
288
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
290
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
289
                    <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
291
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
290
                [% ELSE %]
291
                [% IF ( items ) %]
292
                    <input READONLY type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
293
                [% ELSE %]
292
                [% ELSE %]
294
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
293
                    [% IF ( items ) %]
295
                [% END %]
294
                        <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
296
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
295
                    [% ELSE %]
296
                        <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
297
                    [% END %]
298
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
297
                [% END %]
299
                [% END %]
298
            [% ELSE %]
300
            [% ELSE %]
299
                [% IF ( items ) %]
301
                [% IF ( subscriptionid ) %]
300
                    <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
302
                    <input type="text" readonly="readonly" id="quantity" size="20" name="quantityrec" value="1" />
301
                [% ELSE %]
303
                [% ELSE %]
302
                    <input type="text" size="20" id="quantity" name="quantityrec" value="1" />
304
                    <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
303
                [% END %]
305
                [% END %]
304
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" />
306
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
305
            [% END %]
307
            [% END %]
306
            <div id="qtyrecerror" style="display:none">
308
            <div id="qtyrecerror" style="display:none">
307
                <p class="error">Warning, you have entered more items than expected.
309
                <p class="error">Warning, you have entered more items than expected.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt (+1 lines)
Lines 17-22 Link Here
17
    </div>
17
    </div>
18
  </div>
18
  </div>
19
  <div class="yui-b">
19
  <div class="yui-b">
20
    [% INCLUDE 'subscriptions-search.inc' %]
20
    [% INCLUDE 'serials-menu.inc' %]
21
    [% INCLUDE 'serials-menu.inc' %]
21
  </div>
22
  </div>
22
</div>
23
</div>
(-)a/serials/serials-search.pl (-1 / +1 lines)
Lines 85-91 my $branches = GetBranches(); Link Here
85
my @branches_loop;
85
my @branches_loop;
86
foreach (sort keys %$branches){
86
foreach (sort keys %$branches){
87
    my $selected = 0;
87
    my $selected = 0;
88
    $selected = 1 if( $branch eq $_ );
88
    $selected = 1 if( defined $branch and $branch eq $_ );
89
    push @branches_loop, {
89
    push @branches_loop, {
90
        branchcode  => $_,
90
        branchcode  => $_,
91
        branchname  => $branches->{$_}->{'branchname'},
91
        branchname  => $branches->{$_}->{'branchname'},
(-)a/serials/subscription-detail.pl (-30 / +66 lines)
Lines 15-24 Link Here
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
17
18
use strict;
18
use Modern::Perl;
19
use warnings;
20
use CGI;
19
use CGI;
20
use C4::Acquisition;
21
use C4::Auth;
21
use C4::Auth;
22
use C4::Bookseller qw/GetBookSellerFromId/;
23
use C4::Budgets;
22
use C4::Koha;
24
use C4::Koha;
23
use C4::Dates qw/format_date/;
25
use C4::Dates qw/format_date/;
24
use C4::Serials;
26
use C4::Serials;
Lines 121-154 if (! $subs->{periodicity}) { Link Here
121
my $default_bib_view = get_default_view();
123
my $default_bib_view = get_default_view();
122
124
123
my ( $order, $bookseller, $tmpl_infos );
125
my ( $order, $bookseller, $tmpl_infos );
124
# FIXME = see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5335#c52
126
if ( defined $subscriptionid ) {
125
#if ( defined $subscriptionid ) {
127
    my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid;
126
#    my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid;
128
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
127
#    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
129
    if ( defined $lastOrderNotReceived ) {
128
#    if ( defined $lastOrderNotReceived ) {
130
        my $basket = GetBasket $lastOrderNotReceived->{basketno};
129
#        my $basket = GetBasket $lastOrderNotReceived->{basketno};
131
        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
130
#        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
132
        ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller );
131
#        ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller );
133
        $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} );
132
#        $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} );
134
        $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} );
133
#        $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} );
135
        $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
134
#        $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
136
        $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
135
#        $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
137
        $tmpl_infos->{ordered_exists} = 1;
136
#        $tmpl_infos->{ordered_exists} = 1;
138
    }
137
#    }
139
    if ( defined $lastOrderReceived ) {
138
#    if ( defined $lastOrderReceived ) {
140
        my $basket = GetBasket $lastOrderReceived->{basketno};
139
#        my $basket = GetBasket $lastOrderReceived->{basketno};
141
        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
140
#        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
142
        ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller );
141
#        ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller );
143
        $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
142
#        $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
144
        $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
143
#        $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
145
        $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
144
#        $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
146
        $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber};
145
#        $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber};
147
        $tmpl_infos->{spent_exists} = 1;
146
#        $tmpl_infos->{spent_exists} = 1;
148
    }
147
#    }
149
}
148
#}
149
150
150
$template->param(
151
$template->param(
151
	subscriptionid => $subscriptionid,
152
    subscriptionid => $subscriptionid,
152
    serialslist => \@serialslist,
153
    serialslist => \@serialslist,
153
    hasRouting  => $hasRouting,
154
    hasRouting  => $hasRouting,
154
    routing => C4::Context->preference("RoutingSerials"),
155
    routing => C4::Context->preference("RoutingSerials"),
Lines 168-174 $template->param( Link Here
168
    default_bib_view => $default_bib_view,
169
    default_bib_view => $default_bib_view,
169
    (uc(C4::Context->preference("marcflavour"))) => 1,
170
    (uc(C4::Context->preference("marcflavour"))) => 1,
170
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
171
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
171
    );
172
    basketno => $order->{basketno},
173
    %$tmpl_infos,
174
);
172
175
173
output_html_with_http_headers $query, $cookie, $template->output;
176
output_html_with_http_headers $query, $cookie, $template->output;
174
177
Lines 186-188 sub get_default_view { Link Here
186
    }
189
    }
187
    return 'detail';
190
    return 'detail';
188
}
191
}
189
- 
192
193
sub get_value_with_gst_params {
194
    my $value = shift;
195
    my $gstrate = shift;
196
    my $bookseller = shift;
197
    if ( $bookseller->{listincgst} ) {
198
        return ( $value, $value / ( 1 + $gstrate ) );
199
    } else {
200
        return ( $value * ( 1 + $gstrate ), $value );
201
    }
202
}
203
204
sub get_gste {
205
    my $value = shift;
206
    my $gstrate = shift;
207
    my $bookseller = shift;
208
    if ( $bookseller->{invoiceincgst} ) {
209
        return $value / ( 1 + $gstrate );
210
    } else {
211
        return $value;
212
    }
213
}
214
215
sub get_gst {
216
    my $value = shift;
217
    my $gstrate = shift;
218
    my $bookseller = shift;
219
    if ( $bookseller->{invoiceincgst} ) {
220
        return $value / ( 1 + $gstrate ) * $gstrate;
221
    } else {
222
        return $value * ( 1 + $gstrate ) - $value;
223
    }
224
}
225

Return to bug 5343