Bugzilla – Attachment 35600 Details for
Bug 12911
batch_id for new label batches can be assigned to several batches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12911 - batch_id for new label batches can be assigned to several batches -Added code to make a placeholder and thus reserve the batch number. -Added code to delete old placeholders everytime a new batch is made. -Modified code in SELECT query to disc
Bug-12911---batchid-for-new-label-batches-can-be-a.patch (text/plain), 2.54 KB, created by
Thomas Wright
on 2015-01-29 05:18:12 UTC
(
hide
)
Description:
Bug 12911 - batch_id for new label batches can be assigned to several batches -Added code to make a placeholder and thus reserve the batch number. -Added code to delete old placeholders everytime a new batch is made. -Modified code in SELECT query to disc
Filename:
MIME Type:
Creator:
Thomas Wright
Created:
2015-01-29 05:18:12 UTC
Size:
2.54 KB
patch
obsolete
>From 084b00933b2747536c12a91df1070d2e4df44a67 Mon Sep 17 00:00:00 2001 >From: Thomas <tomsStudy@gmail.com> >Date: Thu, 29 Jan 2015 05:07:10 +0000 >Subject: [PATCH] Bug 12911 - batch_id for new label batches can be assigned > to several batches -Added code to make a placeholder and > thus reserve the batch number. -Added code to delete old > placeholders everytime a new batch is made. -Modified code > in SELECT query to discount placeholders from batch items. > >Testing Plan >-Open two koha staff windows in different browsers/inprivate. >-On both navigate Home>Tools>Label Creator >-Make a new batch in the first window >-Make a new batch in the second window >*The new batches created should have different batch numbers > >-Add items to one of the batches >*Only the items added should show in the summary below. No placeholders should be shown > >-Go back to manage batches page on either window >*The batch created which did not have any items added to it should not be displayed in this window >--- > C4/Creators/Batch.pm | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > >diff --git a/C4/Creators/Batch.pm b/C4/Creators/Batch.pm >index 28beeb7..318d0db 100644 >--- a/C4/Creators/Batch.pm >+++ b/C4/Creators/Batch.pm >@@ -56,6 +56,16 @@ sub new { > my $batch_id = $sth->fetchrow_array; > $self->{'batch_id'} = ++$batch_id unless $self->{'batch_id'} != 0; # this allows batch_id to be passed in for individual label printing > bless ($self, $type); >+ >+ #Delete previous placeholders to clean up data >+ my $query = "DELETE FROM creator_batches WHERE creator = 'PLACEHOLDER';"; >+ my $sth = C4::Context->dbh->prepare($query); >+ $sth->execute(); >+ >+ #Make a placeholder to ensure the batch number is reserved and not assigned to multople clients >+ my $query = "INSERT INTO creator_batches (batch_id, branch_code, creator) VALUES (?, ?, ?);"; >+ my $sth = C4::Context->dbh->prepare($query); >+ $sth->execute($self->{'batch_id'}, $self->{'branch_code'}, "PLACEHOLDER"); > return $self; > } > >@@ -139,7 +149,8 @@ sub retrieve { > $type =~ m/C4::(.+)::.+$/; > my $number_type = ($1 eq 'Patroncards' ? 'borrower_number' : 'item_number'); > my $record_flag = 0; >- my $query = "SELECT * FROM creator_batches WHERE batch_id = ? ORDER BY label_id"; >+ #Added check to query to exclude placeholder results >+ my $query = "SELECT * FROM creator_batches WHERE batch_id = ? AND NOT creator = 'PLACEHOLDER' ORDER BY label_id;"; > my $sth = C4::Context->dbh->prepare($query); > # $sth->{'TraceLevel'} = 3; > $sth->execute($opts{'batch_id'}); >-- >1.7.10.4
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 12911
:
35600
|
35719
|
35807
|
35898