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

(-)a/C4/Acquisition.pm (-6 / +14 lines)
Lines 184-190 The other parameters are optional, see ModBasketHeader for more info on them. Link Here
184
# FIXME : this function seems to be unused.
184
# FIXME : this function seems to be unused.
185
185
186
sub NewBasket {
186
sub NewBasket {
187
    my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber ) = @_;
187
    my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace ) = @_;
188
    my $dbh = C4::Context->dbh;
188
    my $dbh = C4::Context->dbh;
189
    my $query = "
189
    my $query = "
190
        INSERT INTO aqbasket
190
        INSERT INTO aqbasket
Lines 195-201 sub NewBasket { Link Here
195
    $dbh->do($query);
195
    $dbh->do($query);
196
#find & return basketno MYSQL dependant, but $dbh->last_insert_id always returns null :-(
196
#find & return basketno MYSQL dependant, but $dbh->last_insert_id always returns null :-(
197
    my $basket = $dbh->{'mysql_insertid'};
197
    my $basket = $dbh->{'mysql_insertid'};
198
    ModBasketHeader($basket, $basketname || '', $basketnote || '', $basketbooksellernote || '', $basketcontractnumber || undef);
198
    ModBasketHeader( $basket, $basketname || '', $basketnote || '', $basketbooksellernote || '', $basketcontractnumber || undef, $deliveryplace || undef, $billingplace || undef );
199
    return $basket;
199
    return $basket;
200
}
200
}
201
201
Lines 460-466 sub ModBasket { Link Here
460
460
461
=head3 ModBasketHeader
461
=head3 ModBasketHeader
462
462
463
  &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber);
463
  &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber, $deliveryplace, $billingplace);
464
464
465
Modifies a basket's header.
465
Modifies a basket's header.
466
466
Lines 476-491 Modifies a basket's header. Link Here
476
476
477
=item C<$contractnumber> is the "contractnumber" (foreign) key in the "aqbasket" table.
477
=item C<$contractnumber> is the "contractnumber" (foreign) key in the "aqbasket" table.
478
478
479
=item C<$deliveryplace> is the "deliveryplace" field in the aqbasket table.
480
481
=item C<$billingplace> is the "billingplace" field in the aqbasket table.
482
479
=back
483
=back
480
484
481
=cut
485
=cut
482
486
483
sub ModBasketHeader {
487
sub ModBasketHeader {
484
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber) = @_;
488
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $deliveryplace, $billingplace) = @_;
485
    my $query = "UPDATE aqbasket SET basketname=?, note=?, booksellernote=? WHERE basketno=?";
489
    my $query = qq{
490
        UPDATE aqbasket
491
        SET basketname=?, note=?, booksellernote=?, deliveryplace=?, billingplace=?
492
        WHERE basketno=?
493
    };
486
    my $dbh = C4::Context->dbh;
494
    my $dbh = C4::Context->dbh;
487
    my $sth = $dbh->prepare($query);
495
    my $sth = $dbh->prepare($query);
488
    $sth->execute($basketname,$note,$booksellernote,$basketno);
496
    $sth->execute($basketname, $note, $booksellernote, $deliveryplace, $billingplace, $basketno);
