Bug 26632

Summary: BatchStageMarcRecords passes a random number to AddBiblioToBatch / AddAuthToBatch
Product: Koha Reporter: Nick Clemens <nick>
Component: MARC Bibliographic record staging/importAssignee: Nick Clemens <nick>
Status: Pushed to master --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, cmkelleymls, jonathan.druart+koha
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Bug Depends on: 22532    
Bug Blocks:    
Attachments: Bug 26632: (Bug 22532 follow-up) Remove random variables
Bug 26632: Remove two more occurrences
Bug 26632: (Bug 22532 follow-up) Remove random variables
Bug 26632: Remove two more occurrences
Bug 26632: (Bug 22532 follow-up) Remove random variables
Bug 26632: Remove two more occurrences

Description Nick Clemens 2020-10-08 12:51:46 UTC
424                 $import_record_id = AddBiblioToBatch($batch_id, $rec_num, $marc_record, $encoding, int(rand(99999)), 0);
 430                 $import_record_id = AddAuthToBatch($batch_id, $rec_num, $marc_record, $encoding, int(rand(99999)), 0, $marc_type);

This populates:
my $update_counts = @_ ? shift : 1;

Which is used once:
_update_batch_record_counts($batch_id) if $update_counts;

So...almost always we want to update, but very occasionally, randomly, don't?
Comment 1 Jonathan Druart 2020-10-12 15:30:43 UTC
Looks like it's coming from

  commit 5867683fe9aa91d9284d3554cebff9bbec2fa117
  Bug 22532: Remove Z39.50 random

Those rand calls must be removed.
Comment 2 Nick Clemens 2022-05-16 19:34:28 UTC
Created attachment 135047 [details] [review]
Bug 26632: (Bug 22532 follow-up) Remove random variables

AddBiblioToBatch and AddAuthToBatch were btoh passing a random number for the
parameter $update_counts

This simply removes that value as should have been done on 22532

To test:
1 - Stage a marc file
2 - Confirm it works befor and after patch
Comment 3 Nick Clemens 2022-05-16 19:38:19 UTC
Created attachment 135048 [details] [review]
Bug 26632: Remove two more occurrences
Comment 4 ByWater Sandboxes 2022-08-04 20:26:49 UTC
Created attachment 138612 [details] [review]
Bug 26632: (Bug 22532 follow-up) Remove random variables

AddBiblioToBatch and AddAuthToBatch were btoh passing a random number for the
parameter $update_counts

This simply removes that value as should have been done on 22532

To test:
1 - Stage a marc file
2 - Confirm it works befor and after patch

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 5 ByWater Sandboxes 2022-08-04 20:26:52 UTC
Created attachment 138613 [details] [review]
Bug 26632: Remove two more occurrences

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 6 Katrin Fischer 2022-08-05 11:04:23 UTC
Please don't forget to set Assignee!
Comment 7 Jonathan Druart 2022-08-17 09:11:31 UTC
Created attachment 139242 [details] [review]
Bug 26632: (Bug 22532 follow-up) Remove random variables

AddBiblioToBatch and AddAuthToBatch were btoh passing a random number for the
parameter $update_counts

This simply removes that value as should have been done on 22532

To test:
1 - Stage a marc file
2 - Confirm it works befor and after patch

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2022-08-17 09:11:35 UTC
Created attachment 139243 [details] [review]
Bug 26632: Remove two more occurrences

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Tomás Cohen Arazi 2022-08-17 12:26:04 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!