|
Lines 15-20
sub _check_params {
Link Here
|
| 15 |
my @valid_template_params = ( |
15 |
my @valid_template_params = ( |
| 16 |
'label_id', |
16 |
'label_id', |
| 17 |
'batch_id', |
17 |
'batch_id', |
|
|
18 |
'description', |
| 18 |
'item_number', |
19 |
'item_number', |
| 19 |
'card_number', |
20 |
'card_number', |
| 20 |
'branch_code', |
21 |
'branch_code', |
|
Lines 43-48
sub new {
Link Here
|
| 43 |
my $type = ref($invocant) || $invocant; |
44 |
my $type = ref($invocant) || $invocant; |
| 44 |
my $self = { |
45 |
my $self = { |
| 45 |
batch_id => 0, |
46 |
batch_id => 0, |
|
|
47 |
description => '', |
| 46 |
items => [], |
48 |
items => [], |
| 47 |
branch_code => 'NB', |
49 |
branch_code => 'NB', |
| 48 |
batch_stat => 0, # False if any data has changed and the db has not been updated |
50 |
batch_stat => 0, # False if any data has changed and the db has not been updated |
|
Lines 63-69
sub add_item {
Link Here
|
| 63 |
my $batch_id = $sth->fetchrow_array; |
65 |
my $batch_id = $sth->fetchrow_array; |
| 64 |
$self->{'batch_id'}= ++$batch_id; |
66 |
$self->{'batch_id'}= ++$batch_id; |
| 65 |
} |
67 |
} |
| 66 |
my $query = "INSERT INTO creator_batches (batch_id, $number_type, branch_code, creator) VALUES (?,?,?,?);"; |
68 |
my $query = "INSERT INTO creator_batches (batch_id, description, $number_type, branch_code, creator) VALUES (?,?,?,?,?);"; |
| 67 |
my $sth = C4::Context->dbh->prepare($query); |
69 |
my $sth = C4::Context->dbh->prepare($query); |
| 68 |
# $sth->{'TraceLevel'} = 3; |
70 |
# $sth->{'TraceLevel'} = 3; |
| 69 |
$sth->execute($self->{'batch_id'}, $number, $self->{'branch_code'}, $1); |
71 |
$sth->execute($self->{'batch_id'}, $number, $self->{'branch_code'}, $1); |
|
Lines 149-154
sub retrieve {
Link Here
|
| 149 |
while (my $record = $sth->fetchrow_hashref) { |
151 |
while (my $record = $sth->fetchrow_hashref) { |
| 150 |
$self->{'branch_code'} = $record->{'branch_code'}; |
152 |
$self->{'branch_code'} = $record->{'branch_code'}; |
| 151 |
$self->{'creator'} = $record->{'creator'}; |
153 |
$self->{'creator'} = $record->{'creator'}; |
|
|
154 |
$self->{'description'} = $record->{'description'}; |
| 152 |
push (@{$self->{'items'}}, {$number_type => $record->{$number_type}, label_id => $record->{'label_id'}}); |
155 |
push (@{$self->{'items'}}, {$number_type => $record->{$number_type}, label_id => $record->{'label_id'}}); |
| 153 |
$record_flag = 1; # true if one or more rows were retrieved |
156 |
$record_flag = 1; # true if one or more rows were retrieved |
| 154 |
} |
157 |
} |