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 1007-1012 sub GetOrder { Link Here
1007
    return $data;
1007
    return $data;
1008
}
1008
}
1009
1009
1010
=head3 GetLastOrderNotReceivedFromSubscriptionid
1011
1012
  $order = &GetLastOrderNotReceivedFromSubscriptionid($subscriptionid);
1013
1014
Returns a reference-to-hash describing the last order not received for a subscription.
1015
1016
=cut
1017
1018
sub GetLastOrderNotReceivedFromSubscriptionid {
1019
    my ( $subscriptionid ) = @_;
1020
    my $dbh                = C4::Context->dbh;
1021
    my $query              = qq|
1022
        SELECT * FROM aqorders
1023
        LEFT JOIN subscription
1024
            ON ( aqorders.subscriptionid = subscription.subscriptionid )
1025
        WHERE aqorders.subscriptionid = ?
1026
            AND aqorders.datereceived IS NULL
1027
        LIMIT 1
1028
    |;
1029
    my $sth = $dbh->prepare( $query );
1030
    $sth->execute( $subscriptionid );
1031
    my $order = $sth->fetchrow_hashref;
1032
    return $order;
1033
}
1034
1035
=head3 GetLastOrderReceivedFromSubscriptionid
1036
1037
  $order = &GetLastOrderReceivedFromSubscriptionid($subscriptionid);
1038
1039
Returns a reference-to-hash describing the last order received for a subscription.
1040
1041
=cut
1042
1043
sub GetLastOrderReceivedFromSubscriptionid {
1044
    my ( $subscriptionid ) = @_;
1045
    my $dbh                = C4::Context->dbh;
1046
    my $query              = qq|
1047
        SELECT * FROM aqorders
1048
        LEFT JOIN subscription
1049
            ON ( aqorders.subscriptionid = subscription.subscriptionid )
1050
        WHERE aqorders.subscriptionid = ?
1051
            AND aqorders.datereceived =
1052
                (
1053
                    SELECT MAX( aqorders.datereceived )
1054
                    FROM aqorders
1055
                    LEFT JOIN subscription
1056
                        ON ( aqorders.subscriptionid = subscription.subscriptionid )
1057
                        WHERE aqorders.subscriptionid = ?
1058
                            AND aqorders.datereceived IS NOT NULL
1059
                )
1060
        ORDER BY ordernumber DESC
1061
        LIMIT 1
1062
    |;
1063
    my $sth = $dbh->prepare( $query );
1064
    $sth->execute( $subscriptionid, $subscriptionid );
1065
    my $order = $sth->fetchrow_hashref;
1066
    return $order;
1067
1068
}
1069
1070
1010
#------------------------------------------------------------#
1071
#------------------------------------------------------------#
1011
1072
1012
=head3 NewOrder
1073
=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 1441-1447 sub ReNewSubscription { Link Here
1441
    # renew subscription
1442
    # renew subscription
1442
    $query = qq|
1443
    $query = qq|
1443
        UPDATE subscription
1444
        UPDATE subscription
1444
        SET    startdate=?,numberlength=?,weeklength=?,monthlength=?
1445
        SET    startdate=?,numberlength=?,weeklength=?,monthlength=?,reneweddate=NOW()
1445
        WHERE  subscriptionid=?
1446
        WHERE  subscriptionid=?
1446
    |;
1447
    |;
1447
    $sth = $dbh->prepare($query);
1448
    $sth = $dbh->prepare($query);
Lines 2532-2537 sub ReopenSubscription { Link Here
2532
    $sth->execute( $subscriptionid );
2533
    $sth->execute( $subscriptionid );
2533
}
2534
}
2534
2535
2536
=head2 subscriptionCurrentlyOnOrder
2537
2538
    $bool = subscriptionCurrentlyOnOrder( $subscriptionid );
