From 0a72b270cfa739dd8a7493eb738ce04ec69facb6 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 26 Aug 2012 00:29:53 +0200 Subject: [PATCH] Bug 8415: Follow up - Fixing some smaller issues 1) Changes the updatedatabase to be a bit more precise and always add the new field after claimed_date, like it is in kohastructure.sql. 2) Fixes capitalization rules for the new link to create a serial order. 3) Hides EAN search field when marcflavour is not UNIMARC. 4) Adds documentation for the new column in kohastructure.sql 5) Fixes some terms * Branch to Library * Search for Serial Routing Lists to Search for serial subscriptions * Supplier to Vendor 6) Deletes doubled up SearchSubscriptions from Search.pm * Change call to sub to use new signature 7) Deletes "Show only renewed" checkbox and related code. This feature requires a database field reneweddate in subscription that is not available in master. --- C4/Serials.pm | 79 +------------------- acqui/newordersubscription.pl | 16 +++- installer/data/mysql/kohastructure.sql | 2 +- installer/data/mysql/updatedatabase.pl | 4 +- .../en/includes/acquisitions-add-to-basket.inc | 2 +- .../prog/en/includes/subscriptions-search.inc | 6 +- .../prog/en/modules/acqui/newordersubscription.tt | 25 +------ 7 files changed, 25 insertions(+), 109 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 9483c3d..dec5dd3 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -52,7 +52,7 @@ BEGIN { &getroutinglist &delroutingmember &addroutingmember &reorder_members &check_routing &updateClaim &removeMissingIssue - &CountIssues &SearchSubscriptions + &CountIssues &subscriptionCurrentlyOnOrder HasItems &GetSubscriptionsFromBorrower @@ -153,83 +153,6 @@ sub GetLateIssues { return @issuelist; } -=head2 SearchSubscriptions - -@results = SearchSubscriptions($biblionumber, $title, $issn, $ean, $publisher, $supplier, $branch, $minold, $maxold); - -this function gets all subscriptions which have biblionumber eq $biblionumber, title like $title, ISSN like $issn, EAN like $ean, publisher like $publisher, supplier like $supplier AND branchcode eq $branch. -$minold and $maxold are values in days. It allows to get active and inactive subscription apart. - -return: -a table of hashref. Each hash containt the subscription. - -=cut - -sub SearchSubscriptions { - my ($biblionumber, $title, $issn, $ean, $publisher, $supplier, $branch, $minold, $maxold) = @_; - - my $query = qq{ - SELECT subscription.*, subscriptionhistory.*, biblio.*, biblioitems.issn, - subscription.notes AS notes - FROM subscription - LEFT JOIN subscriptionhistory USING(subscriptionid) - LEFT JOIN biblio ON biblio.biblionumber = subscription.biblionumber - LEFT JOIN biblioitems ON biblioitems.biblionumber = subscription.biblionumber - LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id - }; - my @where_strs; - my @where_args; - if($biblionumber){ - push @where_strs, "subscription.biblionumber = ?"; - push @where_args, "$biblionumber"; - } - if($title){ - push @where_strs, "biblio.title LIKE ?"; - push @where_args, "%$title%"; - } - if($issn){ - push @where_strs, "biblioitems.issn LIKE ?"; - push @where_args, "%$issn%"; - } - if($ean){ - push @where_strs, "biblioitems.ean LIKE ?"; - push @where_args, "%$ean%"; - } - if($publisher){ - push @where_strs, "biblioitems.publishercode LIKE ?"; - push @where_args, "%$publisher%"; - } - if($supplier){ - push @where_strs, "aqbooksellers.name LIKE ?"; - push @where_args, "%$supplier%"; - } - if($branch){ - push @where_strs, "subscription.branchcode = ?"; - push @where_args, "$branch"; - } - if ($minold) { - push @where_strs, "TO_DAYS(NOW()) - TO_DAYS(subscription.enddate) > ?" if ($minold); - push @where_args, "$minold" if ($minold); - } - if ($maxold) { - push @where_strs, "(TO_DAYS(NOW()) - TO_DAYS(subscription.enddate) <= ? OR subscription.enddate IS NULL OR subscription.enddate = '0000-00-00')"; - push @where_args, "$maxold"; - } - - if(@where_strs){ - $query .= " WHERE " . join(" AND ", @where_strs); - } - warn $query; - warn join(",", @where_args) if @where_args; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare($query); - $sth->execute(@where_args); - my $results = $sth->fetchall_arrayref( {} ); - $sth->finish; - - return @$results; -} - =head2 $bool = subscriptionCurrentlyOnOrder( $subscriptionid ); Return 1 if subscription is already on order diff --git a/acqui/newordersubscription.pl b/acqui/newordersubscription.pl index 86db2e2..30b5538 100755 --- a/acqui/newordersubscription.pl +++ b/acqui/newordersubscription.pl @@ -18,8 +18,7 @@ # with Koha; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -use warnings; -use strict; +use Modern::Perl; use CGI; use C4::Acquisition; use C4::Auth; @@ -59,7 +58,17 @@ my ($bookseller) = C4::Bookseller::GetBookSellerFromId( $booksellerid); my @subscriptions; my $sub; if ($searched) { - @subscriptions = SearchSubscriptions($biblionumber, $title, $ISSN, $EAN, $publisher, $supplier, $branch); + @subscriptions = SearchSubscriptions( + { + biblionumber => $biblionumber, + title => $title, + issn => $ISSN, + ean => $EAN, + publisher => $publisher, + bookseller => $supplier, + branch => $branch + } + ); } @@ -104,5 +113,6 @@ $template->param( basketname => $basket->{'basketname'}, booksellername => $bookseller->{'name'}, unfolded_search => 1, + marcflavour => uc(C4::Context->preference("marcflavour")), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ec4ff30..4572b42 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2780,7 +2780,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no) `claims_count` int(11) default 0, -- count of claim letters generated `claimed_date` date default NULL, -- last date a claim was generated - `subscriptionid` int(11) default NULL, + `subscriptionid` int(11) default NULL, -- links this order to a subscription in the serials module parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent PRIMARY KEY (`ordernumber`), KEY `basketno` (`basketno`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3fa0541..a695fc5 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5862,8 +5862,8 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = "3.09.00.XXX"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do("ALTER TABLE `aqorders` ADD `subscriptionid` int(11) default NULL"); - print "Upgrade to $DBversion done (Alter table aqorders done)\n"; + $dbh->do("ALTER TABLE `aqorders` ADD `subscriptionid` int(11) default NULL AFTER `claimed_date`"); + print "Upgrade to $DBversion done (Add subscriptionid to table aqorders)\n"; SetVersion ($DBversion); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc index 0391df7..a7a64b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc @@ -6,7 +6,7 @@