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 834-855 sub GetBasketsByBasketgroup { Link Here
834
  $basketgroupid = NewBasketgroup(\%hashref);
834
  $basketgroupid = NewBasketgroup(\%hashref);
835
835
836
Adds a basketgroup to the aqbasketgroups table, and add the initial baskets to it.
836
Adds a basketgroup to the aqbasketgroups table, and add the initial baskets to it.
837
Keys of \%hashref can be one or several fields of aqbooksellers table:
838
- booksellerid
839
- name
840
- basketlist
841
- billingplace
842
- deliveryplace
843
- freedeliveryplace
844
- deliverycomment
845
or the special key "closed", which force the closure of the basketgroup if its value is "1".
846
If "closed" key does not exist or is not set to "1", the new basketgroup will be open.
837
847
838
$hashref->{'booksellerid'} is the 'id' field of the bookseller in the aqbooksellers table,
848
The "booksellerid" key is mandatory.
839
849
840
$hashref->{'name'} is the 'name' field of the basketgroup in the aqbasketgroups table,
850
bg_creationdate field of aqbasketgroups table is filled with the value of now ()
851
bg_closedate field of aqbasketgroups table is filled with the value of now () if the "closed" key has "1" value
841
852
842
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
853
If "booksellerid" key is not provided, the function dies with a message.
843
854
If a key is not allowed, the function ignores it.
844
$hashref->{'billingplace'} is the 'billingplace' field of the basketgroup in the aqbasketgroups table,
845
846
$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
847
848
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgroup in the aqbasketgroups table,
849
850
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
851
852
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
853
855
854
=cut
856
=cut
855
857
Lines 858-878 sub NewBasketgroup { Link Here
858
    die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
860
    die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
859
    my $query = "INSERT INTO aqbasketgroups (";
861
    my $query = "INSERT INTO aqbasketgroups (";
860
    my @params;
862
    my @params;
861
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
863
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment booksellerid)) {
862
        if ( defined $basketgroupinfo->{$field} ) {
864
        if ( defined $basketgroupinfo->{$field} ) {
863
            $query .= "$field, ";
865
            $query .= "$field, ";
864
            push(@params, $basketgroupinfo->{$field});
866
            push(@params, $basketgroupinfo->{$field});
865
        }
867
        }
866
    }
868
    }
867
    $query .= "booksellerid) VALUES (";
869
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "1") {
870
        $query .= "bg_closedate, ";
871
    }
872
    $query .= "bg_creationdate) VALUES (";
868
    foreach (@params) {
873
    foreach (@params) {
869
        $query .= "?, ";
874
        $query .= "?, ";
870
    }
875
    }
871
    $query .= "?)";
876
    chop($query);
872
    push(@params, $basketgroupinfo->{'booksellerid'});
877
    chop($query);
878
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "1") {
879
        $query .= ", CAST(NOW() AS DATE)";
880
    }
881
    $query .= ", CAST(NOW() AS DATE))";
873
    my $dbh = C4::Context->dbh;
882
    my $dbh = C4::Context->dbh;
874
    my $sth = $dbh->prepare($query);
883
    my $sth = $dbh->prepare($query);
875
    $sth->execute(@params);
884
    $sth->execute(@params);
885
    
876
    my $basketgroupid = $dbh->{'mysql_insertid'};
886
    my $basketgroupid = $dbh->{'mysql_insertid'};