2539
2540
Return 1 if subscription is currently on order else 0.
2541
2542
=cut
2543
2544
sub subscriptionCurrentlyOnOrder {
2545
    my ( $subscriptionid ) = @_;
2546
    my $dbh = C4::Context->dbh;
2547
    my $query = qq|
2548
        SELECT COUNT(*) FROM aqorders
2549
        WHERE subscriptionid = ?
2550
            AND datereceived IS NULL
2551
    |;
2552
    my $sth = $dbh->prepare( $query );
2553
    $sth->execute($subscriptionid);
2554
    return $sth->fetchrow_array;
2555
}
2556
2535
1;
2557
1;
2536
__END__
2558
__END__
2537
2559
(-)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 (-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");
(-)a/acqui/neworderempty.pl (-5 / +27 lines)
Lines 97-103 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!
101
my $ordernumber          = $input->param('ordernumber') || '';
100
my $ordernumber          = $input->param('ordernumber') || '';
102
our $biblionumber    = $input->param('biblionumber');
101
our $biblionumber    = $input->param('biblionumber');
103
our $basketno        = $input->param('basketno');
102
our $basketno        = $input->param('basketno');
Lines 105-110 my $suggestionid = $input->param('suggestionid'); Link Here
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
our $basket = GetBasket($basketno);
131
our $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 392-397 $template->param( Link Here
392
    publishercode    => $data->{'publishercode'},
413
    publishercode    => $data->{'publishercode'},
393
    barcode_subfield => $barcode_subfield,
414
    barcode_subfield => $barcode_subfield,
394
    import_batch_id  => $import_batch_id,
415
    import_batch_id  => $import_batch_id,
416
    subscriptionid   => $subscriptionid,
395
    (uc(C4::Context->preference("marcflavour"))) => 1
417
    (uc(C4::Context->preference("marcflavour"))) => 1
396
);
418
);
397
419
(-)a/acqui/newordersubscription.pl (+108 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.tt",
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({
60
        title => $title,
61
        issn => $ISSN,
62
        ean => $EAN,
63
        publisher => $publisher,
64
        bookseller => $supplier,
65
        branch => $branch
66
    });
67
}
68
69
foreach my $sub (@subscriptions) {
70
    $sub->{alreadyOnOrder} = subscriptionCurrentlyOnOrder $sub->{subscriptionid};
71
72
    # to toggle between create or edit routing list options
73
    if ($routing) {
74
        $sub->{routingedit} = check_routing( $sub->{subscriptionid} );
75
    }
76
}
77
78
my $branches = GetBranches();
79
my @branches_loop;
80
foreach (sort keys %$branches){
81
    my $selected = 0;
82
    $selected = 1 if defined $branch && $branch eq $_;
83
    push @branches_loop, {
84
        branchcode  => $_,
85
        branchname  => $branches->{$_}->{branchname},
86
        selected    => $selected,
87
    };
88
}
89
90
$template->param(
91
    subs_loop        => \@subscriptions,
92
    title_filter     => $title,
93
    ISSN_filter      => $ISSN,
94
    EAN_filter       => $EAN,
95
    publisher_filter => $publisher,
96
    supplier_filter  => $supplier,
97
    branch_filter    => $branch,
98
    branches_loop    => \@branches_loop,
99
    done_searched    => $searched,
100
    routing          => $routing,
101
    booksellerid     => $booksellerid,
102
    basketno         => $basket->{basketno},
103
    basketname       => $basket->{basketname},
104
    booksellername   => $bookseller->{name},
105
    dateformat       => C4::Context->preference("dateformat"),
106
);
107
output_html_with_http_headers $query, $cookie, $template->output;
108
(-)a/acqui/orderreceive.pl (+1 lines)
Lines 199-204 $template->param( Link Here
199
    biblionumber          => $order->{'biblionumber'},
199
    biblionumber          => $order->{'biblionumber'},
200
    ordernumber           => $order->{'ordernumber'},
200
    ordernumber           => $order->{'ordernumber'},
201
    biblioitemnumber      => $order->{'biblioitemnumber'},
201
    biblioitemnumber      => $order->{'biblioitemnumber'},
202
    subscriptionid        => $order->{subscriptionid},
202
    booksellerid          => $order->{'booksellerid'},
203
    booksellerid          => $order->{'booksellerid'},
203
    freight               => $freight,
204
    freight               => $freight,
204
    name                  => $bookseller->{'name'},
205
    name                  => $bookseller->{'name'},
(-)a/installer/data/mysql/kohastructure.sql (-3 / +4 lines)
Lines 1908-1913 CREATE TABLE `subscription` ( Link Here
1908
  `graceperiod` int(11) NOT NULL default '0',
1908
  `graceperiod` int(11) NOT NULL default '0',
1909
  `enddate` date default NULL,
1909
  `enddate` date default NULL,
1910
  `closed` INT(1) NOT NULL DEFAULT 0,
1910
  `closed` INT(1) NOT NULL DEFAULT 0,
1911
  `reneweddate` date default NULL,
1911
  PRIMARY KEY  (`subscriptionid`)
1912
  PRIMARY KEY  (`subscriptionid`)
1912
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1913
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1913
1914
Lines 2772-2779 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2772
  `notes` mediumtext, -- notes related to this order line
2773
  `notes` mediumtext, -- notes related to this order line
2773
  `supplierreference` mediumtext, -- not used? always NULL
2774
  `supplierreference` mediumtext, -- not used? always NULL
2774
  `purchaseordernumber` mediumtext, -- not used? always NULL
2775
  `purchaseordernumber` mediumtext, -- not used? always NULL
2775
  `subscription` tinyint(1) default NULL, -- not used? always NULL
2776
  `serialid` varchar(30) default NULL, -- not used? always NULL
2777
  `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno)
2776
  `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno)
2778
  `biblioitemnumber` int(11) default NULL, -- links this order line the biblioitems table (biblioitems.biblioitemnumber)
2777
  `biblioitemnumber` int(11) default NULL, -- links this order line the biblioitems table (biblioitems.biblioitemnumber)
2779
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
2778
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
Lines 2791-2796 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2791
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2790
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2792
  `claims_count` int(11) default 0, -- count of claim letters generated
2791
  `claims_count` int(11) default 0, -- count of claim letters generated
2793
  `claimed_date` date default NULL, -- last date a claim was generated
2792
  `claimed_date` date default NULL, -- last date a claim was generated
2793
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2794
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2794
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2795
  PRIMARY KEY  (`ordernumber`),
2795
  PRIMARY KEY  (`ordernumber`),
2796
  KEY `basketno` (`basketno`),
2796
  KEY `basketno` (`basketno`),
Lines 2798-2804 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2798
  KEY `budget_id` (`budget_id`),
2798
  KEY `budget_id` (`budget_id`),
2799
  CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2799
  CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
2800
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2800
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
2801
  CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE
2801
  CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE,
2802
  CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE
2802
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2803
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2803
2804
2804
2805
(-)a/installer/data/mysql/updatedatabase.pl (+11 lines)
Lines 6700-6705 if ( CheckVersion($DBversion) ) { Link Here
6700
    SetVersion ($DBversion);
6700
    SetVersion ($DBversion);
6701
}
6701
}
6702
6702
6703
$DBversion = "3.11.00.XXX";
6704
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6705
    $dbh->do(q{ALTER TABLE aqorders DROP COLUMN serialid;});
