Bugzilla – Attachment 3461 Details for
Bug 5970
Adds the ability to use a free delivery address for basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch from BibLibre
0001-Bug-5970-Adds-the-ability-to-use-a-free-delivery-add.patch (text/plain), 11.03 KB, created by
Julian Maurice
on 2011-03-28 11:54:04 UTC
(
hide
)
Description:
Patch from BibLibre
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2011-03-28 11:54:04 UTC
Size:
11.03 KB
patch
obsolete
>From f8c913ddc08bcf3baef16af8a02e5d8d6b993bf8 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Mon, 28 Mar 2011 13:39:46 +0200 >Subject: [PATCH] Bug 5970: Adds the ability to use a free delivery address for basket > >When editing a basket group, user can choose a library for delivery >place, or enter address of his choice in a text field. >--- > C4/Acquisition.pm | 2 +- > acqui/basketgroup.pl | 50 +++++++++++--------- > acqui/pdfformat/layout2pages.pm | 25 +++++++--- > acqui/pdfformat/layout3pages.pm | 25 +++++++--- > installer/data/mysql/updatedatabase.pl | 7 +++ > .../prog/en/modules/acqui/basketgroup.tmpl | 3 + > 6 files changed, 75 insertions(+), 37 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index c1b837b..2232d78 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -568,7 +568,7 @@ sub ModBasketgroup { > my $dbh = C4::Context->dbh; > my $query = "UPDATE aqbasketgroups SET "; > my @params; >- foreach my $field (qw(name billingplace deliveryplace deliverycomment closed)) { >+ foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { > if ( defined $basketgroupinfo->{$field} ) { > $query .= "$field=?, "; > push(@params, $basketgroupinfo->{$field}); >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 2a35f3a..457b616 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -273,6 +273,7 @@ if ( $op eq "add" ) { > my $basketgroupid = $input->param('basketgroupid'); > my $billingplace; > my $deliveryplace; >+ my $freedeliveryplace; > if ( $basketgroupid ) { > # Get the selected baskets in the basketgroup to display them > my $selecteds = GetBasketsByBasketgroup($basketgroupid); >@@ -287,9 +288,11 @@ if ( $op eq "add" ) { > $template->param( > name => $basketgroup->{name}, > deliverycomment => $basketgroup->{deliverycomment}, >+ freedeliveryplace => $basketgroup->{freedeliveryplace}, > ); > $billingplace = $basketgroup->{billingplace}; > $deliveryplace = $basketgroup->{deliveryplace}; >+ $freedeliveryplace = $basketgroup->{freedeliveryplace}; > } > > # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data >@@ -405,25 +408,27 @@ if ( $op eq "add" ) { > } elsif ( $op eq 'attachbasket') { > > # Getting parameters >- my $basketgroup = {}; >- my @baskets = $input->param('basket'); >- my $basketgroupid = $input->param('basketgroupid'); >- my $basketgroupname = $input->param('basketgroupname'); >- my $booksellerid = $input->param('booksellerid'); >- my $billingplace = $input->param('billingplace'); >- my $deliveryplace = $input->param('deliveryplace'); >- my $deliverycomment = $input->param('deliverycomment'); >- my $close = $input->param('close') ? 1 : 0; >+ my $basketgroup = {}; >+ my @baskets = $input->param('basket'); >+ my $basketgroupid = $input->param('basketgroupid'); >+ my $basketgroupname = $input->param('basketgroupname'); >+ my $booksellerid = $input->param('booksellerid'); >+ my $billingplace = $input->param('billingplace'); >+ my $deliveryplace = $input->param('deliveryplace'); >+ my $freedeliveryplace = $input->param('freedeliveryplace'); >+ 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, >- billingplace => $billingplace, >- deliveryplace => $deliveryplace, >- deliverycomment => $deliverycomment, >- closed => $close, >+ name => $basketgroupname, >+ id => $basketgroupid, >+ basketlist => \@baskets, >+ billingplace => $billingplace, >+ deliveryplace => $deliveryplace, >+ freedeliveryplace => $freedeliveryplace, >+ deliverycomment => $deliverycomment, >+ closed => $close, > }; > ModBasketgroup($basketgroup); > if($close){ >@@ -431,12 +436,13 @@ if ( $op eq "add" ) { > } > }else{ > $basketgroup = { >- name => $basketgroupname, >- booksellerid => $booksellerid, >- basketlist => \@baskets, >- deliveryplace => $deliveryplace, >- deliverycomment => $deliverycomment, >- closed => $close, >+ name => $basketgroupname, >+ booksellerid => $booksellerid, >+ basketlist => \@baskets, >+ deliveryplace => $deliveryplace, >+ freedeliveryplace => $freedeliveryplace, >+ deliverycomment => $deliverycomment, >+ closed => $close, > }; > $basketgroupid = NewBasketgroup($basketgroup); > } >diff --git a/acqui/pdfformat/layout2pages.pm b/acqui/pdfformat/layout2pages.pm >index 768fdec..148394a 100755 >--- a/acqui/pdfformat/layout2pages.pm >+++ b/acqui/pdfformat/layout2pages.pm >@@ -146,6 +146,7 @@ sub printhead { > # get branch details > my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} ); > my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} ); >+ my $freedeliveryplace = $basketgroup->{freedeliveryplace}; > # get the subject > my $subject; > >@@ -211,13 +212,23 @@ sub printhead { > # print delivery infos > $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm ); > $text->translate(50/mm, ($height-237)/mm); >- $text->text($deliverydetails->{branchaddress1}); >- $text->translate(50/mm, ($height-242)/mm); >- $text->text($deliverydetails->{branchaddress2}); >- $text->translate(50/mm, ($height-247)/mm); >- $text->text($deliverydetails->{branchaddress3}); >- $text->translate(50/mm, ($height-252)/mm); >- $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry})); >+ if ($freedeliveryplace) { >+ my $start = 242; >+ my @fdp = split('\n', $freedeliveryplace); >+ foreach (@fdp) { >+ $text->text($_); >+ $text->translate( 50 / mm, ( $height - $start ) / mm ); >+ $start += 5; >+ } >+ } else { >+ $text->text( $deliverydetails->{branchaddress1} ); >+ $text->translate( 50 / mm, ( $height - 242 ) / mm ); >+ $text->text( $deliverydetails->{branchaddress2} ); >+ $text->translate( 50 / mm, ( $height - 247 ) / mm ); >+ $text->text( $deliverydetails->{branchaddress3} ); >+ $text->translate( 50 / mm, ( $height - 252 ) / mm ); >+ $text->text( join( ' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry} ) ); >+ } > $text->translate(50/mm, ($height-262)/mm); > $text->text($basketgroup->{deliverycomment}); > } >diff --git a/acqui/pdfformat/layout3pages.pm b/acqui/pdfformat/layout3pages.pm >index f081b56..7dab18f 100755 >--- a/acqui/pdfformat/layout3pages.pm >+++ b/acqui/pdfformat/layout3pages.pm >@@ -283,6 +283,7 @@ sub printhead { > # get branch details > my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} ); > my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} ); >+ my $freedeliveryplace = $basketgroup->{freedeliveryplace}; > # get the subject > my $subject; > >@@ -348,13 +349,23 @@ sub printhead { > # print delivery infos > $text->font( $pdf->corefont("Times-Bold", -encoding => "utf8"), 4/mm ); > $text->translate(50/mm, ($height-237)/mm); >- $text->text($deliverydetails->{branchaddress1}); >- $text->translate(50/mm, ($height-242)/mm); >- $text->text($deliverydetails->{branchaddress2}); >- $text->translate(50/mm, ($height-247)/mm); >- $text->text($deliverydetails->{branchaddress3}); >- $text->translate(50/mm, ($height-252)/mm); >- $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry})); >+ if ($freedeliveryplace) { >+ my $start = 242; >+ my @fdp = split('\n', $freedeliveryplace); >+ foreach (@fdp) { >+ $text->text($_); >+ $text->translate( 50 / mm, ( $height - $start ) / mm ); >+ $start += 5; >+ } >+ } else { >+ $text->text($deliverydetails->{branchaddress1}); >+ $text->translate(50/mm, ($height-242)/mm); >+ $text->text($deliverydetails->{branchaddress2}); >+ $text->translate(50/mm, ($height-247)/mm); >+ $text->text($deliverydetails->{branchaddress3}); >+ $text->translate(50/mm, ($height-252)/mm); >+ $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry})); >+ } > $text->translate(50/mm, ($height-262)/mm); > $text->text($basketgroup->{deliverycomment}); > } >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 23b5d67..1c4e4c8 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4134,6 +4134,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = 'XXX'; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("ALTER TABLE `aqbasketgroups` ADD `freedeliveryplace` TEXT NULL AFTER `deliveryplace`;"); >+ print "Upgrade to $DBversion done (adding freedeliveryplace to basketgroups)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl >index 3d33b73..4bf41e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tmpl >@@ -232,6 +232,9 @@ function submitForm(form) { > <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option> > <!-- /TMPL_LOOP --> > </select> >+ <p>or</p> >+ <h3><label for="freedeliveryplace">Delivery Place:</label></h3> >+ <textarea cols="26" name="freedeliveryplace" id="freedeliveryplace"><!-- TMPL_VAR NAME="freedeliveryplace" --></textarea> > <h3><label for="deliverycomment">Delivery comment:</label></h3> > <textarea cols="26" name="deliverycomment" id="deliverycomment"><!-- TMPL_VAR NAME="deliverycomment" --></textarea> > <div class="workarea"> >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5970
:
3461
|
3640
|
3641