Lines 42-48
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
42 |
); |
42 |
); |
43 |
|
43 |
|
44 |
my $err = 0; |
44 |
my $err = 0; |
45 |
my $errstr = undef; |
45 |
my $errtype = undef; |
46 |
my $duplicate_count = undef; |
46 |
my $duplicate_count = undef; |
47 |
my $duplicate_message = undef; |
47 |
my $duplicate_message = undef; |
48 |
my $db_rows = {}; |
48 |
my $db_rows = {}; |
Lines 72-85
if ($op eq 'remove') {
Link Here
|
72 |
foreach my $label_id (@label_ids) { |
72 |
foreach my $label_id (@label_ids) { |
73 |
$err = $batch->remove_item($label_id); |
73 |
$err = $batch->remove_item($label_id); |
74 |
} |
74 |
} |
75 |
$errstr = "item(s) not removed from batch $batch_id." if $err; |
75 |
$errtype = 'ITEM_NOT_REMOVED' if $err; |
76 |
# Something like this would be nice to avoid problems with the browser's 'refresh' button, but it needs an error handling mechanism... |
76 |
# Something like this would be nice to avoid problems with the browser's 'refresh' button, but it needs an error handling mechanism... |
77 |
# print $cgi->redirect("label-edit-batch.pl?op=edit&batch_id=$batch_id"); |
77 |
# print $cgi->redirect("label-edit-batch.pl?op=edit&batch_id=$batch_id"); |
78 |
# exit; |
78 |
# exit; |
79 |
} |
79 |
} |
80 |
elsif ($op eq 'delete') { |
80 |
elsif ($op eq 'delete') { |
81 |
$err = C4::Labels::Batch::delete(batch_id => $batch_id, branch_code => $branch_code); |
81 |
$err = C4::Labels::Batch::delete(batch_id => $batch_id, branch_code => $branch_code); |
82 |
$errstr = "batch $batch_id was not deleted." if $err; |
82 |
$errtype = 'BATCH_NOT_DELETED' if $err; |
83 |
} |
83 |
} |
84 |
elsif ($op eq 'add') { |
84 |
elsif ($op eq 'add') { |
85 |
if ($number_list) { |
85 |
if ($number_list) { |
Lines 103-113
elsif ($op eq 'add') {
Link Here
|
103 |
$err = $batch->add_item($item_number); |
103 |
$err = $batch->add_item($item_number); |
104 |
} |
104 |
} |
105 |
$batch_id = $batch->get_attr('batch_id') if $batch_id == 0; #update batch_id if we added to a new batch |
105 |
$batch_id = $batch->get_attr('batch_id') if $batch_id == 0; #update batch_id if we added to a new batch |
106 |
$errstr = "item(s) not added to batch $batch_id." if $err; |
106 |
$errtype = 'ITEM_NOT_ADDED' if $err; |
107 |
} |
107 |
} |
108 |
else { |
108 |
else { |
109 |
$err = 1; |
109 |
$err = 1; |
110 |
$errstr = "items(s) not added, the error was: Branch is not set, you please set your branch before adding items to a batch"; |
110 |
$errtype = 'BRANCH_NOT_SET'; |
111 |
} |
111 |
} |
112 |
} |
112 |
} |
113 |
elsif ($op eq 'new') { |
113 |
elsif ($op eq 'new') { |
Lines 118-124
elsif ($op eq 'de_duplicate') {
Link Here
|
118 |
$batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); |
118 |
$batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); |
119 |
$duplicate_count = $batch->remove_duplicates(); |
119 |
$duplicate_count = $batch->remove_duplicates(); |
120 |
$duplicate_message = 1 if $duplicate_count != -1; |
120 |
$duplicate_message = 1 if $duplicate_count != -1; |
121 |
$errstr = "batch $batch_id not fully de-duplicated." if $duplicate_count == -1; |
121 |
$errtype = 'BATCH_NOT_DEDUP' if $duplicate_count == -1; |
122 |
} |
122 |
} |
123 |
else { # edit |
123 |
else { # edit |
124 |
$batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); |
124 |
$batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); |
Lines 131-137
my $table = html_table($display_columns, $db_rows);
Link Here
|
131 |
|
131 |
|
132 |
$template->param( |
132 |
$template->param( |
133 |
err => $err, |
133 |
err => $err, |
134 |
errstr => $errstr, |
134 |
errtype => $errtype, |
135 |
) if ($err ne 0); |
135 |
) if ($err ne 0); |
136 |
|
136 |
|
137 |
$template->param( |
137 |
$template->param( |
138 |
- |
|
|