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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-1 / +1 lines)
Lines 166-172 $(document).ready(function() { Link Here
166
      <p>
166
      <p>
167
        Select a library :
167
        Select a library :
168
            <select name="branchcode" id="branch" style="width:20em;">
168
            <select name="branchcode" id="branch" style="width:20em;">
169
                <option value="">All libraries</option>
169
                <option value="*">All libraries</option>
170
            [% FOREACH branchloo IN branchloop %]
170
            [% FOREACH branchloo IN branchloop %]
171
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
171
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
172
            [% END %]
172
            [% END %]
(-)a/tools/letter.pl (-7 / +13 lines)
Lines 62-67 our $input = new CGI; Link Here
62
my $searchfield = $input->param('searchfield');
62
my $searchfield = $input->param('searchfield');
63
my $script_name = '/cgi-bin/koha/tools/letter.pl';
63
my $script_name = '/cgi-bin/koha/tools/letter.pl';
64
our $branchcode  = $input->param('branchcode');
64
our $branchcode  = $input->param('branchcode');
65
$branchcode = '' if defined $branchcode and $branchcode eq '*';
65
my $code        = $input->param('code');
66
my $code        = $input->param('code');
66
my $module      = $input->param('module') || '';
67
my $module      = $input->param('module') || '';
67
my $content     = $input->param('content');
68
my $content     = $input->param('content');
Lines 98-104 if ( $op eq 'add_validate' or $op eq 'copy_validate' ) { Link Here
98
}
99
}
99
if ($op eq 'copy_form') {
100
if ($op eq 'copy_form') {
100
    my $oldbranchcode = $input->param('oldbranchcode') || q||;
101
    my $oldbranchcode = $input->param('oldbranchcode') || q||;
101
    my $branchcode = $input->param('branchcode') || q||;
102
    my $branchcode = $input->param('branchcode');
102
    add_form($oldbranchcode, $module, $code);
103
    add_form($oldbranchcode, $module, $code);
103
    $template->param(
104
    $template->param(
104
        oldbranchcode => $oldbranchcode,
105
        oldbranchcode => $oldbranchcode,
Lines 244-250 sub add_form { Link Here
244
245
245
sub add_validate {
246
sub add_validate {
246
    my $dbh        = C4::Context->dbh;
247
    my $dbh        = C4::Context->dbh;
247
    my $branchcode    = $input->param('branchcode') || '';
248
    my $branchcode    = $input->param('branchcode');
248
    my $module        = $input->param('module');
249
    my $module        = $input->param('module');
249
    my $oldmodule     = $input->param('oldmodule');
250
    my $oldmodule     = $input->param('oldmodule');
250
    my $code          = $input->param('code');
251
    my $code          = $input->param('code');
Lines 260-266 sub add_validate { Link Here
260
261
261
        # getletter can return the default letter even if we pass a branchcode
262
        # getletter can return the default letter even if we pass a branchcode
262
        # If we got the default one and we needed the specific one, we didn't get the one we needed!
263
        # If we got the default one and we needed the specific one, we didn't get the one we needed!
263
        if ( $letter and $branchcode ne $letter->{branchcode} ) {
264
        if ( $letter and $branchcode and $branchcode ne $letter->{branchcode} ) {
264
            $letter = undef;
265
            $letter = undef;
265
        }
266
        }
266
        unless ( $title and $content ) {
267
        unless ( $title and $content ) {
Lines 276-289 sub add_validate { Link Here
276
                    WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ?
277
                    WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ?
277
                },
278
                },
278
                undef,
279
                undef,
279
                $branchcode, $module, $name, $is_html || 0, $title, $content,
280
                $branchcode || '', $module, $name, $is_html || 0, $title, $content,
280
                $branchcode, $oldmodule, $code, $mtt
281
                $branchcode, $oldmodule, $code, $mtt
281
            );
282
            );
282
        } else {
283
        } else {
283
            $dbh->do(
284
            $dbh->do(
284
                q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,?,?,?,?,?,?,?)},
285
                q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,?,?,?,?,?,?,?)},
285
                undef,
286
                undef,
286
                $branchcode, $module, $code, $name, $is_html || 0, $title, $content, $mtt
287
                $branchcode || '', $module, $code, $name, $is_html || 0, $title, $content, $mtt
287
            );
288
            );
288
        }
289
        }
289
    }
290
    }
Lines 307-313 sub delete_confirmed { Link Here
307
    my ($branchcode, $module, $code, $mtt) = @_;
308
    my ($branchcode, $module, $code, $mtt) = @_;
308
    C4::Letters::DelLetter(
309
    C4::Letters::DelLetter(
309
        {
310
        {
310
            branchcode => $branchcode,
311
            branchcode => $branchcode || '',
311
            module     => $module,
312
            module     => $module,
312
            code       => $code,
313
            code       => $code,
313
            mtt        => $mtt
314
            mtt        => $mtt
Lines 353-358 sub retrieve_letters { Link Here
353
sub default_display {
354
sub default_display {
354
    my ($branchcode, $searchfield) = @_;
355
    my ($branchcode, $searchfield) = @_;
355
356
357
    unless ( defined $branchcode ) {
358
        if ( C4::Context->preference('DefaultToLoggedInLibraryNoticesSlips') ) {
359
            $branchcode = C4::Branch::mybranch();
360
        }
361
    }
362
356
    if ( $searchfield  ) {
363
    if ( $searchfield  ) {
357
        $template->param( search      => 1 );
364
        $template->param( search      => 1 );
358
    }
365
    }
359
- 

Return to bug 11625