Bugzilla – Attachment 10152 Details for
Bug 5356
Shipping billing address improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5356: delivery place and billing place centralised in basket management
0001-Bug-5356-delivery-place-and-billing-place-centralise.patch (text/plain), 16.57 KB, created by
Jonathan Druart
on 2012-06-11 08:36:48 UTC
(
hide
)
Description:
Bug 5356: delivery place and billing place centralised in basket management
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-06-11 08:36:48 UTC
Size:
16.57 KB
patch
obsolete
>From 5fc0502c940072d5b895193d3d451ed994742cce Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 2 Mar 2012 10:39:54 +0100 >Subject: [PATCH 1/1] Bug 5356: delivery place and billing place centralised > in basket management > >- adding 2 select option in basdketheader.tmpl (delivery and billing place) >- adding 2 more fields in basket csv export >--- > C4/Acquisition.pm | 22 ++++-- > acqui/basket.pl | 12 +++- > acqui/basketheader.pl | 83 ++++++++++++++++++- > installer/data/mysql/kohastructure.sql | 3 + > installer/data/mysql/updatedatabase.pl | 12 +++ > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 8 ++- > .../prog/en/modules/acqui/basketgroup.tt | 1 + > .../prog/en/modules/acqui/basketheader.tt | 22 +++++ > 8 files changed, 148 insertions(+), 15 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 0f02639..890ff64 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -184,7 +184,7 @@ The other parameters are optional, see ModBasketHeader for more info on them. > # FIXME : this function seems to be unused. > > sub NewBasket { >- my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber ) = @_; >+ my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace ) = @_; > my $dbh = C4::Context->dbh; > my $query = " > INSERT INTO aqbasket >@@ -195,7 +195,7 @@ sub NewBasket { > $dbh->do($query); > #find & return basketno MYSQL dependant, but $dbh->last_insert_id always returns null :-( > my $basket = $dbh->{'mysql_insertid'}; >- ModBasketHeader($basket, $basketname || '', $basketnote || '', $basketbooksellernote || '', $basketcontractnumber || undef); >+ ModBasketHeader( $basket, $basketname || '', $basketnote || '', $basketbooksellernote || '', $basketcontractnumber || undef, $deliveryplace || undef, $billingplace || undef ); > return $basket; > } > >@@ -460,7 +460,7 @@ sub ModBasket { > > =head3 ModBasketHeader > >- &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid); >+ &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace); > > Modifies a basket's header. > >@@ -478,18 +478,24 @@ Modifies a basket's header. > > =item C<$booksellerid> is the id (foreign) key in the "aqbooksellers" table for the vendor. > >+=item C<$deliveryplace> is the "deliveryplace" field in the aqbasket table. >+ >+=item C<$billingplace> is the "billingplace" field in the aqbasket table. >+ > =back > > =cut > > sub ModBasketHeader { >- my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid) = @_; >- >- my $query = "UPDATE aqbasket SET basketname=?, note=?, booksellernote=?, booksellerid=? WHERE basketno=?"; >+ my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace) = @_; >+ my $query = qq{ >+ UPDATE aqbasket >+ SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=? >+ WHERE basketno=? >+ }; > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare($query); >- $sth->execute($basketname,$note,$booksellernote,$booksellerid,$basketno); >- >+ $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $basketno); > if ( $contractnumber ) { > my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; > my $sth2 = $dbh->prepare($query2); >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 4e676d6..ebe965e 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -130,6 +130,8 @@ if ( $op eq 'delete_confirm' ) { > authorisedby => $basket->{authorisedby}, > authorisedbyname => $basket->{authorisedbyname}, > closedate => $basket->{closedate}, >+ deliveryplace => $basket->{deliveryplace} || $basket->{freedeliveryplace}, >+ billingplace => $basket->{billingplace}, > active => $bookseller->{'active'}, > booksellerid => $bookseller->{'id'}, > name => $bookseller->{'name'}, >@@ -356,7 +358,13 @@ my $total_est_gste; > > my $contract = &GetContract($basket->{contractnumber}); > my @orders = GetOrders($basketno); >- >+ if ($basket->{basketgroupid}){ >+ my $basketgroup = GetBasketgroup($basket->{basketgroupid}); >+ for my $key (keys %$basketgroup ){ >+ $basketgroup->{"basketgroup$key"} = delete $basketgroup->{$key}; >+ } >+ $template->param(%$basketgroup); >+ } > my $borrower= GetMember('borrowernumber' => $loggedinuser); > my $budgets = GetBudgetHierarchy(q{},$borrower->{branchcode},$borrower->{borrowernumber}); > my $has_budgets = 0; >@@ -385,6 +393,8 @@ my $total_est_gste; > authorisedbyname => $basket->{authorisedbyname}, > closedate => $basket->{closedate}, > estimateddeliverydate=> $estimateddeliverydate, >+ deliveryplace => $basket->{deliveryplace} || $basket->{freedeliveryplace}, >+ billingplace => $basket->{billingplace}, > active => $bookseller->{'active'}, > booksellerid => $bookseller->{'id'}, > name => $bookseller->{'name'}, >diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl >index 08b38eb..3997811 100755 >--- a/acqui/basketheader.pl >+++ b/acqui/basketheader.pl >@@ -50,6 +50,7 @@ use warnings; > use CGI; > use C4::Context; > use C4::Auth; >+use C4::Branch; > use C4::Output; > use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/; > use C4::Bookseller qw/GetBookSellerFromId GetBookSeller/; >@@ -70,6 +71,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > #parameters: > my $booksellerid = $input->param('booksellerid'); > my $basketno = $input->param('basketno'); >+my $branches = GetBranches; > my $basket; > my $op = $input ->param('op'); > my $is_an_edit= $input ->param('is_an_edit'); >@@ -109,16 +111,87 @@ if ( $op eq 'add_form' ) { > booksellerid => $booksellerid, > basketno => $basketno, > booksellers => \@booksellers, >- ); >+ deliveryplace => $basket->{deliveryplace}, >+ billingplace => $basket->{billingplace}, >+ ); >+ >+ my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"}; >+ my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"}; >+ >+ # Build the combobox to select the billing place >+ my @billingplaceloop; >+ >+ # In case there's no branch selected >+ if ($billingplace eq "NO_LIBRARY_SET") { >+ my %row = ( >+ value => "", >+ selected => 1, >+ branchname => "--", >+ ); >+ push @billingplaceloop, \%row; >+ } >+ >+ for ( sort keys %$branches ) { >+ my $selected = 1 if $_ eq $billingplace; >+ my %row = ( >+ value => $_, >+ selected => $selected, >+ branchname => $branches->{$_}->{branchname}, >+ ); >+ push @billingplaceloop, \%row; >+ } >+ $template->param( billingplaceloop => \@billingplaceloop ); >+ >+ # Build the combobox to select the delivery place >+ my @deliveryplaceloop; >+ >+ # In case there's no branch selected >+ if ($deliveryplace eq "NO_LIBRARY_SET") { >+ my %row = ( >+ value => "", >+ selected => 1, >+ branchname => "--", >+ ); >+ push @deliveryplaceloop, \%row; >+ } >+ >+ for ( sort keys %$branches ) { >+ my $selected = 1 if $_ eq $deliveryplace; >+ my %row = ( >+ value => $_, >+ selected => $selected, >+ branchname => $branches->{$_}->{branchname}, >+ ); >+ push @deliveryplaceloop, \%row; >+ } >+ $template->param( deliveryplaceloop => \@deliveryplaceloop ); >+ > #End Edit > } elsif ( $op eq 'add_validate' ) { > #we are confirming the changes, save the basket >- my $basketno; > if ( $is_an_edit ) { >- $basketno = $input->param('basketno'); >- ModBasketHeader( $input->param('basketno'), $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber') || undef, $input->param('basketbooksellerid') ); >+ ModBasketHeader( >+ $basketno, >+ $input->param('basketname'), >+ $input->param('basketnote'), >+ $input->param('basketbooksellernote'), >+ $input->param('basketcontractnumber') || undef, >+ $input->param('basketbooksellerid'), >+ $input->param('deliveryplace'), >+ $input->param('billingplace'), >+ ); > } else { #New basket >- $basketno = NewBasket($booksellerid, $loggedinuser, $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber')); >+ $basketno = NewBasket( >+ $booksellerid, >+ $loggedinuser, >+ $input->param('basketname'), >+ $input->param('basketnote'), >+ $input->param('basketbooksellernote'), >+ $input->param('basketcontractnumber') || undef, >+ undef, >+ $input->param('deliveryplace'), >+ $input->param('billingplace'), >+ ); > } > print $input->redirect('basket.pl?basketno='.$basketno); > exit 0; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 54498c3..22528a4 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2563,6 +2563,9 @@ CREATE TABLE `aqbasket` ( > `authorisedby` varchar(10) default NULL, > `booksellerinvoicenumber` mediumtext, > `basketgroupid` int(11), >+ deliveryplace varchar(10) default NULL, >+ billingplace varchar(10) default NULL, >+ freedeliveryplace VARCHAR(10) default NULL, > PRIMARY KEY (`basketno`), > KEY `booksellerid` (`booksellerid`), > KEY `basketgroupid` (`basketgroupid`), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 62b4372..1c1621c 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5343,6 +5343,18 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+ >+ >+ >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("ALTER TABLE aqbasket ADD deliveryplace VARCHAR(10) default NULL;"); >+ $dbh->do("ALTER TABLE aqbasket ADD billingplace VARCHAR(10) default NULL;"); >+ $dbh->do("ALTER TABLE aqbasket ADD freedeliveryplace VARCHAR(10) default NULL;"); >+ print "Upgrade to $DBversion done (Added billingplace and deliveryplace to aqbasket)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index dcd6ccb..f6bfb96 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -149,11 +149,14 @@ > // YUI Toolbar Functions > function yuiToolbar() { > new YAHOO.widget.Button("reopenbutton"); >+ new YAHOO.widget.Button("exportbutton"); > } > //]]> > </script> > <ul id="toolbar-list" class="toolbar"> > <li><a href="javascript:confirm_reopen([% skip_confirm_reopen %]);" class="button" id="reopenbutton">Reopen this basket</a></li> >+ <li><a href="[% script_name %]?op=export&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="button" id="exportbutton">Export this basket as CSV</a></li> >+ > </ul> > </div> > [% END %] >@@ -192,6 +195,8 @@ > [% IF ( basketcontractno ) %] > <li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&contractnumber=[% basketcontractno %]&booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li> > [% END %] >+ [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %] >+ [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %] > [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span> [% authorisedbyname %]</li>[% END %] > [% IF ( creationdate ) %]<li><span class="label">Opened on:</span> [% creationdate | $KohaDates %]</li>[% END %] > [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %] >@@ -219,8 +224,9 @@ > <input type="hidden" value="mod_basket" name="op" /> > <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> > <input type="submit" value="Change basket group" /></p> >- > </form> >+ [% IF ( basketgroupdeliveryplace ) %]<p>Basketgroup Delivery place: [% basketgroupdeliveryplace %]</p>[% END %] >+ [% IF ( basketgroupbillingplace ) %]<p>Basketgroup Billing place: [% basketgroupbillingplace %]</p>[% END %] > </div> > [% END %] > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >index df33b1b..9e23ca7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >@@ -189,6 +189,7 @@ function yuiToolbar() { > <input type="text" name="basketgroupname" id="basketgroupname" value="[% name %]" /></li> > <li><label for="billingplace">Billing place:</label> > <select name="billingplace" id="billingplace" style="width:13em;"> >+ <option value="">--</option> > [% FOREACH billingplaceloo IN billingplaceloop %] > [% IF ( billingplaceloo.selected ) %]<option value="[% billingplaceloo.value %]" selected="selected">[% billingplaceloo.branchname %]</option> > [% ELSE %]<option value="[% billingplaceloo.value %]">[% billingplaceloo.branchname %]</option>[% END%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >index 068171e..8b7849d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt >@@ -125,6 +125,28 @@ li.list2 { > <label for="basketname" class="required">Basket name</label> > <input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname %]" /> > </li> >+ <li> >+ <label for="billingplace">Billing Place:</label> >+ <select name="billingplace" id="billingplace"> >+ <option value="">--</option> >+ [% FOREACH billingplace IN billingplaceloop %] >+ <option value="[% billingplace.value %]"[% IF ( billingplace.selected ) %] selected="selected"[% END %]> >+ [% billingplace.branchname %] >+ </option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <label for="deliveryplace">Delivery Place:</label> >+ <select name="deliveryplace" id="deliveryplace"> >+ <option value="">--</option> >+ [% FOREACH deliveryplace IN deliveryplaceloop %] >+ <option value="[% deliveryplace.value %]"[% IF ( deliveryplace.selected ) %] selected="selected"[% END %]> >+ [% deliveryplace.branchname %] >+ </option> >+ [% END %] >+ </select> >+ </li> > <li> > <label for="basketbooksellerid">Vendor</label> > <select name="basketbooksellerid" id="basketbooksellerid"> >-- >1.7.7.3 >
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 5356
:
8405
|
8409
|
8532
|
8940
|
9228
|
9230
|
9975
|
10152
|
10201
|
10338
|
10340
|
10341
|
11120
|
11952
|
12376
|
12377
|
12407
|
12484
|
12838