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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt (-1 / +17 lines)
Lines 191-198 Link Here
191
                <div class="yui-b">
191
                <div class="yui-b">
192
                        [% INCLUDE 'labels-toolbar.inc' %]
192
                        [% INCLUDE 'labels-toolbar.inc' %]
193
                        [% IF ( err ) %]
193
                        [% IF ( err ) %]
194
                            [% BLOCK xlate_errtype %]
195
                            [%    SWITCH errtype %]
196
                            [%       CASE 'ITEM_NOT_REMOVED' %]
197
                            <span>Item(s) not removed from batch [% batch_id %].</span>
198
                            [%       CASE 'BATCH_NOT_DELETED' %]
199
                            <span>Batch [% batch_id %] was not deleted.</span>
200
                            [%       CASE 'ITEM_NOT_ADDED' %]
201
                            <span>Item(s) not added to batch [% batch_id %].</span>
202
                            [%       CASE 'BRANCH_NOT_SET' %]
203
                            <span>Branch is not set, please set your branch before adding items to a batch.</span>
204
                            [%       CASE 'BATCH_NOT_DEDUP' %]
205
                            <span>Batch [% batch_id %] not fully de-duplicated.</span>
206
                            [%       CASE %]
207
                            <span>Unknown error type [% errtype %].</span>
208
                            [%    END %]
209
                            [% END %]
194
                            <div class="dialog alert">
210
                            <div class="dialog alert">
195
                                <strong>WARNING:</strong> An error was encountered and [% errstr %] Please have your system administrator check the error log for details.
211
                                <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
196
                            </div>
212
                            </div>
197
                        [% ELSIF ( duplicate_message ) %]
213
                        [% ELSIF ( duplicate_message ) %]
198
                            <div class="dialog message">
214
                            <div class="dialog message">
(-)a/labels/label-edit-batch.pl (-8 / +7 lines)
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
- 

Return to bug 12020