Bugzilla – Attachment 38113 Details for
Bug 13182
When placing an order from a staged file, check for duplicates, display availability information, choose to overlay matched records.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13182 - When placing an order from a staged file, check for duplicates, display availability information.
Bug-13182---When-placing-an-order-from-a-staged-fi.patch (text/plain), 6.80 KB, created by
Mark Tompsett
on 2015-04-18 03:56:24 UTC
(
hide
)
Description:
Bug 13182 - When placing an order from a staged file, check for duplicates, display availability information.
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-04-18 03:56:24 UTC
Size:
6.80 KB
patch
obsolete
>From 425b048a812e588184284b7739f46807627b1fb7 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Fri, 31 Oct 2014 14:15:15 +0200 >Subject: [PATCH] Bug 13182 - When placing an order from a staged file, check > for duplicates, display availability information. > >When making acquisitions from one staged file, by many branches as a joint effort, it is important to be able to >make orders from the same import_record and to know how many Items have already been ordered. > >Also introduces misc/maintenance/matchAllStagedRecords.pl to recreate import_record matchings based on the given >matcher. > >This places some extra requirements. >1. An status = 'imported' import_record needs to be shown in the stage_file so other branches can order from it as > well. So we can't "hide" a import_record from the staged_file after an order is placed. >2. Having imported one import_record, that import_record must know it is matched to the just imported Biblio, > so next acquirers know that it is already in our catalog. >3. We need to know which other branches have already ordered the item so we wont end up ordering too many copies > of one Biblio to the consortium. Thus we color each row and show the count of Items in the current user's > branch and the total amount of Items in the whole consortium. Additional tooltip listing of Item counts by > Branch is displayed so we know are there any such Items near us. > >TEST PLAN: > >SETUP: > >0a. Define a Matcher from admin/matching-rules.pl. We think good starting values are: >Search index, Tag , score >ISBN, 020a, 1000 >Identifier-standard, 024a, 1000 >Identifier-standard, 028a, 1000 >Title, 245a, 500 >Title-uniform, 240a, 500 >Personal-name, 110a, 300 >Corporate-name, 100a, 300 >Matching threshold 800 > You can use an existing matcher as well if you have it configured to other than ISBN. > >0b. Stage a MARC file. > >BASIC USAGE: > >1. Start making an order from a staged_file, stop when you see the import_records after you selected the batch > to order from at > acqui/addorderiso2709.pl?import_batch_id=50... >2. If you have matches, they are colored and the Item counts are visible. If not, order any item and return to > the previous view and reload. >3. Observe that you should now have atleast one match. The match displays the amount of items in your branch, > in your consortium, and a tooltip from the record title, showing a breakdown of items by branch. >4. When you add more orders, you get more order lines, but all orders are for the same Biblio, thus you don't > get many Biblios for many orderlines. > >UNLEASH THE HOUNDS OF ACQUISITIONS: > >1. Order a bunch of biblios and items for homebranch A. Make sure that you get the ordered orderlines in your > basket. >2. Order a bunch of biblios and items for homebranch B. >3. Order a bunch of biblios and items for homebranch C. >4. Observe that the biblios already ordered into your catalogue are colored and a number is in front of the > title. First number is the count of Items for this Biblio in user's logged-in-branch, second is the total > number of Items in the catalogue. Hovering mouse pointer over the title displays a tooltip with a breakdown > of all Items by homebranch. > >TODO: Unit tests. >--- > acqui/addorderiso2709.pl | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index b4aa4d9..35884c6 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -175,7 +175,7 @@ if ($op eq ""){ > my $c_quantity = shift( @quantities ) || GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour') ) || 1; > my $c_budget_id = shift( @budgets_id ) || $input->param('all_budget_id') || $budget_id; > my $c_discount = shift ( @discount); >- $c_discount = $c_discount / 100 if $c_discount > 1; >+ $c_discount = $c_discount / 100 if $c_discount && $c_discount > 1; > my $c_sort1 = shift( @sort1 ) || $input->param('all_sort1') || ''; > my $c_sort2 = shift( @sort2 ) || $input->param('all_sort2') || ''; > >@@ -197,6 +197,11 @@ if ($op eq ""){ > } > ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); > SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); >+ >+ #We need to provide information to koha.import_record_matches to tell Koha that this import_record matches the >+ #just AddBiblio'd biblio. This is necessary to prevent adding the same import_record to koha.biblio many times. >+ SetImportRecordBiblioMatch($biblio->{'import_record_id'}, $biblionumber); >+ > # 2nd add authorities if applicable > if (C4::Context->preference("BiblioAddsAuthorities")){ > my $headings_linked =BiblioAutoLink($marcrecord, $cgiparams->{'frameworkcode'}); >@@ -357,7 +362,7 @@ sub import_biblios_list { > my ($template, $import_batch_id) = @_; > my $batch = GetImportBatch($import_batch_id,'staged'); > return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; >- my $biblios = GetImportRecordsRange($import_batch_id,'','',$batch->{import_status}); >+ my $biblios = GetImportRecordsRange($import_batch_id,'','',undef); > my @list = (); > > foreach my $biblio (@$biblios) { >@@ -403,6 +408,8 @@ sub import_biblios_list { > $cellrecord{sort1} = $sort1 || ''; > $cellrecord{sort2} = $sort2 || ''; > >+ get_matched_cellrecord_items( \%cellrecord ); >+ > push @list, \%cellrecord; > } > my $num_records = $batch->{'num_records'}; >@@ -463,6 +470,27 @@ sub add_matcher_list { > $template->param(available_matchers => \@matchers); > } > >+#Get the Items already in Koha for this import_record. >+#A summary of them is displayed for the user. >+sub get_matched_cellrecord_items { >+ my $cellrecord = shift; >+ >+ if ($cellrecord->{match_biblionumber}) { >+ my $itemsCountByBranch = C4::Items::GetItemsCountByBranch( $cellrecord->{match_biblionumber} ); >+ my $loginBranchcode = $template->{VARS}->{LoginBranchcode}; >+ my $totalItemsCount = 0; >+ my @availabilityMap; >+ foreach my $homebranch (sort keys %$itemsCountByBranch) { >+ push (@availabilityMap, $homebranch.' = '.$itemsCountByBranch->{ $homebranch }->{ count }); >+ $totalItemsCount += $itemsCountByBranch->{ $homebranch }->{ count }; >+ } >+ my $loginBranchcount = $itemsCountByBranch->{ $loginBranchcode }->{ count }; >+ $cellrecord->{loginBranchItemsCount} = $loginBranchcount || '0'; >+ $cellrecord->{totalItemsCount} = $totalItemsCount; >+ $cellrecord->{availabilityMap} = join("\n", @availabilityMap); >+ } >+} >+ > sub get_infos_syspref { > my ($record, $field_list) = @_; > my $syspref = C4::Context->preference('MarcFieldsToOrder'); >-- >1.9.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 13182
:
33085
|
33087
|
33088
|
33090
|
33376
|
33377
|
33378
|
33379
| 38113 |
38114
|
38115