877
    if( $basketgroupinfo->{'basketlist'} ) {
887
    if( $basketgroupinfo->{'basketlist'} ) {
878
        foreach my $basketno (@{$basketgroupinfo->{'basketlist'}}) {
888
        foreach my $basketno (@{$basketgroupinfo->{'basketlist'}}) {
Lines 891-912 sub NewBasketgroup { Link Here
891
  ModBasketgroup(\%hashref);
901
  ModBasketgroup(\%hashref);
892
902
893
Modifies a basketgroup in the aqbasketgroups table, and add the baskets to it.
903
Modifies a basketgroup in the aqbasketgroups table, and add the baskets to it.
894
904
Keys of \%hashref can be one or several fields of aqbooksellers table:
895
$hashref->{'id'} is the 'id' field of the basketgroup in the aqbasketgroup table, this parameter is mandatory,
905
- booksellerid
896
906
- name
897
$hashref->{'name'} is the 'name' field of the basketgroup in the aqbasketgroups table,
907
- basketlist
898
908
- billingplace
899
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
909
- deliveryplace
900
910
- freedeliveryplace
901
$hashref->{'billingplace'} is the 'billingplace' field of the basketgroup in the aqbasketgroups table,
911
- deliverycomment
902
912
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"
903
$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
913
The "booksellerid" key is mandatory.
904
914
905
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgroup in the aqbasketgroups table,
915
bg_closedate field of aqbasketgroups table is
906
916
- filled with the value of now() if the "closed" key has "1" value
907
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
917
or
908
918
- set to NULL if the "closed" key has "0" value
909
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
919
920
If "booksellerid" key is not provided, the function dies with a message.
921
If a key is not allowed, the function ignores it.
910
922
911
=cut
923
=cut
912
924
Lines 916-922 sub ModBasketgroup { Link Here
916
    my $dbh = C4::Context->dbh;
928
    my $dbh = C4::Context->dbh;
917
    my $query = "UPDATE aqbasketgroups SET ";
929
    my $query = "UPDATE aqbasketgroups SET ";
918
    my @params;
930
    my @params;
919
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
931
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) {
920
        if ( defined $basketgroupinfo->{$field} ) {
932
        if ( defined $basketgroupinfo->{$field} ) {
921
            $query .= "$field=?, ";
933
            $query .= "$field=?, ";
922
            push(@params, $basketgroupinfo->{$field});
934
            push(@params, $basketgroupinfo->{$field});
Lines 924-929 sub ModBasketgroup { Link Here
924
    }
936
    }
925
    chop($query);
937
    chop($query);
926
    chop($query);
938
    chop($query);
939
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "1") {
940
        $query .= ", bg_closedate=CAST(NOW() AS DATE)";        
941
    }
942
    if (defined $basketgroupinfo->{"closed"} and $basketgroupinfo->{"closed"} eq "0") {
943
        $query .= ", bg_closedate=NULL";        
944
    }
927
    $query .= " WHERE id=?";
945
    $query .= " WHERE id=?";
928
    push(@params, $basketgroupinfo->{'id'});
946
    push(@params, $basketgroupinfo->{'id'});
929
    my $sth = $dbh->prepare($query);
947
    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 (-31 / +19 lines)
Lines 311-317 $template->param(booksellerid => $booksellerid); Link Here
311
if ( $op eq "add" ) {
311
if ( $op eq "add" ) {
312
#
312
#
313
# if no param('basketgroupid') is not defined, adds a new basketgroup
313
# if no param('basketgroupid') is not defined, adds a new basketgroup
314
# else, edit (if it is open) or display (if it is close) the basketgroup basketgroupid
314
# else, edit (if it is open) or display (if it is closed) the basketgroup basketgroupid
315
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
315
# the template will know if basketgroup must be displayed or edited, depending on the value of closed key
316
#
316
#
317
    if(! $booksellerid){
317
    if(! $booksellerid){
Lines 353-365 if ( $op eq "add" ) { Link Here
353
                name            => $basketgroup->{name},
353
                name            => $basketgroup->{name},
354
                deliverycomment => $basketgroup->{deliverycomment},
354
                deliverycomment => $basketgroup->{deliverycomment},
355
                freedeliveryplace => $basketgroup->{freedeliveryplace},
355
                freedeliveryplace => $basketgroup->{freedeliveryplace},
356
                bg_creationdate => $basketgroup->{bg_creationdate},
357
                bg_closedate => $basketgroup->{bg_closedate}
356
            );
358
            );
357
            $billingplace  = $basketgroup->{billingplace};
359
            $billingplace  = $basketgroup->{billingplace};
358
            $deliveryplace = $basketgroup->{deliveryplace};
360
            $deliveryplace = $basketgroup->{deliveryplace};
359
            $freedeliveryplace = $basketgroup->{freedeliveryplace};
361
            $freedeliveryplace = $basketgroup->{freedeliveryplace};
360
            $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0);
361
        } else {
362
            $template->param( closedbg => 0);
363
        }
362
        }
364
        # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
363
        # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data
365
        my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) );
364
        my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) );
Lines 472-478 if ( $op eq "add" ) { Link Here
472
    print $input->redirect($redirectpath);
471
    print $input->redirect($redirectpath);
473
} elsif ( $op eq 'attachbasket') {
472
} elsif ( $op eq 'attachbasket') {
474
#
473
#
475
# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page
474
# save a modified basketgroup, or put an existing basket in a basketgroup (called from basket page)
476
#
475
#
477
    # Getting parameters
476
    # Getting parameters
478
    my $basketgroup       = {};
477
    my $basketgroup       = {};
Lines 484-522 if ( $op eq "add" ) { Link Here
484
    my $deliveryplace     = $input->param('deliveryplace');
483
    my $deliveryplace     = $input->param('deliveryplace');
485
    my $freedeliveryplace = $input->param('freedeliveryplace');
484
    my $freedeliveryplace = $input->param('freedeliveryplace');
486
    my $deliverycomment   = $input->param('deliverycomment');
485
    my $deliverycomment   = $input->param('deliverycomment');
487
    my $closedbg          = $input->param('closedbg') ? 1 : 0;
486
    # 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()
487
    my $close             = $input->param('close');
488
    $basketgroup = {
489
        name              => $basketgroupname,
490
        booksellerid      => $booksellerid,
491
        basketlist        => \@baskets,
492
        billingplace      => $billingplace,
493
        deliveryplace     => $deliveryplace,
494
        freedeliveryplace => $freedeliveryplace,
495
        deliverycomment   => $deliverycomment,
496
        closed            => $close,
497
        };
488
    if ($basketgroupid) {
498
    if ($basketgroupid) {
489
    # If we have a basketgroupid we edit the basketgroup
499
    # If we have a basketgroupid we edit the basketgroup
490
        $basketgroup = {
500
        $basketgroup->{id} = $basketgroupid;
491
              name              => $basketgroupname,
492
              id                => $basketgroupid,
493
              basketlist        => \@baskets,
494
              billingplace      => $billingplace,
495
              deliveryplace     => $deliveryplace,
496
              freedeliveryplace => $freedeliveryplace,
497
              deliverycomment   => $deliverycomment,
498
              closed            => $closedbg,
499
        };
500
        ModBasketgroup($basketgroup);
501
        ModBasketgroup($basketgroup);
501
        if($closedbg){
502
# FIXME
503
        }
504
    }else{
502
    }else{
505
    # we create a new basketgroup (whith a closed basket)
503
    # Else we create a new basketgroup
506
        $basketgroup = {
507
            name              => $basketgroupname,
508
            booksellerid      => $booksellerid,
509
            basketlist        => \@baskets,
510
            billingplace      => $billingplace,
511
            deliveryplace     => $deliveryplace,
512
            freedeliveryplace => $freedeliveryplace,
513
            deliverycomment   => $deliverycomment,
514
            closed            => $closedbg,
515
        };
516
        $basketgroupid = NewBasketgroup($basketgroup);
504
        $basketgroupid = NewBasketgroup($basketgroup);
517
    }
505
    }
518
    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;
506
    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;
519
    $redirectpath .=  "&listclosed=1" if $closedbg ;
507
    $redirectpath .=  "&listclosed=1" if $close ;
520
    print $input->redirect($redirectpath );
508
    print $input->redirect($redirectpath );
521
    
509
    
522
}else{
510
}else{
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2767-2778 DROP TABLE IF EXISTS `aqbasketgroups`; Link Here
2767
CREATE TABLE `aqbasketgroups` (
2767
CREATE TABLE `aqbasketgroups` (
2768
  `id` int(11) NOT NULL auto_increment,
2768
  `id` int(11) NOT NULL auto_increment,
2769
  `name` varchar(50) default NULL,
2769
  `name` varchar(50) default NULL,
2770
  `closed` tinyint(1) default NULL,
2771
  `booksellerid` int(11) NOT NULL,
2770
  `booksellerid` int(11) NOT NULL,
2772
  `deliveryplace` varchar(10) default NULL,
2771
  `deliveryplace` varchar(10) default NULL,
2773
  `freedeliveryplace` text default NULL,
2772
  `freedeliveryplace` text default NULL,
2774
  `deliverycomment` varchar(255) default NULL,
2773
  `deliverycomment` varchar(255) default NULL,
2775
  `billingplace` varchar(10) default NULL,
2774
  `billingplace` varchar(10) default NULL,
2775
  bg_creationdate date default NULL, -- the date the basketgroup was created
2776
  bg_closedate date default NULL, -- the date the basketgroup was closed
2776
  PRIMARY KEY  (`id`),
2777
  PRIMARY KEY  (`id`),
2777
  KEY `booksellerid` (`booksellerid`),
2778
  KEY `booksellerid` (`booksellerid`),
2778
  CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
2779
  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 7878-7883 if(CheckVersion($DBversion)) { Link Here
7878
    SetVersion($DBversion);
7878
    SetVersion($DBversion);
7879
}
7879
}
7880
7880
7881
$DBversion = "3.15.00.XXX";
7882
if(CheckVersion($DBversion)) {
7883
    $dbh->do("ALTER TABLE aqbasketgroups ADD bg_creationdate DATE DEFAULT NULL AFTER billingplace;");
7884
    $dbh->do("ALTER TABLE aqbasketgroups ADD bg_closedate DATE DEFAULT NULL AFTER bg_creationdate;");
7885
    $dbh->do("UPDATE aqbasketgroups SET bg_creationdate=(SELECT MAX(creationdate) FROM aqbasket WHERE aqbasket.basketgroupid=aqbasketgroups.id)");
7886
    $dbh->do("UPDATE aqbasketgroups SET bg_closedate=(SELECT MAX(creationdate) FROM aqbasket WHERE aqbasket.basketgroupid=aqbasketgroups.id) WHERE aqbasketgroups.closed = 1");
7887
    $dbh->do("ALTER TABLE aqbasketgroups DROP COLUMN closed;");
7888
    print "Upgrade to $DBversion done (Bug 10919)\n";
7889
    SetVersion($DBversion);
7890
}
7891
7881
=head1 FUNCTIONS
7892
=head1 FUNCTIONS
7882
7893
7883
=head2 TableExists($table)
7894
=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