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

(-)a/C4/Circulation.pm (-6 / +14 lines)
Lines 2628-2638 sub SendCirculationAlert { Link Here
2628
        borrowernumber => $borrower->{borrowernumber},
2628
        borrowernumber => $borrower->{borrowernumber},
2629
        message_name   => $message_name{$type},
2629
        message_name   => $message_name{$type},
2630
    });
2630
    });
2631
    my $letter = C4::Letters::getletter('circulation', $type);
2631
    my $letter =  C4::Letters::GetPreparedLetter (
2632
    C4::Letters::parseletter($letter, 'biblio',      $item->{biblionumber});
2632
        module => 'circulation',
2633
    C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber});
2633
        letter_code => $type,
2634
    C4::Letters::parseletter($letter, 'borrowers',   $borrower->{borrowernumber});
2634
        branchcode => $branch,
2635
    C4::Letters::parseletter($letter, 'branches',    $branch);
2635
        tables => {
2636
            'biblio'      => $item->{biblionumber},
2637
            'biblioitems' => $item->{biblionumber},
2638
            'borrowers'   => $borrower,
2639
            'branches'    => $branch,
2640
        }
2641
    ) or return;
2642
2636
    my @transports = @{ $borrower_preferences->{transports} };
2643
    my @transports = @{ $borrower_preferences->{transports} };
2637
    # warn "no transports" unless @transports;
2644
    # warn "no transports" unless @transports;
2638
    for (@transports) {
2645
    for (@transports) {
Lines 2647-2653 sub SendCirculationAlert { Link Here
2647
            $message->update;
2654
            $message->update;
2648
        }
2655
        }
2649
    }
2656
    }
2650
    $letter;
2657
2658
    return $letter;
