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

(-)a/tools/letter.pl (-12 / +28 lines)
Lines 46-51 use C4::Auth; Link Here
46
use C4::Context;
46
use C4::Context;
47
use C4::Output;
47
use C4::Output;
48
use C4::Letters;
48
use C4::Letters;
49
use C4::Log;
49
50
50
use Koha::Patron::Attribute::Types;
51
use Koha::Patron::Attribute::Types;
51
52
Lines 315-320 sub add_validate { Link Here
315
            next;
316
            next;
316
        }
317
        }
317
        elsif ( $letter and $letter->{message_transport_type} eq $mtt and $letter->{lang} eq $lang ) {
318
        elsif ( $letter and $letter->{message_transport_type} eq $mtt and $letter->{lang} eq $lang ) {
319
            logaction( 'NOTICES', 'MODIFY', $letter->{id}, $letter->{content},
320
                'Intranet' )
321
              unless ( $content eq $letter->{content} );
318
            $dbh->do(
322
            $dbh->do(
319
                q{
323
                q{
320
                    UPDATE letter
324
                    UPDATE letter
Lines 326-336 sub add_validate { Link Here
326
                $branchcode, $oldmodule, $code, $mtt, $lang
330
                $branchcode, $oldmodule, $code, $mtt, $lang
327
            );
331
            );
328
        } else {
332
        } else {
329
            $dbh->do(
333
            my $letter = Koha::Notice::Template->new(
330
                q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content,message_transport_type, lang) VALUES (?,?,?,?,?,?,?,?,?)},
334
                {
331
                undef,
335
                    branchcode             => $branchcode,
332
                $branchcode || '', $module, $code, $name, $is_html || 0, $title, $content, $mtt, $lang
336
                    module                 => $module,
333
            );
337
                    code                   => $code,
338
                    name                   => $name,
339
                    is_html                => $is_html,
340
                    title                  => $title,
341
                    content                => $content,
342
                    message_transport_type => $mtt,
343
                    lang                   => $lang
344
                }
345
            )->store;
346
            logaction('NOTICES', 'CREATE', $letter->id, $letter->content, 'Intranet');
334
        }
347
        }
335
    }
348
    }
336
    # set up default display
349
    # set up default display
Lines 351-365 sub delete_confirm { Link Here
351
364
352
sub delete_confirmed {
365
sub delete_confirmed {
353
    my ($branchcode, $module, $code, $mtt, $lang) = @_;
366
    my ($branchcode, $module, $code, $mtt, $lang) = @_;
354
    C4::Letters::DelLetter(
367
    my $letter = Koha::Notice::Templates->find(
355
        {
368
        {
356
            branchcode => $branchcode || '',
369
            branchcode             => $branchcode || '',
357
            module     => $module,
370
            module                 => $module,
358
            code       => $code,
371
            code                   => $code,
359
            mtt        => $mtt,
372
            message_transport_type => $mtt,
360
            lang       => $lang,
373
            lang                   => $lang,
361
        }
374
        }
362
    );
375
    );
376
    if ( $letter ) {
377
        logaction('NOTICES', 'DELETE', $letter->id, $letter->content, 'Intranet');
378
        $letter->delete;
379
    }
363
    # setup default display for screen
380
    # setup default display for screen
364
    default_display($branchcode);
381
    default_display($branchcode);
365
    return;
382
    return;
366
- 

Return to bug 14233