489
    if ( $contractnumber ) {
497
    if ( $contractnumber ) {
490
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
498
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
491
        my $sth2 = $dbh->prepare($query2);
499
        my $sth2 = $dbh->prepare($query2);
(-)a/acqui/basket.pl (-1 / +11 lines)
Lines 130-135 if ( $op eq 'delete_confirm' ) { Link Here
130
        authorisedby         => $basket->{authorisedby},
130
        authorisedby         => $basket->{authorisedby},
131
        authorisedbyname     => $basket->{authorisedbyname},
131
        authorisedbyname     => $basket->{authorisedbyname},
132
        closedate            => $basket->{closedate},
132
        closedate            => $basket->{closedate},
133
        deliveryplace        => $basket->{deliveryplace} || $basket->{freedeliveryplace},
134
        billingplace         => $basket->{billingplace},
133
        active               => $bookseller->{'active'},
135
        active               => $bookseller->{'active'},
134
        booksellerid         => $bookseller->{'id'},
136
        booksellerid         => $bookseller->{'id'},
135
        name                 => $bookseller->{'name'},
137
        name                 => $bookseller->{'name'},
Lines 356-362 my $total_est_gste; Link Here
356
358
357
    my $contract = &GetContract($basket->{contractnumber});
359
    my $contract = &GetContract($basket->{contractnumber});
358
    my @orders = GetOrders($basketno);
360
    my @orders = GetOrders($basketno);
359
361
    if ($basket->{basketgroupid}){
362
        my $basketgroup = GetBasketgroup($basket->{basketgroupid});
363
        for my $key (keys %$basketgroup ){
364
            $basketgroup->{"basketgroup$key"} = delete $basketgroup->{$key};
365
        }
366
        $template->param(%$basketgroup);
367
    }
360
    my $borrower= GetMember('borrowernumber' => $loggedinuser);
368
    my $borrower= GetMember('borrowernumber' => $loggedinuser);
361
    my $budgets = GetBudgetHierarchy(q{},$borrower->{branchcode},$borrower->{borrowernumber});
369
    my $budgets = GetBudgetHierarchy(q{},$borrower->{branchcode},$borrower->{borrowernumber});
362
    my $has_budgets = 0;
370
    my $has_budgets = 0;
Lines 385-390 my $total_est_gste; Link Here
385
        authorisedbyname     => $basket->{authorisedbyname},
393
        authorisedbyname     => $basket->{authorisedbyname},
386
        closedate            => $basket->{closedate},
394
        closedate            => $basket->{closedate},
387
        estimateddeliverydate=> $estimateddeliverydate,
395
        estimateddeliverydate=> $estimateddeliverydate,
396
        deliveryplace        => $basket->{deliveryplace} || $basket->{freedeliveryplace},
397
        billingplace         => $basket->{billingplace},
388
        active               => $bookseller->{'active'},
398
        active               => $bookseller->{'active'},
389
        booksellerid         => $bookseller->{'id'},
399
        booksellerid         => $bookseller->{'id'},
390
        name                 => $bookseller->{'name'},
400
        name                 => $bookseller->{'name'},
(-)a/acqui/basketheader.pl (-8 / +78 lines)
Lines 50-55 use warnings; Link Here
50
use CGI;
50
use CGI;
51
use C4::Context;
51
use C4::Context;
52
use C4::Auth;
52
use C4::Auth;
53
use C4::Branch;
53
use C4::Output;
54
use C4::Output;
54
use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/;
55
use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/;
55
use C4::Bookseller qw/GetBookSellerFromId/;
56
use C4::Bookseller qw/GetBookSellerFromId/;
Lines 68-76 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
68
);
69
);
69
70
70
#parameters:
71
#parameters:
71
my $booksellerid;
72
my $booksellerid = $input->param('booksellerid');
72
$booksellerid = $input->param('booksellerid');
73
my $basketno = $input->param('basketno');
73
my $basketno = $input->param('basketno');
74
my $branches = GetBranches;
74
my $basket;
75
my $basket;
75
my $op = $input ->param('op');
76
my $op = $input ->param('op');
76
my $is_an_edit= $input ->param('is_an_edit');
77
my $is_an_edit= $input ->param('is_an_edit');
Lines 107-123 if ( $op eq 'add_form' ) { Link Here
107
                    basketbooksellernote => $basket->{'booksellernote'},
108
                    basketbooksellernote => $basket->{'booksellernote'},
108
                    booksellername => $bookseller->{'name'},
109
                    booksellername => $bookseller->{'name'},
109
                    booksellerid => $booksellerid,
110
                    booksellerid => $booksellerid,
110
                    basketno => $basketno
111
                    basketno => $basketno,
111
    	);
112
                    deliveryplace => $basket->{deliveryplace},
113
                    billingplace => $basket->{billingplace},
114
    );
115
116
    my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"};
117
    my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"};
118
119
    # Build the combobox to select the billing place
120
    my @billingplaceloop;
121
122
    # In case there's no branch selected
123
    if ($billingplace eq "NO_LIBRARY_SET") {
124
        my %row = (
125
          value => "",
126
          selected => 1,
127
          branchname => "--",
128
        );
129
        push @billingplaceloop, \%row;
130
    }
131
132
    for ( sort keys %$branches ) {
133
        my $selected = 1 if $_ eq $billingplace;
134
        my %row = (
135
            value      => $_,
136
            selected   => $selected,
137
            branchname => $branches->{$_}->{branchname},
138
        );
139
        push @billingplaceloop, \%row;
140
    }
141
    $template->param( billingplaceloop => \@billingplaceloop );
142
143
    # Build the combobox to select the delivery place
144
    my @deliveryplaceloop;
145
146
    # In case there's no branch selected
147
    if ($deliveryplace eq "NO_LIBRARY_SET") {
148
        my %row = (
149
          value => "",
150
          selected => 1,
151
          branchname => "--",
152
        );
153
        push @deliveryplaceloop, \%row;
154
    }