2651
}
2659
}
2652
2660
2653
=head2 updateWrongTransfer
2661
=head2 updateWrongTransfer
(-)a/C4/Letters.pm (-203 / +377 lines)
Lines 26-31 use Encode; Link Here
26
use Carp;
26
use Carp;
27
27
28
use C4::Members;
28
use C4::Members;
29
use C4::Members::Attributes qw(GetBorrowerAttributes);
29
use C4::Branch;
30
use C4::Branch;
30
use C4::Log;
31
use C4::Log;
31
use C4::SMS;
32
use C4::SMS;
Lines 42-48 BEGIN { Link Here
42
	$VERSION = 3.01;
43
	$VERSION = 3.01;
43
	@ISA = qw(Exporter);
44
	@ISA = qw(Exporter);
44
	@EXPORT = qw(
45
	@EXPORT = qw(
45
	&GetLetters &getletter &addalert &getalert &delalert &findrelatedto &SendAlerts GetPrintMessages
46
	&GetLetters &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &findrelatedto &SendAlerts &GetPrintMessages
46
	);
47
	);
47
}
48
}
48
49
Lines 117-129 sub GetLetters (;$) { Link Here
117
    return \%letters;
118
    return \%letters;
118
}
119
}
119
120
120
sub getletter ($$) {
121
my %letter;
121
    my ( $module, $code ) = @_;
122
sub getletter ($$$) {
123
    my ( $module, $code, $branchcode ) = @_;
124
125
    if (C4::Context->preference('IndependantBranches') && $branchcode){
126
        $$branchcode = C4::Context->userenv->{'branch'};
127
    }
128
129
    if ( my $l = $letter{$module}{$code}{$branchcode} ) {
130
        return { %$l }; # deep copy
131
    }
132
122
    my $dbh = C4::Context->dbh;
133
    my $dbh = C4::Context->dbh;
123
    my $sth = $dbh->prepare("select * from letter where module=? and code=?");
134
    my $sth = $dbh->prepare("select * from letter where module=? and code=? and (branchcode = ? or branchcode = '') order by branchcode desc limit 1");
124
    $sth->execute( $module, $code );
135
    $sth->execute( $module, $code, $branchcode );
125
    my $line = $sth->fetchrow_hashref;
136
    my $line = $sth->fetchrow_hashref
126
    return $line;
137
      or return;
138
    $line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html};
139
    $letter{$module}{$code}{$branchcode} = $line;
140
    return { %$line };
127
}
141
}
128
142
129
=head2 addalert ($borrowernumber, $type, $externalid)
143
=head2 addalert ($borrowernumber, $type, $externalid)
Lines 178-184 sub delalert ($) { Link Here
178
sub getalert (;$$$) {
192
sub getalert (;$$$) {
179
    my ( $borrowernumber, $type, $externalid ) = @_;
193
    my ( $borrowernumber, $type, $externalid ) = @_;
180
    my $dbh   = C4::Context->dbh;
194
    my $dbh   = C4::Context->dbh;
181
    my $query = "SELECT * FROM alert WHERE";
195
    my $query = "SELECT a.*, b.branchcode FROM alert a JOIN borrowers b USING(borrowernumber) WHERE";
182
    my @bind;
196
    my @bind;
183
    if ($borrowernumber and $borrowernumber =~ /^\d+$/) {
197
    if ($borrowernumber and $borrowernumber =~ /^\d+$/) {
184
        $query .= " borrowernumber=? AND ";
198
        $query .= " borrowernumber=? AND ";
Lines 234-303 sub findrelatedto ($$) { Link Here
234
    parameters :
248
    parameters :
235
    - $type : the type of alert
249
    - $type : the type of alert
236
    - $externalid : the id of the "object" to query
250
    - $externalid : the id of the "object" to query
237
    - $letter : the letter to send.
251
    - $letter_code : the letter to send.
238
252
239
    send an alert to all borrowers having put an alert on a given subject.
253
    send an alert to all borrowers having put an alert on a given subject.
240
254
241
=cut
255
=cut
242
256
243
sub SendAlerts {
257
sub SendAlerts {
244
    my ( $type, $externalid, $letter ) = @_;
258
    my ( $type, $externalid, $letter_code ) = @_;
245
    my $dbh = C4::Context->dbh;
259
    my $dbh = C4::Context->dbh;
246
    if ( $type eq 'issue' ) {
260
    if ( $type eq 'issue' ) {
247
261
248
        # 		warn "sending issues...";
249
        my $letter = getletter( 'serial', $letter );
250
251
        # prepare the letter...
262
        # prepare the letter...
252
        # search the biblionumber
263
        # search the biblionumber
253
        my $sth =
264
        my $sth =
254
          $dbh->prepare(
265
          $dbh->prepare(
255
            "SELECT biblionumber FROM subscription WHERE subscriptionid=?");
266
            "SELECT biblionumber FROM subscription WHERE subscriptionid=?");
256
        $sth->execute($externalid);
267
        $sth->execute($externalid);
257
        my ($biblionumber) = $sth->fetchrow;
268
        my ($biblionumber) = $sth->fetchrow
258
269
          or warn( "No subscription for '$externalid'" ),
259
        # parsing branch info
270
             return;
260
        my $userenv = C4::Context->userenv;
261
        parseletter( $letter, 'branches', $userenv->{branch} );
262
263
        # parsing librarian name
264
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/g;
265
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
266
        $letter->{content} =~
267
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
268
269
        # parsing biblio information
270
        parseletter( $letter, 'biblio',      $biblionumber );
271
        parseletter( $letter, 'biblioitems', $biblionumber );
272
271
272
        my %letter;
273
        # find the list of borrowers to alert
273
        # find the list of borrowers to alert
274
        my $alerts = getalert( '', 'issue', $externalid );
274
        my $alerts = getalert( '', 'issue', $externalid );
275
        foreach (@$alerts) {
275
        foreach (@$alerts) {
276
276
277
            # and parse borrower ...
278
            my $innerletter = $letter;
279
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
277
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
280
            parseletter( $innerletter, 'borrowers', $_->{'borrowernumber'} );
278
            my $email = $borinfo->{email} or next;
279
280
            # 		warn "sending issues...";
281
            my $userenv = C4::Context->userenv;
282
            my $letter = GetPreparedLetter (
283
                module => 'serial',
284
                letter_code => $letter_code,
285
                branchcode => $userenv->{branch},
286
                tables => {
287
                    'branches'    => $_->{branchcode},
288
                    'biblio'      => $biblionumber,
289
                    'biblioitems' => $biblionumber,
290
                    'borrowers'   => $borinfo,
291
                },
292
                want_librarian => 1,
293
            ) or return;
281
294
282
            # ... then send mail
295
            # ... then send mail
283
            if ( $borinfo->{email} ) {
296
            my %mail = (
284
                my %mail = (
297
                To      => $email,
285
                    To      => $borinfo->{email},
298
                From    => $email,
286
                    From    => $borinfo->{email},
299
                Subject => "" . $letter->{title},
287
                    Subject => "" . $innerletter->{title},
300
                Message => "" . $letter->{content},
288
                    Message => "" . $innerletter->{content},
301
                'Content-Type' => 'text/plain; charset="utf8"',
289
                    'Content-Type' => 'text/plain; charset="utf8"',
302
                );
290
                    );
303
            sendmail(%mail) or carp $Mail::Sendmail::error;
291
                sendmail(%mail) or carp $Mail::Sendmail::error;
292
293
# warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}";
304
# warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}";
294
            }
295
        }
305
        }
296
    }
306
    }
297
    elsif ( $type eq 'claimacquisition' ) {
307
    elsif ( $type eq 'claimacquisition' ) {
298
308
299
        # 		warn "sending issues...";
309
        # 		warn "sending issues...";
300
        my $letter = getletter( 'claimacquisition', $letter );
301
310
302
        # prepare the letter...
311
        # prepare the letter...
303
        # search the biblionumber
312
        # search the biblionumber
Lines 307-358 sub SendAlerts { Link Here
307
        my $sthorders = $dbh->prepare($strsth);
316
        my $sthorders = $dbh->prepare($strsth);
308
        $sthorders->execute;
317
        $sthorders->execute;
309
        my $dataorders = $sthorders->fetchall_arrayref( {} );
318
        my $dataorders = $sthorders->fetchall_arrayref( {} );
310
        parseletter( $letter, 'aqbooksellers',
319
311
            $dataorders->[0]->{booksellerid} );
312
        my $sthbookseller =
320
        my $sthbookseller =
313
          $dbh->prepare("select * from aqbooksellers where id=?");
321
          $dbh->prepare("select * from aqbooksellers where id=?");
314
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
322
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
315
        my $databookseller = $sthbookseller->fetchrow_hashref;
323
        my $databookseller = $sthbookseller->fetchrow_hashref;
316
324
317
        # parsing branch info
325
        my @email;
318
        my $userenv = C4::Context->userenv;
326
        push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail};
319
        parseletter( $letter, 'branches', $userenv->{branch} );
327
        push @email, $databookseller->{contemail}       if $databookseller->{contemail};
320
328
        unless (@email) {
321
        # parsing librarian name
329
            warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
322
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/g;
330
            return;
323
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
324
        $letter->{content} =~
325
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
326
        foreach my $data ( @{$dataorders} ) {
327
            if ( $letter->{content} =~ m/(<<.*>>)/ ) {
328
                my $line = $1;
329
                foreach my $field ( keys %{$data} ) {
330
                    $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
331
                }
332
                $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
333
            }
334
        }
331
        }
335
        $letter->{content} =~ s/<<[^>]*>>//g;
332
336
        my $innerletter = $letter;
333
        my $userenv = C4::Context->userenv;
334
        my $letter = GetPreparedLetter (
335
            module => 'claimacquisition',
336
            letter_code => $letter_code,
337
            branchcode => $userenv->{branch},
338
            tables => {
339
                'branches'    => $userenv->{branch},
340
                'aqbooksellers' => $databookseller,
341
            },
342
            repeat => $dataorders,
343
            want_librarian => 1,
344
        ) or return;
337
345
338
        # ... then send mail
346
        # ... then send mail
339
        if (   $databookseller->{bookselleremail}
347
        my %mail = (
340
            || $databookseller->{contemail} )
348
            To => join( ','. @email),
341
        {
349
            From           => $userenv->{emailaddress},
342
            my %mail = (
350
            Subject        => "" . $letter->{title},
343
                To => $databookseller->{bookselleremail}
351
            Message        => "" . $letter->{content},
344
                  . (
352
            'Content-Type' => 'text/plain; charset="utf8"',
345
                    $databookseller->{contemail}
353
        );
346
                    ? "," . $databookseller->{contemail}
354
        sendmail(%mail) or carp $Mail::Sendmail::error;
347
                    : ""
355
348
                  ),
349
                From           => $userenv->{emailaddress},
350
                Subject        => "" . $innerletter->{title},
351
                Message        => "" . $innerletter->{content},
352
                'Content-Type' => 'text/plain; charset="utf8"',
353
            );
354
            sendmail(%mail) or carp $Mail::Sendmail::error;
355
        }
356
        if ( C4::Context->preference("LetterLog") ) {
356
        if ( C4::Context->preference("LetterLog") ) {
357
            logaction(
357
            logaction(
358
                "ACQUISITION",
358
                "ACQUISITION",
Lines 360-375 sub SendAlerts { Link Here
360
                "",
360
                "",
361
                "order list : "
361
                "order list : "
362
                  . join( ",", @$externalid )
362
                  . join( ",", @$externalid )
363
                  . "\n$innerletter->{title}\n$innerletter->{content}"
363
                  . "\n$letter->{title}\n$letter->{content}"
364
            );
364
            );
365
        }
365
        }
366
    }
366
    }
367
    elsif ( $type eq 'claimissues' ) {
367
    elsif ( $type eq 'claimissues' ) {
368
368
369
        # 		warn "sending issues...";
369
        # 		warn "sending issues...";
370
        my $letter = getletter( 'claimissues', $letter );
371
372
        # prepare the letter...
373
        # search the biblionumber
370
        # search the biblionumber
374
        my $strsth =
371
        my $strsth =
375
"select serial.*,subscription.*, biblio.* from serial LEFT JOIN subscription on serial.subscriptionid=subscription.subscriptionid LEFT JOIN biblio on serial.biblionumber=biblio.biblionumber where serial.serialid IN ("
372
"select serial.*,subscription.*, biblio.* from serial LEFT JOIN subscription on serial.subscriptionid=subscription.subscriptionid LEFT JOIN biblio on serial.biblionumber=biblio.biblionumber where serial.serialid IN ("
Lines 377-457 sub SendAlerts { Link Here
377
        my $sthorders = $dbh->prepare($strsth);
374
        my $sthorders = $dbh->prepare($strsth);
378
        $sthorders->execute;
375
        $sthorders->execute;
379
        my $dataorders = $sthorders->fetchall_arrayref( {} );
376
        my $dataorders = $sthorders->fetchall_arrayref( {} );
380
        parseletter( $letter, 'aqbooksellers',
377
381
            $dataorders->[0]->{aqbooksellerid} );
382
        my $sthbookseller =
378
        my $sthbookseller =
383
          $dbh->prepare("select * from aqbooksellers where id=?");
379
          $dbh->prepare("select * from aqbooksellers where id=?");
384
        $sthbookseller->execute( $dataorders->[0]->{aqbooksellerid} );
380
        $sthbookseller->execute( $dataorders->[0]->{aqbooksellerid} );
385
        my $databookseller = $sthbookseller->fetchrow_hashref;
381
        my $databookseller = $sthbookseller->fetchrow_hashref;
386
382
387
        # parsing branch info
383
        my @email;
388
        my $userenv = C4::Context->userenv;
384
        push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail};
389
        parseletter( $letter, 'branches', $userenv->{branch} );
385
        push @email, $databookseller->{contemail}       if $databookseller->{contemail};
390
386
        unless (@email) {
391
        # parsing librarian name
387
            warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
392
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/g;
388
            return;
393
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
394
        $letter->{content} =~
395
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
396
        foreach my $data ( @{$dataorders} ) {
397
            if ( $letter->{content} =~ m/(<<.*>>)/ ) {
398
                my $line = $1;
399
                foreach my $field ( keys %{$data} ) {
400
                    $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
401
                }
402
                $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
403
            }
404
        }
389
        }
405
        $letter->{content} =~ s/<<[^>]*>>//g;
390
406
        my $innerletter = $letter;
391
        # prepare the letter...
392
        my $userenv = C4::Context->userenv;
393
        my $letter = GetPreparedLetter (
394
            module => 'claimissues',
395
            letter_code => $letter_code,
396
            branchcode => $userenv->{branch},
397
            tables => {
398
                'branches'    => $userenv->{branch},
399
                'aqbooksellers' => $databookseller,
400
            },
401
            repeat => $dataorders,
402
            want_librarian => 1,
403
        ) or return;
407
404
408
        # ... then send mail
405
        # ... then send mail
409
        if (   $databookseller->{bookselleremail}
406
        my $mail_subj = $letter->{title};
410
            || $databookseller->{contemail} ) {
407
        my $mail_msg  = $letter->{content};
411
            my $mail_to = $databookseller->{bookselleremail};
408
        $mail_msg  ||= q{};
412
            if ($databookseller->{contemail}) {
409
        $mail_subj ||= q{};
413
                if (!$mail_to) {
414
                    $mail_to = $databookseller->{contemail};
415
                } else {
416
                    $mail_to .= q|,|;
417
                    $mail_to .= $databookseller->{contemail};
418
                }
419
            }
420
            my $mail_subj = $innerletter->{title};
421
            my $mail_msg  = $innerletter->{content};
422
            $mail_msg  ||= q{};
423
            $mail_subj ||= q{};
424
410
425
            my %mail = (
411
        my %mail = (
426
                To => $mail_to,
412
            To => join( ','. @email),
427
                From    => $userenv->{emailaddress},
413
            From    => $userenv->{emailaddress},
428
                Subject => $mail_subj,
414
            Subject => $mail_subj,
429
                Message => $mail_msg,
415
            Message => $mail_msg,
430
                'Content-Type' => 'text/plain; charset="utf8"',
416
            'Content-Type' => 'text/plain; charset="utf8"',
431
            );
417
        );
432
            sendmail(%mail) or carp $Mail::Sendmail::error;
418
        sendmail(%mail) or carp $Mail::Sendmail::error;
433
            logaction(
419
434
                "ACQUISITION",
420
        logaction(
435
                "CLAIM ISSUE",
421
            "ACQUISITION",
436
                undef,
422
            "CLAIM ISSUE",
437
                "To="
423
            undef,
438
                  . $databookseller->{contemail}
424
            "To="
439
                  . " Title="
425
                . $databookseller->{contemail}
440
                  . $innerletter->{title}
426
                . " Title="
441
                  . " Content="
427
                . $letter->{title}
442
                  . $innerletter->{content}
428
                . " Content="
443
            ) if C4::Context->preference("LetterLog");
429
                . $letter->{content}
444
        }
430
        ) if C4::Context->preference("LetterLog");
445
    }    
431
    }    
446
   # send an "account details" notice to a newly created user 
432
   # send an "account details" notice to a newly created user 
447
    elsif ( $type eq 'members' ) {
433
    elsif ( $type eq 'members' ) {
448
        # must parse the password special, before it's hashed.
449
        $letter->{content} =~ s/<<borrowers.password>>/$externalid->{'password'}/g;
450
451
        parseletter( $letter, 'borrowers', $externalid->{'borrowernumber'});
452
        parseletter( $letter, 'branches', $externalid->{'branchcode'} );
453
454
        my $branchdetails = GetBranchDetail($externalid->{'branchcode'});
434
        my $branchdetails = GetBranchDetail($externalid->{'branchcode'});
435
        my $letter = GetPreparedLetter (
436
            module => 'members',
437
            letter_code => $letter_code,
438
            branchcode => $externalid->{'branchcode'},
439
            tables => {
440
                'branches'    => $branchdetails,
441
                'borrowers' => $externalid->{'borrowernumber'},
442
            },
443
            substitute => { 'borrowers.password' => $externalid->{'password'} },
444
            want_librarian => 1,
445
        ) or return;
446
455
        my %mail = (
447
        my %mail = (
456
                To      =>     $externalid->{'emailaddr'},
448
                To      =>     $externalid->{'emailaddr'},
457
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
449
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
Lines 463-486 sub SendAlerts { Link Here
463
    }
455
    }
464
}
456
}
465
457
466
=head2 parseletter($letter, $table, $pk)
458
=head2 GetPreparedLetter( %params )
467
459
468
    parameters :
460
    %params hash:
469
    - $letter : a hash to letter fields (title & content useful)
461
      module => letter module, mandatory
470
    - $table : the Koha table to parse.
462
      letter_code => letter code, mandatory
471
    - $pk : the primary key to query on the $table table
463
      branchcode => for letter selection, if missing default system letter taken
472
    parse all fields from a table, and replace values in title & content with the appropriate value
464
      tables => a hashref with table names as keys. Values are either:
473
    (not exported sub, used only internally)
465
        - a scalar - primary key value
466
        - an arrayref - primary key values
467
        - a hashref - full record
468
      substitute => custom substitution key/value pairs
469
      repeat => records to be substituted on consecutive lines:
470
        - an arrayref - tries to guess what needs substituting by
471
          taking remaining << >> tokensr; not recommended
472
        - a hashref token => @tables - replaces <token> << >> << >> </token>
473
          subtemplate for each @tables row; table is a hashref as above
474
      want_librarian => boolean,  if set to true triggers librarian details
475
        substitution from the userenv
476
    Return value:
477
      letter fields hashref (title & content useful)
474
478
475
=cut
479
=cut
476
480
477
our %handles = ();
481
sub GetPreparedLetter {
478
our %columns = ();
482
    my %params = @_;
483
484
    my $module      = $params{module} or croak "No module";
485
    my $letter_code = $params{letter_code} or croak "No letter_code";
486
    my $branchcode  = $params{branchcode} || '';
487
488
    my $letter = getletter( $module, $letter_code, $branchcode )
489
        or warn( "No $module $letter_code letter"),
490
            return;
491
492
    my $tables = $params{tables};
493
    my $substitute = $params{substitute};
494
    my $repeat = $params{repeat};
495
    $tables || $substitute || $repeat
496
      or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ),
497
         return;
498
    my $want_librarian = $params{want_librarian};
499
500
    if ($substitute) {
501
        while ( my ($token, $val) = each %$substitute ) {
502
            $letter->{title} =~ s/<<$token>>/$val/g;
503
            $letter->{content} =~ s/<<$token>>/$val/g;
504
       }
505
    }
506
507
    if ($want_librarian) {
508
        # parsing librarian name
509
        my $userenv = C4::Context->userenv;
510
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/go;
511
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/go;
512
        $letter->{content} =~ s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/go;
513
    }
514
515
    my ($repeat_no_enclosing_tags, $repeat_enclosing_tags);
516
517
    if ($repeat) {
518
        if (ref ($repeat) eq 'ARRAY' ) {
519
            $repeat_no_enclosing_tags = $repeat;
520
        } else {
521
            $repeat_enclosing_tags = $repeat;
522
        }
523
    }
524
525
    if ($repeat_enclosing_tags) {
526
        while ( my ($tag, $tag_tables) = each %$repeat_enclosing_tags ) {
527
            if ( $letter->{content} =~ m!<$tag>(.*)</$tag>!s ) {
528
                my $subcontent = $1;
529
                my @lines = map {
530
                    my %subletter = ( title => '', content => $subcontent );
531
                    _substitute_tables( \%subletter, $_ );
532
                    $subletter{content};
533
                } @$tag_tables;
534
                $letter->{content} =~ s!<$tag>.*</$tag>!join( "\n", @lines )!se;
535
            }
536
        }
537
    }
538
539
    if ($tables) {
540
        _substitute_tables( $letter, $tables );
541
    }
542
543
    if ($repeat_no_enclosing_tags) {
544
        if ( $letter->{content} =~ m/[^\n]*<<.*>>[^\n]*/so ) {
545
            my $line = $&;
546
            my $i = 1;
547
            my @lines = map {
548
                my $c = $line;
549
                $c =~ s/<<count>>/$i/go;
550
                foreach my $field ( keys %{$_} ) {
551
                    $c =~ s/(<<[^\.]+.$field>>)/$_->{$field}/;
552
                }
553
                $i++;
554
                $c;
555
            } @$repeat_no_enclosing_tags;
556
557
            my $replaceby = join( "\n", @lines );
558
            $letter->{content} =~ s/\Q$line\E/$replaceby/s;
559
        }
560
    }
561
562
    $letter->{content} =~ s/<<\S*>>//go; #remove any stragglers
563
#   $letter->{content} =~ s/<<[^>]*>>//go;
564
565
    return $letter;
566
}
567
568
sub _substitute_tables {
569
    my ( $letter, $tables ) = @_;
570
    while ( my ($table, $param) = each %$tables ) {
571
        next unless $param;
572
573
        my $ref = ref $param;
479
574
480
sub parseletter_sth {
575
        my $values;
576
        if ($ref && $ref eq 'HASH') {
577
            $values = $param;
578
        }
579
        else {
580
            my @pk;
581
            my $sth = _parseletter_sth($table);
582
            unless ($sth) {
583
                warn "_parseletter_sth('$table') failed to return a valid sth.  No substitution will be done for that table.";
584
                return;
585
            }
586
            $sth->execute( $ref ? @$param : $param );
587
588
            $values = $sth->fetchrow_hashref;
589
        }
590
591
        _parseletter ( $letter, $table, $values );
592
    }
593
}
594
595
my %handles = ();
596
sub _parseletter_sth {
481
    my $table = shift;
597
    my $table = shift;
482
    unless ($table) {
598
    unless ($table) {
483
        carp "ERROR: parseletter_sth() called without argument (table)";
599
        carp "ERROR: _parseletter_sth() called without argument (table)";
484
        return;
600
        return;
485
    }
601
    }
486
    # check cache first
602
    # check cache first
Lines 496-503 sub parseletter_sth { Link Here
496
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                      :
612
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                      :
497
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                      :
613
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                      :
498
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                      : undef ;
614
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                      : undef ;
615
    ($table eq 'aqorders'     ) ? "SELECT * FROM $table WHERE    ordernumber = ?"                      : undef ;
616
    ($table eq 'opac_news'    ) ? "SELECT * FROM $table WHERE          idnew = ?"                      : undef ;
499
    unless ($query) {
617
    unless ($query) {
500
        warn "ERROR: No parseletter_sth query for table '$table'";
618
        warn "ERROR: No _parseletter_sth query for table '$table'";
501
        return;     # nothing to get
619
        return;     # nothing to get
502
    }
620
    }
503
    unless ($handles{$table} = C4::Context->dbh->prepare($query)) {
621
    unless ($handles{$table} = C4::Context->dbh->prepare($query)) {
Lines 507-531 sub parseletter_sth { Link Here
507
    return $handles{$table};    # now cache is populated for that $table
625
    return $handles{$table};    # now cache is populated for that $table
508
}
626
}
509
627
510
sub parseletter {
628
=head2 _parseletter($letter, $table, $values)
511
    my ( $letter, $table, $pk, $pk2 ) = @_;
512
    unless ($letter) {
513
        carp "ERROR: parseletter() 1st argument 'letter' empty";
514
        return;
515
    }
516
    my $sth = parseletter_sth($table);
517
    unless ($sth) {
518
        warn "parseletter_sth('$table') failed to return a valid sth.  No substitution will be done for that table.";
519
        return;
520
    }
521
    if ( $pk2 ) {
522
        $sth->execute($pk, $pk2);
523
    } else {
524
        $sth->execute($pk);
525
    }
526
629
527
    my $values = $sth->fetchrow_hashref;
630
    parameters :
528
    
631
    - $letter : a hash to letter fields (title & content useful)
632
    - $table : the Koha table to parse.
633
    - $values : table record hashref
634
    parse all fields from a table, and replace values in title & content with the appropriate value
635
    (not exported sub, used only internally)
636
637
=cut
638
639
my %columns = ();
640
sub _parseletter {
641
    my ( $letter, $table, $values ) = @_;
642
   
529
    # TEMPORARY hack until the expirationdate column is added to reserves
643
    # TEMPORARY hack until the expirationdate column is added to reserves
530
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
644
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
531
        my @waitingdate = split /-/, $values->{'waitingdate'};
645
        my @waitingdate = split /-/, $values->{'waitingdate'};
Lines 539-554 sub parseletter { Link Here
539
        )->output();
653
        )->output();
540
    }
654
    }
541
655
656
    if ($letter->{content} && $letter->{content} =~ /<<today>>/) {
657
        my @da = localtime();
658
        my $todaysdate = "$da[2]:$da[1]  " . C4::Dates->today();
659
        $letter->{content} =~ s/<<today>>/$todaysdate/go;
660
    }
542
661
543
    # and get all fields from the table
662
    # and get all fields from the table
544
    my $columns = C4::Context->dbh->prepare("SHOW COLUMNS FROM $table");
663
#   my $columns = $columns{$table};
545
    $columns->execute;
664
#   unless ($columns) {
546
    while ( ( my $field ) = $columns->fetchrow_array ) {
665
#       $columns = $columns{$table} =  C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table");
547
        my $replacefield = "<<$table.$field>>";
666
#   }
548
        $values->{$field} =~ s/\p{P}(?=$)//g if $values->{$field};
667
#   foreach my $field (@$columns) {
549
        my $replacedby   = $values->{$field} || '';
668
550
        ($letter->{title}  ) and $letter->{title}   =~ s/$replacefield/$replacedby/g;
669
    while ( my ($field, $val) = each %$values ) {
551
        ($letter->{content}) and $letter->{content} =~ s/$replacefield/$replacedby/g;
670
        my $replacetablefield = "<<$table.$field>>";
671
        my $replacefield = "<<$field>>";
672
        $val =~ s/\p{P}(?=$)//g if $val;
673
        my $replacedby   = defined ($val) ? $val : '';
674
        ($letter->{title}  ) and do {
675
            $letter->{title}   =~ s/$replacetablefield/$replacedby/g;
676
            $letter->{title}   =~ s/$replacefield/$replacedby/g;
677
        };
678
        ($letter->{content}) and do {
679
            $letter->{content} =~ s/$replacetablefield/$replacedby/g;
680
            $letter->{content} =~ s/$replacefield/$replacedby/g;
681
        };
682
    }
683
684
    if ($table eq 'borrowers' && $letter->{content}) {
685
        if ( my $attributes = GetBorrowerAttributes($values->{borrowernumber}) ) {
686
            my %attr;
687
            foreach (@$attributes) {
688
                my $code = $_->{code};
689
                my $val  = $_->{value_description} || $_->{value};
690
                $val =~ s/\p{P}(?=$)//g if $val;
691
                next unless $val gt '';
692
                $attr{$code} ||= [];
693
                push @{ $attr{$code} }, $val;
694
            }
695
            while ( my ($code, $val_ar) = each %attr ) {
696
                my $replacefield = "<<borrower-attribute:$code>>";
697
                my $replacedby   = join ',', @$val_ar;
698
                $letter->{content} =~ s/$replacefield/$replacedby/g;
699
            }
700
        }
552
    }
701
    }
553
    return $letter;
702
    return $letter;
554
}
703
}
Lines 733-763 returns your letter object, with the content updated. Link Here
733
sub _add_attachments {
882
sub _add_attachments {
734
    my $params = shift;
883
    my $params = shift;
735
884
736
    return unless 'HASH' eq ref $params;
885
    my $letter = $params->{'letter'};
737
    foreach my $required_parameter (qw( letter attachments message )) {
886
    my $attachments = $params->{'attachments'};
738
        return unless exists $params->{$required_parameter};
887
    return $letter unless @$attachments;
739
    }
888
    my $message = $params->{'message'};
740
    return $params->{'letter'} unless @{ $params->{'attachments'} };
741
889
742
    # First, we have to put the body in as the first attachment
890
    # First, we have to put the body in as the first attachment
743
    $params->{'message'}->attach(
891
    $message->attach(
744
        Type => 'TEXT',
892
        Type => $letter->{'content-type'} || 'TEXT',
745
        Data => $params->{'letter'}->{'content'},
893
        Data => $letter->{'is_html'}
894
            ? _wrap_html($letter->{'content'}, $letter->{'title'})
895
            : $letter->{'content'},
746
    );
896
    );
747
897
748
    foreach my $attachment ( @{ $params->{'attachments'} } ) {
898
    foreach my $attachment ( @$attachments ) {
749
        $params->{'message'}->attach(
899
        $message->attach(
750
            Type     => $attachment->{'type'},
900
            Type     => $attachment->{'type'},
751
            Data     => $attachment->{'content'},
901
            Data     => $attachment->{'content'},
752
            Filename => $attachment->{'filename'},
902
            Filename => $attachment->{'filename'},
753
        );
903
        );
754
    }
904
    }
755
    # we're forcing list context here to get the header, not the count back from grep.
905
    # we're forcing list context here to get the header, not the count back from grep.
756
    ( $params->{'letter'}->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) );
906
    ( $letter->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) );
757
    $params->{'letter'}->{'content-type'} =~ s/^Content-Type:\s+//;
907
    $letter->{'content-type'} =~ s/^Content-Type:\s+//;
758
    $params->{'letter'}->{'content'} = $params->{'message'}->body_as_string;
908
    $letter->{'content'} = $message->body_as_string;
759
909
760
    return $params->{'letter'};
910
    return $letter;
761
911
762
}
912
}
763
913
Lines 824-837 sub _send_message_by_email ($;$$$) { Link Here
824
974
825
    my $utf8   = decode('MIME-Header', $message->{'subject'} );
975
    my $utf8   = decode('MIME-Header', $message->{'subject'} );
826
    $message->{subject}= encode('MIME-Header', $utf8);
976
    $message->{subject}= encode('MIME-Header', $utf8);
977
    my $subject = encode('utf8', $message->{'subject'});
827
    my $content = encode('utf8', $message->{'content'});
978
    my $content = encode('utf8', $message->{'content'});
979
    my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"';
980
    my $is_html = $content_type =~ m/html/io;
828
    my %sendmail_params = (
981
    my %sendmail_params = (
829
        To   => $to_address,
982
        To   => $to_address,
830
        From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'),
983
        From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'),
831
        Subject => encode('utf8', $message->{'subject'}),
984
        Subject => $subject,
832
        charset => 'utf8',
985
        charset => 'utf8',
833
        Message => $content,
986
        Message => $is_html ? _wrap_html($content, $subject) : $content,
834
        'content-type' => $message->{'content_type'} || 'text/plain; charset="UTF-8"',
987
        'content-type' => $content_type,
835
    );
988
    );
836
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
989
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
837
    if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) {
990
    if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) {
Lines 851-856 sub _send_message_by_email ($;$$$) { Link Here
851
    }
1004
    }
852
}
1005
}
853
1006
1007
sub _wrap_html {
1008
    my ($content, $title) = @_;
1009
1010
    my $css = C4::Context->preference("NoticeCSS") || '';
1011
    $css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css;
1012
    return <<EOS;
1013
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1014
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1015
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
1016
<head>
1017
<title>$title</title>
1018
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1019
$css
1020
</head>
1021
<body>
1022
$content
1023
</body>
1024
</html>
1025
EOS
1026
}
1027
854
sub _send_message_by_sms ($) {
1028
sub _send_message_by_sms ($) {
855
    my $message = shift or return undef;
1029
    my $message = shift or return undef;
856
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
1030
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
(-)a/C4/Members.pm (-2 / +79 lines)
Lines 23-29 package C4::Members; Link Here
23
use strict;
23
use strict;
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
25
use C4::Context;
25
use C4::Context;
26
use C4::Dates qw(format_date_in_iso);
26
use C4::Dates qw(format_date_in_iso format_date);
27
use Digest::MD5 qw(md5_base64);
27
use Digest::MD5 qw(md5_base64);
28
use Date::Calc qw/Today Add_Delta_YM/;
28
use Date::Calc qw/Today Add_Delta_YM/;
29
use C4::Log; # logaction
29
use C4::Log; # logaction
Lines 31-38 use C4::Overdues; Link Here
31
use C4::Reserves;
31
use C4::Reserves;
32
use C4::Accounts;
32
use C4::Accounts;
33
use C4::Biblio;
33
use C4::Biblio;
34
use C4::Letters;
34
use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable);
35
use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable);
35
use C4::Members::Attributes qw(SearchIdMatchingAttribute);
36
use C4::Members::Attributes qw(SearchIdMatchingAttribute);
37
use C4::NewsChannels; #get slip news
36
38
37
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
39
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
38
40
Lines 91-96 BEGIN { Link Here
91
		&DeleteMessage
93
		&DeleteMessage
92
		&GetMessages
94
		&GetMessages
93
		&GetMessagesCount
95
		&GetMessagesCount
96
97
        &IssueSlip
94
	);
98
	);
95
99
96
	#Modify data
100
	#Modify data
Lines 2243-2249 sub DeleteMessage { Link Here
2243
2247
2244
}
2248
}
2245
2249
2246
END { }    # module clean-up code here (global destructor)
2250
=head2 IssueSlip
2251
2252
  IssueSlip($branchcode, $borrowernumber, $quickslip)
2253
2254
  Returns letter hash ( see C4::Letters::GetPreparedLetter )
2255
2256
  $quickslip is boolean, to indicate whether we want a quick slip
2257
2258
=cut
2259
2260
sub IssueSlip {
2261
    my ($branch, $borrowernumber, $quickslip) = @_;
2262
2263
#   return unless ( C4::Context->boolean_preference('printcirculationslips') );
2264
2265
    my $today       = POSIX::strftime("%Y-%m-%d", localtime);
2266
2267
    my $issueslist = GetPendingIssues($borrowernumber);
2268
    foreach my $it (@$issueslist){
2269
        if ($it->{'issuedate'} eq $today) {
2270
            $it->{'today'} = 1;
2271
        }
2272
        elsif ($it->{'date_due'} le $today) {
2273
            $it->{'overdue'} = 1;
2274
        }
2275
2276
        $it->{'date_due'}=format_date($it->{'date_due'});
2277
    }
2278
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
2279
2280
    my ($letter_code, %repeat);
2281
    if ( $quickslip ) {
2282
        $letter_code = 'ISSUEQSLIP';
2283
        %repeat =  (
2284
            'checkedout' => [ map {
2285
                'biblio' => $_,
2286
                'items'  => $_,
2287
                'issues' => $_,
2288
            }, grep { $_->{'today'} } @issues ],
2289
        );
2290
    }
2291
    else {
2292
        $letter_code = 'ISSUESLIP';
2293
        %repeat =  (
2294
            'checkedout' => [ map {
2295
                'biblio' => $_,
2296
                'items'  => $_,
2297
                'issues' => $_,
2298
            }, grep { !$_->{'overdue'} } @issues ],
2299
2300
            'overdue' => [ map {
2301
                'biblio' => $_,
2302
                'items'  => $_,
2303
                'issues' => $_,
2304
            }, grep { $_->{'overdue'} } @issues ],
2305
2306
            'news' => [ map {
2307
                $_->{'timestamp'} = $_->{'newdate'};
2308
                { opac_news => $_ }
2309
            } @{ GetNewsToDisplay("slip") } ],
2310
        );
2311
    }
2312
2313
    return  C4::Letters::GetPreparedLetter (
2314
        module => 'circulation',
2315
        letter_code => $letter_code,
2316
        branchcode => $branch,
2317
        tables => {
2318
            'branches'    => $branch,
2319
            'borrowers'   => $borrowernumber,
2320
        },
2321
        repeat => \%repeat,
2322
    );
2323
}
2247
2324
2248
1;
2325
1;
2249
2326
(-)a/C4/Message.pm (-3 / +9 lines)
Lines 18-26 How to add a new message to the queue: Link Here
18
  use C4::Items;
18
  use C4::Items;
19
  my $borrower = { borrowernumber => 1 };
19
  my $borrower = { borrowernumber => 1 };
20
  my $item     = C4::Items::GetItem(1);
20
  my $item     = C4::Items::GetItem(1);
21
  my $letter   = C4::Letters::getletter('circulation', 'CHECKOUT');
21
  my $letter =  C4::Letters::GetPreparedLetter (
22
  C4::Letters::parseletter($letter, 'biblio', $item->{biblionumber});
22
      module => 'circulation',
23
  C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber});
23
      letter_code => 'CHECKOUT',
24
      branchcode => $branch,
25
      tables => {
26
          'biblio', $item->{biblionumber},
27
          'biblioitems', $item->{biblionumber},
28
      },
29
  );
24
  C4::Message->enqueue($letter, $borrower->{borrowernumber}, 'email');
30
  C4::Message->enqueue($letter, $borrower->{borrowernumber}, 'email');
25
31
26
How to update a borrower's last checkout message:
32
How to update a borrower's last checkout message:
(-)a/C4/Print.pm (-104 / +35 lines)
Lines 20-27 package C4::Print; Link Here
20
use strict;
20
use strict;
21
#use warnings; FIXME - Bug 2505
21
#use warnings; FIXME - Bug 2505
22
use C4::Context;
22
use C4::Context;
23
use C4::Members;
24
use C4::Dates qw(format_date);
25
23
26
use vars qw($VERSION @ISA @EXPORT);
24
use vars qw($VERSION @ISA @EXPORT);
27
25
Lines 30-36 BEGIN { Link Here
30
	$VERSION = 3.01;
28
	$VERSION = 3.01;
31
	require Exporter;
29
	require Exporter;
32
	@ISA    = qw(Exporter);
30
	@ISA    = qw(Exporter);
33
	@EXPORT = qw(&remoteprint &printreserve &printslip);
31
	@EXPORT = qw(&printslip);
34
}
32
}
35
33
36
=head1 NAME
34
=head1 NAME
Lines 47-74 The functions in this module handle sending text to a printer. Link Here
47
45
48
=head1 FUNCTIONS
46
=head1 FUNCTIONS
49
47
50
=head2 remoteprint
48
=cut
51
49
52
  &remoteprint($items, $borrower);
50
=comment
51
    my $slip = <<"EOF";
52
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
Date: $todaysdate;
53
54
54
Prints the list of items in C<$items> to a printer.
55
ITEM RESERVED: 
56
$itemdata->{'title'} ($itemdata->{'author'})
57
barcode: $itemdata->{'barcode'}
58
59
COLLECT AT: $branchname
55
60
56
C<$borrower> is a reference-to-hash giving information about a patron.
61
BORROWER:
57
This may be gotten from C<&GetMemberDetails>. The patron's name
62
$bordata->{'surname'}, $bordata->{'firstname'}
58
will be printed in the output.
63
card number: $bordata->{'cardnumber'}
64
Phone: $bordata->{'phone'}
65
$bordata->{'streetaddress'}
66
$bordata->{'suburb'}
67
$bordata->{'town'}
68
$bordata->{'emailaddress'}
59
69
60
C<$items> is a reference-to-list, where each element is a
61
reference-to-hash describing a borrowed item. C<$items> may be gotten
62
from C<&GetBorrowerIssues>.
63
70
71
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
EOF
64
=cut
73
=cut
65
74
75
=head2 printslip
76
77
  &printslip($slip)
78
79
print a slip for the given $borrowernumber and $branchcode
80
81
=cut
82
83
sub printslip ($) {
84
    my ($slip) = @_;
85
86
    return unless ( C4::Context->boolean_preference('printcirculationslips') );
87
66
# FIXME - It'd be nifty if this could generate pretty PostScript.
88
# FIXME - It'd be nifty if this could generate pretty PostScript.
67
sub remoteprint ($$) {
68
    my ($items, $borrower) = @_;
69
89
70
    (return)
71
      unless ( C4::Context->boolean_preference('printcirculationslips') );
72
    my $queue = '';
90
    my $queue = '';
73
91
74
    # FIXME - If 'queue' is undefined or empty, then presumably it should
92
    # FIXME - If 'queue' is undefined or empty, then presumably it should
Lines 93-192 sub remoteprint ($$) { Link Here
93
111
94
    #  print $queue;
112
    #  print $queue;
95
    #open (FILE,">/tmp/$file");
113
    #open (FILE,">/tmp/$file");
96
    my $i      = 0;
114
    print PRINTER $slip;
97
    # FIXME - This is HLT-specific. Put this stuff in a customizable
98
    # site-specific file somewhere.
99
    print PRINTER "Horowhenua Library Trust\r\n";
100
    print PRINTER "Phone: 368-1953\r\n";
101
    print PRINTER "Fax:    367-9218\r\n";
102
    print PRINTER "Email:  renewals\@library.org.nz\r\n\r\n\r\n";
103
    print PRINTER "$borrower->{'cardnumber'}\r\n";
104
    print PRINTER
105
      "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
106
107
    # FIXME - Use   for ($i = 0; $items->[$i]; $i++)
108
    # Or better yet,   foreach $item (@{$items})
109
    while ( $items->[$i] ) {
110
111
        #    print $i;
112
        my $itemdata = $items->[$i];
113
114
        # FIXME - This is just begging for a Perl format.
115
        print PRINTER "$i $itemdata->{'title'}\r\n";
116
        print PRINTER "$itemdata->{'barcode'}";
117
        print PRINTER " " x 15;
118
        print PRINTER "$itemdata->{'date_due'}\r\n";
119
        $i++;
120
    }
121
    print PRINTER "\r\n" x 7 ;
115
    print PRINTER "\r\n" x 7 ;
122
    close PRINTER;
116
    close PRINTER;
123
117
124
    #system("lpr /tmp/$file");
118
    #system("lpr /tmp/$file");
125
}
119
}
126
120
127
sub printreserve {
128
    my ( $branchname, $bordata, $itemdata ) = @_;
129
    my $printer = '';
130
    (return) unless ( C4::Context->boolean_preference('printreserveslips') );
131
    if ( $printer eq "" || $printer eq 'nulllp' ) {
132
        open( PRINTER, ">>/tmp/kohares" )
133
		  or die "Could not write to /tmp/kohares";
134
    }
135
    else {
136
        open( PRINTER, "| lpr -P $printer >/dev/null" )
137
          or die "Couldn't write to queue:$!\n";
138
    }
139
    my @da = localtime();
140
    my $todaysdate = "$da[2]:$da[1]  " . C4::Dates->today();
141
    my $slip = <<"EOF";
142
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143
Date: $todaysdate;
144
145
ITEM RESERVED: 
146
$itemdata->{'title'} ($itemdata->{'author'})
147
barcode: $itemdata->{'barcode'}
148
149
COLLECT AT: $branchname
150
151
BORROWER:
152
$bordata->{'surname'}, $bordata->{'firstname'}
153
card number: $bordata->{'cardnumber'}
154
Phone: $bordata->{'phone'}
155
$bordata->{'streetaddress'}
156
$bordata->{'suburb'}
157
$bordata->{'town'}
158
$bordata->{'emailaddress'}
159
160
161
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
EOF
163
    print PRINTER $slip;
164
    close PRINTER;
165
    return $slip;
166
}
167
168
=head2 printslip
169
170
  &printslip($borrowernumber)
171
172
print a slip for the given $borrowernumber
173
174
=cut
175
176
#'
177
sub printslip ($) {
178
    my $borrowernumber = shift;
179
    my $borrower   = GetMemberDetails($borrowernumber);
180
	my $issueslist = GetPendingIssues($borrowernumber); 
181
	foreach my $it (@$issueslist){
182
		$it->{'date_due'}=format_date($it->{'date_due'});
183
    }		
184
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
185
    remoteprint(\@issues, $borrower );
186
}
187
188
END { }    # module clean-up code here (global destructor)
189
190
1;
121
1;
191
__END__
122
__END__
192
123
(-)a/C4/Reserves.pm (-36 / +67 lines)
Lines 120-125 BEGIN { Link Here
120
        
120
        
121
        &AlterPriority
121
        &AlterPriority
122
        &ToggleLowestPriority
122
        &ToggleLowestPriority
123
124
        &ReserveSlip
123
    );
125
    );
124
    @EXPORT_OK = qw( MergeHolds );
126
    @EXPORT_OK = qw( MergeHolds );
125
}    
127
}    
Lines 193-224 sub AddReserve { Link Here
193
    # Send e-mail to librarian if syspref is active
195
    # Send e-mail to librarian if syspref is active
194
    if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
196
    if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
195
        my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
197
        my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
196
        my $biblio   = GetBiblioData($biblionumber);
198
        my $branch_details = C4::Branch::GetBranchDetail($borrower->{branchcode});
197
        my $letter = C4::Letters::getletter( 'reserves', 'HOLDPLACED');
199
        if ( my $letter =  C4::Letters::GetPreparedLetter (
198
	my $branchcode = $borrower->{branchcode};
200
            module => 'reserves',
199
        my $branch_details = C4::Branch::GetBranchDetail($branchcode);
201
            letter_code => 'HOLDPLACED',
200
        my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
202
            branchcode => $branch,
201
203
            tables => {
202
        my %keys = (%$borrower, %$biblio);
204
                'branches'  => $branch_details,
203
        foreach my $key (keys %keys) {
205
                'borrowers' => $borrower,
204
            my $replacefield = "<<$key>>";
206
                'biblio'    => $biblionumber,
205
            $letter->{content} =~ s/$replacefield/$keys{$key}/g;
207
            },
206
            $letter->{title} =~ s/$replacefield/$keys{$key}/g;
208
        ) ) {
209
210
            my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
211
212
            C4::Letters::EnqueueLetter(
213
                {   letter                 => $letter,
214
                    borrowernumber         => $borrowernumber,
215
                    message_transport_type => 'email',
216
                    from_address           => $admin_email_address,
217
                    to_address           => $admin_email_address,
218
                }
219
            );
207
        }
220
        }
208
        
209
        C4::Letters::EnqueueLetter(
210
                            {   letter                 => $letter,
211
                                borrowernumber         => $borrowernumber,
212
                                message_transport_type => 'email',
213
                                from_address           => $admin_email_address,
214
                                to_address           => $admin_email_address,
215
                            }
216
                        );
217
        
218
219
    }
