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 248-254 sub add_form { Link Here
248
249
249
sub add_validate {
250
sub add_validate {
250
    my $dbh        = C4::Context->dbh;
251
    my $dbh        = C4::Context->dbh;
251
    my $branchcode    = $input->param('branchcode') || '';
252
    my $branchcode    = $input->param('branchcode');
252
    my $module        = $input->param('module');
253
    my $module        = $input->param('module');
253
    my $oldmodule     = $input->param('oldmodule');
254
    my $oldmodule     = $input->param('oldmodule');
254
    my $code          = $input->param('code');
255
    my $code          = $input->param('code');
Lines 264-270 sub add_validate { Link Here
264
265
265
        # getletter can return the default letter even if we pass a branchcode
266
        # getletter can return the default letter even if we pass a branchcode
266
        # If we got the default one and we needed the specific one, we didn't get the one we needed!
267
        # If we got the default one and we needed the specific one, we didn't get the one we needed!
267
        if ( $letter and $branchcode ne $letter->{branchcode} ) {
268
        if ( $letter and $branchcode and $branchcode ne $letter->{branchcode} ) {
268
            $letter = undef;
269
            $letter = undef;
269
        }
270
        }
270
        unless ( $title and $content ) {
271
        unless ( $title and $content ) {
Lines 280-293 sub add_validate { Link Here
280
                    WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ?
281
                    WHERE branchcode = ? AND module = ? AND code = ? AND message_transport_type = ?
281
                },
282
                },
282
                undef,
283
                undef,
283
                $branchcode, $module, $name, $is_html || 0, $title, $content,
284
                $branchcode || '', $module, $name, $is_html || 0, $title, $content,
284
                $branchcode, $oldmodule, $code, $mtt
285
                $branchcode, $oldmodule, $code, $mtt
285
            );
286
            );
286
        } else {
287
        } else {
287
            $dbh->do(
288
            $dbh->do(
288
                q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,?,?,?,?,?,?,?)},
289
                q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES (?,?,?,?,?,?,?,?)},
289
                undef,
290
                undef,
290
                $branchcode, $module, $code, $name, $is_html || 0, $title, $content, $mtt
291
                $branchcode || '', $module, $code, $name, $is_html || 0, $title, $content, $mtt
291
            );
292
            );
292
        }
293
        }
293
    }
294
    }
Lines 311-317 sub delete_confirmed { Link Here
311
    my ($branchcode, $module, $code, $mtt) = @_;
312
    my ($branchcode, $module, $code, $mtt) = @_;
312
    C4::Letters::DelLetter(
313
    C4::Letters::DelLetter(
313
        {
314
        {
314
            branchcode => $branchcode,
315
            branchcode => $branchcode || '',
315
            module     => $module,
316
            module     => $module,
316
            code       => $code,
317
            code       => $code,
317
            mtt        => $mtt
318
            mtt        => $mtt
Lines 357-362 sub retrieve_letters { Link Here
357
sub default_display {
358
sub default_display {
358
    my ($branchcode, $searchfield) = @_;
359
    my ($branchcode, $searchfield) = @_;
359
360
361
    unless ( defined $branchcode ) {
362
        if ( C4::Context->preference('DefaultToLoggedInLibraryNoticesSlips') ) {
363
            $branchcode = C4::Branch::mybranch();
364
        }
365
    }
366
360
    if ( $searchfield  ) {
367
    if ( $searchfield  ) {
361
        $template->param( search      => 1 );
368
        $template->param( search      => 1 );
362
    }
369
    }
363
- 

Return to bug 11625