From 89c0cda081a21f20ba1bebf715128ca3f2a1695b Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Wed, 16 Sep 2009 10:33:47 +0200 Subject: [PATCH] [replace previous] fix for 3612 (bookseller improvements) - removing useless fields from aqbooksellers table: specialty, deliverydays,followupdays,followupscancel,nocalc, invoicedisc They were in the DB schema, but unused for years - reworked bookseller and contract gui - no warning thrown NOTE : updatedatabase not done for field removal in aqbooksellers table. Should have: ALTER TABLE `aqbooksellers` DROP `deliverydays`, DROP `followupdays`, DROP `followupscancel`, DROP `specialty`, DROP `nocalc`; --- C4/Bookseller.pm | 15 +- acqui/supplier.pl | 8 +- admin/aqcontract.pl | 31 ++-- installer/data/mysql/kohastructure.sql | 6 - .../prog/en/includes/acquisitions-toolbar.inc | 67 ++++---- .../prog/en/modules/acqui/booksellers.tmpl | 162 +++++++++--------- .../prog/en/modules/acqui/supplier.tmpl | 86 +++++----- .../prog/en/modules/admin/admin-home.tmpl | 2 - .../prog/en/modules/admin/aqcontract.tmpl | 106 ++++++------ 9 files changed, 241 insertions(+), 242 deletions(-) diff --git a/C4/Bookseller.pm b/C4/Bookseller.pm index c18769a0f9..655d25edca 100644 --- a/C4/Bookseller.pm +++ b/C4/Bookseller.pm @@ -172,10 +172,10 @@ sub AddBookseller { postal, phone, fax, url, contact, contpos, contphone, contfax, contaltphone, contemail, contnotes, active, listprice, invoiceprice, gstreg, - listincgst,invoiceincgst, specialty, discount, invoicedisc, - nocalc, notes + listincgst,invoiceincgst, discount, + notes ) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; my $sth = $dbh->prepare($query); $sth->execute( @@ -190,9 +190,7 @@ sub AddBookseller { $data->{'active'}, $data->{'listprice'}, $data->{'invoiceprice'}, $data->{'gstreg'}, $data->{'listincgst'}, $data->{'invoiceincgst'}, - $data->{'specialty'}, $data->{'discount'}, - $data->{'invoicedisc'}, $data->{'nocalc'}, - $data->{'notes'} + $data->{'discount'}, $data->{'notes'} ); # return the id of this new supplier @@ -233,7 +231,7 @@ sub ModBookseller { contphone=?,contfax=?,contaltphone=?,contemail=?, contnotes=?,active=?,listprice=?, invoiceprice=?, gstreg=?,listincgst=?,invoiceincgst=?, - specialty=?,discount=?,invoicedisc=?,nocalc=?,notes=?,gstrate=? + discount=?, notes=?, gstrate=? WHERE id=? "; my $sth = $dbh->prepare($query); @@ -249,8 +247,7 @@ sub ModBookseller { $data->{'active'}, $data->{'listprice'}, $data->{'invoiceprice'}, $data->{'gstreg'}, $data->{'listincgst'}, $data->{'invoiceincgst'}, - $data->{'specialty'}, $data->{'discount'}, - $data->{'invoicedisc'}, $data->{'nocalc'}, + $data->{'discount'}, $data->{'notes'}, $data->{'gstrate'}, $data->{'id'} ); diff --git a/acqui/supplier.pl b/acqui/supplier.pl index b3ed949771..3934da31a8 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -88,11 +88,10 @@ if ($op eq "display") { contnotes => $booksellers[0]->{'contnotes'}, notes => $booksellers[0]->{'notes'}, active => $booksellers[0]->{'active'}, - specialty => $booksellers[0]->{'specialty'}, gstreg => $booksellers[0]->{'gstreg'}, listincgst => $booksellers[0]->{'listincgst'}, invoiceincgst => $booksellers[0]->{'invoiceincgst'}, - gstrate => $booksellers[0]->{'gstrate'}, + gstrate => $booksellers[0]->{'gstrate'}*100, discount => $booksellers[0]->{'discount'}, invoiceprice => $booksellers[0]->{'invoiceprice'}, listprice => $booksellers[0]->{'listprice'}, @@ -143,12 +142,11 @@ elsif ($op eq 'delete') { contemail => $booksellers[0]->{'contemail'}, contnotes => $booksellers[0]->{'contnotes'}, notes => $booksellers[0]->{'notes'}, - active => $booksellers[0]->{'active'}, - specialty => $booksellers[0]->{'specialty'}, + active => $id?$booksellers[0]->{'active'}:1, # set active ON by default for supplier add (id empty for add) gstreg => $booksellers[0]->{'gstreg'}, listincgst => $booksellers[0]->{'listincgst'}, invoiceincgst => $booksellers[0]->{'invoiceincgst'}, - gstrate => $booksellers[0]->{'gstrate'}, + gstrate => $booksellers[0]->{'gstrate'}*100, discount => $booksellers[0]->{'discount'}, loop_pricescurrency => \@loop_pricescurrency, loop_invoicecurrency => \@loop_invoicecurrency, diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl index 37a76000ce..eea782d960 100755 --- a/admin/aqcontract.pl +++ b/admin/aqcontract.pl @@ -27,13 +27,14 @@ use C4::Context; use C4::Auth; use C4::Output; use C4::Dates qw/format_date format_date_in_iso/; -use C4::Bookseller qw/GetBookSeller/; +use C4::Bookseller qw/GetBookSellerFromId/; sub StringSearch { my ($searchstring)=@_; my $dbh = C4::Context->dbh; $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); + $data[0]='' unless $data[0]; my $sth=$dbh->prepare("Select * from aqcontract where (contractdescription like ? or contractname like ?) order by contractnumber"); $sth->execute("%$data[0]%","%$data[0]%"); my @results; @@ -45,10 +46,13 @@ sub StringSearch { } my $input = new CGI; -my $searchfield = $input->param('searchfield'); +my $searchfield = $input->param('searchfield') || ''; my $script_name = "/cgi-bin/koha/admin/aqcontract.pl"; my $contractnumber = $input->param('contractnumber'); -my $op = $input->param('op'); +my $booksellerid = $input->param('booksellerid'); +my $op = $input->param('op') || ''; +my @bookseller = GetBookSellerFromId("$booksellerid"); + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "admin/aqcontract.tmpl", @@ -63,15 +67,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( $template->param( script_name => $script_name, contractnumber => $contractnumber, - searchfield => $searchfield + searchfield => $searchfield, + booksellerid => $booksellerid, + name => $bookseller[0]->{name}, + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); - #ADD_FORM: called if $op is 'add_form'. Used to create form to add or modify a record if ( $op eq 'add_form' ) { $template->param( add_form => 1 ); my $data; - my @booksellerloop = GetBookSeller(""); #---- if primkey exists, it's a modify action, so read values to modify... if ($contractnumber) { @@ -81,11 +86,17 @@ if ( $op eq 'add_form' ) { $data = $sth->fetchrow_hashref; $sth->finish; - for my $bookseller (@booksellerloop) { + for my $bookseller (@bookseller) { if ( $bookseller->{'id'} eq $data->{'booksellerid'} ) { $bookseller->{'selected'} = 1; } } + } else { + for my $bookseller (@bookseller) { + if ( $bookseller->{'id'} eq $booksellerid ) { + $bookseller->{'selected'} = 1; + } + } } $template->param( contractnumber => $data->{'contractnumber'}, @@ -93,7 +104,7 @@ if ( $op eq 'add_form' ) { contractdescription => $data->{'contractdescription'}, contractstartdate => format_date( $data->{'contractstartdate'} ), contractenddate => format_date( $data->{'contractenddate'} ), - booksellerloop => \@booksellerloop, + booksellerloop => \@bookseller, booksellerid => $data->{'booksellerid'}, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); @@ -135,7 +146,7 @@ elsif ( $op eq 'add_validate' ) { ); $sth->finish; } - print "Content-Type: text/html\n\n"; + print "Content-Type: text/html\n\n"; exit; # END $OP eq ADD_VALIDATE @@ -180,7 +191,7 @@ elsif ( $op eq 'delete_confirmed' ) { my $sth = $dbh->prepare("delete from aqcontract where contractnumber=?"); $sth->execute($contractnumber); $sth->finish; - print "Content-Type: text/html\n\n"; + print "Content-Type: text/html\n\n"; exit; # END $OP eq DELETE_CONFIRMED diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e8bd67566f..821bb18d23 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2273,10 +2273,6 @@ CREATE TABLE `aqbooksellers` ( `accountnumber` mediumtext, `othersupplier` mediumtext, `currency` varchar(3) NOT NULL default '', - `deliverydays` smallint(6) default NULL, - `followupdays` smallint(6) default NULL, - `followupscancel` smallint(6) default NULL, - `specialty` mediumtext, `booksellerfax` mediumtext, `notes` mediumtext, `bookselleremail` mediumtext, @@ -2299,8 +2295,6 @@ CREATE TABLE `aqbooksellers` ( `gstrate` decimal(6,4) default NULL, `discount` float(6,4) default NULL, `fax` varchar(50) default NULL, - `nocalc` int(11) default NULL, - `invoicedisc` float(6,4) default NULL, PRIMARY KEY (`id`), KEY `listprice` (`listprice`), KEY `invoiceprice` (`invoiceprice`), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc index 28cfd1aaa1..ce8b289ab3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc @@ -1,46 +1,47 @@
- + //]]> + +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tmpl index 72e1cd0c78..fd939093a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tmpl @@ -10,92 +10,94 @@
-
-
-
- +
+
+
+

You searched on vendor , results found

-
- - - - - - - - - - - - - - - - - - - - - - - - -
OrderOrder receiveVendor 
- &op=add_form">Add basket - - Inactive - - ">Receive shipment - ">">NO NAME - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BasketItemsCreated byDate 
- - - closed on - ">View - - - ">modify - - ">View - - -
No pending baskets
-
-
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
OrderOrder receiveVendor 
+ &op=add_form">Add basket + + Inactive + + ">Receive shipment + ">">NO NAME + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BasketItemsCreated byDate 
+ + + closed on + ">View + + + ">modify + + ">View + + +
No pending baskets
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl index 62ed3b090a..7b1778e240 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tmpl @@ -4,13 +4,13 @@ -
  •   - " /> +
  •   + " maxlength="10" size="10" /> /lib/calendar/cal.gif" id="contractenddate_button" alt="Show Calendar" />
  • -

    Contract Administration

    - - - - - - - - - - +

    Contract(s) of

    + +
    contract idContract nameContract descriptioncontract start datecontract end datebookseller 
    + + + + + + + - - - - - + +
    NameDescriptionStart dateEnd date 
    - ?op=add_form&contractnumber="> + + ?op=add_form&contractnumber="> ?op=add_form&contractnumber=">Edit?op=delete_confirm&contractnumber=">Delete?op=add_form&contractnumber=&booksellerid=">Edit?op=delete_confirm&contractnumber=&booksellerid=">Delete
    +
    -- 2.39.5