221
    }
220
222
221
222
    #}
223
    #}
223
    ($const eq "o" || $const eq "e") or return;   # FIXME: why not have a useful return value?
224
    ($const eq "o" || $const eq "e") or return;   # FIXME: why not have a useful return value?
224
    $query = qq/
225
    $query = qq/
Lines 1720-1740 sub _koha_notify_reserve { Link Here
1720
1721
1721
    my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
1722
    my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
1722
1723
1723
    my $letter = getletter( 'reserves', $letter_code );
1724
    my $letter =  C4::Letters::GetPreparedLetter (
1724
    die "Could not find a letter called '$letter_code' in the 'reserves' module" unless( $letter );
1725
        module => 'reserves',
1726
        letter_code => $letter_code,
1727
        branchcode => $reserve->{branchcode},
1728
        tables => {
1729
            'branches'  => $branch_details,
1730
            'borrowers' => $borrower,
1731
            'biblio'    => $biblionumber,
1732
            'reserves'  => $reserve,
1733
            'items', $reserve->{'itemnumber'},
1734
        },
1735
        substitute => { today => C4::Dates->new()->output() },
1736
    ) or die "Could not find a letter called '$letter_code' in the 'reserves' module";
1725
1737
1726
    C4::Letters::parseletter( $letter, 'branches', $reserve->{'branchcode'} );
1727
    C4::Letters::parseletter( $letter, 'borrowers', $borrowernumber );
1728
    C4::Letters::parseletter( $letter, 'biblio', $biblionumber );
1729
    C4::Letters::parseletter( $letter, 'reserves', $borrowernumber, $biblionumber );
1730
1738
1731
    if ( $reserve->{'itemnumber'} ) {
1732
        C4::Letters::parseletter( $letter, 'items', $reserve->{'itemnumber'} );
1733
    }
1734
    my $today = C4::Dates->new()->output();
1735
    $letter->{'title'} =~ s/<<today>>/$today/g;
1736
    $letter->{'content'} =~ s/<<today>>/$today/g;
1737
    $letter->{'content'} =~ s/<<[a-z0-9_]+\.[a-z0-9]+>>//g; #remove any stragglers
1738
1739
1739
    if ( $print_mode ) {
1740
    if ( $print_mode ) {
1740
        C4::Letters::EnqueueLetter( {
1741
        C4::Letters::EnqueueLetter( {
Lines 1861-1866 sub MergeHolds { Link Here
1861
}
1862
}
1862
1863
1863
1864
1865
=head2 ReserveSlip
1866
1867
  ReserveSlip($branchcode, $borrowernumber, $biblionumber)
1868
1869
  Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef
1870
1871
=cut
1872
1873
sub ReserveSlip {
1874
    my ($branch, $borrowernumber, $biblionumber) = @_;
1875
1876
#   return unless ( C4::Context->boolean_preference('printreserveslips') );
1877
1878
    my $reserve = GetReserveInfo($borrowernumber,$biblionumber )
1879
      or return;
1880
1881
    return  C4::Letters::GetPreparedLetter (
1882
        module => 'circulation',
1883
        letter_code => 'RESERVESLIP',
1884
        branchcode => $branch,
1885
        tables => {
1886
            'reserves'    => $reserve,
1887
            'branches'    => $reserve->{branchcode},
1888
            'borrowers'   => $reserve,
1889
            'biblio'      => $reserve,
1890
            'items'       => $reserve,
1891
        },
1892
    );
1893
}
1894
1864
=head1 AUTHOR
1895
=head1 AUTHOR
1865
1896
1866
Koha Development Team <http://koha-community.org/>
1897
Koha Development Team <http://koha-community.org/>
(-)a/C4/Suggestions.pm (-9 / +13 lines)
Lines 371-390 sub ModSuggestion { Link Here
371
    if ($suggestion->{STATUS}) {
371
    if ($suggestion->{STATUS}) {
372
        # fetch the entire updated suggestion so that we can populate the letter
372
        # fetch the entire updated suggestion so that we can populate the letter
373
        my $full_suggestion = GetSuggestion($suggestion->{suggestionid});
373
        my $full_suggestion = GetSuggestion($suggestion->{suggestionid});
374
        my $letter = C4::Letters::getletter('suggestions', $full_suggestion->{STATUS});
374
        if ( my $letter =  C4::Letters::GetPreparedLetter (
375
        if ($letter) {
375
            module => 'suggestions',
376
            C4::Letters::parseletter($letter, 'branches',    $full_suggestion->{branchcode});
376
            letter_code => $full_suggestion->{STATUS},
377
            C4::Letters::parseletter($letter, 'borrowers',   $full_suggestion->{suggestedby});
377
            branchcode => $full_suggestion->{branchcode},
378
            C4::Letters::parseletter($letter, 'suggestions', $full_suggestion->{suggestionid});
378
            tables => {
379
            C4::Letters::parseletter($letter, 'biblio',      $full_suggestion->{biblionumber});
379
                'branches'    => $full_suggestion->{branchcode},
380
            my $enqueued = C4::Letters::EnqueueLetter({
380
                'borrowers'   => $full_suggestion->{suggestedby},
381
                'suggestions' => $full_suggestion,
382
                'biblio'      => $full_suggestion->{biblionumber},
383
            },
384
        ) ) {
385
            C4::Letters::EnqueueLetter({
381
                letter                  => $letter,
386
                letter                  => $letter,
382
                borrowernumber          => $full_suggestion->{suggestedby},
387
                borrowernumber          => $full_suggestion->{suggestedby},
383
                suggestionid            => $full_suggestion->{suggestionid},
388
                suggestionid            => $full_suggestion->{suggestionid},
384
                LibraryName             => C4::Context->preference("LibraryName"),
389
                LibraryName             => C4::Context->preference("LibraryName"),
385
                message_transport_type  => 'email',
390
                message_transport_type  => 'email',
386
            });
391
            }) or warn "can't enqueue letter $letter";
387
            if (!$enqueued){warn "can't enqueue letter $letter";}
388
        }
392
        }
389
    }
393
    }
390
    return $status_update_table;
394
    return $status_update_table;
(-)a/acqui/booksellers.pl (-2 / +1 lines)
Lines 111-122 for my $vendor (@suppliers) { Link Here
111
    
111
    
112
    for my $basket ( @{$baskets} ) {
112
    for my $basket ( @{$baskets} ) {
113
        my $authorisedby = $basket->{authorisedby};
113
        my $authorisedby = $basket->{authorisedby};
114
        my $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode};
115
        
114
        
116
        if ($userenv->{'flags'} & 1 || #user is superlibrarian
115
        if ($userenv->{'flags'} & 1 || #user is superlibrarian
117
               (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and
116
               (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and
118
                   ($viewbaskets eq 'all' || #user is allowed to see all baskets
117
                   ($viewbaskets eq 'all' || #user is allowed to see all baskets
119
                   ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq $basketbranch) || #basket belongs to user's branch
118
                   ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq GetMember( borrowernumber => $authorisedby )->{branchcode}) || #basket belongs to user's branch
120
                   ($basket->{authorisedby} &&  $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket
119
                   ($basket->{authorisedby} &&  $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket
121
                   ) 
120
                   ) 
122
                ) 
121
                ) 
(-)a/circ/circulation.pl (-2 / +1 lines)
Lines 24-30 use strict; Link Here
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
25
use CGI;
25
use CGI;
26
use C4::Output;
26
use C4::Output;
27
use C4::Print;
28
use C4::Auth qw/:DEFAULT get_session/;
27
use C4::Auth qw/:DEFAULT get_session/;
29
use C4::Dates qw/format_date/;
28
use C4::Dates qw/format_date/;
30
use C4::Branch; # GetBranches
29
use C4::Branch; # GetBranches
Lines 175-181 if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { Link Here
175
}
174
}
176
175
177
if ( $print eq 'yes' && $borrowernumber ne '' ) {
176
if ( $print eq 'yes' && $borrowernumber ne '' ) {
178
    printslip( $borrowernumber );
177
    PrintIssueSlip($branch, $borrowernumber);
179
    $query->param( 'borrowernumber', '' );
178
    $query->param( 'borrowernumber', '' );
180
    $borrowernumber = '';
179
    $borrowernumber = '';
181
}
180
}
(-)a/circ/hold-transfer-slip.pl (-11 / +16 lines)
Lines 25-32 use C4::Output; Link Here
25
use CGI;
25
use CGI;
26
use C4::Auth;
26
use C4::Auth;
27
use C4::Reserves;
27
use C4::Reserves;
28
use C4::Branch;
29
use C4::Dates qw/format_date format_date_in_iso/;
30
28
31
use vars qw($debug);
29
use vars qw($debug);
32
30
Lines 41-47 my $transfer = $input->param('transfer'); Link Here
41
39
42
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
43
    {   
41
    {   
44
        template_name   => "circ/hold-transfer-slip.tmpl",
42
        template_name   => "circ/printslip.tmpl",
45
        query           => $input,
43
        query           => $input,
46
        type            => "intranet",
44
        type            => "intranet",
47
        authnotrequired => 0,
45
        authnotrequired => 0,
Lines 50-63 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
50
    }
48
    }
51
);
49
);
52
50
53
my $reserveinfo = GetReserveInfo($borrowernumber,$biblionumber );
51
my $userenv = C4::Context->userenv;
54
my $pulldate = C4::Dates->new();
52
my ($slip, $is_html);
55
$reserveinfo->{'pulldate'} = $pulldate->output();
53
if ( my $letter = ReserveSlip ($userenv->{branch}, $borrowernumber, $biblionumber) ) {
56
$reserveinfo->{'branchname'} = GetBranchName($reserveinfo->{'branchcode'});
54
    $slip = $letter->{content};
57
$reserveinfo->{'transferrequired'} = $transfer;
55
    $is_html = $letter->{is_html};
58
56
}
59
$template->param( reservedata => [ $reserveinfo ] ,
57
else {
60
				);
58
    $slip = "Reserve not found";
59
}
60
$template->param(
61
    slip => $slip,
62
    plain => !$is_html,
63
    title => "Koha -- Circulation: Transfers",
64
    stylesheet => C4::Context->preference("SlipCSS"),
65
);
61
66
62
output_html_with_http_headers $input, $cookie, $template->output;
67
output_html_with_http_headers $input, $cookie, $template->output;
63
68
(-)a/installer/data/mysql/de-DE/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 11-17 VALUES ('circulation','ODUE','Mahnung','Mahnung','Liebe/r <<borrowers.firstname> Link Here
11
('reserves', 'HOLD_PRINT', 'Vormerkbenachrichtigung (Print)', 'Vormerkbenachrichtigung (Print)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchzip>> <<branches.branchcity>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.address2>>\r\n<<borrowers.zipcode>> <<borrowers.city>>\r\n<<borrowers.country>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nLiebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nFür Sie liegt seit dem <<reserves.waitingdate>> eine Vormerkung zur Abholung bereit:\r\n\r\nTitel: <<biblio.title>>\r\nVerfasser: <<biblio.author>>\r\nSignatur: <<items.itemcallnumber>>\r\n'),
11
('reserves', 'HOLD_PRINT', 'Vormerkbenachrichtigung (Print)', 'Vormerkbenachrichtigung (Print)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchzip>> <<branches.branchcity>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.address2>>\r\n<<borrowers.zipcode>> <<borrowers.city>>\r\n<<borrowers.country>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nLiebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nFür Sie liegt seit dem <<reserves.waitingdate>> eine Vormerkung zur Abholung bereit:\r\n\r\nTitel: <<biblio.title>>\r\nVerfasser: <<biblio.author>>\r\nSignatur: <<items.itemcallnumber>>\r\n'),
12
('circulation','CHECKIN','Rückgabequittung (Zusammenfassung)','Rückgabequittung','Die folgenden Medien wurden zurückgegeben:\r\n----\r\n<<biblio.title>>\r\n----\r\nVielen Dank.'),
12
('circulation','CHECKIN','Rückgabequittung (Zusammenfassung)','Rückgabequittung','Die folgenden Medien wurden zurückgegeben:\r\n----\r\n<<biblio.title>>\r\n----\r\nVielen Dank.'),
13
('circulation','CHECKOUT','Ausleihquittung (Zusammenfassung)','Ausleihquittung','Die folgenden Medien wurden entliehen:\r\n----\r\n<<biblio.title>>\r\n----\r\nVielen Dank für Ihren Besuch in <<branches.branchname>>.'),
13
('circulation','CHECKOUT','Ausleihquittung (Zusammenfassung)','Ausleihquittung','Die folgenden Medien wurden entliehen:\r\n----\r\n<<biblio.title>>\r\n----\r\nVielen Dank für Ihren Besuch in <<branches.branchname>>.'),
14
('reserves', 'HOLDPLACED', 'Neue Vormerkung', 'Neue Vormerkung','Folgender Titel wurde vorgemerkt: <<title>> (<<biblionumber>>) durch den Benutzer <<firstname>> <<surname>> (<<cardnumber>>).'),
14
('reserves', 'HOLDPLACED', 'Neue Vormerkung', 'Neue Vormerkung','Folgender Titel wurde vorgemerkt: <<biblio.title>> (<<biblio.biblionumber>>) durch den Benutzer <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
15
('suggestions','ACCEPTED','Anschaffungsvorschlag wurde angenommen', 'Ihr Anschaffungsvorschlag wurde angenommen','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> by <<suggestions.author>>.\n\nDie Bibliothek hat diesen Titel heute recherchiert und wird Ihn sobald wie möglich im Buchhandel bestellen. Sie erhalten Nachricht, sobald die Bestellung abgeschlossen ist und sobald der Titel in der Bibliotek verfügbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'),
15
('suggestions','ACCEPTED','Anschaffungsvorschlag wurde angenommen', 'Ihr Anschaffungsvorschlag wurde angenommen','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> by <<suggestions.author>>.\n\nDie Bibliothek hat diesen Titel heute recherchiert und wird Ihn sobald wie möglich im Buchhandel bestellen. Sie erhalten Nachricht, sobald die Bestellung abgeschlossen ist und sobald der Titel in der Bibliotek verfügbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Vorgeschlagenes Medium verfügbar', 'Das vorgeschlagene Medium ist jetzt verfügbar','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu können, dass dieser Titel jetzt im Bestand der Bibliothek verfügbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Vorgeschlagenes Medium verfügbar', 'Das vorgeschlagene Medium ist jetzt verfügbar','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlagen: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu können, dass dieser Titel jetzt im Bestand der Bibliothek verfügbar ist.\n\nWenn Sie Fragen haben, richten Sie Ihre Mail bitte an: <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Vorgeschlagenes Medium bestellt', 'Das vorgeschlagene Medium wurde im Buchhandel bestellt','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlaten: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu können, dass dieser Titel jetzt im Buchhandel bestellt wurde. Nach Eintreffen wird er in unseren Bestand eingearbeitet.\n\nSie erhalten Nachricht, sobald das Medium verfügbar ist.\n\nBei Nachfragen erreichen Sie uns unter der Emailadresse <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Vorgeschlagenes Medium bestellt', 'Das vorgeschlagene Medium wurde im Buchhandel bestellt','Liebe(r) <<borrowers.firstname>> <<borrowers.surname>>,\n\nSie haben der Bibliothek folgendes Medium zur Anschaffung vorgeschlaten: <<suggestions.title>> von <<suggestions.author>>.\n\nWir freuen uns Ihnen mitteilen zu können, dass dieser Titel jetzt im Buchhandel bestellt wurde. Nach Eintreffen wird er in unseren Bestand eingearbeitet.\n\nSie erhalten Nachricht, sobald das Medium verfügbar ist.\n\nBei Nachfragen erreichen Sie uns unter der Emailadresse <<branches.branchemail>>.\n\nVielen Dank,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (-1 / +83 lines)
Lines 11-18 VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f Link Here
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
18
('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <<suggestions.reason>>\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>');
18
('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <<suggestions.reason>>\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>');
19
INSERT INTO `letter` (module, code, name, title, content, is_html)
20
VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3>
21
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
22
(<<borrowers.cardnumber>>) <br />
23
24
<<today>><br />
25
26
<h4>Checked Out</h4>
27
<checkedout>
28
<p>
29
<<biblio.title>> <br />
30
Barcode: <<items.barcode>><br />
31
Date due: <<issues.date_due>><br />
32
</p>
33
</checkedout>
34
35
<h4>Overdues</h4>
36
<overdue>
37
<p>
38
<<biblio.title>> <br />
39
Barcode: <<items.barcode>><br />
40
Date due: <<issues.date_due>><br />
41
</p>
42
</overdue>
43
44
<hr>
45
46
<h4 style="text-align: center; font-style:italic;">News</h4>
47
<news>
48
<div class="newsitem">
49
<h5 style="margin-bottom: 1px; margin-top: 1px"><b><<opac_news.title>></b></h5>
50
<p style="margin-bottom: 1px; margin-top: 1px"><<opac_news.new>></p>
51
<p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Posted on <<opac_news.timestamp>></p>
52
<hr />
53
</div>
54
</news>', 1),
55
('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3>
56
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
57
(<<borrowers.cardnumber>>) <br />
58
59
<<today>><br />
60
61
<h4>Checked Out Today</h4>
62
<checkedout>
63
<p>
64
<<biblio.title>> <br />
65
Barcode: <<items.barcode>><br />
66
Date due: <<issues.date_due>><br />
67
</p>
68
</checkedout>', 1),
69
('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5>
70
71
<h3> Transfer to/Hold in <<branches.branchname>></h3>
72
73
<reserves>
74
<div>
75
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
76
77
<ul>
78
    <li><<borrowers.cardnumber>></li>
79
    <li><<borrowers.phone>></li>
80
    <li> <<borrowers.address>><br />
81
         <<borrowers.address2>><br />
82
         <<borrowers.city >>  <<borrowers.zipcode>>
83
    </li>
84
    <li><<borrowers.email>></li>
85
</ul>
86
<br />
87
<h3>ITEM ON HOLD</h3>
88
 <h4><<biblio.title>></h4>
89
 <h5><<biblio.author>></h5>
90
 <ul>
91
    <li><<items.barcode>></li>
92
    <li><<items.itemcallnumber>></li>
93
    <li><<reserves.waitingdate>></li>
94
 </ul>
95
 <p>Notes:
96
 <pre><<reserves.reservenotes>></pre>
97
 </p>
98
</div>
99
</reserves>', 1);
100
(-)a/installer/data/mysql/es-ES/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 11-17 VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f Link Here
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (-1 / +1 lines)
Lines 13-19 VALUES Link Here
13
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup at <<branches.branchname>>', '<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n\n\nChange Service Requested\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>>\n<<borrowers.address>>\n<<borrowers.city>> <<borrowers.zipcode>>\n\n\n\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\n\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
13
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup at <<branches.branchname>>', '<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n\n\nChange Service Requested\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>>\n<<borrowers.address>>\n<<borrowers.city>> <<borrowers.zipcode>>\n\n\n\n\n\n\n\n\n\n\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\n\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
14
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
14
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
15
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
15
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
16
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
16
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
17
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
18
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
18
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
19
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
19
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/it-IT/necessari/notices.sql (-1 / +1 lines)
Lines 11-17 VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f Link Here
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 1166-1175 DROP TABLE IF EXISTS `letter`; Link Here
1166
CREATE TABLE `letter` ( -- table for all notice templates in Koha
1166
CREATE TABLE `letter` ( -- table for all notice templates in Koha
1167
  `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1167
  `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1168
  `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1168
  `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1169
  `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1169
  `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1170
  `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1171
  `is_html` tinyint(1) default 0,
1170
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1172
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1171
  `content` text, -- body text for the notice
1173
  `content` text, -- body text for the notice
1172
  PRIMARY KEY  (`module`,`code`)
1174
  PRIMARY KEY  (`module`,`code`, `branchcode`)
1173
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1175
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1174
1176
1175
--
1177
--
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql (-1 / +1 lines)
Lines 32-38 VALUES ('circulation','ODUE','Purring','Purring pÃ¥ dokument','<<borrowers.first Link Here
32
('reserves', 'HOLD_PRINT', 'Hentemelding (på papir)', 'Hentemelding', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nDu har et reservert dokument som kan hentes fra  <<reserves.waitingdate>>:\r\n\r\nTittel: <<biblio.title>>\r\nForfatter: <<biblio.author>>\r\nEksemplar: <<items.copynumber>>\r\n'),
32
('reserves', 'HOLD_PRINT', 'Hentemelding (på papir)', 'Hentemelding', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nDu har et reservert dokument som kan hentes fra  <<reserves.waitingdate>>:\r\n\r\nTittel: <<biblio.title>>\r\nForfatter: <<biblio.author>>\r\nEksemplar: <<items.copynumber>>\r\n'),
33
('circulation','CHECKIN','Innlevering','Melding om innlevering','Følgende dokument har blitt innlevert:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'),
33
('circulation','CHECKIN','Innlevering','Melding om innlevering','Følgende dokument har blitt innlevert:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'),
34
('circulation','CHECKOUT','Utlån','Melding om utlån','Følgende dokument har blitt lånt ut:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'),
34
('circulation','CHECKOUT','Utlån','Melding om utlån','Følgende dokument har blitt lånt ut:\r\n----\r\n<<biblio.title>>\r\n----\r\nVennlig hilsen\r\nBiblioteket'),
35
('reserves', 'HOLDPLACED', 'Melding om reservasjon', 'Melding om reservasjon','Følgende dokument har blitt reservert : <<title>> (<<biblionumber>>) av <<firstname>> <<surname>> (<<cardnumber>>).'),
35
('reserves', 'HOLDPLACED', 'Melding om reservasjon', 'Melding om reservasjon','Følgende dokument har blitt reservert : <<biblio.title>> (<<biblio.biblionumber>>) av <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
36
('suggestions','ACCEPTED','Forslag godtatt', 'Innkjøpsforslag godtatt','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at biblioteket kjøper inn <<suggestions.title>> av <<suggestions.author>>.\n\nBiblioteket har vurdert forslaget i dag. Dokumentet vil bli bestilt så fort det lar seg gjøre. Du vil få en ny melding når bestillingen er gjort, og når dokumentet ankommer biblioteket.\n\nEr det noe du lurer på, vennligst kontakt oss på <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
36
('suggestions','ACCEPTED','Forslag godtatt', 'Innkjøpsforslag godtatt','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at biblioteket kjøper inn <<suggestions.title>> av <<suggestions.author>>.\n\nBiblioteket har vurdert forslaget i dag. Dokumentet vil bli bestilt så fort det lar seg gjøre. Du vil få en ny melding når bestillingen er gjort, og når dokumentet ankommer biblioteket.\n\nEr det noe du lurer på, vennligst kontakt oss på <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
37
('suggestions','AVAILABLE','Foreslått dokument tilgjengelig', 'Foreslått dokument tilgjengelig','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at biblioteket kjøper inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av å informere deg om at dokumentet nå er innlemmet i samlingen.\n\nEr det noe du lurer på, vennligst kontakt oss på <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
37
('suggestions','AVAILABLE','Foreslått dokument tilgjengelig', 'Foreslått dokument tilgjengelig','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at biblioteket kjøper inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av å informere deg om at dokumentet nå er innlemmet i samlingen.\n\nEr det noe du lurer på, vennligst kontakt oss på <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
38
('suggestions','ORDERED','Innkjøpsforslag i bestilling', 'Innkjøpsforslag i bestilling','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at biblioteket kjøper inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av å informere deg om at dokumentet du foreslo nå er i bestilling.\n\nDu vil få en ny melding når dokumentet er tilgjengelig.\n\nEr det noe du lurer på, vennligst kontakt oss på <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
38
('suggestions','ORDERED','Innkjøpsforslag i bestilling', 'Innkjøpsforslag i bestilling','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at biblioteket kjøper inn <<suggestions.title>> av <<suggestions.author>>.\n\nVi har gleden av å informere deg om at dokumentet du foreslo nå er i bestilling.\n\nDu vil få en ny melding når dokumentet er tilgjengelig.\n\nEr det noe du lurer på, vennligst kontakt oss på <<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 13-19 VALUES Link Here
13
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
13
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
14
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
14
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
15
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
15
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
16
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
16
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
17
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
18
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
18
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
19
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
19
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 11-17 VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f Link Here
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
11
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
12
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
13
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
14
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
15
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
17
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/sysprefs.sql (+3 lines)
Lines 328-331 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
328
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
328
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
329
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
329
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
330
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
330
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
331
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free');
332
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free');
333
331
334
(-)a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql (-1 / +1 lines)
Lines 10-16 VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.f Link Here
10
('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>\r\n<<branches.branchcity>> <<branches.branchzip>>'),
10
('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>\r\n<<branches.branchcity>> <<branches.branchzip>>'),
11
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
11
('circulation','CHECKIN','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you.'),
12
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
12
('circulation','CHECKOUT','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting <<branches.branchname>>.'),
13
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<title>> (<<biblionumber>>) by the user <<firstname>> <<surname>> (<<cardnumber>>).'),
13
('reserves', 'HOLDPLACED', 'Hold Placed on Item', 'Hold Placed on Item','A hold has been placed on the following item : <<biblio.title>> (<<biblio.biblionumber>>) by the user <<borrowers.firstname>> <<borrowers.surname>> (<<borrowers.cardnumber>>).'),
14
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
14
('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
15
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
15
('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
16
('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the library acquire <<suggestions.title>> by <<suggestions.author>>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <<branches.branchemail>>\n\nThank you,\n\n<<branches.branchname>>'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +97 lines)
Lines 4496-4502 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4496
        print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
4496
        print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
4497
        SetVersion ($DBversion);
4497
        SetVersion ($DBversion);
4498
    }
4498
    }
4499
		
4500
}
4499
}
4501
4500
4502
$DBversion = "3.05.00.018";
4501
$DBversion = "3.05.00.018";
Lines 4550-4555 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4550
    SetVersion ($DBversion);
4549
    SetVersion ($DBversion);
4551
}
4550
}
4552
4551
4552
$DBversion = "3.06.00.XXX";
4553
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4554
    $dbh->do("ALTER TABLE `letter` DROP PRIMARY KEY");
4555
    $dbh->do("ALTER TABLE `letter` ADD `branchcode` varchar(10) default NULL AFTER `code`");
4556
    $dbh->do("ALTER TABLE `letter` ADD PRIMARY KEY  (`module`,`code`, `branchcode`)");
4557
    $dbh->do("ALTER TABLE `letter` ADD `is_html` tinyint(1) default 0 AFTER `name`");
4558
    print "Added branchcode and is_html to letter table\n";
4559
4560
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4561
              VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3>
4562
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
4563
(<<borrowers.cardnumber>>) <br />
4564
4565
<<today>><br />
4566
4567
<h4>Checked Out</h4>
4568
<checkedout>
4569
<p>
4570
<<biblio.title>> <br />
4571
Barcode: <<items.barcode>><br />
4572
Date due: <<issues.date_due>><br />
4573
</p>
4574
</checkedout>
4575
4576
<h4>Overdues</h4>
4577
<overdue>
4578
<p>
4579
<<biblio.title>> <br />
4580
Barcode: <<items.barcode>><br />
4581
Date due: <<issues.date_due>><br />
4582
</p>
4583
</overdue>
4584
4585
<hr>
4586
4587
<h4 style=\"text-align: center; font-style:italic;\">News</h4>
4588
<news>
4589
<div class=\"newsitem\">
4590
<h5 style=\"margin-bottom: 1px; margin-top: 1px\"><b><<opac_news.title>></b></h5>
4591
<p style=\"margin-bottom: 1px; margin-top: 1px\"><<opac_news.new>></p>
4592
<p class=\"newsfooter\" style=\"font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px\">Posted on <<opac_news.timestamp>></p>
4593
<hr />
4594
</div>
4595
</news>', 1)");
4596
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4597
              VALUES ('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3>
4598
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
4599
(<<borrowers.cardnumber>>) <br />
4600
4601
<<today>><br />
4602
4603
<h4>Checked Out Today</h4>
4604
<checkedout>
4605
<p>
4606
<<biblio.title>> <br />
4607
Barcode: <<items.barcode>><br />
4608
Date due: <<issues.date_due>><br />
4609
</p>
4610
</checkedout>', 1)");
4611
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4612
              VALUES ('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5>
4613
4614
<h3> Transfer to/Hold in <<branches.branchname>></h3>
4615
4616
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
4617
4618
<ul>
4619
    <li><<borrowers.cardnumber>></li>
4620
    <li><<borrowers.phone>></li>
4621
    <li> <<borrowers.address>><br />
4622
         <<borrowers.address2>><br />
4623
         <<borrowers.city >>  <<borrowers.zipcode>>
4624
    </li>
4625
    <li><<borrowers.email>></li>
4626
</ul>
4627
<br />
4628
<h3>ITEM ON HOLD</h3>
4629
<h4><<biblio.title>></h4>
4630
<h5><<biblio.author>></h5>
4631
<ul>
4632
   <li><<items.barcode>></li>
4633
   <li><<items.itemcallnumber>></li>
4634
   <li><<reserves.waitingdate>></li>
4635
</ul>
4636
<p>Notes:
4637
<pre><<reserves.reservenotes>></pre>
4638
</p>', 1)");
4639
4640
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free')");
4641
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free')");
4642
4643
    $dbh->do("UPDATE `letter` SET content = replace(content, '<<title>>', '<<biblio.title>>') WHERE code = 'HOLDPLACED')");
4644
4645
    print "Upgrade to $DBversion done (Add branchcode and is_html to letter table; Add NoticeCSS and SlipCSS sysprefs)\n";
4646
    SetVersion($DBversion);
4647
}
4648
4553
=head1 FUNCTIONS
4649
=head1 FUNCTIONS
4554
4650
4555
=head2 DropAllForeignKeys($table)
4651
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc (-1 / +3 lines)
Lines 42-49 function update_child() { Link Here
42
	 });
42
	 });
43
43
44
	// YUI Toolbar Functions
44
	// YUI Toolbar Functions
45
    var slip_re = /slip/;
45
	function printx_window(print_type) {
46
	function printx_window(print_type) {
46
		window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
47
        var handler = print_type.match(slip_re) ? "printslip" : "moremember";
48
		window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
47
		return false;
49
		return false;
48
	}
50
	}
49
	function searchToHold(){
51
	function searchToHold(){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+5 lines)
Lines 91-96 Circulation: Link Here
91
                  yes: Record
91
                  yes: Record
92
                  no: "Don't record"
92
                  no: "Don't record"
93
            - local use when an unissued item is checked in.
93
            - local use when an unissued item is checked in.
94
        -
95
            - Include the stylesheet at
96
            - pref: NoticeCSS
97
              class: url
98
            - on Notices. (This should be a complete URL, starting with <code>http://</code>.)
94
    Checkout Policy:
99
    Checkout Policy:
95
        -
100
        -
96
            - pref: AllowNotForLoanOverride
101
            - pref: AllowNotForLoanOverride
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref (+5 lines)
Lines 83-88 Staff Client: Link Here
83
                  Results: "Results page (for future use, Results XSLT not functional at this time)."
83
                  Results: "Results page (for future use, Results XSLT not functional at this time)."
84
                  Both: "Both Results and Details pages (for future use, Results XSLT not functional at this time)."
84
                  Both: "Both Results and Details pages (for future use, Results XSLT not functional at this time)."
85
            - 'Note: The corresponding XSLT option must be turned on.'
85
            - 'Note: The corresponding XSLT option must be turned on.'
86
        -
87
            - Include the stylesheet at
88
            - pref: SlipCSS
89
              class: url
90
            - on Issue and Reserve Slips. (This should be a complete URL, starting with <code>http://</code>.)
86
    Options:
91
    Options:
87
        -
92
        -
88
            - pref: viewMARC
93
            - pref: viewMARC
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt (-5 / +1 lines)
Lines 8-18 Link Here
8
        -->
8
        -->
9
    </style>
9
    </style>
10
    [% IF ( stylesheet ) %]
10
    [% IF ( stylesheet ) %]
11
    <style type="text/css">
11
    <link rel="stylesheet" type="text/css" href="[% stylesheet %]">
12
        <!--
13
        [% stylesheet %]
14
        -->
15
    </style>
16
    [% END %]
12
    [% END %]
17
</head>
13
</head>
18
<body>
14
<body>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/hold-transfer-slip.tt (-54 lines)
Lines 1-54 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha -- Circulation: Transfers</title>
3
[% INCLUDE 'doc-head-close-receipt.inc' %]
4
<script language="javascript">
5
function printandclose()
6
{
7
window.print();
8
window.close();
9
}
10
</script>
11
</head>
12
<body onload="printandclose();"><div id="main">
13
14
[% FOREACH reservedat IN reservedata %]
15
16
<h5>Date: [% reservedat.pulldate %]</h5>
17
<h3> [% IF ( reservedat.transferrequired ) %]Transfer to [% reservedat.branchname %] [% ELSE %]Hold in [% reservedat.branchname %][% END %]</h3>
18
19
<div id="reserve_display">
20
21
<h3>[% reservedat.surname %], [% reservedat.firstname %]</h3>
22
23
<ul>
24
	<li>[% reservedat.cardnumber %]</li>
25
    [% IF ( reservedat.phone ) %]
26
        <li>[% reservedat.phone %]</li>
27
    [% END %]
28
    <li>
29
        [% reservedat.address %]<br />
30
	    [% IF ( reservedat.address2 ) %][% reservedat.address2 %]<br />[% END %]
31
        [% reservedat.city %]  [% reservedat.zip %]
32
    </li>
33
    [% IF ( reservedat.email ) %]
34
        <li>[% reservedat.email %]</li>
35
    [% END %]
36
</ul>
37
<br />
38
<h3>ITEM ON HOLD</h3>
39
 <h4>[% reservedat.title |html %]</h4>
40
 <h5>[% reservedat.author %] </h5>
41
 <ul>
42
    [% IF ( reservedat.barcode ) %]<li>[% reservedat.barcode %]</li>[% END %]
43
    [% IF ( reservedat.itemcallnumber ) %]<li>[% reservedat.itemcallnumber %]</li>[% END %]
44
    [% IF ( reservedat.waitingdate ) %]<li>[% reservedat.waitingdate %]</li>[% END %]
45
 </ul>
46
 [% IF ( reservedat.reservenotes ) %]
47
    <p>Notes: [% reservedat.reservenotes %]</p>
48
 [% END %]
49
50
51
52
[% END %]
53
</div>
54
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt (+28 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>[% title %]</title>
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/print.css" />
6
[% IF stylesheet %]
7
<link rel="stylesheet" type="text/css" href="[% stylesheet %]" />
8
[% END %]
9
10
<script language="javascript">
11
    function printThenClose() {
12
        window.print();
13
        window.close();
14
    }
15
</script>
16
</head>
17
<body onload="printThenClose();">
18
<div id="receipt">
19
20
[% IF plain %]
21
<pre>
22
[% slip %]
23
</pre>
24
[% ELSE %]
25
[% slip %]
26
[% END %]
27
28
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt (-76 lines)
Lines 1-76 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Print Receipt for [% cardnumber %]</title>
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
5
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/print.css" />
6
7
<script language="javascript">
8
    function printThenClose() {
9
        window.print();
10
        window.close();
11
    }
12
</script>
13
</head>
14
<body onload="printThenClose();">
15
16
<div id="receipt">
17
18
<h3>[% LibraryName %]</h3>
19
[% IF ( branchname ) %][% branchname %]<br />[% END %]
20
Checked out to [% firstname %] [% surname %] <br />
21
(<a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber %]">[% cardnumber %]</a>)<br />
22
23
[% todaysdate %]<br />
24
25
[% IF ( quickslip ) %]
26
<h4>Checked Out Today</h4>
27
[% FOREACH issueloo IN issueloop %]
28
[% IF ( issueloo.red ) %][% ELSE %]
29
[% IF ( issueloo.today ) %]
30
<p><a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber %]&amp;biblionumber=[% issueloo.biblionumber %]&amp;bi=[% issueloo.biblioitemnumber %]">[% issueloo.title |html %]</a><br />
31
Barcode: [% issueloo.barcode %]<br />
32
Date due: [% issueloo.date_due %]<br /></p>
33
    [% END %]
34
    [% END %]
35
    [% END %]
36
37
[% ELSE %]
38
<h4>Checked Out</h4>
39
[% FOREACH issueloo IN issueloop %]
40
[% IF ( issueloo.red ) %][% ELSE %]
41
<p><a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber %]&amp;biblionumber=[% issueloo.biblionumber %]&amp;bi=[% issueloo.biblioitemnumber %]">[% issueloo.title |html %]</a><br />
42
Barcode: [% issueloo.barcode %]<br />
43
Date due: [% issueloo.date_due %]<br /></p>
44
    [% END %]
45
    [% END %]
46
47
[% END %]
48
49
[% IF ( quickslip ) %]
50
[% ELSE %]
51
[% IF ( overdues_exist ) %]
52
<h4>Overdues</h4>
53
    [% FOREACH issueloo IN issueloop %]
54
    [% IF ( issueloo.red ) %]
55
<p><a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber %]&amp;biblionumber=[% issueloo.biblionumber %]&amp;bi=[% issueloo.biblioitemnumber %]">[% issueloo.title |html %]</a><br />
56
Barcode: [% issueloo.barcode %]<br />
57
Date due: [% issueloo.date_due %]</p>
58
[% END %]
59
[% END %]
60
[% END %]
61
[% END %]
62
63
[% IF ( koha_news_count ) %]
64
            <hr><h4 style="text-align: center; font-style:italic;">News</h4>
65
                       <!-- [% koha_news_count %] recent news item(s) -->
66
            [% FOREACH koha_new IN koha_news %]
67
                    <div class="newsitem" id="news[% koha_new.idnew %]"><h5 style="margin-bottom: 1px; margin-top: 1px"><b>[% koha_new.title %]</b></h5>
68
                                        <p style="margin-bottom: 1px; margin-top: 1px">[% koha_new.new %]</p>
69
                                       <p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px"> Posted on [% koha_new.newdate %]
70
71
</p><hr /></div>
72
            [% END %]
73
[% END %]
74
75
76
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-3 / +55 lines)
Lines 10-15 $(document).ready(function() { Link Here
10
		sortList: [[0,0]],
10
		sortList: [[0,0]],
11
		headers: { 3: {sorter:false},4: { sorter: false }}
11
		headers: { 3: {sorter:false},4: { sorter: false }}
12
	}); 
12
	}); 
13
14
    $('#branch').change(function() {
15
            $('#selectlibrary').submit();
16
    });
13
}); 
17
}); 
14
[% IF ( add_form ) %]
18
[% IF ( add_form ) %]
15
	
19
	
Lines 128-133 $(document).ready(function() { Link Here
128
	}
132
	}
129
	//]]>
133
	//]]>
130
	</script>
134
	</script>
135
136
      <p>
137
        <form method="get" action="?" id="selectlibrary">
138
            <input type="hidden" name="searchfield" value="[% searchfield %]" />
139
        Select a library :
140
            <select name="branchcode" id="branch" style="width:20em;">
141
                <option value="">All libraries</option>
142
            [% FOREACH branchloo IN branchloop %]
143
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
144
            [% END %]
145
            </select>
146
        </form>
147
      </p>
148
131
	<ul class="toolbar">
149
	<ul class="toolbar">
132
	<li><a id="newnotice" href="/cgi-bin/koha/tools/letter.pl?op=add_form">New Notice</a></li>
150
	<li><a id="newnotice" href="/cgi-bin/koha/tools/letter.pl?op=add_form">New Notice</a></li>
133
</ul></div>
151
</ul></div>
Lines 135-147 $(document).ready(function() { Link Here
135
		[% IF ( search ) %]
153
		[% IF ( search ) %]
136
		<p>You Searched for <b>[% searchfield %]</b></p>
154
		<p>You Searched for <b>[% searchfield %]</b></p>
137
		[% END %]
155
		[% END %]
138
		[% IF ( letter ) %]<table id="lettert">
156
		[% IF ( letter ) %]
157
            [% select_for_copy = BLOCK %]
158
            <select name="branchcode">
159
                [% FOREACH branchloo IN branchloop %]
160
                <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
161
                [% END %]
162
            </select>
163
            [% END %]
164
        <table id="lettert">
139
		<thead><tr>
165
		<thead><tr>
166
			<th>Branch</th>
140
			<th>Module</th>
167
			<th>Module</th>
141
			<th>Code</th>
168
			<th>Code</th>
142
			<th>Name</th>
169
			<th>Name</th>
143
			<th>&nbsp;</th>
170
			<th>&nbsp;</th>
144
			<th>&nbsp;</th>
171
			<th>&nbsp;</th>
172
			<th>&nbsp;</th>
145
		</tr></thead>
173
		</tr></thead>
146
		<tbody>[% FOREACH lette IN letter %]
174
		<tbody>[% FOREACH lette IN letter %]
147
		[% UNLESS ( loop.odd ) %]
175
		[% UNLESS ( loop.odd ) %]
Lines 149-165 $(document).ready(function() { Link Here
149
		[% ELSE %]
177
		[% ELSE %]
150
			<tr>
178
			<tr>
151
		[% END %]
179
		[% END %]
180
				<td>[% lette.branchname || "(All libraries)" %]</td>
152
				<td>[% lette.module %]</td>
181
				<td>[% lette.module %]</td>
153
				<td>[% lette.code %]</td>
182
				<td>[% lette.code %]</td>
154
				<td>[% lette.name %]</td>
183
				<td>[% lette.name %]</td>
155
				<td>
184
				<td>
156
					<a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Edit</a>
185
					<a href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Edit</a>
186
				</td>
187
				<td>
188
                    <form method="post" action="?">
189
                        <input type="hidden" name="op" value="copy" />
190
				        <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
191
                        <input type="hidden" name="module" value="[% lette.module %]" />
192
                        <input type="hidden" name="code" value="[% lette.code %]" />
193
                        [% select_for_copy %]
194
                        <input type="submit" value="Copy" />
195
                    </form>
157
				</td>
196
				</td>
158
				<td>
197
				<td>
159
					[% IF ( lette.protected ) %]
198
					[% IF ( lette.protected ) %]
160
					-
199
					-
161
					[% ELSE %]
200
					[% ELSE %]
162
					<a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Delete</a>
201
					<a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Delete</a>
163
					[% END %]
202
					[% END %]
164
				</td>
203
				</td>
165
			</tr>
204
			</tr>
Lines 183-188 $(document).ready(function() { Link Here
183
		<legend>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</legend>
222
		<legend>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</legend>
184
		<ol>
223
		<ol>
185
			<li>
224
			<li>
225
				<label for="branchcode">Library:</label>
226
				<input type="hidden" name="oldbranchcode" value="[% branchcode %]" />
227
                <select name="branchcode" id="branch" style="width:20em;">
228
                    <option value="">All libraries</option>
229
                [% FOREACH branchloo IN branchloop %]
230
                    [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
231
                [% END %]
232
                </select>
233
			</li>
234
			<li>
186
				<label for="module">Koha module:</label>
235
				<label for="module">Koha module:</label>
187
				<input type="hidden" name="oldmodule" value="[% module %]" />
236
				<input type="hidden" name="oldmodule" value="[% module %]" />
188
		[% IF ( modify ) %]<select name="module" id="module">[% END %] [% IF ( adding ) %] <select name="module" id="module" onchange="javascript:window.location.href = unescape(window.location.pathname)+'?op=add_form&amp;module='+this.value+'&amp;content='+window.document.forms['Aform'].elements['content'].value;">[% END %]
237
		[% IF ( modify ) %]<select name="module" id="module">[% END %] [% IF ( adding ) %] <select name="module" id="module" onchange="javascript:window.location.href = unescape(window.location.pathname)+'?op=add_form&amp;module='+this.value+'&amp;content='+window.document.forms['Aform'].elements['content'].value;">[% END %]
Lines 235-240 $(document).ready(function() { Link Here
235
			<label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
284
			<label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
236
		</li>
285
		</li>
237
		<li>
286
		<li>
287
			<label for="is_html">HTML Message:</label><input type="checkbox" id="is_html" name="is_html" value="1"[% IF is_html %] checked[% END %] />
288
		</li>
289
		<li>
238
			<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
290
			<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
239
		</li>
291
		</li>
240
		<li>
292
		<li>
(-)a/members/memberentry.pl (-4 / +1 lines)
Lines 327-336 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
327
            # if we manage to find a valid email address, send notice 
327
            # if we manage to find a valid email address, send notice 
328
            if ($emailaddr) {
328
            if ($emailaddr) {
329
                $newdata{emailaddr} = $emailaddr;
329
                $newdata{emailaddr} = $emailaddr;
330
                my $letter = getletter ('members', "ACCTDETAILS:$newdata{'branchcode'}") ;
330
                SendAlerts ( 'members', \%newdata, "ACCTDETAILS" );
331
                # if $branch notice fails, then email a default notice instead.
332
                $letter = getletter ('members', "ACCTDETAILS")  if !$letter;
333
                SendAlerts ( 'members' , \%newdata , $letter ) if $letter
334
            }
331
            }
335
        } 
332
        } 
336
333
(-)a/members/moremember.pl (-10 lines)
Lines 50-56 use C4::Biblio; Link Here
50
use C4::Reserves;
50
use C4::Reserves;
51
use C4::Branch; # GetBranchName
51
use C4::Branch; # GetBranchName
52
use C4::Form::MessagingPreferences;
52
use C4::Form::MessagingPreferences;
53
use C4::NewsChannels; #get slip news
54
use List::MoreUtils qw/uniq/;
53
use List::MoreUtils qw/uniq/;
55
use C4::Members::Attributes qw(GetBorrowerAttributes);
54
use C4::Members::Attributes qw(GetBorrowerAttributes);
56
55
Lines 473-485 $template->param( Link Here
473
    quickslip		  => $quickslip,
472
    quickslip		  => $quickslip,
474
);
473
);
475
474
476
#Get the slip news items
477
my $all_koha_news   = &GetNewsToDisplay("slip");
478
my $koha_news_count = scalar @$all_koha_news;
479
480
$template->param(
481
    koha_news       => $all_koha_news,
482
    koha_news_count => $koha_news_count
483
);
484
485
output_html_with_http_headers $input, $cookie, $template->output;
475
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printslip.pl (+89 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2000-2002 Katipo Communications
4
# Copyright 2010 BibLibre
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
22
=head1 moremember.pl
23
24
 script to do a borrower enquiry/bring up borrower details etc
25
 Displays all the details about a borrower
26
 written 20/12/99 by chris@katipo.co.nz
27
 last modified 21/1/2000 by chris@katipo.co.nz
28
 modified 31/1/2001 by chris@katipo.co.nz
29
   to not allow items on request to be renewed
30
31
 needs html removed and to use the C4::Output more, but its tricky
32
33
=cut
34
35
use strict;
36
#use warnings; FIXME - Bug 2505
37
use CGI;
38
use C4::Context;
39
use C4::Auth;
40
use C4::Output;
41
use C4::Members;
42
use C4::Koha;
43
44
#use Smart::Comments;
45
#use Data::Dumper;
46
47
use vars qw($debug);
48
49
BEGIN {
50
	$debug = $ENV{DEBUG} || 0;
51
}
52
53
my $input = new CGI;
54
$debug or $debug = $input->param('debug') || 0;
55
my $print = $input->param('print');
56
my $error = $input->param('error');
57
58
# circ staff who process checkouts but can't edit
59
# patrons still need to be able to print receipts
60
my $flagsrequired = { circulate => "circulate_remaining_permissions" };
61
62
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
63
    {
64
        template_name   => "circ/printslip.tmpl",
65
        query           => $input,
66
        type            => "intranet",
67
        authnotrequired => 0,
68
        flagsrequired   => $flagsrequired,
69
        debug           => 1,
70
    }
71
);
72
73
my $borrowernumber = $input->param('borrowernumber');
74
my $branch=C4::Context->userenv->{'branch'};
75
my ($slip, $is_html);
76
if (my $letter = IssueSlip ($branch, $borrowernumber, $print eq "qslip")) {
77
    $slip = $letter->{content};
78
    $is_html = $letter->{is_html};
79
}
80
81
$template->param(
82
    slip => $slip,
83
    plain => !$is_html,
84
    title => "Print Receipt for $borrowernumber",
85
    stylesheet => C4::Context->preference("SlipCSS"),
86
    error           => $error,
87
);
88
89
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/misc/cronjobs/advance_notices.pl (-45 / +33 lines)
Lines 79-91 patrons. It queues them in the message queue, which is processed by Link Here
79
the process_message_queue.pl cronjob.
79
the process_message_queue.pl cronjob.
80
See the comments in the script for directions on changing the script.
80
See the comments in the script for directions on changing the script.
81
This script has the following parameters :
81
This script has the following parameters :
82
	-c Confirm and remove this help & warning
82
    -c Confirm and remove this help & warning
83
        -m maximum number of days in advance to send advance notices.
83
    -m maximum number of days in advance to send advance notices.
84
	-n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes.
84
    -n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes.
85
        -v verbose
85
    -v verbose
86
        -i csv list of fields that get substituted into templates in places
87
           of the E<lt>E<lt>items.contentE<gt>E<gt> placeholder.  Defaults to
88
           issuedate,title,barcode,author
89
ENDUSAGE
86
ENDUSAGE
90
87
91
# Since advance notice options are not visible in the web-interface
88
# Since advance notice options are not visible in the web-interface
Lines 157-164 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
157
        } else {
154
        } else {
158
            my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
155
            my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
159
            my $letter_type = 'DUE';
156
            my $letter_type = 'DUE';
160
            $letter = C4::Letters::getletter( 'circulation', $letter_type );
161
            die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter;
162
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0');
157
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0');
163
            my $titles = "";
158
            my $titles = "";
164
            while ( my $item_info = $sth->fetchrow_hashref()) {
159
            while ( my $item_info = $sth->fetchrow_hashref()) {
Lines 166-178 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
166
              $titles .= join("\t",@item_info) . "\n";
161
              $titles .= join("\t",@item_info) . "\n";
167
            }
162
            }
168
        
163
        
169
            $letter = parse_letter( { letter         => $letter,
164
            $letter = parse_letter( { letter_code    => $letter_type,
170
                                      borrowernumber => $upcoming->{'borrowernumber'},
165
                                      borrowernumber => $upcoming->{'borrowernumber'},
171
                                      branchcode     => $upcoming->{'branchcode'},
166
                                      branchcode     => $upcoming->{'branchcode'},
172
                                      biblionumber   => $biblio->{'biblionumber'},
167
                                      biblionumber   => $biblio->{'biblionumber'},
173
                                      itemnumber     => $upcoming->{'itemnumber'},
168
                                      itemnumber     => $upcoming->{'itemnumber'},
174
                                      substitute     => { 'items.content' => $titles }
169
                                      substitute     => { 'items.content' => $titles }
175
                                    } );
170
                                    } )
171
              or die "no letter of type '$letter_type' found. Please see sample_notices.sql";
176
        }
172
        }
177
    } else {
173
    } else {
178
        $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
174
        $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
Lines 189-196 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
189
        } else {
185
        } else {
190
            my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
186
            my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
191
            my $letter_type = 'PREDUE';
187
            my $letter_type = 'PREDUE';
192
            $letter = C4::Letters::getletter( 'circulation', $letter_type );
193
            die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter;
194
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'});
188
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'});
195
            my $titles = "";
189
            my $titles = "";
196
            while ( my $item_info = $sth->fetchrow_hashref()) {
190
            while ( my $item_info = $sth->fetchrow_hashref()) {
Lines 198-210 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
198
              $titles .= join("\t",@item_info) . "\n";
192
              $titles .= join("\t",@item_info) . "\n";
199
            }
193
            }
200
        
194
        
201
            $letter = parse_letter( { letter         => $letter,
195
            $letter = parse_letter( { letter_code    => $letter_type,
202
                                      borrowernumber => $upcoming->{'borrowernumber'},
196
                                      borrowernumber => $upcoming->{'borrowernumber'},
203
                                      branchcode     => $upcoming->{'branchcode'},
197
                                      branchcode     => $upcoming->{'branchcode'},
204
                                      biblionumber   => $biblio->{'biblionumber'},
198
                                      biblionumber   => $biblio->{'biblionumber'},
205
                                      itemnumber     => $upcoming->{'itemnumber'},
199
                                      itemnumber     => $upcoming->{'itemnumber'},
206
                                      substitute     => { 'items.content' => $titles }
200
                                      substitute     => { 'items.content' => $titles }
207
                                    } );
201
                                    } )
202
              or die "no letter of type '$letter_type' found. Please see sample_notices.sql";
208
        }
203
        }
209
    }
204
    }
210
205
Lines 250-257 PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { Link Here
250
245
251
246
252
    my $letter_type = 'PREDUEDGST';
247
    my $letter_type = 'PREDUEDGST';
253
    my $letter = C4::Letters::getletter( 'circulation', $letter_type );
254
    die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter;
255
248
256
    $sth->execute($borrowernumber,$borrower_preferences->{'days_in_advance'});
249
    $sth->execute($borrowernumber,$borrower_preferences->{'days_in_advance'});
257
    my $titles = "";
250
    my $titles = "";
Lines 259-270 PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { Link Here
259
      my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields;
252
      my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields;
260
      $titles .= join("\t",@item_info) . "\n";
253
      $titles .= join("\t",@item_info) . "\n";
261
    }
254
    }
262
    $letter = parse_letter( { letter         => $letter,
255
    my $letter = parse_letter( { letter_code    => $letter_type,
263
                              borrowernumber => $borrowernumber,
256
                              borrowernumber => $borrowernumber,
264
                              substitute     => { count => $count,
257
                              substitute     => { count => $count,
265
                                                  'items.content' => $titles
258
                                                  'items.content' => $titles
266
                                                }
259
                                                }
267
                         } );
260
                         } )
261
      or die "no letter of type '$letter_type' found. Please see sample_notices.sql";
268
    if ($nomail) {
262
    if ($nomail) {
269
      local $, = "\f";
263
      local $, = "\f";
270
      print $letter->{'content'};
264
      print $letter->{'content'};
Lines 290-309 PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { Link Here
290
    next PATRON unless $borrower_preferences; # how could this happen?
284
    next PATRON unless $borrower_preferences; # how could this happen?
291
285
292
    my $letter_type = 'DUEDGST';
286
    my $letter_type = 'DUEDGST';
293
    my $letter = C4::Letters::getletter( 'circulation', $letter_type );
294
    die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter;
295
    $sth->execute($borrowernumber,'0');
287
    $sth->execute($borrowernumber,'0');
296
    my $titles = "";
288
    my $titles = "";
297
    while ( my $item_info = $sth->fetchrow_hashref()) {
289
    while ( my $item_info = $sth->fetchrow_hashref()) {
298
      my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields;
290
      my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields;
299
      $titles .= join("\t",@item_info) . "\n";
291
      $titles .= join("\t",@item_info) . "\n";
300
    }
292
    }
301
    $letter = parse_letter( { letter         => $letter,
293
    my $letter = parse_letter( { letter_code    => $letter_type,
302
                              borrowernumber => $borrowernumber,
294
                              borrowernumber => $borrowernumber,
303
                              substitute     => { count => $count,
295
                              substitute     => { count => $count,
304
                                                  'items.content' => $titles
296
                                                  'items.content' => $titles
305
                                                }
297
                                                }
306
                         } );
298
                         } )
299
      or die "no letter of type '$letter_type' found. Please see sample_notices.sql";
307
300
308
    if ($nomail) {
301
    if ($nomail) {
309
      local $, = "\f";
302
      local $, = "\f";
Lines 323-362 PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { Link Here
323
316
324
=head2 parse_letter
317
=head2 parse_letter
325
318
326
327
328
=cut
319
=cut
329
320
330
sub parse_letter {
321
sub parse_letter {
331
    my $params = shift;
322
    my $params = shift;
332
    foreach my $required ( qw( letter borrowernumber ) ) {
323
    foreach my $required ( qw( letter_code borrowernumber ) ) {
333
        return unless exists $params->{$required};
324
        return unless exists $params->{$required};
334
    }
325
    }
335
326
336
    if ( $params->{'substitute'} ) {
327
    my %table_params = ( 'borrowers' => $params->{'borrowernumber'} );
337
        while ( my ($key, $replacedby) = each %{$params->{'substitute'}} ) {
338
            my $replacefield = "<<$key>>";
339
            
340
            $params->{'letter'}->{title}   =~ s/$replacefield/$replacedby/g;
341
            $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g;
342
        }
343
    }
344
345
    C4::Letters::parseletter( $params->{'letter'}, 'borrowers',   $params->{'borrowernumber'} );
346
328
347
    if ( $params->{'branchcode'} ) {
329
    if ( my $p = $params->{'branchcode'} ) {
348
        C4::Letters::parseletter( $params->{'letter'}, 'branches',    $params->{'branchcode'} );
330
        $table_params{'branches'} = $p;
349
    }
331
    }
350
    if ( $params->{'itemnumber'} ) {
332
    if ( my $p = $params->{'itemnumber'} ) {
351
        C4::Letters::parseletter( $params->{'letter'}, 'issues', $params->{'itemnumber'} );
333
        $table_params{'issues'} = $p;
352
        C4::Letters::parseletter( $params->{'letter'}, 'items', $params->{'itemnumber'} );
334
        $table_params{'items'} = $p;
353
    }
335
    }
354
    if ( $params->{'biblionumber'} ) {
336
    if ( my $p = $params->{'biblionumber'} ) {
355
        C4::Letters::parseletter( $params->{'letter'}, 'biblio',      $params->{'biblionumber'} );
337
        $table_params{'biblio'} = $p;
356
        C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $params->{'biblionumber'} );
338
        $table_params{'biblioitems'} = $p;
357
    }
339
    }
358
340
359
    return $params->{'letter'};
341
    return C4::Letters::GetPreparedLetter (
342
        module => 'circulation',
343
        letter_code => $params->{'letter_code'},
344
        branchcode => $table_params{'branches'},
345
        substitute => $params->{'substitute'},
346
        tables     => \%table_params,
347
    );
360
}
348
}
361
349
362
1;
350
1;
(-)a/misc/cronjobs/gather_print_notices.pl (-12 / +2 lines)
Lines 39-49 use Getopt::Long; Link Here
39
39
40
sub usage {
40
sub usage {
41
    print STDERR <<USAGE;
41
    print STDERR <<USAGE;
42
Usage: $0 [ -s STYLESHEET ] OUTPUT_DIRECTORY
42
Usage: $0 OUTPUT_DIRECTORY
43
  Will print all waiting print notices to
43
  Will print all waiting print notices to
44
  OUTPUT_DIRECTORY/notices-CURRENT_DATE.html .
44
  OUTPUT_DIRECTORY/notices-CURRENT_DATE.html .
45
  If the filename of a CSS stylesheet is specified with -s, the contents of that
46
  file will be included in the HTML.
47
USAGE
45
USAGE
48
    exit $_[0];
46
    exit $_[0];
49
}
47
}
Lines 51-57 USAGE Link Here
51
my ( $stylesheet, $help );
49
my ( $stylesheet, $help );
52
50
53
GetOptions(
51
GetOptions(
54
    's:s' => \$stylesheet,
55
    'h|help' => \$help,
52
    'h|help' => \$help,
56
) || usage( 1 );
53
) || usage( 1 );
57
54
Lines 71-86 exit unless( @messages ); Link Here
71
open OUTPUT, '>', File::Spec->catdir( $output_directory, "holdnotices-" . $today->output( 'iso' ) . ".html" );
68
open OUTPUT, '>', File::Spec->catdir( $output_directory, "holdnotices-" . $today->output( 'iso' ) . ".html" );
72
69
73
my $template = C4::Templates::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI );
70
my $template = C4::Templates::gettemplate( 'batch/print-notices.tmpl', 'intranet', new CGI );
74
my $stylesheet_contents = '';
75
76
if ($stylesheet) {
77
  open STYLESHEET, '<', $stylesheet;
78
  while ( <STYLESHEET> ) { $stylesheet_contents .= $_ }
79
  close STYLESHEET;
80
}
81
71
82
$template->param(
72
$template->param(
83
    stylesheet => $stylesheet_contents,
73
    stylesheet => C4::Context->preference("NoticeCSS"),
84
    today => $today->output(),
74
    today => $today->output(),
85
    messages => \@messages,
75
    messages => \@messages,
86
);
76
);
(-)a/misc/cronjobs/overdue_notices.pl (-43 / +43 lines)
Lines 459-475 END_SQL Link Here
459
                    $longest_issue ) = $sth->fetchrow )
459
                    $longest_issue ) = $sth->fetchrow )
460
            {
460
            {
461
                $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has $itemcount items triggering level $i.";
461
                $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has $itemcount items triggering level $i.";
462
    
462
   
463
                my $letter = C4::Letters::getletter( 'circulation', $overdue_rules->{"letter$i"} );
464
465
                unless ($letter) {
466
                    $verbose and warn "Message '$overdue_rules->{letter$i}' content not found";
467
    
468
                    # might as well skip while PERIOD, no other borrowers are going to work.
469
                    # FIXME : Does this mean a letter must be defined in order to trigger a debar ?
470
                    next PERIOD;
471
                }
472
    
473
                if ( $overdue_rules->{"debarred$i"} ) {
463
                if ( $overdue_rules->{"debarred$i"} ) {
474
    
464
    
475
                    #action taken is debarring
465
                    #action taken is debarring
Lines 494-504 END_SQL Link Here
494
                    my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
484
                    my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
495
                    $titles .= join("\t", @item_info) . "\n";
485
                    $titles .= join("\t", @item_info) . "\n";
496
                    $itemcount++;
486
                    $itemcount++;
497
                    push @items, { itemnumber => $item_info->{'itemnumber'}, biblionumber => $item_info->{'biblionumber'} };
487
                    push @items, $item_info;
498
                }
488
                }
499
                $sth2->finish;
489
                $sth2->finish;
500
                $letter = parse_letter(
490
501
                    {   letter          => $letter,
491
                my $letter = parse_letter(
492
                    {   letter_code     => $overdue_rules->{"letter$i"},
502
                        borrowernumber  => $borrowernumber,
493
                        borrowernumber  => $borrowernumber,
503
                        branchcode      => $branchcode,
494
                        branchcode      => $branchcode,
504
                        items           => \@items,
495
                        items           => \@items,
Lines 508-513 END_SQL Link Here
508
                                           }
499
                                           }
509
                    }
500
                    }
510
                );
501
                );
502
                unless ($letter) {
503
                    $verbose and warn "Message '$overdue_rules->{letter$i}' content not found";
504
    
505
                    # might as well skip while PERIOD, no other borrowers are going to work.
506
                    # FIXME : Does this mean a letter must be defined in order to trigger a debar ?
507
                    next PERIOD;
508
                }
511
                
509
                
512
                if ( $exceededPrintNoticesMaxLines ) {
510
                if ( $exceededPrintNoticesMaxLines ) {
513
                  $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
511
                  $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
Lines 642-694 substituted keys and values. Link Here
642
640
643
=cut
641
=cut
644
642
645
sub parse_letter { # FIXME: this code should probably be moved to C4::Letters:parseletter
643
sub parse_letter {
646
    my $params = shift;
644
    my $params = shift;
647
    foreach my $required (qw( letter borrowernumber )) {
645
    foreach my $required (qw( letter_code borrowernumber )) {
648
        return unless exists $params->{$required};
646
        return unless exists $params->{$required};
649
    }
647
    }
650
648
651
   my $todaysdate = C4::Dates->new()->output("syspref");
649
    my $substitute = $params->{'substitute'} || {};
652
   $params->{'letter'}->{title}   =~ s/<<today>>/$todaysdate/g;
650
    $substitute->{today} ||= C4::Dates->new()->output("syspref");
653
   $params->{'letter'}->{content} =~ s/<<today>>/$todaysdate/g;
654
651
655
    if ( $params->{'substitute'} ) {
652
    my %tables = ( 'borrowers' => $params->{'borrowernumber'} );
656
        while ( my ( $key, $replacedby ) = each %{ $params->{'substitute'} } ) {
653
    if ( my $p = $params->{'branchcode'} ) {
657
            my $replacefield = "<<$key>>";
654
        $tables{'branches'} = $p;
658
            $params->{'letter'}->{title}   =~ s/$replacefield/$replacedby/g;
659
            $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g;
660
        }
661
    }
655
    }
662
656
663
    $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'borrowers', $params->{'borrowernumber'} );
657
    my $currency_format;
664
658
    if ($params->{'letter'}->{'content'} =~ m/<fine>(.*)<\/fine>/o) { # process any fine tags...
665
    if ( $params->{'branchcode'} ) {
659
        $currency_format = $1;
666
        $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'branches', $params->{'branchcode'} );
660
        $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/<<item.fine>>/o;
667
    }
661
    }
668
662
669
    if ( $params->{'items'} ) {
663
    my @item_tables;
664
    if ( my $i = $params->{'items'} ) {
670
        my $item_format = '';
665
        my $item_format = '';
671
        PROCESS_ITEMS:
666
        foreach my $item (@$i) {
672
        while (scalar(@{$params->{'items'}}) > 0) {
673
            my $item = shift @{$params->{'items'}};
674
            my $fine = GetFine($item->{'itemnumber'}, $params->{'borrowernumber'});
667
            my $fine = GetFine($item->{'itemnumber'}, $params->{'borrowernumber'});
675
            if (!$item_format) {
668
            if (!$item_format) {
676
                $params->{'letter'}->{'content'} =~ m/(<item>.*<\/item>)/;
669
                $params->{'letter'}->{'content'} =~ m/(<item>.*<\/item>)/;
677
                $item_format = $1;
670
                $item_format = $1;
678
            }
671
            }
679
            if ($params->{'letter'}->{'content'} =~ m/<fine>(.*)<\/fine>/) { # process any fine tags...
680
                my $formatted_fine = currency_format("$1", "$fine", FMT_SYMBOL);
681
                $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/$formatted_fine/;
682
            }
683
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblio',      $item->{'biblionumber'} );
684
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $item->{'biblionumber'} );
685
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'items', $item->{'itemnumber'} );
686
            $params->{'letter'}->{'content'} =~ s/(<item>.*<\/item>)/$1\n$item_format/ if scalar(@{$params->{'items'}} > 0);
687
672
673
            $item->{'fine'} = currency_format($currency_format, "$fine", FMT_SYMBOL)
674
              if $currency_format;
675
676
            push @item_tables, {
677
                'biblio' => $item->{'biblionumber'},
678
                'biblioitems' => $item->{'biblionumber'},
679
                'items' => $item,
680
            };
688
        }
681
        }
689
    }
682
    }
690
    $params->{'letter'}->{'content'} =~ s/<\/{0,1}?item>//g; # strip all remaining item tags...
683
691
    return $params->{'letter'};
684
    return C4::Letters::GetPreparedLetter (
685
        module => 'circulation',
686
        letter_code => $params->{'letter_code'},
687
        branchcode => $params->{'branchcode'},
688
        tables => \%tables,
689
        substitute => $substitute,
690
        repeat => { item => \@item_tables },
691
    );
692
}
692
}
693
693
694
=head2 prepare_letter_for_printing
694
=head2 prepare_letter_for_printing
(-)a/t/db_dependent/lib/KohaTest/Letters.pm (-3 / +2 lines)
Lines 12-24 sub testing_class { 'C4::Letters' }; Link Here
12
12
13
sub methods : Test( 1 ) {
13
sub methods : Test( 1 ) {
14
    my $self = shift;
14
    my $self = shift;
15
    my @methods = qw( getletter
15
    my @methods = qw( addalert
16
                      addalert
17
                      delalert
16
                      delalert
18
                      getalert
17
                      getalert
19
                      findrelatedto
18
                      findrelatedto
20
                      SendAlerts
19
                      SendAlerts
21
                      parseletter
20
                      GetPreparedLetter
22
                );
21
                );
23
    
22
    
24
    can_ok( $self->testing_class, @methods );    
23
    can_ok( $self->testing_class, @methods );    
(-)a/t/db_dependent/lib/KohaTest/Letters/GetLetter.pm (-2 / +1 lines)
Lines 10-16 use Test::More; Link Here
10
sub GetLetter : Test( 6 ) {
10
sub GetLetter : Test( 6 ) {
11
    my $self = shift;
11
    my $self = shift;
12
12
13
    my $letter = getletter( 'circulation', 'ODUE' );
13
    my $letter = getletter( 'circulation', 'ODUE', '' );
14
14
15
    isa_ok( $letter, 'HASH' )
15
    isa_ok( $letter, 'HASH' )
16
      or diag( Data::Dumper->Dump( [ $letter ], [ 'letter' ] ) );
16
      or diag( Data::Dumper->Dump( [ $letter ], [ 'letter' ] ) );
Lines 21-27 sub GetLetter : Test( 6 ) { Link Here
21
    ok( exists $letter->{'name'}, 'name' );
21
    ok( exists $letter->{'name'}, 'name' );
22
    ok( exists $letter->{'title'}, 'title' );
22
    ok( exists $letter->{'title'}, 'title' );
23
23
24
25
}
24
}
26
25
27
1;
26
1;
(-)a/t/db_dependent/lib/KohaTest/Members.pm (+1 lines)
Lines 52-57 sub methods : Test( 1 ) { Link Here
52
                      GetBorrowersWhoHaveNeverBorrowed 
52
                      GetBorrowersWhoHaveNeverBorrowed 
53
                      GetBorrowersWithIssuesHistoryOlderThan 
53
                      GetBorrowersWithIssuesHistoryOlderThan 
54
                      GetBorrowersNamesAndLatestIssue 
54
                      GetBorrowersNamesAndLatestIssue 
55
                      IssueSlip
55
                );
56
                );
56
    
57
    
57
    can_ok( $self->testing_class, @methods );    
58
    can_ok( $self->testing_class, @methods );    
(-)a/t/db_dependent/lib/KohaTest/Print.pm (-4 / +1 lines)
Lines 12-21 sub testing_class { 'C4::Print' }; Link Here
12
12
13
sub methods : Test( 1 ) {
13
sub methods : Test( 1 ) {
14
    my $self = shift;
14
    my $self = shift;
15
    my @methods = qw( remoteprint
15
    my @methods = qw( printslip );
16
                      printreserve 
17
                      printslip
18
                );
19
    
16
    
20
    can_ok( $self->testing_class, @methods );    
17
    can_ok( $self->testing_class, @methods );    
21
}
18
}
(-)a/t/db_dependent/lib/KohaTest/Reserves.pm (+1 lines)
Lines 32-37 sub methods : Test( 1 ) { Link Here
32
                       GetReserveInfo 
32
                       GetReserveInfo 
33
                       _FixPriority 
33
                       _FixPriority 
34
                       _Findgroupreserve 
34
                       _Findgroupreserve 
35
                       ReserveSlip
35
                );
36
                );
36
    
37
    
37
    can_ok( $self->testing_class, @methods );    
38
    can_ok( $self->testing_class, @methods );    
(-)a/tools/letter.pl (-68 / +137 lines)
Lines 46-59 use CGI; Link Here
46
use C4::Auth;
46
use C4::Auth;
47
use C4::Context;
47
use C4::Context;
48
use C4::Output;
48
use C4::Output;
49
use C4::Branch; # GetBranches
49
50
50
# letter_exists($module, $code)
51
# _letter_from_where($branchcode,$module, $code)
51
# - return true if a letter with the given $module and $code exists
52
# - return FROM WHERE clause and bind args for a letter
53
sub _letter_from_where {
54
    my ($branchcode, $module, $code) = @_;
55
    my $sql = q{FROM letter WHERE branchcode = ? AND module = ? AND code = ?};
56
    my @args = ($branchcode || '', $module, $code);
57
# Mysql is retarded. cause branchcode is part of the primary key it cannot be null. How does that
58
# work with foreign key constraint I wonder...
59
60
#   if ($branchcode) {
61
#       $sql .= " AND branchcode = ?";
62
#       push @args, $branchcode;
63
#   } else {
64
#       $sql .= " AND branchcode IS NULL";
65
#   }
66
67
    return ($sql, \@args);
68
}
69
70
# letter_exists($branchcode,$module, $code)
71
# - return true if a letter with the given $branchcode, $module and $code exists
52
sub letter_exists {
72
sub letter_exists {
53
    my ($module, $code) = @_;
73
    my ($sql, $args) = _letter_from_where(@_);
54
    my $dbh = C4::Context->dbh;
74
    my $dbh = C4::Context->dbh;
55
    my $letters = $dbh->selectall_arrayref(q{SELECT name FROM letter WHERE module = ? AND code = ?}, undef, $module, $code);
75
    my $letter = $dbh->selectrow_hashref("SELECT * $sql", undef, @$args);
56
    return @{$letters};
76
    return $letter;
57
}
77
}
58
78
59
# $protected_letters = protected_letters()
79
# $protected_letters = protected_letters()
Lines 67-80 sub protected_letters { Link Here
67
my $input       = new CGI;
87
my $input       = new CGI;
68
my $searchfield = $input->param('searchfield');
88
my $searchfield = $input->param('searchfield');
69
my $script_name = '/cgi-bin/koha/tools/letter.pl';
89
my $script_name = '/cgi-bin/koha/tools/letter.pl';
90
my $branchcode  = $input->param('branchcode');
70
my $code        = $input->param('code');
91
my $code        = $input->param('code');
71
my $module      = $input->param('module');
92
my $module      = $input->param('module');
72
my $content     = $input->param('content');
93
my $content     = $input->param('content');
73
my $op          = $input->param('op');
94
my $op          = $input->param('op') || '';
74
my $dbh = C4::Context->dbh;
95
my $dbh = C4::Context->dbh;
75
if (!defined $module ) {
76
    $module = q{};
77
}
78
96
79
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
97
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
80
    {
98
    {
Lines 87-95 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
87
    }
105
    }
88
);
106
);
89
107
90
if (!defined $op) {
91
    $op = q{}; # silence errors from eq
92
}
93
# we show only the TMPL_VAR names $op
108
# we show only the TMPL_VAR names $op
94
109
95
$template->param(
110
$template->param(
Lines 97-118 $template->param( Link Here
97
	action => $script_name
112
	action => $script_name
98
);
113
);
99
114
115
if ($op eq 'copy') {
116
    add_copy();
117
    $op = 'add_form';
118
}
119
100
if ($op eq 'add_form') {
120
if ($op eq 'add_form') {
101
    add_form($module, $code);
121
    add_form($branchcode, $module, $code);
102
}
122
}
103
elsif ( $op eq 'add_validate' ) {
123
elsif ( $op eq 'add_validate' ) {
104
    add_validate();
124
    add_validate();
105
    $op = q{}; # next operation is to return to default screen
125
    $op = q{}; # next operation is to return to default screen
106
}
126
}
107
elsif ( $op eq 'delete_confirm' ) {
127
elsif ( $op eq 'delete_confirm' ) {
108
    delete_confirm($module, $code);
128
    delete_confirm($branchcode, $module, $code);
109
}
129
}
110
elsif ( $op eq 'delete_confirmed' ) {
130
elsif ( $op eq 'delete_confirmed' ) {
111
    delete_confirmed($module, $code);
131
    delete_confirmed($branchcode, $module, $code);
112
    $op = q{}; # next operation is to return to default screen
132
    $op = q{}; # next operation is to return to default screen
113
}
133
}
114
else {
134
else {
115
    default_display($searchfield);
135
    default_display($branchcode,$searchfield);
116
}
136
}
117
137
118
# Do this last as delete_confirmed resets
138
# Do this last as delete_confirmed resets
Lines 125-147 if ($op) { Link Here
125
output_html_with_http_headers $input, $cookie, $template->output;
145
output_html_with_http_headers $input, $cookie, $template->output;
126
146
127
sub add_form {
147
sub add_form {
128
    my ($module, $code ) = @_;
148
    my ($branchcode,$module, $code ) = @_;
129
149
130
    my $letter;
150
    my $letter;
131
    # if code has been passed we can identify letter and its an update action
151
    # if code has been passed we can identify letter and its an update action
132
    if ($code) {
152
    if ($code) {
133
        $letter = $dbh->selectrow_hashref(q{SELECT module, code, name, title, content FROM letter WHERE module=? AND code=?},
153
        $letter = letter_exists($branchcode,$module, $code);
134
            undef, $module, $code);
154
    }
155
    if ($letter) {
135
        $template->param( modify => 1 );
156
        $template->param( modify => 1 );
136
        $template->param( code   => $letter->{code} );
157
        $template->param( code   => $letter->{code} );
137
    }
158
    }
138
    else { # initialize the new fields
159
    else { # initialize the new fields
139
        $letter = {
160
        $letter = {
140
            module  => $module,
161
            branchcode => $branchcode,
141
            code    => q{},
162
            module     => $module,
142
            name    => q{},
143
            title   => q{},
144
            content => q{},
145
        };
163
        };
146
        $template->param( adding => 1 );
164
        $template->param( adding => 1 );
147
    }
165
    }
Lines 173-186 sub add_form { Link Here
173
            {value => q{},             text => '---ITEMS---'  },
191
            {value => q{},             text => '---ITEMS---'  },
174
            {value => 'items.content', text => 'items.content'},
192
            {value => 'items.content', text => 'items.content'},
175
            add_fields('issues','borrowers');
193
            add_fields('issues','borrowers');
194
        if ($module eq 'circulation') {
195
            push @{$field_selection}, add_fields('opac_news');
196
        }
176
    }
197
    }
177
198
178
    $template->param(
199
    $template->param(
179
        name    => $letter->{name},
200
        branchcode => $letter->{branchcode},
180
        title   => $letter->{title},
201
        name       => $letter->{name},
181
        content => $letter->{content},
202
        is_html    => $letter->{is_html},
182
        module  => $module,
203
        title      => $letter->{title},
183
        $module => 1,
204
        content    => $letter->{content},
205
        module     => $module,
206
        $module    => 1,
207
        branchloop => _branchloop($branchcode),
184
        SQLfieldname => $field_selection,
208
        SQLfieldname => $field_selection,
185
    );
209
    );
186
    return;
210
    return;
Lines 188-224 sub add_form { Link Here
188
212
189
sub add_validate {
213
sub add_validate {
190
    my $dbh        = C4::Context->dbh;
214
    my $dbh        = C4::Context->dbh;
191
    my $module     = $input->param('module');
215
    my $oldbranchcode = $input->param('oldbranchcode');
192
    my $oldmodule  = $input->param('oldmodule');
216
    my $branchcode    = $input->param('branchcode') || '';
193
    my $code       = $input->param('code');
217
    my $module        = $input->param('module');
194
    my $name       = $input->param('name');
218
    my $oldmodule     = $input->param('oldmodule');
195
    my $title      = $input->param('title');
219
    my $code          = $input->param('code');
196
    my $content    = $input->param('content');
220
    my $name          = $input->param('name');
197
    if (letter_exists($oldmodule, $code)) {
221
    my $is_html       = $input->param('is_html');
222
    my $title         = $input->param('title');
223
    my $content       = $input->param('content');
224
    if (letter_exists($oldbranchcode,$oldmodule, $code)) {
198
        $dbh->do(
225
        $dbh->do(
199
            q{UPDATE letter SET module = ?, code = ?, name = ?, title = ?, content = ? WHERE module = ? AND code = ?},
226
            q{UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ? WHERE branchcode = ? AND module = ? AND code = ?},
200
            undef,
227
            undef,
201
            $module, $code, $name, $title, $content,
228
            $branchcode, $module, $name, $is_html || 0, $title, $content,
202
            $oldmodule, $code
229
            $oldbranchcode, $oldmodule, $code
203
        );
230
        );
204
    } else {
231
    } else {
205
        $dbh->do(
232
        $dbh->do(
206
            q{INSERT INTO letter (module,code,name,title,content) VALUES (?,?,?,?,?)},
233
            q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)},
207
            undef,
234
            undef,
208
            $module, $code, $name, $title, $content
235
            $branchcode, $module, $code, $name, $is_html || 0, $title, $content
209
        );
236
        );
210
    }
237
    }
211
    # set up default display
238
    # set up default display
212
    default_display();
239
    default_display($branchcode);
213
    return;
240
}
241
242
sub add_copy {
243
    my $dbh        = C4::Context->dbh;
244
    my $oldbranchcode = $input->param('oldbranchcode');
245
    my $branchcode    = $input->param('branchcode');
246
    my $module        = $input->param('module');
247
    my $code          = $input->param('code');
248
249
    return if letter_exists($branchcode,$module, $code);
250
251
    my $old_letter = letter_exists($oldbranchcode,$module, $code);
252
253
    $dbh->do(
254
        q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)},
255
        undef,
256
        $branchcode, $module, $code, $old_letter->{name}, $old_letter->{is_html}, $old_letter->{title}, $old_letter->{content}
257
    );
214
}
258
}
215
259
216
sub delete_confirm {
260
sub delete_confirm {
217
    my ($module, $code) = @_;
261
    my ($branchcode, $module, $code) = @_;
218
    my $dbh = C4::Context->dbh;
262
    my $dbh = C4::Context->dbh;
219
    my $letter = $dbh->selectrow_hashref(q|SELECT  name FROM letter WHERE module = ? AND code = ?|,
263
    my $letter = letter_exists($branchcode, $module, $code);
220
        { Slice => {} },
264
    $template->param( branchcode => $branchcode );
221
        $module, $code);
222
    $template->param( code => $code );
265
    $template->param( code => $code );
223
    $template->param( module => $module);
266
    $template->param( module => $module);
224
    $template->param( name => $letter->{name});
267
    $template->param( name => $letter->{name});
Lines 226-265 sub delete_confirm { Link Here
226
}
269
}
227
270
228
sub delete_confirmed {
271
sub delete_confirmed {
229
    my ($module, $code) = @_;
272
    my ($branchcode, $module, $code) = @_;
273
    my ($sql, $args) = _letter_from_where($branchcode, $module, $code);
230
    my $dbh    = C4::Context->dbh;
274
    my $dbh    = C4::Context->dbh;
231
    $dbh->do('DELETE FROM letter WHERE module=? AND code=?',{},$module,$code);
275
    $dbh->do("DELETE $sql", undef, @$args);
232
    # setup default display for screen
276
    # setup default display for screen
233
    default_display();
277
    default_display($branchcode);
234
    return;
278
    return;
235
}
279
}
236
280
237
sub retrieve_letters {
281
sub retrieve_letters {
238
    my $searchstring = shift;
282
    my ($branchcode, $searchstring) = @_;
283
239
    my $dbh = C4::Context->dbh;
284
    my $dbh = C4::Context->dbh;
240
    if ($searchstring) {
285
    my ($sql, @where, @args);
241
        if ($searchstring=~m/(\S+)/) {
286
    $sql = "SELECT branchcode, module, code, name, branchname
242
            $searchstring = $1 . q{%};
287
            FROM letter
243
            return $dbh->selectall_arrayref('SELECT module, code, name FROM letter WHERE code LIKE ? ORDER BY module, code',
288
            LEFT OUTER JOIN branches USING (branchcode)";
244
                { Slice => {} }, $searchstring);
289
    if ($searchstring && $searchstring=~m/(\S+)/) {
245
        }
290
        $searchstring = $1 . q{%};
291
        push @where, 'code LIKE ?';
292
        push @args, $searchstring;
246
    }
293
    }
247
    else {
294
    elsif ($branchcode) {
248
        return $dbh->selectall_arrayref('SELECT module, code, name FROM letter ORDER BY module, code', { Slice => {} });
295
        push @where, 'branchcode = ?';
296
        push @args, $branchcode || '';
249
    }
297
    }
250
    return;
298
299
    $sql .= " WHERE ".join(" AND ", @where) if @where;
300
    $sql .= " ORDER BY module, code, branchcode";
301
#   use Data::Dumper; die Dumper($sql, \@args);
302
    return $dbh->selectall_arrayref($sql, { Slice => {} }, @args);
251
}
303
}
252
304
253
sub default_display {
305
sub default_display {
254
    my $searchfield = shift;
306
    my ($branchcode, $searchfield) = @_;
255
    my $results;
307
256
    if ( $searchfield  ) {
308
    if ( $searchfield  ) {
257
        $template->param( search      => 1 );
309
        $template->param( search      => 1 );
258
        $template->param( searchfield => $searchfield );
310
        $template->param( searchfield => $searchfield );
259
        $results = retrieve_letters($searchfield);
260
    } else {
261
        $results = retrieve_letters();
262
    }
311
    }
312
    my $results = retrieve_letters($branchcode,$searchfield);
313
263
    my $loop_data = [];
314
    my $loop_data = [];
264
    my $protected_letters = protected_letters();
315
    my $protected_letters = protected_letters();
265
    foreach my $row (@{$results}) {
316
    foreach my $row (@{$results}) {
Lines 267-274 sub default_display { Link Here
267
        push @{$loop_data}, $row;
318
        push @{$loop_data}, $row;
268
319
269
    }
320
    }
270
    $template->param( letter => $loop_data );
321
271
    return;
322
    $template->param(
323
        letter => $loop_data,
324
        branchloop => _branchloop($branchcode),
325
    );
326
}
327
328
sub _branchloop {
329
    my ($branchcode) = @_;
330
331
    my $branches = GetBranches();
332
    my @branchloop;
333
    for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
334
        push @branchloop, {
335
            value      => $thisbranch,
336
            selected   => $branchcode && $thisbranch eq $branchcode,
337
            branchname => $branches->{$thisbranch}->{'branchname'},
338
        };
339
    }
340
341
    return \@branchloop;
272
}
342
}
273
343
274
sub add_fields {
344
sub add_fields {
275
- 

Return to bug 7001