View | Details | Raw Unified | Return to bug 12911
Collapse All | Expand All

(-)a/C4/Creators/Batch.pm (-2 / +12 lines)
Lines 56-61 sub new { Link Here
56
    my $batch_id = $sth->fetchrow_array;
56
    my $batch_id = $sth->fetchrow_array;
57
    $self->{'batch_id'} = ++$batch_id unless $self->{'batch_id'} != 0;      # this allows batch_id to be passed in for individual label printing
57
    $self->{'batch_id'} = ++$batch_id unless $self->{'batch_id'} != 0;      # this allows batch_id to be passed in for individual label printing
58
    bless ($self, $type);
58
    bless ($self, $type);
59
60
    #Delete previous placeholders to clean up data
61
    my $query = "DELETE FROM creator_batches WHERE creator = 'PLACEHOLDER';";
62
    my $sth = C4::Context->dbh->prepare($query);
63
    $sth->execute();
64
65
    #Make a placeholder to ensure the batch number is reserved and not assigned to multople clients
66
    my $query = "INSERT INTO creator_batches (batch_id, branch_code, creator) VALUES (?, ?, ?);";
67
    my $sth = C4::Context->dbh->prepare($query);
68
    $sth->execute($self->{'batch_id'}, $self->{'branch_code'}, "PLACEHOLDER");
59
    return $self;
69
    return $self;
60
}
70
}
61
71
Lines 139-145 sub retrieve { Link Here
139
    $type =~ m/C4::(.+)::.+$/;
149
    $type =~ m/C4::(.+)::.+$/;
140
    my $number_type = ($1 eq 'Patroncards' ? 'borrower_number' : 'item_number');
150
    my $number_type = ($1 eq 'Patroncards' ? 'borrower_number' : 'item_number');
141
    my $record_flag = 0;
151
    my $record_flag = 0;
142
    my $query = "SELECT * FROM creator_batches WHERE batch_id = ? ORDER BY label_id";
152
    #Added check to query to exclude placeholder results
153
    my $query = "SELECT * FROM creator_batches WHERE batch_id = ? AND NOT creator = 'PLACEHOLDER' ORDER BY label_id;";
143
    my $sth = C4::Context->dbh->prepare($query);
154
    my $sth = C4::Context->dbh->prepare($query);
144
#    $sth->{'TraceLevel'} = 3;
155
#    $sth->{'TraceLevel'} = 3;
145
    $sth->execute($opts{'batch_id'});
156
    $sth->execute($opts{'batch_id'});
146
- 

Return to bug 12911