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

(-)a/C4/Acquisition.pm (-2 / +10 lines)
Lines 480-485 $hashref->{'name'} is the 'name' field of the basketgroup in the aqbasketgroups Link Here
480
480
481
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
481
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
482
482
483
$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
484
485
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
486
483
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
487
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
484
488
485
=back
489
=back
Lines 493-499 sub NewBasketgroup { Link Here
493
    die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
497
    die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
494
    my $query = "INSERT INTO aqbasketgroups (";
498
    my $query = "INSERT INTO aqbasketgroups (";
495
    my @params;
499
    my @params;
496
    foreach my $field ('name', 'closed') {
500
    foreach my $field ('name', 'deliveryplace', 'deliverycomment', 'closed') {
497
        if ( $basketgroupinfo->{$field} ) {
501
        if ( $basketgroupinfo->{$field} ) {
498
            $query .= "$field, ";
502
            $query .= "$field, ";
499
            push(@params, $basketgroupinfo->{$field});
503
            push(@params, $basketgroupinfo->{$field});
Lines 537-542 $hashref->{'name'} is the 'name' field of the basketgroup in the aqbasketgroups Link Here
537
541
538
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
542
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
539
543
544
$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
545
546
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
547
540
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
548
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
541
549
542
=back
550
=back
Lines 551-557 sub ModBasketgroup { Link Here
551
    my $dbh = C4::Context->dbh;
559
    my $dbh = C4::Context->dbh;
552
    my $query = "UPDATE aqbasketgroups SET ";
560
    my $query = "UPDATE aqbasketgroups SET ";
553
    my @params;
561
    my @params;
554
    foreach my $field (qw(name closed)) {
562
    foreach my $field (qw(name deliveryplace deliverycomment closed)) {
555
        if ( $basketgroupinfo->{$field} ne undef) {
563
        if ( $basketgroupinfo->{$field} ne undef) {
556
            $query .= "$field=?, ";
564
            $query .= "$field=?, ";
557
            push(@params, $basketgroupinfo->{$field});
565
            push(@params, $basketgroupinfo->{$field});
(-)a/acqui/basketgroup.pl (-9 / +44 lines)
Lines 53-58 use CGI; Link Here
53
use C4::Bookseller qw/GetBookSellerFromId/;
53
use C4::Bookseller qw/GetBookSellerFromId/;
54
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket/;
54
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket/;
55
use C4::Bookseller qw/GetBookSellerFromId/;
55
use C4::Bookseller qw/GetBookSellerFromId/;
56
use C4::Branch qw/GetBranches/;
57
use C4::Members qw/GetMember/;
56
58
57
my $input=new CGI;
59
my $input=new CGI;
58
60
Lines 268-281 if ( $op eq "add" ) { Link Here
268
        }
270
        }
269
    } else {
271
    } else {
270
        my $basketgroupid = $input->param('basketgroupid');
272
        my $basketgroupid = $input->param('basketgroupid');
271
        if($basketgroupid){
273
        my $branchcode;
274
        if ( $basketgroupid ) {
275
            # Get the selected baskets in the basketgroup to display them
272
            my $selecteds = GetBasketsByBasketgroup($basketgroupid);
276
            my $selecteds = GetBasketsByBasketgroup($basketgroupid);
273
            foreach (@{$selecteds}){
277
            foreach (@{$selecteds}){
274
                $_->{total} = BasketTotal($_->{basketno}, $_);
278
                $_->{total} = BasketTotal($_->{basketno}, $_);
275
            }
279
            }
276
            $template->param(basketgroupid => $basketgroupid,
280
            $template->param(basketgroupid => $basketgroupid,
277
                             selectedbaskets => $selecteds);
281
                             selectedbaskets => $selecteds);
282
283
            # Get general informations about the basket group to prefill the form
284
            my $basketgroup = GetBasketgroup($basketgroupid);
285
            $template->param(
286
                name            => $basketgroup->{name},
287
                deliverycomment => $basketgroup->{deliverycomment},
288
            );
289
            $branchcode = $basketgroup->{deliveryplace};
290
        }
291
292
        # Build the combobox to select the delivery place
293
        my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) );
294
        my $branch   = $branchcode || $borrower->{'branchcode'};
295
        my $branches = GetBranches;
296
        my @branchloop;
297
        foreach my $thisbranch (sort keys %$branches) {
298
            my $selected = 1 if $thisbranch eq $branch;
299
            my %row = (
300
                value      => $thisbranch,
301
                selected   => $selected,
302
                branchname => $branches->{$thisbranch}->{branchname},
303
            );
304
            push @branchloop, \%row;
278
        }
305
        }
306
        $template->param( branchloop => \@branchloop );
307
279
        $template->param( booksellerid => $booksellerid );
308
        $template->param( booksellerid => $booksellerid );
280
    }
309
    }
281
    $template->param(grouping => 1);
310
    $template->param(grouping => 1);
Lines 362-375 if ( $op eq "add" ) { Link Here
362
    my $basketgroupid   = $input->param('basketgroupid');
391
    my $basketgroupid   = $input->param('basketgroupid');
363
    my $basketgroupname = $input->param('basketgroupname');
392
    my $basketgroupname = $input->param('basketgroupname');
364
    my $booksellerid    = $input->param('booksellerid');
393
    my $booksellerid    = $input->param('booksellerid');
394
    my $deliveryplace   = $input->param('deliveryplace');
395
    my $deliverycomment = $input->param('deliverycomment');
365
    my $close           = $input->param('close') ? 1 : 0;
396
    my $close           = $input->param('close') ? 1 : 0;
366
    # If we got a basketgroupname, we create a basketgroup
397
    # If we got a basketgroupname, we create a basketgroup
367
    if ($basketgroupid) {
398
    if ($basketgroupid) {
368
        $basketgroup = {
399
        $basketgroup = {
369
              name => $basketgroupname,
400
              name            => $basketgroupname,
370
              id => $basketgroupid,
401
              id              => $basketgroupid,
371
              basketlist => \@baskets,
402
              basketlist      => \@baskets,
372
              closed      => $close,
403
              deliveryplace   => $deliveryplace,
404
              deliverycomment => $deliverycomment,
405
              closed          => $close,
373
        };
406
        };
374
        ModBasketgroup($basketgroup);
407
        ModBasketgroup($basketgroup);
375
        if($close){
408
        if($close){
Lines 377-386 if ( $op eq "add" ) { Link Here
377
        }
410
        }
378
    }else{
411
    }else{
379
        $basketgroup = {
412
        $basketgroup = {
380
            name         => $basketgroupname,
413
            name            => $basketgroupname,
381
            booksellerid => $booksellerid,
414
            booksellerid    => $booksellerid,
382
            basketlist   => \@baskets,
415
            basketlist      => \@baskets,
383
            closed        => $close,
416
            deliveryplace   => $deliveryplace,
417
            deliverycomment => $deliverycomment,
418
            closed          => $close,
384
        };
419
        };
385
        $basketgroupid = NewBasketgroup($basketgroup);
420
        $basketgroupid = NewBasketgroup($basketgroup);
386
    }
421
    }
(-)a/acqui/pdfformat/example.pm (+16 lines)
Lines 28-33 use strict; Link Here
28
use warnings;
28
use warnings;
29
use utf8;
29
use utf8;
30
30
31
use C4::Branch qw(GetBranchDetail);
32
31
BEGIN {
33
BEGIN {
32
         use Exporter   ();
34
         use Exporter   ();
33
         our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
35
         our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
Lines 267-272 sub printbaskets { Link Here
267
269
268
sub printhead {
270
sub printhead {
269
    my ($pdf, $basketgroup, $bookseller, $branch) = @_;
271
    my ($pdf, $basketgroup, $bookseller, $branch) = @_;
272
273
    # get branch details
274
    my $branchdetails = GetBranchDetail( $basketgroup->{'deliveryplace'} );
275
270
    # open 1st page (with the header)
276
    # open 1st page (with the header)
271
    my $page = $pdf->openpage(1);
277
    my $page = $pdf->openpage(1);
272
    
278
    
Lines 294-299 sub printhead { Link Here
294
    $text->text($bookseller->{address2});
300
    $text->text($bookseller->{address2});
295
    $text->translate(110/mm,  ($height-190)/mm);
301
    $text->translate(110/mm,  ($height-190)/mm);
296
    $text->text($bookseller->{address3});
302
    $text->text($bookseller->{address3});
303
    # print delivery infos
304
    $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
305
    $text->translate(50/mm,  ($height-230)/mm);
306
    $text->text($branchdetails->{branchaddress1});
307
    $text->translate(50/mm,  ($height-235)/mm);
308
    $text->text($branchdetails->{branchaddress2});
309
    $text->translate(50/mm,  ($height-240)/mm);
310
    $text->text($branchdetails->{branchaddress3});
311
    $text->translate(50/mm,  ($height-245)/mm);
312
    $text->text($basketgroup->{'deliverycomment'});
297
}
313
}
298
314
299
sub printfooters {
315
sub printfooters {
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 3127-3132 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3127
    SetVersion ($DBversion);
3127
    SetVersion ($DBversion);
3128
}
3128
}
3129
3129
3130
$DBversion = "3.01.00.122";
3131
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3132
	$dbh->do(qq{
3133
	ALTER TABLE aqbasketgroups ADD deliveryplace VARCHAR(10), deliverycomment VARCHAR(255);
3134
	});
3135
	
3136
    print "Upgrade to $DBversion done (isbd updated)\n";
3137
    SetVersion ($DBversion);
3138
}
3139
3130
3140
3131
=item DropAllForeignKeys($table)
3141
=item DropAllForeignKeys($table)
3132
3142
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl (-3 / +11 lines)
Lines 205-212 fieldset.various li { Link Here
205
		    <div class="yui-u grouping"> 
205
		    <div class="yui-u grouping"> 
206
		    	<form action="" method="post">
206
		    	<form action="" method="post">
207
					<fieldset id="various" class='various' >
207
					<fieldset id="various" class='various' >
208
	       	        	<h3><label for="basketgroupname">Basketgroup Name:</label></h3>
208
						<h3><label for="basketgroupname">Basketgroup Name:</label></h3>
209
	   	            	<input type="text" name="basketgroupname" id="basketgroupname" />
209
						<input type="text" name="basketgroupname" id="basketgroupname" value="<!-- TMPL_VAR NAME="name" -->" />
210
						<h3><label for="deliveryplace">Delivery Place:</label></h3>
211
						<select name="deliveryplace" id="deliveryplace">
212
							<option value="">--</option>
213
							<!-- TMPL_LOOP name="branchloop" -->
214
							<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
215
							<!-- /TMPL_LOOP -->
216
						</select>
217
						<h3><label for="deliverycomment">Delivery comment:</label></h3>
218
						<textarea cols="26" name="deliverycomment" id="deliverycomment"><!-- TMPL_VAR NAME="deliverycomment" --></textarea>
210
		         		<div class="workarea">
219
		         		<div class="workarea">
211
							<h3>Grouping</h3>
220
							<h3>Grouping</h3>
212
							<ul class="draglist" id="bg">
221
							<ul class="draglist" id="bg">
213
- 

Return to bug 3624