Librarian are now able to select a different delivery place for each basketgroup. They can choose one from the branch list or manualy using a textarea.
Database schema and PDF generation have been modified to reflect these changes.
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
+$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
+
+$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
+
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
=back
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'};
my $query = "INSERT INTO aqbasketgroups (";
my @params;
- foreach my $field ('name', 'closed') {
+ foreach my $field ('name', 'deliveryplace', 'deliverycomment', 'closed') {
if ( $basketgroupinfo->{$field} ) {
$query .= "$field, ";
push(@params, $basketgroupinfo->{$field});
$hashref->{'basketlist'} is a list reference of the 'id's of the baskets that belong to this group,
+$hashref->{'deliveryplace'} is the 'deliveryplace' field of the basketgroup in the aqbasketgroups table,
+
+$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table,
+
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise.
=back
my $dbh = C4::Context->dbh;
my $query = "UPDATE aqbasketgroups SET ";
my @params;
- foreach my $field (qw(name closed)) {
+ foreach my $field (qw(name deliveryplace deliverycomment closed)) {
if ( $basketgroupinfo->{$field} ne undef) {
$query .= "$field=?, ";
push(@params, $basketgroupinfo->{$field});
use C4::Bookseller qw/GetBookSellerFromId/;
use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket/;
use C4::Bookseller qw/GetBookSellerFromId/;
+use C4::Branch qw/GetBranches/;
+use C4::Members qw/GetMember/;
my $input=new CGI;
}
} else {
my $basketgroupid = $input->param('basketgroupid');
- if($basketgroupid){
+ my $branchcode;
+ if ( $basketgroupid ) {
+ # Get the selected baskets in the basketgroup to display them
my $selecteds = GetBasketsByBasketgroup($basketgroupid);
foreach (@{$selecteds}){
$_->{total} = BasketTotal($_->{basketno}, $_);
}
$template->param(basketgroupid => $basketgroupid,
selectedbaskets => $selecteds);
+
+ # Get general informations about the basket group to prefill the form
+ my $basketgroup = GetBasketgroup($basketgroupid);
+ $template->param(
+ name => $basketgroup->{name},
+ deliverycomment => $basketgroup->{deliverycomment},
+ );
+ $branchcode = $basketgroup->{deliveryplace};
+ }
+
+ # Build the combobox to select the delivery place
+ my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) );
+ my $branch = $branchcode || $borrower->{'branchcode'};
+ my $branches = GetBranches;
+ my @branchloop;
+ foreach my $thisbranch (sort keys %$branches) {
+ my $selected = 1 if $thisbranch eq $branch;
+ my %row = (
+ value => $thisbranch,
+ selected => $selected,
+ branchname => $branches->{$thisbranch}->{branchname},
+ );
+ push @branchloop, \%row;
}
+ $template->param( branchloop => \@branchloop );
+
$template->param( booksellerid => $booksellerid );
}
$template->param(grouping => 1);
my $basketgroupid = $input->param('basketgroupid');
my $basketgroupname = $input->param('basketgroupname');
my $booksellerid = $input->param('booksellerid');
+ my $deliveryplace = $input->param('deliveryplace');
+ my $deliverycomment = $input->param('deliverycomment');
my $close = $input->param('close') ? 1 : 0;
# If we got a basketgroupname, we create a basketgroup
if ($basketgroupid) {
$basketgroup = {
- name => $basketgroupname,
- id => $basketgroupid,
- basketlist => \@baskets,
- closed => $close,
+ name => $basketgroupname,
+ id => $basketgroupid,
+ basketlist => \@baskets,
+ deliveryplace => $deliveryplace,
+ deliverycomment => $deliverycomment,
+ closed => $close,
};
ModBasketgroup($basketgroup);
if($close){
}
}else{
$basketgroup = {
- name => $basketgroupname,
- booksellerid => $booksellerid,
- basketlist => \@baskets,
- closed => $close,
+ name => $basketgroupname,
+ booksellerid => $booksellerid,
+ basketlist => \@baskets,
+ deliveryplace => $deliveryplace,
+ deliverycomment => $deliverycomment,
+ closed => $close,
};
$basketgroupid = NewBasketgroup($basketgroup);
}
use warnings;
use utf8;
+use C4::Branch qw(GetBranchDetail);
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
sub printhead {
my ($pdf, $basketgroup, $bookseller, $branch) = @_;
+
+ # get branch details
+ my $branchdetails = GetBranchDetail( $basketgroup->{'deliveryplace'} );
+
# open 1st page (with the header)
my $page = $pdf->openpage(1);
$text->text($bookseller->{address2});
$text->translate(110/mm, ($height-190)/mm);
$text->text($bookseller->{address3});
+ # print delivery infos
+ $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm );
+ $text->translate(50/mm, ($height-230)/mm);
+ $text->text($branchdetails->{branchaddress1});
+ $text->translate(50/mm, ($height-235)/mm);
+ $text->text($branchdetails->{branchaddress2});
+ $text->translate(50/mm, ($height-240)/mm);
+ $text->text($branchdetails->{branchaddress3});
+ $text->translate(50/mm, ($height-245)/mm);
+ $text->text($basketgroup->{'deliverycomment'});
}
sub printfooters {
SetVersion ($DBversion);
}
+$DBversion = "3.01.00.123";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do(qq{
+ ALTER TABLE aqbasketgroups ADD deliveryplace VARCHAR(10), deliverycomment VARCHAR(255);
+ });
+
+ print "Upgrade to $DBversion done (isbd updated)\n";
+ SetVersion ($DBversion);
+}
+
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
<div class="yui-u grouping">
<form action="" method="post">
<fieldset id="various" class='various' >
- <h3><label for="basketgroupname">Basketgroup Name:</label></h3>
- <input type="text" name="basketgroupname" id="basketgroupname" />
+ <h3><label for="basketgroupname">Basketgroup Name:</label></h3>
+ <input type="text" name="basketgroupname" id="basketgroupname" value="<!-- TMPL_VAR NAME="name" -->" />
+ <h3><label for="deliveryplace">Delivery Place:</label></h3>
+ <select name="deliveryplace" id="deliveryplace">
+ <option value="">--</option>
+ <!-- TMPL_LOOP name="branchloop" -->
+ <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+ <h3><label for="deliverycomment">Delivery comment:</label></h3>
+ <textarea cols="26" name="deliverycomment" id="deliverycomment"><!-- TMPL_VAR NAME="deliverycomment" --></textarea>
<div class="workarea">
<h3>Grouping</h3>
<ul class="draglist" id="bg">
use strict;
sub kohaversion {
- our $VERSION = '3.01.00.122';
+ our $VERSION = '3.01.00.123';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install