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

(-)a/C4/Acquisition.pm (-36 / +54 lines)
Lines 424-430 sub CloseBasketgroup { Link Here
424
    my $dbh        = C4::Context->dbh;
424
    my $dbh        = C4::Context->dbh;
425
    my $sth = $dbh->prepare("
425
    my $sth = $dbh->prepare("
426
        UPDATE aqbasketgroups
426
        UPDATE aqbasketgroups
427
        SET    closed=1
427
        SET    bg_closedate=now()
428
        WHERE  id=?
428
        WHERE  id=?
429
    ");
429
    ");
430
    $sth->execute($basketgroupno);
430
    $sth->execute($basketgroupno);
Lines 445-451 sub ReOpenBasketgroup { Link Here
445
    my $dbh        = C4::Context->dbh;
445
    my $dbh        = C4::Context->dbh;
446
    my $sth = $dbh->prepare("
446
    my $sth = $dbh->prepare("
447
        UPDATE aqbasketgroups
447
        UPDATE aqbasketgroups
448
        SET    closed=0
448
        SET    bg_closedate=NULL
449
        WHERE  id=?
449
        WHERE  id=?
450
    ");
450
    ");
451
    $sth->execute($basketgroupno);
451
    $sth->execute($basketgroupno);
Lines 828-849 sub GetBasketsByBasketgroup { Link Here
828
  $basketgroupid = NewBasketgroup(\%hashref);
828
  $basketgroupid = NewBasketgroup(\%hashref);
829
829
830
Adds a basketgroup to the aqbasketgroups table, and add the initial baskets to it.
830
Adds a basketgroup to the aqbasketgroups table, and add the initial baskets to it.
831
Keys of \%hashref can be one or several fields of aqbooksellers table:
832
- booksellerid
833
- name
834
- basketlist
835
- billingplace
836
- deliveryplace
837
- freedeliveryplace
838
- deliverycomment
839
or the special key "closed", which force the closure of the basketgroup if its value is "1".
840
If "closed" key does not exist or is not set to "1", the new basketgroup will be open.
831
841
832
$hashref->{'booksellerid'} is the 'id' field of the bookseller in the aqbooksellers table,
842
The "booksellerid" key is mandatory.
833
843
834
$hashref->{'name'} is the 'name' field of the basketgroup in the aqbasketgroups table,
844
bg_creationdate field of aqbasketgroups table is filled with the value of now ()
845
bg_closedate field of aqbasketgroups table is filled with the value of now () if the "closed" key has "1" value
835
846
836
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
847
If "booksellerid" key is not provided, the function dies with a message.
837
848
If a key is not allowed, the function ignores it.
838
$hashref->{'billingplace'} is the 'billingplace' field of the basketgroup in the aqbasketgroups table,
839
840
$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
841
842
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgroup in the aqbasketgroups table,
843
844
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
845
846
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
847
849
848
=cut
850
=cut
849
851
Lines 852-872 sub NewBasketgroup { Link Here
852
    die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
854
    die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
853
    my $query = "INSERT INTO aqbasketgroups (";
855
    my $query = "INSERT INTO aqbasketgroups (";
854
    my @params;
856
    my @params;
855
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
857
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment booksellerid)) {
856
        if ( defined $basketgroupinfo->{$field} ) {
858
        if ( defined $basketgroupinfo->{$field} ) {
857
            $query .= "$field, ";
859
            $query .= "$field, ";
858
            push(@params, $basketgroupinfo->{$field});
860
            push(@params, $basketgroupinfo->{$field});
859
        }
861
        }
860
    }
862
    }
861
    $query .= "booksellerid) VALUES (";
863
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "1") {
864
        $query .= "bg_closedate, ";
865
    }
866
    $query .= "bg_creationdate) VALUES (";
862
    foreach (@params) {
867
    foreach (@params) {
863
        $query .= "?, ";
868
        $query .= "?, ";
864
    }
869
    }
865
    $query .= "?)";
870
    chop($query);
866
    push(@params, $basketgroupinfo->{'booksellerid'});
871
    chop($query);
872
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "1") {
873
        $query .= ", CAST(NOW() AS DATE)";
874
    }
875
    $query .= ", CAST(NOW() AS DATE))";
867
    my $dbh = C4::Context->dbh;
876
    my $dbh = C4::Context->dbh;
868
    my $sth = $dbh->prepare($query);
877
    my $sth = $dbh->prepare($query);
869
    $sth->execute(@params);
878
    $sth->execute(@params);
879
870
    my $basketgroupid = $dbh->{'mysql_insertid'};
880
    my $basketgroupid = $dbh->{'mysql_insertid'};
871
    if( $basketgroupinfo->{'basketlist'} ) {
881
    if( $basketgroupinfo->{'basketlist'} ) {
872
        foreach my $basketno (@{$basketgroupinfo->{'basketlist'}}) {
882
        foreach my $basketno (@{$basketgroupinfo->{'basketlist'}}) {
Lines 885-906 sub NewBasketgroup { Link Here
885
  ModBasketgroup(\%hashref);
895
  ModBasketgroup(\%hashref);
886
896
887
Modifies a basketgroup in the aqbasketgroups table, and add the baskets to it.
897
Modifies a basketgroup in the aqbasketgroups table, and add the baskets to it.
888
898
Keys of \%hashref can be one or several fields of aqbooksellers table:
889
$hashref->{'id'} is the 'id' field of the basketgroup in the aqbasketgroup table, this parameter is mandatory,
899
- booksellerid
890
900
- name
891
$hashref->{'name'} is the 'name' field of the basketgroup in the aqbasketgroups table,
901
- basketlist
892
902
- billingplace
893
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
903
- deliveryplace
894
904
- freedeliveryplace
895
$hashref->{'billingplace'} is the 'billingplace' field of the basketgroup in the aqbasketgroups table,
905
- deliverycomment
896
906
or the special key "closed", which force the closure of the basketgroup if its value is "1", and its opening if its value is "0"
897
$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
907
The "booksellerid" key is mandatory.
898
908
899
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgroup in the aqbasketgroups table,
909
bg_closedate field of aqbasketgroups table is
900
910
- filled with the value of now() if the "closed" key has "1" value
901
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
911
or
902
912
- set to NULL if the "closed" key has "0" value
903
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
913
914
If "booksellerid" key is not provided, the function dies with a message.
915
If a key is not allowed, the function ignores it.
904
916
905
=cut
917
=cut
906
918
Lines 910-916 sub ModBasketgroup { Link Here
910
    my $dbh = C4::Context->dbh;
922
    my $dbh = C4::Context->dbh;
911
    my $query = "UPDATE aqbasketgroups SET ";
923
    my $query = "UPDATE aqbasketgroups SET ";
912
    my @params;
924
    my @params;
913
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
925
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) {
914
        if ( defined $basketgroupinfo->{$field} ) {
926
        if ( defined $basketgroupinfo->{$field} ) {
915
            $query .= "$field=?, ";
927
            $query .= "$field=?, ";
916
            push(@params, $basketgroupinfo->{$field});
928
            push(@params, $basketgroupinfo->{$field});
Lines 918-923 sub ModBasketgroup { Link Here
918
    }
930
    }
919
    chop($query);
931
    chop($query);
920
    chop($query);
932
    chop($query);
933
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "1") {
934
        $query .= ", bg_closedate=CAST(NOW() AS DATE)";
935
    }
936
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "0") {
937
        $query .= ", bg_closedate=NULL";
938
    }
921
    $query .= " WHERE id=?";
939
    $query .= " WHERE id=?";
922
    push(@params, $basketgroupinfo->{'id'});
940
    push(@params, $basketgroupinfo->{'id'});
923
    my $sth = $dbh->prepare($query);
941
    my $sth = $dbh->prepare($query);
(-)a/Koha/Schema/Result/Aqbasketgroup.pm (-7 / +16 lines)
Lines 35-45 __PACKAGE__->table("aqbasketgroups"); Link Here
35
  is_nullable: 1
35
  is_nullable: 1
36
  size: 50
36
  size: 50
37
37
38
=head2 closed
39
40
  data_type: 'tinyint'
41
  is_nullable: 1
42
43
=head2 booksellerid
38
=head2 booksellerid
44
39
45
  data_type: 'integer'
40
  data_type: 'integer'
Lines 69-74 __PACKAGE__->table("aqbasketgroups"); Link Here
69
  is_nullable: 1
64
  is_nullable: 1
70
  size: 10
65
  size: 10
71
66
67
=head2 bg_creationdate
68
69
  data_type: 'date'
70
  is_nullable: 1
71
  datetime_undef_if_invalid: 1
72
73
=head2 bg_closedate
74
75
  data_type: 'varchar'
76
  is_nullable: 1
77
  datetime_undef_if_invalid: 1
78
72
=cut
79
=cut
73
80
74
__PACKAGE__->add_columns(
81
__PACKAGE__->add_columns(
Lines 76-83 __PACKAGE__->add_columns( Link Here
76
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
83
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
77
  "name",
84
  "name",
78
  { data_type => "varchar", is_nullable => 1, size => 50 },
85
  { data_type => "varchar", is_nullable => 1, size => 50 },
79
  "closed",
80
  { data_type => "tinyint", is_nullable => 1 },
81
  "booksellerid",
86
  "booksellerid",
82
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
87
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
83
  "deliveryplace",
88
  "deliveryplace",
Lines 88-93 __PACKAGE__->add_columns( Link Here
88
  { data_type => "varchar", is_nullable => 1, size => 255 },
93
  { data_type => "varchar", is_nullable => 1, size => 255 },
89
  "billingplace",
94
  "billingplace",
90
  { data_type => "varchar", is_nullable => 1, size => 10 },
95
  { data_type => "varchar", is_nullable => 1, size => 10 },
96
  "bg_creationdate",
97
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1},
98
  "bg_closedate",
99
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1},
91
);
100
);
92
101
93
=head1 PRIMARY KEY
102
=head1 PRIMARY KEY
(-)a/acqui/basketgroup.pl (-34 / +22 lines)
Lines 246-253 $template->param(booksellerid => $booksellerid); Link Here
246
246
247
if ( $op eq "add" ) {
247
if ( $op eq "add" ) {
248
#
248
#
249
# if no param('basketgroupid') is not defined, adds a new basketgroup
249
# if param('basketgroupid') is not defined, adds a new basketgroup
250
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
250
# otherwise, edits (if it is open) or displays (if it is closed) the basketgroup basketgroupid
251
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
251
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
252
#
252
#
253
    my $bookseller = &GetBookSellerFromId($booksellerid);
253
    my $bookseller = &GetBookSellerFromId($booksellerid);
Lines 270-282 if ( $op eq "add" ) { Link Here
270
            name            => $basketgroup->{name},
270
            name            => $basketgroup->{name},
271
            deliverycomment => $basketgroup->{deliverycomment},
271
            deliverycomment => $basketgroup->{deliverycomment},
272
            freedeliveryplace => $basketgroup->{freedeliveryplace},
272
            freedeliveryplace => $basketgroup->{freedeliveryplace},
273
        );
273
            bg_creationdate => $basketgroup->{bg_creationdate},
274
            bg_closedate    => $basketgroup->{bg_closedate}
275
);
274
        $billingplace  = $basketgroup->{billingplace};
276
        $billingplace  = $basketgroup->{billingplace};
275
        $deliveryplace = $basketgroup->{deliveryplace};
277
        $deliveryplace = $basketgroup->{deliveryplace};
276
        $freedeliveryplace = $basketgroup->{freedeliveryplace};
278
        $freedeliveryplace = $basketgroup->{freedeliveryplace};
277
        $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0);
278
    } else {
279
        $template->param( closedbg => 0);
280
    }
279
    }
281
    # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
280
    # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
282
    my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) );
281
    my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) );
Lines 347-353 if ( $op eq "add" ) { Link Here
347
    print $input->redirect($redirectpath);
346
    print $input->redirect($redirectpath);
348
} elsif ( $op eq 'attachbasket') {
347
} elsif ( $op eq 'attachbasket') {
349
#
348
#
350
# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
349
# save a modified basketgroup, or put an existing basket in a basketgroup (called from basket page)
351
#
350
#
352
    # Getting parameters
351
    # Getting parameters
353
    my $basketgroup       = {};
352
    my $basketgroup       = {};
Lines 359-399 if ( $op eq "add" ) { Link Here
359
    my $deliveryplace     = $input->param('deliveryplace');
358
    my $deliveryplace     = $input->param('deliveryplace');
360
    my $freedeliveryplace = $input->param('freedeliveryplace');
359
    my $freedeliveryplace = $input->param('freedeliveryplace');
361
    my $deliverycomment   = $input->param('deliverycomment');
360
    my $deliverycomment   = $input->param('deliverycomment');
362
    my $closedbg          = $input->param('closedbg') ? 1 : 0;
361
    # if "close" box is checked in form, $close is set to 1, and ModBasketgroup/NewBasketgroup closes the basketgroup by setting bg_closedate field to now()
362
    my $close             = $input->param('close');
363
    $basketgroup = {
364
        name              => $basketgroupname,
365
        booksellerid      => $booksellerid,
366
        basketlist        => \@baskets,
367
        billingplace      => $billingplace,
368
        deliveryplace     => $deliveryplace,
369
        freedeliveryplace => $freedeliveryplace,
370
        deliverycomment   => $deliverycomment,
371
        closed            => $close,
372
        };
363
    if ($basketgroupid) {
373
    if ($basketgroupid) {
364
    # If we have a basketgroupid we edit the basketgroup
374
    # If we have a basketgroupid we edit the basketgroup
365
        $basketgroup = {
375
        $basketgroup->{id} = $basketgroupid;
366
              name              => $basketgroupname,
367
              id                => $basketgroupid,
368
              basketlist        => \@baskets,
369
              billingplace      => $billingplace,
370
              deliveryplace     => $deliveryplace,
371
              freedeliveryplace => $freedeliveryplace,
372
              deliverycomment   => $deliverycomment,
373
              closed            => $closedbg,
374
        };
375
        ModBasketgroup($basketgroup);
376
        ModBasketgroup($basketgroup);
376
        if($closedbg){
377
# FIXME
378
        }
379
    }else{
377
    }else{
380
    # we create a new basketgroup (whith a closed basket)
378
    # Otherwise we create a new basketgroup
381
        $basketgroup = {
382
            name              => $basketgroupname,
383
            booksellerid      => $booksellerid,
384
            basketlist        => \@baskets,
385
            billingplace      => $billingplace,
386
            deliveryplace     => $deliveryplace,
387
            freedeliveryplace => $freedeliveryplace,
388
            deliverycomment   => $deliverycomment,
389
            closed            => $closedbg,
390
        };
391
        $basketgroupid = NewBasketgroup($basketgroup);
379
        $basketgroupid = NewBasketgroup($basketgroup);
392
    }
380
    }
393
    my $redirectpath = ((defined $input->param('mode')) && ($input->param('mode') eq 'singlebg')) ?'/cgi-bin/koha/acqui/basketgroup.pl?op=add&basketgroupid='.$basketgroupid.'&booksellerid='.$booksellerid : '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid;
381
    my $redirectpath = ((defined $input->param('mode')) && ($input->param('mode') eq 'singlebg')) ?'/cgi-bin/koha/acqui/basketgroup.pl?op=add&basketgroupid='.$basketgroupid.'&booksellerid='.$booksellerid : '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid;
394
    $redirectpath .=  "&listclosed=1" if $closedbg ;
382
    $redirectpath .=  "&listclosed=1" if $close ;
395
    print $input->redirect($redirectpath );
383
    print $input->redirect($redirectpath );
396
    
384
397
}else{
385
}else{
398
# no param : display the list of all basketgroups for a given vendor
386
# no param : display the list of all basketgroups for a given vendor
399
    my $basketgroups = &GetBasketgroups($booksellerid);
387
    my $basketgroups = &GetBasketgroups($booksellerid);
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2761-2772 DROP TABLE IF EXISTS `aqbasketgroups`; Link Here
2761
CREATE TABLE `aqbasketgroups` (
2761
CREATE TABLE `aqbasketgroups` (
2762
  `id` int(11) NOT NULL auto_increment,
2762
  `id` int(11) NOT NULL auto_increment,
2763
  `name` varchar(50) default NULL,
2763
  `name` varchar(50) default NULL,
2764
  `closed` tinyint(1) default NULL,
2765
  `booksellerid` int(11) NOT NULL,
2764
  `booksellerid` int(11) NOT NULL,
2766
  `deliveryplace` varchar(10) default NULL,
2765
  `deliveryplace` varchar(10) default NULL,
2767
  `freedeliveryplace` text default NULL,
2766
  `freedeliveryplace` text default NULL,
2768
  `deliverycomment` varchar(255) default NULL,
2767
  `deliverycomment` varchar(255) default NULL,
2769
  `billingplace` varchar(10) default NULL,
2768
  `billingplace` varchar(10) default NULL,
2769
  bg_creationdate date default NULL, -- the date the basketgroup was created
2770
  bg_closedate date default NULL, -- the date the basketgroup was closed
2770
  PRIMARY KEY  (`id`),
2771
  PRIMARY KEY  (`id`),
2771
  KEY `booksellerid` (`booksellerid`),
2772
  KEY `booksellerid` (`booksellerid`),
2772
  CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
2773
  CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
(-)a/installer/data/mysql/updatedatabase.pl (+11 lines)
Lines 8083-8088 if ( CheckVersion($DBversion) ) { Link Here
8083
    SetVersion($DBversion);
8083
    SetVersion($DBversion);
8084
}
8084
}
8085
8085
8086
$DBversion = "3.15.00.XXX";
8087
if(CheckVersion($DBversion)) {
8088
    $dbh->do("ALTER TABLE aqbasketgroups ADD bg_creationdate DATE DEFAULT NULL AFTER billingplace;");
8089
    $dbh->do("ALTER TABLE aqbasketgroups ADD bg_closedate DATE DEFAULT NULL AFTER bg_creationdate;");
8090
    $dbh->do("UPDATE aqbasketgroups SET bg_creationdate=(SELECT MAX(creationdate) FROM aqbasket WHERE aqbasket.basketgroupid=aqbasketgroups.id)");
8091
    $dbh->do("UPDATE aqbasketgroups SET bg_closedate=(SELECT MAX(creationdate) FROM aqbasket WHERE aqbasket.basketgroupid=aqbasketgroups.id) WHERE aqbasketgroups.closed = 1");
8092
    $dbh->do("ALTER TABLE aqbasketgroups DROP COLUMN closed;");
8093
    print "Upgrade to $DBversion done (Bug 11438 - Add creation date and closing date to basketgroups)\n";
8094
    SetVersion($DBversion);
8095
}
8096
8086
=head1 FUNCTIONS
8097
=head1 FUNCTIONS
8087
8098
8088
=head2 TableExists($table)
8099
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-26 / +37 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE KohaDates %]
3
2
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
5
<title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
Lines 96-111 var MSG_SAVE_BEFORE_PRINTING = _("You need to save the page before printing"); Link Here
96
var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
98
var MSG_REOPEN_BASKETGROUP = _("reopen basketgroup");
97
var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
99
var MSG_FILE_DOWNLOAD_ERROR = _("Error downloading the file");
98
100
99
function submitForm(form) {
100
    if (form.close.checked == true) {
101
	var input = document.createElement("input");
102
	input.setAttribute("type", "hidden");
103
	input.setAttribute("name", "closed");
104
	input.setAttribute("value", "1");
105
	form.appendChild(input);
106
    }
107
}
108
109
 $(document).ready(function() {
101
 $(document).ready(function() {
110
    $("#basket_groups").tabs();
102
    $("#basket_groups").tabs();
111
103
Lines 139-145 function submitForm(form) { Link Here
139
        <div id="yui-main">
131
        <div id="yui-main">
140
            <div class="yui-b">
132
            <div class="yui-b">
141
                [% IF ( grouping ) %]
133
                [% IF ( grouping ) %]
142
                    [% IF (closedbg) %]
134
                    [% IF (bg_closedate) %]
143
                        <div id="toolbar" class="btn-toolbar">
135
                        <div id="toolbar" class="btn-toolbar">
144
                            <div class="btn-group"><a href="[% script_name %]?op=reopen&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]&amp;mode=singlebg" class="btn btn-small" id="reopenbutton"><i class="icon-download"></i> Reopen this basket group</a></div>
136
                            <div class="btn-group"><a href="[% script_name %]?op=reopen&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]&amp;mode=singlebg" class="btn btn-small" id="reopenbutton"><i class="icon-download"></i> Reopen this basket group</a></div>
145
                            <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket group as CSV</a></div>
137
                            <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket group as CSV</a></div>
Lines 148-154 function submitForm(form) { Link Here
148
                    [% ELSE %]
140
                    [% ELSE %]
149
                        <div class="btn-group"><a href="[% script_name %]?op=delete&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="delbutton"><i class="icon-remove"></i> Delete basket group</a></div>
141
                        <div class="btn-group"><a href="[% script_name %]?op=delete&amp;basketgroupid=[% basketgroupid %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="delbutton"><i class="icon-remove"></i> Delete basket group</a></div>
150
                    [% END %]
142
                    [% END %]
151
                    [% IF (name && closedbg) %]
143
                    [% IF (name && bg_closedate) %]
152
                        <h1>Basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
144
                        <h1>Basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
153
                    [% ELSIF (name) %]
145
                    [% ELSIF (name) %]
154
                        <h1>Edit basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
146
                        <h1>Edit basket group [% name %] ([% basketgroupid %]) for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
Lines 156-162 function submitForm(form) { Link Here
156
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
148
                        <h1>Add basket group for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1>
157
                    [% END %]
149
                    [% END %]
158
                    <div id="basketgroupcolumns" class="yui-g">
150
                    <div id="basketgroupcolumns" class="yui-g">
159
                        [% UNLESS (closedbg) %]
151
                        [% UNLESS (bg_closedate) %]
160
                            <div class="yui-u">
152
                            <div class="yui-u">
161
                                <form action="[% scriptname %]" method="post" name="basketgroups" id="basketgroups">
153
                                <form action="[% scriptname %]" method="post" name="basketgroups" id="basketgroups">
162
                                    <div id="groups">
154
                                    <div id="groups">
Lines 190-196 function submitForm(form) { Link Here
190
                            <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
182
                            <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)">
191
                                <fieldset id="various" class="brief">
183
                                <fieldset id="various" class="brief">
192
                                    <ol>
184
                                    <ol>
193
                                        [% UNLESS (closedbg) %]
185
                                        [% IF (bg_creationdate) %]
186
                                            <li>
187
                                                <label for="bg_creationdate">Created on:</label>
188
                                                <span>[% bg_creationdate | $KohaDates %]</span>
189
                                            </li>
190
                                            <input type="hidden" id="bg_creationdate" name="bg_creationdate" value = "[% bg_creationdate %]"/>
191
                                        [% END %]
192
                                        [% IF (bg_closedate ) %]
193
                                            <li>
194
                                                <label for="bg_closedate">Closed on:</label>
195
                                                <span>[% bg_closedate | $KohaDates %]</span>
196
                                            </li>
197
                                            <input type="hidden" id="bg_closedate" name="bg_closedate" value = "[% bg_closedate %]"/>
198
                                        [% END %]
199
                                        [% UNLESS (bg_closedate) %]
194
                                            <li>
200
                                            <li>
195
                                                <label for="basketgroupname">Basket group name:</label>
201
                                                <label for="basketgroupname">Basket group name:</label>
196
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" class="focus" />
202
                                                <input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" class="focus" />
Lines 199-205 function submitForm(form) { Link Here
199
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name %]" />
205
                                            <input type="hidden" name="basketgroupname" id="basketgroupname" value="[% name %]" />
200
                                        [% END %]
206
                                        [% END %]
201
                                        <li>
207
                                        <li>
202
                                            [% UNLESS (closedbg) %]
208
                                            [% UNLESS (bg_closedate) %]
203
                                                <label for="billingplace">Billing place:</label>
209
                                                <label for="billingplace">Billing place:</label>
204
                                                <select name="billingplace" id="billingplace" style="width:13em;">
210
                                                <select name="billingplace" id="billingplace" style="width:13em;">
205
                                                    <option value="">--</option>
211
                                                    <option value="">--</option>
Lines 217-223 function submitForm(form) { Link Here
217
                                                [% END %]
223
                                                [% END %]
218
                                            [% END %]
224
                                            [% END %]
219
                                        </li>
225
                                        </li>
220
                                        [% UNLESS (closedbg) %]
226
                                        [% UNLESS (bg_closedate) %]
221
                                            <li>
227
                                            <li>
222
                                                <label for="deliveryplace">Delivery place:</label>
228
                                                <label for="deliveryplace">Delivery place:</label>
223
                                                <select name="deliveryplace" id="deliveryplace" style="width:13em;">
229
                                                <select name="deliveryplace" id="deliveryplace" style="width:13em;">
Lines 250-256 function submitForm(form) { Link Here
250
                                                </li>
256
                                                </li>
251
                                            [% END %]
257
                                            [% END %]
252
                                            <li>
258
                                            <li>
253
                                                [% UNLESS (closedbg) %]
259
                                                [% UNLESS (bg_closedate) %]
254
                                                    <label for="deliverycomment">Delivery comment:</label>
260
                                                    <label for="deliverycomment">Delivery comment:</label>
255
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment %]</textarea>
261
                                                    <textarea cols="26" rows="3" name="deliverycomment" id="deliverycomment">[% deliverycomment %]</textarea>
256
                                                [% ELSE %]
262
                                                [% ELSE %]
Lines 260-266 function submitForm(form) { Link Here
260
                                            </li>
266
                                            </li>
261
                                            <li>
267
                                            <li>
262
                                                <span class="label">Baskets in this group:</span>
268
                                                <span class="label">Baskets in this group:</span>
263
                                                [% UNLESS (closedbg) %]
269
                                                [% UNLESS (bg_closedate) %]
264
                                                    <ul class="draglist" id="bg">
270
                                                    <ul class="draglist" id="bg">
265
                                                [% ELSE %]
271
                                                [% ELSE %]
266
                                                    <ul>
272
                                                    <ul>
Lines 280-293 function submitForm(form) { Link Here
280
                                                [% END %]
286
                                                [% END %]
281
                                            </ul>
287
                                            </ul>
282
                                        </li>
288
                                        </li>
283
                                            [% UNLESS (closedbg) %]
289
                                            [% UNLESS (bg_closedate) %]
284
                                                <li><label><input type="checkbox" id="closedbg" name="closedbg" />Close basket group</label></li>
290
                                                <li><label><input type="checkbox" id="close" name="close" value="1" />Close basket group</label></li>
285
                                            [% ELSE %]
286
                                                <input type="hidden" id="closedbg" name="closedbg" value ="1"/>
287
                                            [% END %]
291
                                            [% END %]
288
                                    </ol>
292
                                    </ol>
289
                                </fieldset>
293
                                </fieldset>
290
                                [% UNLESS (closedbg) %]
294
                                [% UNLESS (bg_closedate) %]
291
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid %]" />
295
                                    <fieldset class="action"><input type="hidden" name="booksellerid" value="[% booksellerid %]" />
292
                                        [% IF ( basketgroupid ) %]
296
                                        [% IF ( basketgroupid ) %]
293
                                            <input type="hidden" name="basketgroupid" value="[% basketgroupid %]" />
297
                                            <input type="hidden" name="basketgroupid" value="[% basketgroupid %]" />
Lines 320-331 function submitForm(form) { Link Here
320
                                        <th>Billing place</th>
324
                                        <th>Billing place</th>
321
                                        <th>Delivery place</th>
325
                                        <th>Delivery place</th>
322
                                        <th>Number of baskets</th>
326
                                        <th>Number of baskets</th>
327
                                        <th>Created on</th>
328
                                        <th>Closed on</th>
323
                                        <th>Action</th>
329
                                        <th>Action</th>
324
                                    </tr>
330
                                    </tr>
325
                                </thead>
331
                                </thead>
326
                                <tbody>
332
                                <tbody>
327
                                    [% FOREACH basketgroup IN basketgroups %]
333
                                    [% FOREACH basketgroup IN basketgroups %]
328
                                        [% UNLESS ( basketgroup.closed ) %]
334
                                        [% UNLESS ( basketgroup.bg_closedate ) %]
329
                                            <tr>
335
                                            <tr>
330
                                                <td>[% IF ( basketgroup.name ) %]
336
                                                <td>[% IF ( basketgroup.name ) %]
331
                                                    [% basketgroup.name %]
337
                                                    [% basketgroup.name %]
Lines 337-342 function submitForm(form) { Link Here
337
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
343
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
338
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
344
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
339
                                                <td>[% basketgroup.basketsqty %]</td>
345
                                                <td>[% basketgroup.basketsqty %]</td>
346
                                                <td>[% basketgroup.bg_creationdate %]</td>
347
                                                <td>[% basketgroup.bg_closedate %]</td>
340
                                                <td>
348
                                                <td>
341
                                                    <input type="button" onclick="closeandprint('[% basketgroup.id %]');" value="Close and print" />
349
                                                    <input type="button" onclick="closeandprint('[% basketgroup.id %]');" value="Close and print" />
342
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Edit" /></form>
350
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Edit" /></form>
Lines 357-368 function submitForm(form) { Link Here
357
                                        <th>Billing place</th>
365
                                        <th>Billing place</th>
358
                                        <th>Delivery place</th>
366
                                        <th>Delivery place</th>
359
                                        <th>Number of baskets</th>
367
                                        <th>Number of baskets</th>
368
                                        <th>Created on</th>
369
                                        <th>Closed on</th>
360
                                        <th>Action</th>
370
                                        <th>Action</th>
361
                                    </tr>
371
                                    </tr>
362
                                </thead>
372
                                </thead>
363
                                <tbody>
373
                                <tbody>
364
                                    [% FOREACH basketgroup IN basketgroups %]
374
                                    [% FOREACH basketgroup IN basketgroups %]
365
                                        [% IF ( basketgroup.closed ) %]
375
                                        [% IF ( basketgroup.bg_closedate ) %]
366
                                            <tr>
376
                                            <tr>
367
                                                <td>
377
                                                <td>
368
                                                    [% IF ( basketgroup.name ) %]
378
                                                    [% IF ( basketgroup.name ) %]
Lines 375-380 function submitForm(form) { Link Here
375
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
385
                                                <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
376
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
386
                                                <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
377
                                                <td>[% basketgroup.basketsqty %]</td>
387
                                                <td>[% basketgroup.basketsqty %]</td>
388
                                                <td>[% basketgroup.bg_creationdate %]</td>
389
                                                <td>[% basketgroup.bg_closedate %]</td>
378
                                                <td>
390
                                                <td>
379
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="View" /></form>
391
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="View" /></form>
380
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form>
392
                                                    <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form>
381
- 

Return to bug 11438