6706
    $dbh->do(q{ALTER TABLE aqorders DROP COLUMN subscription;});
6707
    $dbh->do(q{ALTER TABLE aqorders ADD COLUMN subscriptionid INT(11) DEFAULT NULL;});
6708
    $dbh->do(q{ALTER TABLE aqorders ADD CONSTRAINT aqorders_subscriptionid FOREIGN KEY (subscriptionid) REFERENCES subscription (subscriptionid) ON DELETE CASCADE ON UPDATE CASCADE;});
6709
    $dbh->do(q{ALTER TABLE subscription ADD COLUMN reneweddate DATE DEFAULT NULL;});
6710
    print "Upgrade to $DBversion done (Bug 5343: table aqorders: DROP serialid and subscription fields and ADD subscriptionid, table subscription: ADD reneweddate)\n";
6711
    SetVersion ($DBversion);
6712
}
6713
6703
=head1 FUNCTIONS
6714
=head1 FUNCTIONS
6704
6715
6705
=head2 TableExists($table)
6716
=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 (-44 / +59 lines)
Lines 361-406 $(document).ready(function() Link Here
361
        </fieldset>
361
        </fieldset>
362
    [% END %]
362
    [% END %]
363
363
364
    [% IF (AcqCreateItemOrdering) %]
364
    [% UNLESS subscriptionid %][% # it is a suggestion, we have not items %]
365
365
      [% IF (AcqCreateItemOrdering) %]
366
    <div id="items_list" style="display:none">
366
367
        <p><b>Items list</b></p>
367
      <div id="items_list" style="display:none">
368
        <div style="width:100%;overflow:auto;">
368
          <p><b>Items list</b></p>
369
            <table>
369
          <div style="width:100%;overflow:auto;">
370
                <thead>
370
              <table>
371
                    <tr>
371
                  <thead>
372
                        <th>&nbsp;</th>
372
                      <tr>
373
                        <th>&nbsp;</th>
373
                          <th>&nbsp;</th>
374
                        <th>Barcode</th>
374
                          <th>&nbsp;</th>
375
                        <th>Home library</th>
375
                          <th>Barcode</th>
376
                        <th>Holding library</th>
376
                          <th>Home library</th>
377
                        <th>Not for loan</th>
377
                          <th>Holding library</th>
378
                        <th>Restricted</th>
378
                          <th>Not for loan</th>
379
                        <th>Location</th>
379
                          <th>Restricted</th>
380
                        <th>Call number</th>
380
                          <th>Location</th>
381
                        <th>Copy number</th>
381
                          <th>Call number</th>
382
                        <th>Stock number</th>
382
                          <th>Copy number</th>
383
                        <th>Collection code</th>
383
                          <th>Stock number</th>
384
                        <th>Item type</th>
384
                          <th>Collection code</th>
385
                        <th>Materials</th>
385
                          <th>Item type</th>
386
                        <th>Notes</th>
386
                          <th>Materials</th>
387
                    </tr>
387
                          <th>Notes</th>
388
                </thead>
388
                      </tr>
389
                <tbody>
389
                  </thead>
390
                </tbody>
390
                  <tbody>
391
            </table>
391
                  </tbody>
392
        </div>
392
              </table>
393
    </div>
393
          </div>
394
394
      </div>
395
    <fieldset class="rows" id="itemfieldset">
395
396
        <legend>Item</legend>
396
      <fieldset class="rows" id="itemfieldset">
397
        [% IF ( NoACQframework ) %]
397
          <legend>Item</legend>
398
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
398
          [% IF ( NoACQframework ) %]
399
        [% END %]
399
              <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
400
400
          [% END %]
401
        <div id="outeritemblock"></div>
401
402
402
          <div id="outeritemblock"></div>
403
    </fieldset>
403
404
      </fieldset>
405
      [% END %][%# UNLESS subscriptionid %]
404
    [% END %][%# IF (AcqCreateItemOrdering) %]
406
    [% END %][%# IF (AcqCreateItemOrdering) %]
405
    <fieldset class="rows">
407
    <fieldset class="rows">
406
        <legend>Accounting Details</legend>
408
        <legend>Accounting Details</legend>
Lines 412-420 $(document).ready(function() Link Here
412
                [% ELSE %]
414
                [% ELSE %]
413
                    <label class="required" for="quantity">Quantity: </label>
415
                    <label class="required" for="quantity">Quantity: </label>
414
                    [% IF (AcqCreateItemOrdering) %]
416
                    [% IF (AcqCreateItemOrdering) %]
415
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
417
                        [% IF subscriptionid %]
418
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
419
                        [% ELSE %]
420
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
421
                        [% END %]
416
                    [% ELSE %]
422
                    [% ELSE %]
417
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
423
                        [% IF subscriptionid %]
424
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
425
                        [% ELSE %]
426
                            <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
427
                        [% END %]
418
                    [% END %]
428
                    [% END %]
419
                [% END %]
429
                [% END %]
420
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
430
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
Lines 586-599 $(document).ready(function() Link Here
586
                [% END %]
596
                [% END %]
587
                </span>
597
                </span>
588
            </li>
598
            </li>
589
</ol>
599
        </ol>
590
    </fieldset>
600
    </fieldset>
591
    <fieldset class="action">
601
    <fieldset class="action">
602
        <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
592
        <input type="submit" value="Save" />
603
        <input type="submit" value="Save" />
593
        [% IF (suggestionid) %]
604
        [% IF (suggestionid) %]
594
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
605
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
595
        [% ELSE %]
606
        [% ELSE %]
596
            <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
607
            [% IF subscriptionid %]
608
                <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
609
            [% ELSE %]
610
                <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
611
            [% END %]
597
        [% END %]
612
        [% END %]
598
    </fieldset>
613
    </fieldset>
599
</form>
614
</form>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt (+120 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Serials [% biblionumber %]</title>
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'doc-head-close.inc' %]
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7
[% INCLUDE 'datatables-strings.inc' %]
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9
<script type="text/javascript">
10
//<![CDATA[
11
    function updateRowsVisibility(show_only_renewed) {
12
        if ( show_only_renewed ) {
13
            $("#srlt [data-reneweddate='']").hide();
14
        } else {
15
            $("#srlt > tbody > tr").show();
16
        }
17
    }
18
19
    [% IF (dateformat == 'metric') %]
20
        dt_add_type_uk_date();
21
    [% END %]
22
    $(document).ready(function() {
23
        $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, {
24
            "aoColumnDefs": [
25
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
26
                [% IF (dateformat == 'metric') %]
27
                    { "aTargets": [ -2 ], "sType": "uk_date" },
28
                [% END %]
29
            ],
30
        } ) )
31
32
        $("#show_only_renewed").click(function(){
33
            updateRowsVisibility($(this+":checked").val());
34
        });
35
        $("#show_only_renewed").attr('checked', false);
36
        updateRowsVisibility(false);
37
    });
38
 //]]>
39
</script>
40
</head>
41
<body>
42
[% INCLUDE 'header.inc' %]
43
[% INCLUDE 'acquisitions-search.inc' %]
44
45
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% supplierid %]">[% booksellername %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Shopping Basket [% basketno %]</a> &rsaquo; Add order from a subscription</div>
46
47
<div id="doc3" class="yui-t2">
48
    <div id="bd">
49
    <div id="yui-main">
50
        <div class="yui-b">
51
            <h2>Serials subscriptions</h2>
52
            [% IF (routing) %]
53
                <h3>Search for Serial Routing List</h3>
54
            [% END %]
55
            [% IF (done_searched) %]
56
                <label for="show_only_renewed">
57
                    <input type="checkbox" style="vertical-align: middle;" id="show_only_renewed" />
58
                    Show only renewed
59
                </label>
60
                [% IF (subs_loop) %]
61
                    <table id="srlt">
62
                        <thead>
63
                            <tr>
64
                                <th>ISSN</th>
65
                                <th>Title</th>
66
                                <th> Notes </th>
67
                                <th>Library</th>
68
                                <th>Call number</th>
69
                                <th>Expiration date</th>
70
                                <th></th>
71
                            </tr>
72
                        </thead>
73
                        <tbody>
74
                        [% FOREACH sub IN subs_loop %]
75
                            <tr data-reneweddate="[% sub.reneweddate %]" >
76
                                <td>[% sub.issn %]</td>
77
                                <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid %]" class="button" title="subscription detail">[% IF (sub.title) %][% sub.title |html %][% ELSE %]
78
                                ---
79
                            [% END %][% IF (sub.unititle) %], [% sub.unititle %][% END %]</a>
80
                                </td>
81
                                <td>[% notes %]
82
                                    [% IF (sub.internalnotes) %]([% sub.internalnotes %])[% END %]
83
                                </td>
84
                                <td>
85
                                    [% IF (sub.branchcode) %][% sub.branchcode %][% END %]
86
                                </td>
87
                                <td>
88
                                    [% IF (sub.callnumber) %][% sub.callnumber %][% END %]
89
                                </td>
90
                                <td>
91
                                    [% IF (sub.enddate) %][% sub.enddate | $KohaDates %][% END %]
92
                                </td>
93
                                <td>
94
                                    [% IF (sub.alreadyOnOrder) %]
95
                                        Outstanding order (only one order per subscription is allowed)
96
                                    [% ELSE %]
97
                                        <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;biblionumber=[% sub.biblionumber %]&amp;subscriptionid=[% sub.subscriptionid %]" title="Order this one">
98
                                            Order
99
                                        </a>
100
                                    [% END %]
101
                                </td>
102
                            </tr>
103
                        [% END %]
104
                        </tbody>
105
                    </table>
106
                [% ELSE %]
107
                    <p>Sorry, there is no result for your search.</p>
108
                [% END %]
109
            [% ELSE %]
110
                <p>Use the search form on the left to find subscriptions.</p>
111
            [% END %]
112
        </div>
113
    </div>
114
115
    <div class="yui-b">
116
        [% INCLUDE 'subscriptions-search.inc' %]
117
        [% INCLUDE 'acquisitions-menu.inc' %]
118
    </div>
119
</div>
120
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-24 / +26 lines)
Lines 218-234 function IEEventHandler_KeyDown() { Link Here
218
            </div>
218
            </div>
219
        </div>
219
        </div>
220
220
221
        <fieldset class="rows" id="itemfieldset">
221
        [% UNLESS subscriptionid %]
222
            <legend>Item</legend>
222
          <fieldset class="rows" id="itemfieldset">
223
            [% IF ( NoACQframework ) %]
223
              <legend>Item</legend>
224
                <p class="required">
224
              [% IF ( NoACQframework ) %]
225
                    No ACQ framework, using default. You should create a
225
                  <p class="required">
226
                    framework with code ACQ, the items framework would be
226
                      No ACQ framework, using default. You should create a
227
                    used
227
                      framework with code ACQ, the items framework would be
228
                </p>
228
                      used
229
            [% END %]
229
                  </p>
230
            <div id="outeritemblock"></div>
230
              [% END %]
231
        </fieldset>
231
              <div id="outeritemblock"></div>
232
          </fieldset>
233
        [% END %]
232
    [% ELSIF (AcqCreateItem == 'ordering') %]
234
    [% ELSIF (AcqCreateItem == 'ordering') %]
233
        [% IF (items.size) %]
235
        [% IF (items.size) %]
234
            <h5>Items</h5>
236
            <h5>Items</h5>
Lines 294-302 function IEEventHandler_KeyDown() { Link Here
294
       <li><label for="bookfund">Budget: </label><span> [% bookfund %] </span></li>
296
       <li><label for="bookfund">Budget: </label><span> [% bookfund %] </span></li>
295
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
297
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
296
       <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label">
298
       <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label">
297
           [% IF ( edit ) %]
299
           [% IF ( edit and not subscriptionid) %]
298
               <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
300
               <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
299
           [% ELSE %]
301
           [% ELSE%]
300
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
302
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
301
           [% END %]
303
           [% END %]
302
           </span></li>
304
           </span></li>
Lines 307-328 function IEEventHandler_KeyDown() { Link Here
307
            [% IF ( quantityreceived ) %]
309
            [% IF ( quantityreceived ) %]
308
                [% IF ( edit ) %]
310
                [% IF ( edit ) %]
309
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
311
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
310
                    <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
312
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
311
                [% ELSE %]
312
                [% IF ( items ) %]
313
                    <input READONLY type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
314
                [% ELSE %]
313
                [% ELSE %]
315
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
314
                    [% IF ( items ) %]
316
                [% END %]
315
                        <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
317
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
316
                    [% ELSE %]
317
                        <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 %]" />
318
                    [% END %]
319
                    <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived %]" />
318
                [% END %]
320
                [% END %]
319
            [% ELSE %]
321
            [% ELSE %]
320
                [% IF ( items ) %]
322
                [% IF ( subscriptionid ) %]
321
                    <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
323
                    <input type="text" readonly="readonly" id="quantity" size="20" name="quantityrec" value="1" />
322
                [% ELSE %]
324
                [% ELSE %]
323
                    <input type="text" size="20" id="quantity" name="quantityrec" value="1" />
325
                    <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
324
                [% END %]
326
                [% END %]
325
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" />
327
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
326
            [% END %]
328
            [% END %]
327
            <div id="qtyrecerror" style="display:none">
329
            <div id="qtyrecerror" style="display:none">
328
                <p class="error">Warning, you have entered more items than expected.
330
                <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 106-112 my $branches = GetBranches(); Link Here
106
my @branches_loop;
106
my @branches_loop;
107
foreach (sort keys %$branches){
107
foreach (sort keys %$branches){
108
    my $selected = 0;
108
    my $selected = 0;
109
    $selected = 1 if( $branch eq $_ );
109
    $selected = 1 if( defined $branch and $branch eq $_ );
110
    push @branches_loop, {
110
    push @branches_loop, {
111
        branchcode  => $_,
111
        branchcode  => $_,
112
        branchname  => $branches->{$_}->{'branchname'},
112
        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 128-161 if (! $subs->{periodicity}) { Link Here
128
my $default_bib_view = get_default_view();
130
my $default_bib_view = get_default_view();
129
131
130
my ( $order, $bookseller, $tmpl_infos );
132
my ( $order, $bookseller, $tmpl_infos );
131
# FIXME = see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5335#c52
133
if ( defined $subscriptionid ) {
132
#if ( defined $subscriptionid ) {
134
    my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid;
133
#    my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid;
135
    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
134
#    my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
136
    if ( defined $lastOrderNotReceived ) {
135
#    if ( defined $lastOrderNotReceived ) {
137
        my $basket = GetBasket $lastOrderNotReceived->{basketno};
136
#        my $basket = GetBasket $lastOrderNotReceived->{basketno};
138
        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
137
#        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
139
        ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller );
138
#        ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller );
140
        $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} );
139
#        $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} );
141
        $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} );
140
#        $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} );
142
        $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
141
#        $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
143
        $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
142
#        $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
144
        $tmpl_infos->{ordered_exists} = 1;
143
#        $tmpl_infos->{ordered_exists} = 1;
145
    }
144
#    }
146
    if ( defined $lastOrderReceived ) {
145
#    if ( defined $lastOrderReceived ) {
147
        my $basket = GetBasket $lastOrderReceived->{basketno};
146
#        my $basket = GetBasket $lastOrderReceived->{basketno};
148
        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
147
#        my $bookseller = GetBookSellerFromId $basket->{booksellerid};
149
        ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller );
148
#        ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller );
150
        $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
149
#        $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
151
        $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
150
#        $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
152
        $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
151
#        $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
153
        $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber};
152
#        $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber};
154
        $tmpl_infos->{spent_exists} = 1;
153
#        $tmpl_infos->{spent_exists} = 1;
155
    }
154
#    }
156
}
155
#}
156
157
157
$template->param(
158
$template->param(
158
	subscriptionid => $subscriptionid,
159
    subscriptionid => $subscriptionid,
159
    serialslist => \@serialslist,
160
    serialslist => \@serialslist,
160
    hasRouting  => $hasRouting,
161
    hasRouting  => $hasRouting,
161
    routing => C4::Context->preference("RoutingSerials"),
162
    routing => C4::Context->preference("RoutingSerials"),
Lines 175-181 $template->param( Link Here
175
    default_bib_view => $default_bib_view,
176
    default_bib_view => $default_bib_view,
176
    (uc(C4::Context->preference("marcflavour"))) => 1,
177
    (uc(C4::Context->preference("marcflavour"))) => 1,
177
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
178
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
178
    );
179
    basketno => $order->{basketno},
180
    %$tmpl_infos,
181
);
179
182
180
output_html_with_http_headers $query, $cookie, $template->output;
183
output_html_with_http_headers $query, $cookie, $template->output;
181
184
Lines 193-195 sub get_default_view { Link Here
193
    }
196
    }
194
    return 'detail';
197
    return 'detail';
195
}
198
}
196
- 
199
200
sub get_value_with_gst_params {
201
    my $value = shift;
202
    my $gstrate = shift;
203
    my $bookseller = shift;
204
    if ( $bookseller->{listincgst} ) {
205
        return ( $value, $value / ( 1 + $gstrate ) );
206
    } else {
207
        return ( $value * ( 1 + $gstrate ), $value );
208
    }
209
}
210
211
sub get_gste {
212
    my $value = shift;
213
    my $gstrate = shift;
214
    my $bookseller = shift;
215
    if ( $bookseller->{invoiceincgst} ) {
216
        return $value / ( 1 + $gstrate );
217
    } else {
218
        return $value;
219
    }
220
}
221
222
sub get_gst {
223
    my $value = shift;
224
    my $gstrate = shift;
225
    my $bookseller = shift;
226
    if ( $bookseller->{invoiceincgst} ) {
227
        return $value / ( 1 + $gstrate ) * $gstrate;
228
    } else {
229
        return $value * ( 1 + $gstrate ) - $value;
230
    }
231
}
232

Return to bug 5343