155
156
    for ( sort keys %$branches ) {
157
        my $selected = 1 if $_ eq $deliveryplace;
158
        my %row = (
159
            value      => $_,
160
            selected   => $selected,
161
            branchname => $branches->{$_}->{branchname},
162
        );
163
        push @deliveryplaceloop, \%row;
164
    }
165
    $template->param( deliveryplaceloop => \@deliveryplaceloop );
166
112
#End Edit
167
#End Edit
113
} elsif ( $op eq 'add_validate' ) {
168
} elsif ( $op eq 'add_validate' ) {
114
#we are confirming the changes, save the basket
169
#we are confirming the changes, save the basket
115
    my $basketno;
116
    if ( $is_an_edit ) {
170
    if ( $is_an_edit ) {
117
        $basketno = $input->param('basketno');
171
        ModBasketHeader(
118
        ModBasketHeader($input->param('basketno'),$input->param('basketname'),$input->param('basketnote'),$input->param('basketbooksellernote'),$input->param('basketcontractnumber'));
172
            $basketno,
173
            $input->param('basketname'),
174
            $input->param('basketnote'),
175
            $input->param('basketbooksellernote'),
176
            $input->param('basketcontractnumber'),
177
            $input->param('deliveryplace'),
178
            $input->param('billingplace'),
179
        );
119
    } else { #New basket
180
    } else { #New basket
120
        $basketno = NewBasket($booksellerid, $loggedinuser, $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber'));
181
        $basketno = NewBasket(
182
            $booksellerid,
183
            $loggedinuser,
184
            $input->param('basketname'),
185
            $input->param('basketnote'),
186
            $input->param('basketbooksellernote'),
187
            $input->param('basketcontractnumber'),
188
            $input->param('deliveryplace'),
189
            $input->param('billingplace'),
190
        );
121
    }
191
    }
122
    print $input->redirect('basket.pl?basketno='.$basketno);
192
    print $input->redirect('basket.pl?basketno='.$basketno);
123
    exit 0;
193
    exit 0;
(-)a/installer/data/mysql/kohastructure.sql (+3 lines)
Lines 2559-2564 CREATE TABLE `aqbasket` ( Link Here
2559
  `authorisedby` varchar(10) default NULL,
2559
  `authorisedby` varchar(10) default NULL,
2560
  `booksellerinvoicenumber` mediumtext,
2560
  `booksellerinvoicenumber` mediumtext,
2561
  `basketgroupid` int(11),
2561
  `basketgroupid` int(11),
2562
  deliveryplace varchar(10) default NULL,
2563
  billingplace varchar(10) default NULL,
2564
  freedeliveryplace VARCHAR(10) default NULL,
2562
  PRIMARY KEY  (`basketno`),
2565
  PRIMARY KEY  (`basketno`),
2563
  KEY `booksellerid` (`booksellerid`),
2566
  KEY `booksellerid` (`booksellerid`),
2564
  KEY `basketgroupid` (`basketgroupid`),
2567
  KEY `basketgroupid` (`basketgroupid`),
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 5199-5204 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5199
}
5199
}
5200
5200
5201
5201
5202
5203
5204
5205
$DBversion = "3.07.00.XXX";
5206
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5207
    $dbh->do("ALTER TABLE aqbasket ADD deliveryplace VARCHAR(10) default NULL;");
5208
    $dbh->do("ALTER TABLE aqbasket ADD billingplace VARCHAR(10) default NULL;");
5209
    $dbh->do("ALTER TABLE aqbasket ADD freedeliveryplace VARCHAR(10) default NULL;");
5210
    print "Upgrade to $DBversion done (Added billingplace and deliveryplace to aqbasket)\n";
5211
    SetVersion($DBversion);
5212
}
5213
5202
=head1 FUNCTIONS
5214
=head1 FUNCTIONS
5203
5215
5204
=head2 TableExists($table)
5216
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +7 lines)
Lines 135-145 Link Here
135
                        // YUI Toolbar Functions
135
                        // YUI Toolbar Functions
136
                        function yuiToolbar() {
136
                        function yuiToolbar() {
137
                            new YAHOO.widget.Button("reopenbutton");
137
                            new YAHOO.widget.Button("reopenbutton");
138
                            new YAHOO.widget.Button("exportbutton");
138
                        }
139
                        }
139
                        //]]>
140
                        //]]>
140
                    </script>
141
                    </script>
141
                        <ul id="toolbar-list" class="toolbar">
142
                        <ul id="toolbar-list" class="toolbar">
142
                            <li><a href="javascript:confirm_reopen([% skip_confirm_reopen %]);" class="button" id="reopenbutton">Reopen this basket</a></li>
143
                            <li><a href="javascript:confirm_reopen([% skip_confirm_reopen %]);" class="button" id="reopenbutton">Reopen this basket</a></li>
144
                            <li><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="button" id="exportbutton">Export this basket as CSV</a></li>
145
143
                        </ul>
146
                        </ul>
144
                </div>
147
                </div>
145
                [% END %]
148
                [% END %]
Lines 178-183 Link Here
178
                [% IF ( basketcontractno ) %]
181
                [% IF ( basketcontractno ) %]
179
                    <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
182
                    <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno %]&amp;booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
180
                [% END %]
183
                [% END %]
184
                [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
185
                [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
181
                [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname %]</li>[% END %]
186
                [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname %]</li>[% END %]
182
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
187
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
183
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
188
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
Lines 205-212 Link Here
205
                        <input type="hidden" value="mod_basket" name="op" />
210
                        <input type="hidden" value="mod_basket" name="op" />
206
                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
211
                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
207
                        <input type="submit" value="Change basket group" /></p>
212
                        <input type="submit" value="Change basket group" /></p>
208
209
                    </form>
213
                    </form>
214
                    [% IF ( basketgroupdeliveryplace ) %]<p>Basketgroup Delivery place: [% basketgroupdeliveryplace %]</p>[% END %]
215
                    [% IF ( basketgroupbillingplace ) %]<p>Basketgroup Billing place: [% basketgroupbillingplace %]</p>[% END %]
210
                </div>
216
                </div>
211
                [% END %]
217
                [% END %]
212
            </div>
218
            </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (+1 lines)
Lines 189-194 function yuiToolbar() { Link Here
189
							<input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" /></li>
189
							<input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" /></li>
190
                        <li><label for="billingplace">Billing place:</label>
190
                        <li><label for="billingplace">Billing place:</label>
191
							<select name="billingplace" id="billingplace" style="width:13em;">
191
							<select name="billingplace" id="billingplace" style="width:13em;">
192
                                <option value="">--</option>
192
								[% FOREACH billingplaceloo IN billingplaceloop %]
193
								[% FOREACH billingplaceloo IN billingplaceloop %]
193
	                                [% IF ( billingplaceloo.selected ) %]<option value="[% billingplaceloo.value %]" selected="selected">[% billingplaceloo.branchname %]</option>
194
	                                [% IF ( billingplaceloo.selected ) %]<option value="[% billingplaceloo.value %]" selected="selected">[% billingplaceloo.branchname %]</option>
194
	                                [% ELSE %]<option value="[% billingplaceloo.value %]">[% billingplaceloo.branchname %]</option>[% END%]
195
	                                [% ELSE %]<option value="[% billingplaceloo.value %]">[% billingplaceloo.branchname %]</option>[% END%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-1 / +22 lines)
Lines 125-130 li.list2 { Link Here
125
                    <label for="basketname" class="required">Basket name</label> &nbsp;
125
                    <label for="basketname" class="required">Basket name</label> &nbsp;
126
                        <input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname %]" />
126
                        <input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname %]" />
127
                </li>
127
                </li>
128
                 <li>
129
                    <label for="billingplace">Billing Place:</label>
130
                    <select name="billingplace" id="billingplace">
131
                        <option value="">--</option>
132
                        [% FOREACH billingplace IN billingplaceloop %]
133
                            <option value="[% billingplace.value %]"[% IF ( billingplace.selected ) %] selected="selected"[% END %]>
134
                                [% billingplace.branchname %]
135
                            </option>
136
                        [% END %]
137
                    </select>
138
                </li>
139
                <li>
140
                    <label for="deliveryplace">Delivery  Place:</label>
141
                    <select name="deliveryplace" id="deliveryplace">
142
                        <option value="">--</option>
143
                        [% FOREACH deliveryplace IN deliveryplaceloop %]
144
                            <option value="[% deliveryplace.value %]"[% IF ( deliveryplace.selected ) %] selected="selected"[% END %]>
145
                                [% deliveryplace.branchname %]
146
                            </option>
147
                        [% END %]
148
                    </select>
149
                </li>
128
                <li>
150
                <li>
129
                    <label for="basketnote">Internal note</label> &nbsp;
151
                    <label for="basketnote">Internal note</label> &nbsp;
130
                    <textarea name="basketnote" id="basketnote" rows="5" cols="40">[% basketnote %]</textarea>
152
                    <textarea name="basketnote" id="basketnote" rows="5" cols="40">[% basketnote %]</textarea>
131
- 

Return to bug 5356