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

(-)a/C4/Circulation.pm (-6 / +14 lines)
Lines 2655-2665 sub SendCirculationAlert { Link Here
2655
        borrowernumber => $borrower->{borrowernumber},
2655
        borrowernumber => $borrower->{borrowernumber},
2656
        message_name   => $message_name{$type},
2656
        message_name   => $message_name{$type},
2657
    });
2657
    });
2658
    my $letter = C4::Letters::getletter('circulation', $type);
2658
    my $letter =  C4::Letters::GetPreparedLetter (
2659
    C4::Letters::parseletter($letter, 'biblio',      $item->{biblionumber});
2659
        module => 'circulation',
2660
    C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber});
2660
        letter_code => $type,
2661
    C4::Letters::parseletter($letter, 'borrowers',   $borrower->{borrowernumber});
2661
        branchcode => $branch,
2662
    C4::Letters::parseletter($letter, 'branches',    $branch);
2662
        tables => {
2663
            'biblio'      => $item->{biblionumber},
2664
            'biblioitems' => $item->{biblionumber},
2665
            'borrowers'   => $borrower,
2666
            'branches'    => $branch,
2667
        }
2668
    ) or return;
2669
2663
    my @transports = @{ $borrower_preferences->{transports} };
2670
    my @transports = @{ $borrower_preferences->{transports} };
2664
    # warn "no transports" unless @transports;
2671
    # warn "no transports" unless @transports;
2665
    for (@transports) {
2672
    for (@transports) {
Lines 2674-2680 sub SendCirculationAlert { Link Here
2674
            $message->update;
2681
            $message->update;
2675
        }
2682
        }
2676
    }
2683
    }
2677
    $letter;
2684
2685
    return $letter;
2678
}
2686
}
2679
2687
2680
=head2 updateWrongTransfer
2688
=head2 updateWrongTransfer
(-)a/C4/Letters.pm (-204 / +379 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 494-502 sub parseletter_sth { Link Here
494
    ($table eq 'borrowers'    ) ? "SELECT * FROM $table WHERE borrowernumber = ?"                      :
610
    ($table eq 'borrowers'    ) ? "SELECT * FROM $table WHERE borrowernumber = ?"                      :
495
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                      :
611
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                      :
496
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                      :
612
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                      :
497
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                      : undef ;
613
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                      :
614
    ($table eq 'aqorders'     ) ? "SELECT * FROM $table WHERE    ordernumber = ?"                      :
615
    ($table eq 'opac_news'    ) ? "SELECT * FROM $table WHERE          idnew = ?"                      :
616
    undef ;
498
    unless ($query) {
617
    unless ($query) {
499
        warn "ERROR: No parseletter_sth query for table '$table'";
618
        warn "ERROR: No _parseletter_sth query for table '$table'";
500
        return;     # nothing to get
619
        return;     # nothing to get
501
    }
620
    }
502
    unless ($handles{$table} = C4::Context->dbh->prepare($query)) {
621
    unless ($handles{$table} = C4::Context->dbh->prepare($query)) {
Lines 506-530 sub parseletter_sth { Link Here
506
    return $handles{$table};    # now cache is populated for that $table
625
    return $handles{$table};    # now cache is populated for that $table
507
}
626
}
508
627
509
sub parseletter {
628
=head2 _parseletter($letter, $table, $values)
510
    my ( $letter, $table, $pk, $pk2 ) = @_;
511
    unless ($letter) {
512
        carp "ERROR: parseletter() 1st argument 'letter' empty";
513
        return;
514
    }
515
    my $sth = parseletter_sth($table);
516
    unless ($sth) {
517
        warn "parseletter_sth('$table') failed to return a valid sth.  No substitution will be done for that table.";
518
        return;
519
    }
520
    if ( $pk2 ) {
521
        $sth->execute($pk, $pk2);
522
    } else {
523
        $sth->execute($pk);
524
    }
525
629
526
    my $values = $sth->fetchrow_hashref;
630
    parameters :
527
    
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
   
528
    # TEMPORARY hack until the expirationdate column is added to reserves
643
    # TEMPORARY hack until the expirationdate column is added to reserves
529
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
644
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
530
        my @waitingdate = split /-/, $values->{'waitingdate'};
645
        my @waitingdate = split /-/, $values->{'waitingdate'};
Lines 538-553 sub parseletter { Link Here
538
        )->output();
653
        )->output();
539
    }
654
    }
540
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
    }
541
661
542
    # and get all fields from the table
662
    # and get all fields from the table
543
    my $columns = C4::Context->dbh->prepare("SHOW COLUMNS FROM $table");
663
#   my $columns = $columns{$table};
544
    $columns->execute;
664
#   unless ($columns) {
545
    while ( ( my $field ) = $columns->fetchrow_array ) {
665
#       $columns = $columns{$table} =  C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table");
546
        my $replacefield = "<<$table.$field>>";
666
#   }
547
        $values->{$field} =~ s/\p{P}(?=$)//g if $values->{$field};
667
#   foreach my $field (@$columns) {
548
        my $replacedby   = $values->{$field} || '';
668
549
        ($letter->{title}  ) and $letter->{title}   =~ s/$replacefield/$replacedby/g;
669
    while ( my ($field, $val) = each %$values ) {
550
        ($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
        }
551
    }
701
    }
552
    return $letter;
702
    return $letter;
553
}
703
}
Lines 732-762 returns your letter object, with the content updated. Link Here
732
sub _add_attachments {
882
sub _add_attachments {
733
    my $params = shift;
883
    my $params = shift;
734
884
735
    return unless 'HASH' eq ref $params;
885
    my $letter = $params->{'letter'};
736
    foreach my $required_parameter (qw( letter attachments message )) {
886
    my $attachments = $params->{'attachments'};
737
        return unless exists $params->{$required_parameter};
887
    return $letter unless @$attachments;
738
    }
888
    my $message = $params->{'message'};
739
    return $params->{'letter'} unless @{ $params->{'attachments'} };
740
889
741
    # 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
742
    $params->{'message'}->attach(
891
    $message->attach(
743
        Type => 'TEXT',
892
        Type => $letter->{'content-type'} || 'TEXT',
744
        Data => $params->{'letter'}->{'content'},
893
        Data => $letter->{'is_html'}
894
            ? _wrap_html($letter->{'content'}, $letter->{'title'})
895
            : $letter->{'content'},
745
    );
896
    );
746
897
747
    foreach my $attachment ( @{ $params->{'attachments'} } ) {
898
    foreach my $attachment ( @$attachments ) {
748
        $params->{'message'}->attach(
899
        $message->attach(
749
            Type     => $attachment->{'type'},
900
            Type     => $attachment->{'type'},
750
            Data     => $attachment->{'content'},
901
            Data     => $attachment->{'content'},
751
            Filename => $attachment->{'filename'},
902
            Filename => $attachment->{'filename'},
752
        );
903
        );
753
    }
904
    }
754
    # 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.
755
    ( $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 ) );
756
    $params->{'letter'}->{'content-type'} =~ s/^Content-Type:\s+//;
907
    $letter->{'content-type'} =~ s/^Content-Type:\s+//;
757
    $params->{'letter'}->{'content'} = $params->{'message'}->body_as_string;
908
    $letter->{'content'} = $message->body_as_string;
758
909
759
    return $params->{'letter'};
910
    return $letter;
760
911
761
}
912
}
762
913
Lines 823-836 sub _send_message_by_email ($;$$$) { Link Here
823
974
824
    my $utf8   = decode('MIME-Header', $message->{'subject'} );
975
    my $utf8   = decode('MIME-Header', $message->{'subject'} );
825
    $message->{subject}= encode('MIME-Header', $utf8);
976
    $message->{subject}= encode('MIME-Header', $utf8);
977
    my $subject = encode('utf8', $message->{'subject'});
826
    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;
827
    my %sendmail_params = (
981
    my %sendmail_params = (
828
        To   => $to_address,
982
        To   => $to_address,
829
        From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'),
983
        From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'),
830
        Subject => encode('utf8', $message->{'subject'}),
984
        Subject => $subject,
831
        charset => 'utf8',
985
        charset => 'utf8',
832
        Message => $content,
986
        Message => $is_html ? _wrap_html($content, $subject) : $content,
833
        'content-type' => $message->{'content_type'} || 'text/plain; charset="UTF-8"',
987
        'content-type' => $content_type,
834
    );
988
    );
835
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
989
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
836
    if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) {
990
    if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) {
Lines 850-855 sub _send_message_by_email ($;$$$) { Link Here
850
    }
1004
    }
851
}
1005
}
852
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
853
sub _send_message_by_sms ($) {
1028
sub _send_message_by_sms ($) {
854
    my $message = shift or return undef;
1029
    my $message = shift or return undef;
855
    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 check_date Date_to_Days/;
28
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
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 2227-2233 sub DeleteMessage { Link Here
2227
    logaction("MEMBERS", "DELCIRCMESSAGE", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog");
2231
    logaction("MEMBERS", "DELCIRCMESSAGE", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog");
2228
}
2232
}
2229
2233
2230
END { }    # module clean-up code here (global destructor)
2234
=head2 IssueSlip
2235
2236
  IssueSlip($branchcode, $borrowernumber, $quickslip)
2237
2238
  Returns letter hash ( see C4::Letters::GetPreparedLetter )
2239
2240
  $quickslip is boolean, to indicate whether we want a quick slip
2241
2242
=cut
2243
2244
sub IssueSlip {
2245
    my ($branch, $borrowernumber, $quickslip) = @_;
2246
2247
#   return unless ( C4::Context->boolean_preference('printcirculationslips') );
2248
2249
    my $today       = POSIX::strftime("%Y-%m-%d", localtime);
2250
2251
    my $issueslist = GetPendingIssues($borrowernumber);
2252
    foreach my $it (@$issueslist){
2253
        if ($it->{'issuedate'} eq $today) {
2254
            $it->{'today'} = 1;
2255
        }
2256
        elsif ($it->{'date_due'} le $today) {
2257
            $it->{'overdue'} = 1;
2258
        }
2259
2260
        $it->{'date_due'}=format_date($it->{'date_due'});
2261
    }
2262
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
2263
2264
    my ($letter_code, %repeat);
2265
    if ( $quickslip ) {
2266
        $letter_code = 'ISSUEQSLIP';
2267
        %repeat =  (
2268
            'checkedout' => [ map {
2269
                'biblio' => $_,
2270
                'items'  => $_,
2271
                'issues' => $_,
2272
            }, grep { $_->{'today'} } @issues ],
2273
        );
2274
    }
2275
    else {
2276
        $letter_code = 'ISSUESLIP';
2277
        %repeat =  (
2278
            'checkedout' => [ map {
2279
                'biblio' => $_,
2280
                'items'  => $_,
2281
                'issues' => $_,
2282
            }, grep { !$_->{'overdue'} } @issues ],
2283
2284
            'overdue' => [ map {
2285
                'biblio' => $_,
2286
                'items'  => $_,
2287
                'issues' => $_,
2288
            }, grep { $_->{'overdue'} } @issues ],
2289
2290
            'news' => [ map {
2291
                $_->{'timestamp'} = $_->{'newdate'};
2292
                { opac_news => $_ }
2293
            } @{ GetNewsToDisplay("slip") } ],
2294
        );
2295
    }
2296
2297
    return  C4::Letters::GetPreparedLetter (
2298
        module => 'circulation',
2299
        letter_code => $letter_code,
2300
        branchcode => $branch,
2301
        tables => {
2302
            'branches'    => $branch,
2303
            'borrowers'   => $borrowernumber,
2304
        },
2305
        repeat => \%repeat,
2306
    );
2307
}
2231
2308
2232
1;
2309
1;
2233
2310
(-)a/C4/Members/Attributes.pm (+18 lines)
Lines 95-100 sub GetBorrowerAttributes { Link Here
95
    return \@results;
95
    return \@results;
96
}
96
}
97
97
98
=head2 GetAttributes
99
100
  my $attributes = C4::Members::Attributes::GetAttributes([$opac_only]);
101
102
Retrieve an arrayref of extended attribute codes
103
104
=cut
105
106
sub GetAttributes {
107
    my ($opac_only) = @_;
108
109
    my $dbh = C4::Context->dbh();
110
    my $query = "SELECT code FROM borrower_attribute_types";
111
    $query .= "\nWHERE opac_display = 1" if $opac_only;
112
    $query .= "\nORDER BY code";
113
    return $dbh->selectcol_arrayref($query);
114
}
115
98
=head2 GetBorrowerAttributeValue
116
=head2 GetBorrowerAttributeValue
99
117
100
  my $value = C4::Members::Attributes::GetBorrowerAttributeValue($borrowernumber, $attribute_code);
118
  my $value = C4::Members::Attributes::GetBorrowerAttributeValue($borrowernumber, $attribute_code);
(-)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 (-111 / +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'}
55
58
56
C<$borrower> is a reference-to-hash giving information about a patron.
59
COLLECT AT: $branchname
57
This may be gotten from C<&GetMemberDetails>. The patron's name
60
58
will be printed in the output.
61
BORROWER:
62
$bordata->{'surname'}, $bordata->{'firstname'}
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 94-200 sub remoteprint ($$) { Link Here
94
112
95
    #  print $queue;
113
    #  print $queue;
96
    #open (FILE,">/tmp/$file");
114
    #open (FILE,">/tmp/$file");
97
    my $i      = 0;
115
    print PRINTER $slip;
98
    # FIXME - This is HLT-specific. Put this stuff in a customizable
99
    # site-specific file somewhere.
100
    print PRINTER "Horowhenua Library Trust\r\n";
101
    print PRINTER "Phone: 368-1953\r\n";
102
    print PRINTER "Fax:    367-9218\r\n";
103
    print PRINTER "Email:  renewals\@library.org.nz\r\n\r\n\r\n";
104
    print PRINTER "$borrower->{'cardnumber'}\r\n";
105
    print PRINTER
106
      "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
107
108
    # FIXME - Use   for ($i = 0; $items->[$i]; $i++)
109
    # Or better yet,   foreach $item (@{$items})
110
    while ( $items->[$i] ) {
111
112
        #    print $i;
113
        my $itemdata = $items->[$i];
114
115
        # FIXME - This is just begging for a Perl format.
116
        print PRINTER "$i $itemdata->{'title'}\r\n";
117
        print PRINTER "$itemdata->{'barcode'}";
118
        print PRINTER " " x 15;
119
        print PRINTER "$itemdata->{'date_due'}\r\n";
120
        $i++;
121
    }
122
    print PRINTER "\r\n" x 7 ;
116
    print PRINTER "\r\n" x 7 ;
123
    close PRINTER;
117
    close PRINTER;
124
118
125
    #system("lpr /tmp/$file");
119
    #system("lpr /tmp/$file");
126
}
120
}
127
121
128
sub printreserve {
129
130
    # FIXME - make useful
131
    return;
132
133
    my ( $branchname, $bordata, $itemdata ) = @_;
134
    my $printer = '';
135
    (return) unless ( C4::Context->boolean_preference('printreserveslips') );
136
    if ( $printer eq "" || $printer eq 'nulllp' ) {
137
        open( PRINTER, ">>/tmp/kohares" )
138
		  or die "Could not write to /tmp/kohares";
139
    }
140
    else {
141
        open( PRINTER, "| lpr -P $printer >/dev/null" )
142
          or die "Couldn't write to queue:$!\n";
143
    }
144
    my @da = localtime();
145
    my $todaysdate = "$da[2]:$da[1]  " . C4::Dates->today();
146
    my $slip = <<"EOF";
147
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148
Date: $todaysdate;
149
150
ITEM RESERVED: 
151
$itemdata->{'title'} ($itemdata->{'author'})
152
barcode: $itemdata->{'barcode'}
153
154
COLLECT AT: $branchname
155
156
BORROWER:
157
$bordata->{'surname'}, $bordata->{'firstname'}
158
card number: $bordata->{'cardnumber'}
159
Phone: $bordata->{'phone'}
160
$bordata->{'streetaddress'}
161
$bordata->{'suburb'}
162
$bordata->{'town'}
163
$bordata->{'emailaddress'}
164
165
166
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
EOF
168
    print PRINTER $slip;
169
    close PRINTER;
170
    return $slip;
171
}
172
173
=head2 printslip
174
175
  &printslip($borrowernumber)
176
177
print a slip for the given $borrowernumber
178
179
=cut
180
181
#'
182
sub printslip ($) {
183
184
    #FIXME - make useful
185
186
    my $borrowernumber = shift;
187
    my $borrower   = GetMemberDetails($borrowernumber);
188
	my $issueslist = GetPendingIssues($borrowernumber); 
189
	foreach my $it (@$issueslist){
190
		$it->{'date_due'}=format_date($it->{'date_due'});
191
    }		
192
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
193
    remoteprint(\@issues, $borrower );
194
}
195
196
END { }    # module clean-up code here (global destructor)
197
198
1;
122
1;
199
__END__
123
__END__
200
124
(-)a/C4/Reserves.pm (-36 / +67 lines)
Lines 121-126 BEGIN { Link Here
121
        
121
        
122
        &AlterPriority
122
        &AlterPriority
123
        &ToggleLowestPriority
123
        &ToggleLowestPriority
124
125
        &ReserveSlip
124
    );
126
    );
125
    @EXPORT_OK = qw( MergeHolds );
127
    @EXPORT_OK = qw( MergeHolds );
126
}    
128
}    
Lines 194-225 sub AddReserve { Link Here
194
    # Send e-mail to librarian if syspref is active
196
    # Send e-mail to librarian if syspref is active
195
    if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
197
    if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
196
        my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
198
        my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
197
        my $biblio   = GetBiblioData($biblionumber);
199
        my $branch_details = C4::Branch::GetBranchDetail($borrower->{branchcode});
198
        my $letter = C4::Letters::getletter( 'reserves', 'HOLDPLACED');
200
        if ( my $letter =  C4::Letters::GetPreparedLetter (
199
	my $branchcode = $borrower->{branchcode};
201
            module => 'reserves',
200
        my $branch_details = C4::Branch::GetBranchDetail($branchcode);
202
            letter_code => 'HOLDPLACED',
201
        my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
203
            branchcode => $branch,
202
204
            tables => {
203
        my %keys = (%$borrower, %$biblio);
205
                'branches'  => $branch_details,
204
        foreach my $key (keys %keys) {
206
                'borrowers' => $borrower,
205
            my $replacefield = "<<$key>>";
207
                'biblio'    => $biblionumber,
206
            $letter->{content} =~ s/$replacefield/$keys{$key}/g;
208
            },
207
            $letter->{title} =~ s/$replacefield/$keys{$key}/g;
209
        ) ) {
210
211
            my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
212
213
            C4::Letters::EnqueueLetter(
214
                {   letter                 => $letter,
215
                    borrowernumber         => $borrowernumber,
216
                    message_transport_type => 'email',
217
                    from_address           => $admin_email_address,
218
                    to_address           => $admin_email_address,
219
                }
220
            );
208
        }
221
        }
209
        
210
        C4::Letters::EnqueueLetter(
211
                            {   letter                 => $letter,
212
                                borrowernumber         => $borrowernumber,
213
                                message_transport_type => 'email',
214
                                from_address           => $admin_email_address,
215
                                to_address           => $admin_email_address,
216
                            }
217
                        );
218
        
219
220
    }
222
    }
221
223
222
223
    #}
224
    #}
224
    ($const eq "o" || $const eq "e") or return;   # FIXME: why not have a useful return value?
225
    ($const eq "o" || $const eq "e") or return;   # FIXME: why not have a useful return value?
225
    $query = qq/
226
    $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 1908-1913 sub MergeHolds { Link Here
1908
}
1909
}
1909
1910
1910
1911
1912
=head2 ReserveSlip
1913
1914
  ReserveSlip($branchcode, $borrowernumber, $biblionumber)
1915
1916
  Returns letter hash ( see C4::Letters::GetPreparedLetter ) or undef
1917
1918
=cut
1919
1920
sub ReserveSlip {
1921
    my ($branch, $borrowernumber, $biblionumber) = @_;
1922
1923
#   return unless ( C4::Context->boolean_preference('printreserveslips') );
1924
1925
    my $reserve = GetReserveInfo($borrowernumber,$biblionumber )
1926
      or return;
1927
1928
    return  C4::Letters::GetPreparedLetter (
1929
        module => 'circulation',
1930
        letter_code => 'RESERVESLIP',
1931
        branchcode => $branch,
1932
        tables => {
1933
            'reserves'    => $reserve,
1934
            'branches'    => $reserve->{branchcode},
1935
            'borrowers'   => $reserve,
1936
            'biblio'      => $reserve,
1937
            'items'       => $reserve,
1938
        },
1939
    );
1940
}
1941
1911
=head1 AUTHOR
1942
=head1 AUTHOR
1912
1943
1913
Koha Development Team <http://koha-community.org/>
1944
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 (-6 / +1 lines)
Lines 111-126 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 = ''; # set a blank branch to start with
115
        if ( GetMember( borrowernumber => $authorisedby ) ) {
116
           # authorisedby may not be a valid borrowernumber; it's not foreign-key constrained!
117
           $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode};
118
        }
119
        
114
        
120
        if ($userenv->{'flags'} & 1 || #user is superlibrarian
115
        if ($userenv->{'flags'} & 1 || #user is superlibrarian
121
               (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and
116
               (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and
122
                   ($viewbaskets eq 'all' || #user is allowed to see all baskets
117
                   ($viewbaskets eq 'all' || #user is allowed to see all baskets
123
                   ($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
124
                   ($basket->{authorisedby} &&  $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket
119
                   ($basket->{authorisedby} &&  $viewbaskets == 'user' && $authorisedby == $loggedinuser) #user created this basket
125
                   ) 
120
                   ) 
126
                ) 
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 176-182 if ( $barcode eq '' && $query->param('charges') eq 'yes' ) { Link Here
176
}
175
}
177
176
178
if ( $print eq 'yes' && $borrowernumber ne '' ) {
177
if ( $print eq 'yes' && $borrowernumber ne '' ) {
179
    printslip( $borrowernumber );
178
    PrintIssueSlip($branch, $borrowernumber);
180
    $query->param( 'borrowernumber', '' );
179
    $query->param( 'borrowernumber', '' );
181
    $borrowernumber = '';
180
    $borrowernumber = '';
182
}
181
}
(-)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 (-2 / +5 lines)
Lines 1168-1177 DROP TABLE IF EXISTS `letter`; Link Here
1168
CREATE TABLE `letter` ( -- table for all notice templates in Koha
1168
CREATE TABLE `letter` ( -- table for all notice templates in Koha
1169
  `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1169
  `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1170
  `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1170
  `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1171
  `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1171
  `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1172
  `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1173
  `is_html` tinyint(1) default 0,
1172
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1174
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1173
  `content` text, -- body text for the notice
1175
  `content` text, -- body text for the notice
1174
  PRIMARY KEY  (`module`,`code`)
1176
  PRIMARY KEY  (`module`,`code`, `branchcode`)
1175
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1177
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1176
1178
1177
--
1179
--
Lines 2252-2263 CREATE TABLE `message_transports` ( Link Here
2252
  `is_digest` tinyint(1) NOT NULL default '0',
2254
  `is_digest` tinyint(1) NOT NULL default '0',
2253
  `letter_module` varchar(20) NOT NULL default '',
2255
  `letter_module` varchar(20) NOT NULL default '',
2254
  `letter_code` varchar(20) NOT NULL default '',
2256
  `letter_code` varchar(20) NOT NULL default '',
2257
  `branchcode` varchar(10) NOT NULL default '',
2255
  PRIMARY KEY  (`message_attribute_id`,`message_transport_type`,`is_digest`),
2258
  PRIMARY KEY  (`message_attribute_id`,`message_transport_type`,`is_digest`),
2256
  KEY `message_transport_type` (`message_transport_type`),
2259
  KEY `message_transport_type` (`message_transport_type`),
2257
  KEY `letter_module` (`letter_module`,`letter_code`),
2260
  KEY `letter_module` (`letter_module`,`letter_code`),
2258
  CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2261
  CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2259
  CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2262
  CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2260
  CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`) REFERENCES `letter` (`module`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
2263
  CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2261
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2264
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2262
2265
2263
--
2266
--
(-)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 330-332 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
330
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('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
331
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('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
332
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
332
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free');
335
(-)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 / +99 lines)
Lines 4497-4503 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4497
        print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
4497
        print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
4498
        SetVersion ($DBversion);
4498
        SetVersion ($DBversion);
4499
    }
4499
    }
4500
		
4501
}
4500
}
4502
4501
4503
$DBversion = "3.05.00.018";
4502
$DBversion = "3.05.00.018";
Lines 4605-4610 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4605
    SetVersion ($DBversion);
4604
    SetVersion ($DBversion);
4606
}
4605
}
4607
4606
4607
$DBversion = "3.07.00.XXX";
4608
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4609
    $dbh->do("ALTER TABLE `message_transports` DROP FOREIGN KEY `message_transports_ibfk_3`");
4610
    $dbh->do("ALTER TABLE `letter` DROP PRIMARY KEY");
4611
    $dbh->do("ALTER TABLE `letter` ADD `branchcode` varchar(10) default NULL AFTER `code`");
4612
    $dbh->do("ALTER TABLE `letter` ADD PRIMARY KEY  (`module`,`code`, `branchcode`)");
4613
    $dbh->do("ALTER TABLE `message_transports` ADD `branchcode` varchar(10) NOT NULL default ''");
4614
    $dbh->do("ALTER TABLE `message_transports` ADD CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE");
4615
    $dbh->do("ALTER TABLE `letter` ADD `is_html` tinyint(1) default 0 AFTER `name`");
4616
    print "Added branchcode and is_html to letter table\n";
4617
4618
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4619
              VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3>
4620
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
4621
(<<borrowers.cardnumber>>) <br />
4622
4623
<<today>><br />
4624
4625
<h4>Checked Out</h4>
4626
<checkedout>
4627
<p>
4628
<<biblio.title>> <br />
4629
Barcode: <<items.barcode>><br />
4630
Date due: <<issues.date_due>><br />
4631
</p>
4632
</checkedout>
4633
4634
<h4>Overdues</h4>
4635
<overdue>
4636
<p>
4637
<<biblio.title>> <br />
4638
Barcode: <<items.barcode>><br />
4639
Date due: <<issues.date_due>><br />
4640
</p>
4641
</overdue>
4642
4643
<hr>
4644
4645
<h4 style=\"text-align: center; font-style:italic;\">News</h4>
4646
<news>
4647
<div class=\"newsitem\">
4648
<h5 style=\"margin-bottom: 1px; margin-top: 1px\"><b><<opac_news.title>></b></h5>
4649
<p style=\"margin-bottom: 1px; margin-top: 1px\"><<opac_news.new>></p>
4650
<p class=\"newsfooter\" style=\"font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px\">Posted on <<opac_news.timestamp>></p>
4651
<hr />
4652
</div>
4653
</news>', 1)");
4654
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4655
              VALUES ('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3>
4656
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
4657
(<<borrowers.cardnumber>>) <br />
4658
4659
<<today>><br />
4660
4661
<h4>Checked Out Today</h4>
4662
<checkedout>
4663
<p>
4664
<<biblio.title>> <br />
4665
Barcode: <<items.barcode>><br />
4666
Date due: <<issues.date_due>><br />
4667
</p>
4668
</checkedout>', 1)");
4669
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4670
              VALUES ('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5>
4671
4672
<h3> Transfer to/Hold in <<branches.branchname>></h3>
4673
4674
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
4675
4676
<ul>
4677
    <li><<borrowers.cardnumber>></li>
4678
    <li><<borrowers.phone>></li>
4679
    <li> <<borrowers.address>><br />
4680
         <<borrowers.address2>><br />
4681
         <<borrowers.city >>  <<borrowers.zipcode>>
4682
    </li>
4683
    <li><<borrowers.email>></li>
4684
</ul>
4685
<br />
4686
<h3>ITEM ON HOLD</h3>
4687
<h4><<biblio.title>></h4>
4688
<h5><<biblio.author>></h5>
4689
<ul>
4690
   <li><<items.barcode>></li>
4691
   <li><<items.itemcallnumber>></li>
4692
   <li><<reserves.waitingdate>></li>
4693
</ul>
4694
<p>Notes:
4695
<pre><<reserves.reservenotes>></pre>
4696
</p>', 1)");
4697
4698
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free')");
4699
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free')");
4700
4701
    $dbh->do("UPDATE `letter` SET content = replace(content, '<<title>>', '<<biblio.title>>') WHERE code = 'HOLDPLACED'");
4702
4703
    print "Upgrade to $DBversion done (Add branchcode and is_html to letter table; Add NoticeCSS and SlipCSS sysprefs)\n";
4704
    SetVersion($DBversion);
4705
}
4608
4706
4609
=head1 FUNCTIONS
4707
=head1 FUNCTIONS
4610
4708
(-)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 98-103 Circulation: Link Here
98
                  yes: "open a print quick slip window"
98
                  yes: "open a print quick slip window"
99
                  no: "clear the screen"
99
                  no: "clear the screen"
100
            - .
100
            - .
101
        -
102
            - Include the stylesheet at
103
            - pref: NoticeCSS
104
              class: url
105
            - on Notices. (This should be a complete URL, starting with <code>http://</code>)
101
    Checkout Policy:
106
    Checkout Policy:
102
        -
107
        -
103
            - pref: AllowNotForLoanOverride
108
            - 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 (-44 / +113 lines)
Lines 5-18 Link Here
5
	<script type="text/javascript">
5
	<script type="text/javascript">
6
	//<![CDATA[
6
	//<![CDATA[
7
$(document).ready(function() {
7
$(document).ready(function() {
8
	$("#lettert").tablesorter({
8
	$("#lettert:has(tbody tr)").tablesorter({
9
		widgets : ['zebra'],
9
		widgets : ['zebra'],
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
            $('#op').val("");
16
            $('#selectlibrary').submit();
17
    });
18
    $('#newnotice').click(function() {
19
            $('#op').val("add_form");
20
            return true;
21
    });
13
}); 
22
}); 
14
[% IF ( add_form ) %]
23
[% IF ( add_form ) %]
15
	
24
	
25
    function cancel(f) {
26
        $('#op').val("");
27
        f.method = "get";
28
        f.submit();
29
    }
30
16
		function isNotNull(f,noalert) {
31
		function isNotNull(f,noalert) {
17
			if (f.value.length ==0) {
32
			if (f.value.length ==0) {
18
	return false;
33
	return false;
Lines 106-112 $(document).ready(function() { Link Here
106
[% INCLUDE 'header.inc' %]
121
[% INCLUDE 'header.inc' %]
107
[% INCLUDE 'letters-search.inc' %]
122
[% INCLUDE 'letters-search.inc' %]
108
123
109
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %][% IF ( modify ) %]<a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Add notice[% END %][% ELSE %][% IF ( add_validate ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Confirm Deletion[% ELSE %]Notices[% END %][% END %][% END %]</div>
124
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %][% IF ( modify ) %]<a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Add notice[% END %][% ELSE %][% IF ( add_validate ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Confirm Deletion[% ELSE %]Notices &amp; Slips[% END %][% END %][% END %]</div>
110
125
111
[% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
126
[% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
112
   
127
   
Lines 114-178 $(document).ready(function() { Link Here
114
	<div id="yui-main">
129
	<div id="yui-main">
115
	<div class="yui-b">
130
	<div class="yui-b">
116
131
117
	[% IF ( no_op_set ) %]
132
[% IF ( no_op_set ) %]
118
<div id="toolbar">
133
    <form method="get" action="?" id="selectlibrary">
119
	<script type="text/javascript">
134
      <input type="hidden" name="searchfield" value="[% searchfield %]" />
120
	//<![CDATA[
135
    [% UNLESS independant_branch %]        
121
	// prepare DOM for YUI Toolbar
136
      <p>
122
	 $(document).ready(function() {
137
        Select a library :
123
	    yuiToolbar();
138
            <select name="branchcode" id="branch" style="width:20em;">
124
	 });
139
                <option value="">All libraries</option>
125
	// YUI Toolbar Functions
140
            [% FOREACH branchloo IN branchloop %]
126
	function yuiToolbar() {
141
                [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
127
	    new YAHOO.widget.Button("newnotice");
142
            [% END %]
128
	}
143
            </select>
129
	//]]>
144
      </p>
130
	</script>
145
    [% END %]        
131
	<ul class="toolbar">
146
      <p>
132
	<li><a id="newnotice" href="/cgi-bin/koha/tools/letter.pl?op=add_form">New Notice</a></li>
147
	      <input type="submit" id="newnotice" value="New Notice" />
133
</ul></div>
148
        <input type="hidden" id="op" name="op" />
134
		
149
      </p>
150
    </form>
151
135
		[% IF ( search ) %]
152
		[% IF ( search ) %]
136
		<p>You Searched for <b>[% searchfield %]</b></p>
153
		<p>You Searched for <b>[% searchfield %]</b></p>
137
		[% END %]
154
		[% END %]
138
		[% IF ( letter ) %]<table id="lettert">
155
		[% IF ( letter && !independant_branch) %]
156
            [% select_for_copy = BLOCK %]
157
            <select name="branchcode">
158
                [% FOREACH branchloo IN branchloop %]
159
                <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
160
                [% END %]
161
            </select>
162
            [% END %]
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>
147
		[% UNLESS ( loop.odd ) %]
175
    [% FOREACH lette IN letter %]
176
        [% can_edit = lette.branchcode || !independant_branch %]
177
        [% UNLESS ( loop.odd ) %]
148
			<tr class="highlight">
178
			<tr class="highlight">
149
		[% ELSE %]
179
        [% ELSE %]
150
			<tr>
180
			<tr>
151
		[% END %]
181
        [% END %]
182
				<td>[% lette.branchname || "(All libraries)" %]</td>
152
				<td>[% lette.module %]</td>
183
				<td>[% lette.module %]</td>
153
				<td>[% lette.code %]</td>
184
				<td>[% lette.code %]</td>
154
				<td>[% lette.name %]</td>
185
				<td>[% lette.name %]</td>
155
				<td>
186
				<td>
156
					<a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Edit</a>
187
        [% IF can_edit %]
188
					<a href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[% lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Edit</a>
189
        [% END %]        
190
				</td>
191
				<td>
192
        [% IF !independant_branch || !lette.branchcode %]
193
                    <form method="post" action="?">
194
                        <input type="hidden" name="op" value="copy" />
195
				        <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
196
                        <input type="hidden" name="module" value="[% lette.module %]" />
197
                        <input type="hidden" name="code" value="[% lette.code %]" />
198
            [% IF independant_branch %]
199
                        <input type="hidden" name="branchcode" value="[% independant_branch %]" />
200
            [% ELSE %]
201
                        [% select_for_copy %]
202
            [% END %]
203
                        <input type="submit" value="Copy" />
204
                    </form>
205
        [% END %]        
157
				</td>
206
				</td>
158
				<td>
207
				<td>
159
					[% IF ( lette.protected ) %]
208
        [% IF !lette.protected && can_edit %]
160
					-
209
					<a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Delete</a>
161
					[% ELSE %]
210
        [% END %]
162
					<a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Delete</a>
163
					[% END %]
164
				</td>
211
				</td>
165
			</tr>
212
			</tr>
166
		[% END %]</tbody>
213
    [% END %]
214
        </tbody>
167
		</table>
215
		</table>
168
		[% END %]
216
[% END %]
169
217
170
	[% END %]
171
	
218
	
172
	[% IF ( add_form ) %]
219
[% IF ( add_form ) %]
173
	
220
	
174
		<form action="/cgi-bin/koha/tools/letter.pl" name="Aform" method="post">
221
		<form action="?" name="Aform" method="post">
175
		<input type="hidden" name="op" value="add_validate" />
222
		<input type="hidden" name="op" id="op" value="add_validate" />
176
		<input type="hidden" name="checked" value="0" />
223
		<input type="hidden" name="checked" value="0" />
177
		[% IF ( modify ) %]
224
		[% IF ( modify ) %]
178
		<input type="hidden" name="add" value="0" />
225
		<input type="hidden" name="add" value="0" />
Lines 182-187 $(document).ready(function() { Link Here
182
		<fieldset class="rows">
229
		<fieldset class="rows">
183
		<legend>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</legend>
230
		<legend>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</legend>
184
		<ol>
231
		<ol>
232
				<input type="hidden" name="oldbranchcode" value="[% branchcode %]" />
233
            [% IF independant_branch %]
234
                <input type="hidden" name="branchcode" value="[% independant_branch %]" />
235
            [% ELSE %]
236
			<li>
237
				<label for="branchcode">Library:</label>
238
                <select name="branchcode" id="branch" style="width:20em;">
239
                    <option value="">All libraries</option>
240
                [% FOREACH branchloo IN branchloop %]
241
                    [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
242
                [% END %]
243
                </select>
244
			</li>
245
            [% END %]
185
			<li>
246
			<li>
186
				<label for="module">Koha module:</label>
247
				<label for="module">Koha module:</label>
187
				<input type="hidden" name="oldmodule" value="[% module %]" />
248
				<input type="hidden" name="oldmodule" value="[% module %]" />
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 %]" />
296
			<label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
236
		</li>
297
		</li>
237
		<li>
298
		<li>
299
			<label for="is_html">HTML Message:</label><input type="checkbox" id="is_html" name="is_html" value="1"[% IF is_html %] checked[% END %] />
300
		</li>
301
		<li>
238
			<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
302
			<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
239
		</li>
303
		</li>
240
		<li>
304
		<li>
Lines 252-278 $(document).ready(function() { Link Here
252
		</ol>
316
		</ol>
253
		</fieldset>
317
		</fieldset>
254
		<fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
318
		<fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
319
		<fieldset class="action"><input type="button" value="Cancel" onclick="cancel(this.form)" class="button" /></fieldset>
320
      <input type="hidden" name="searchfield" value="[% searchfield %]" />
255
		</form>
321
		</form>
256
	[% END %]
322
[% END %]
257
	
323
	
258
	[% IF ( add_validate ) %]
324
[% IF ( add_validate ) %]
259
	Data recorded
325
	Data recorded
260
	<form action="[% action %]" method="post">
326
	<form action="[% action %]" method="post">
261
	<input type="submit" value="OK" />
327
	<input type="submit" value="OK" />
262
	</form>
328
	</form>
263
	[% END %]
329
[% END %]
264
	
330
	
265
	[% IF ( delete_confirm ) %]
331
[% IF ( delete_confirm ) %]
266
	<div class="dialog alert"><h3>Delete Notice?</h3>
332
	<div class="dialog alert"><h3>Delete Notice?</h3>
267
	<table>
333
	<table>
268
        <thead>
334
        <thead>
269
		<tr>
335
		<tr>
336
			<th>Branch</th>
270
			<th>Module</th>
337
			<th>Module</th>
271
			<th>Code</th>
338
			<th>Code</th>
272
			<th>Name</th>
339
			<th>Name</th>
273
		</tr>
340
		</tr>
274
        </thead>
341
        </thead>
275
		<tr>
342
		<tr>
343
			<td>[% branchname %]</td>
276
			<td>[% module %]</td>
344
			<td>[% module %]</td>
277
            <td>[% code %]</td>
345
            <td>[% code %]</td>
278
			<td>[% name %]</td>
346
			<td>[% name %]</td>
Lines 280-285 $(document).ready(function() { Link Here
280
	</table>
348
	</table>
281
		<form action="[% action %]" method="post">
349
		<form action="[% action %]" method="post">
282
		<input type="hidden" name="op" value="delete_confirmed">
350
		<input type="hidden" name="op" value="delete_confirmed">
351
		<input type="hidden" name="branchcode" value="[% branchcode %]" />
283
		<input type="hidden" name="code" value="[% code %]" />
352
		<input type="hidden" name="code" value="[% code %]" />
284
		<input type="hidden" name="module" value="[% module %]" />
353
		<input type="hidden" name="module" value="[% module %]" />
285
				<input type="submit" value="Yes, Delete" class="approve" />
354
				<input type="submit" value="Yes, Delete" class="approve" />
Lines 290-303 $(document).ready(function() { Link Here
290
				</form>
359
				</form>
291
		</div>
360
		</div>
292
361
293
	[% END %]
362
[% END %]
294
	
363
	
295
	[% IF ( delete_confirmed ) %]
364
[% IF ( delete_confirmed ) %]
296
	Data deleted
365
	Data deleted
297
	<form action="[% action %]" method="post">
366
	<form action="[% action %]" method="post">
298
	<input type="submit" value="OK" />
367
	<input type="submit" value="OK" />
299
	</form>
368
	</form>
300
	[% END %]
369
[% END %]
301
370
302
</div>
371
</div>
303
</div>
372
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-1 / +1 lines)
Lines 26-32 Link Here
26
    [% END %]
26
    [% END %]
27
27
28
    [% IF ( CAN_user_tools_edit_notices ) %]
28
    [% IF ( CAN_user_tools_edit_notices ) %]
29
    <dt><a href="/cgi-bin/koha/tools/letter.pl">Notices</a></dt>
29
    <dt><a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a></dt>
30
    <dd>Define notices (print and email notification messages for overdues, etc.)</dd>
30
    <dd>Define notices (print and email notification messages for overdues, etc.)</dd>
31
    [% END %]
31
    [% END %]
32
32
(-)a/members/memberentry.pl (-4 / +1 lines)
Lines 345-354 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
345
            # if we manage to find a valid email address, send notice 
345
            # if we manage to find a valid email address, send notice 
346
            if ($emailaddr) {
346
            if ($emailaddr) {
347
                $newdata{emailaddr} = $emailaddr;
347
                $newdata{emailaddr} = $emailaddr;
348
                my $letter = getletter ('members', "ACCTDETAILS:$newdata{'branchcode'}") ;
348
                SendAlerts ( 'members', \%newdata, "ACCTDETAILS" );
349
                # if $branch notice fails, then email a default notice instead.
350
                $letter = getletter ('members', "ACCTDETAILS")  if !$letter;
351
                SendAlerts ( 'members' , \%newdata , $letter ) if $letter
352
            }
349
            }
353
        } 
350
        } 
354
351
(-)a/members/moremember.pl (-10 lines)
Lines 51-57 use C4::Reserves; Link Here
51
use C4::Branch; # GetBranchName
51
use C4::Branch; # GetBranchName
52
use C4::Overdues qw/CheckBorrowerDebarred/;
52
use C4::Overdues qw/CheckBorrowerDebarred/;
53
use C4::Form::MessagingPreferences;
53
use C4::Form::MessagingPreferences;
54
use C4::NewsChannels; #get slip news
55
use List::MoreUtils qw/uniq/;
54
use List::MoreUtils qw/uniq/;
56
use C4::Members::Attributes qw(GetBorrowerAttributes);
55
use C4::Members::Attributes qw(GetBorrowerAttributes);
57
56
Lines 483-495 $template->param( Link Here
483
    quickslip		  => $quickslip,
482
    quickslip		  => $quickslip,
484
);
483
);
485
484
486
#Get the slip news items
487
my $all_koha_news   = &GetNewsToDisplay("slip");
488
my $koha_news_count = scalar @$all_koha_news;
489
490
$template->param(
491
    koha_news       => $all_koha_news,
492
    koha_news_count => $koha_news_count
493
);
494
495
output_html_with_http_headers $input, $cookie, $template->output;
485
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 460-475 END_SQL Link Here
460
            {
460
            {
461
                $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has items triggering level $i.";
461
                $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has 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 509-514 END_SQL Link Here
509
                                           }
500
                                           }
510
                    }
501
                    }
511
                );
502
                );
503
                unless ($letter) {
504
                    $verbose and warn "Message '$overdue_rules->{letter$i}' content not found";
505
    
506
                    # might as well skip while PERIOD, no other borrowers are going to work.
507
                    # FIXME : Does this mean a letter must be defined in order to trigger a debar ?
508
                    next PERIOD;
509
                }
512
                
510
                
513
                if ( $exceededPrintNoticesMaxLines ) {
511
                if ( $exceededPrintNoticesMaxLines ) {
514
                  $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
512
                  $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
Lines 643-696 substituted keys and values. Link Here
643
641
644
=cut
642
=cut
645
643
646
sub parse_letter { # FIXME: this code should probably be moved to C4::Letters:parseletter
644
sub parse_letter {
647
    my $params = shift;
645
    my $params = shift;
648
    foreach my $required (qw( letter borrowernumber )) {
646
    foreach my $required (qw( letter_code borrowernumber )) {
649
        return unless exists $params->{$required};
647
        return unless exists $params->{$required};
650
    }
648
    }
651
649
652
   my $todaysdate = C4::Dates->new()->output("syspref");
650
    my $substitute = $params->{'substitute'} || {};
653
   $params->{'letter'}->{title}   =~ s/<<today>>/$todaysdate/g;
651
    $substitute->{today} ||= C4::Dates->new()->output("syspref");
654
   $params->{'letter'}->{content} =~ s/<<today>>/$todaysdate/g;
655
652
656
    if ( $params->{'substitute'} ) {
653
    my %tables = ( 'borrowers' => $params->{'borrowernumber'} );
657
        while ( my ( $key, $replacedby ) = each %{ $params->{'substitute'} } ) {
654
    if ( my $p = $params->{'branchcode'} ) {
658
            my $replacefield = "<<$key>>";
655
        $tables{'branches'} = $p;
659
            $params->{'letter'}->{title}   =~ s/$replacefield/$replacedby/g;
660
            $params->{'letter'}->{content} =~ s/$replacefield/$replacedby/g;
661
        }
662
    }
656
    }
663
657
664
    $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'borrowers', $params->{'borrowernumber'} );
658
    my $currency_format;
665
659
    if ($params->{'letter'}->{'content'} =~ m/<fine>(.*)<\/fine>/o) { # process any fine tags...
666
    if ( $params->{'branchcode'} ) {
660
        $currency_format = $1;
667
        $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'branches', $params->{'branchcode'} );
661
        $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/<<item.fine>>/o;
668
    }
662
    }
669
663
670
    if ( $params->{'items'} ) {
664
    my @item_tables;
665
    if ( my $i = $params->{'items'} ) {
671
        my $item_format = '';
666
        my $item_format = '';
672
        PROCESS_ITEMS:
667
        foreach my $item (@$i) {
673
        while (scalar(@{$params->{'items'}}) > 0) {
674
            my $item = shift @{$params->{'items'}};
675
            my $fine = GetFine($item->{'itemnumber'}, $params->{'borrowernumber'});
668
            my $fine = GetFine($item->{'itemnumber'}, $params->{'borrowernumber'});
676
            if (!$item_format) {
669
            if (!$item_format) {
677
                $params->{'letter'}->{'content'} =~ m/(<item>.*<\/item>)/;
670
                $params->{'letter'}->{'content'} =~ m/(<item>.*<\/item>)/;
678
                $item_format = $1;
671
                $item_format = $1;
679
            }
672
            }
680
            if ($params->{'letter'}->{'content'} =~ m/<fine>(.*)<\/fine>/) { # process any fine tags...
681
                my $formatted_fine = currency_format("$1", "$fine", FMT_SYMBOL);
682
                $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/$formatted_fine/;
683
            }
684
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblio',      $item->{'biblionumber'} );
685
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'biblioitems', $item->{'biblionumber'} );
686
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'items', $item->{'itemnumber'} );
687
            $params->{'letter'} = C4::Letters::parseletter( $params->{'letter'}, 'issues', $item->{'itemnumber'} );
688
            $params->{'letter'}->{'content'} =~ s/(<item>.*<\/item>)/$1\n$item_format/ if scalar(@{$params->{'items'}} > 0);
689
673
674
            $item->{'fine'} = currency_format($currency_format, "$fine", FMT_SYMBOL)
675
              if $currency_format;
676
677
            push @item_tables, {
678
                'biblio' => $item->{'biblionumber'},
679
                'biblioitems' => $item->{'biblionumber'},
680
                'items' => $item,
681
                'issues' => $item->{'itemnumber'},
682
            };
690
        }
683
        }
691
    }
684
    }
692
    $params->{'letter'}->{'content'} =~ s/<\/{0,1}?item>//g; # strip all remaining item tags...
685
693
    return $params->{'letter'};
686
    return C4::Letters::GetPreparedLetter (
687
        module => 'circulation',
688
        letter_code => $params->{'letter_code'},
689
        branchcode => $params->{'branchcode'},
690
        tables => \%tables,
691
        substitute => $substitute,
692
        repeat => { item => \@item_tables },
693
    );
694
}
694
}
695
695
696
=head2 prepare_letter_for_printing
696
=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 33-38 sub methods : Test( 1 ) { Link Here
33
                       GetReserveInfo 
33
                       GetReserveInfo 
34
                       _FixPriority 
34
                       _FixPriority 
35
                       _Findgroupreserve 
35
                       _Findgroupreserve 
36
                       ReserveSlip
36
                );
37
                );
37
    
38
    
38
    can_ok( $self->testing_class, @methods );    
39
    can_ok( $self->testing_class, @methods );    
(-)a/tools/letter.pl (-69 / +160 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
50
use C4::Members::Attributes;
49
51
50
# letter_exists($module, $code)
52
# _letter_from_where($branchcode,$module, $code)
51
# - return true if a letter with the given $module and $code exists
53
# - return FROM WHERE clause and bind args for a letter
54
sub _letter_from_where {
55
    my ($branchcode, $module, $code) = @_;
56
    my $sql = q{FROM letter WHERE branchcode = ? AND module = ? AND code = ?};
57
    my @args = ($branchcode || '', $module, $code);
58
# Mysql is retarded. cause branchcode is part of the primary key it cannot be null. How does that
59
# work with foreign key constraint I wonder...
60
61
#   if ($branchcode) {
62
#       $sql .= " AND branchcode = ?";
63
#       push @args, $branchcode;
64
#   } else {
65
#       $sql .= " AND branchcode IS NULL";
66
#   }
67
68
    return ($sql, \@args);
69
}
70
71
# letter_exists($branchcode,$module, $code)
72
# - return true if a letter with the given $branchcode, $module and $code exists
52
sub letter_exists {
73
sub letter_exists {
53
    my ($module, $code) = @_;
74
    my ($sql, $args) = _letter_from_where(@_);
54
    my $dbh = C4::Context->dbh;
75
    my $dbh = C4::Context->dbh;
55
    my $letters = $dbh->selectall_arrayref(q{SELECT name FROM letter WHERE module = ? AND code = ?}, undef, $module, $code);
76
    my $letter = $dbh->selectrow_hashref("SELECT * $sql", undef, @$args);
56
    return @{$letters};
77
    return $letter;
57
}
78
}
58
79
59
# $protected_letters = protected_letters()
80
# $protected_letters = protected_letters()
Lines 67-80 sub protected_letters { Link Here
67
my $input       = new CGI;
88
my $input       = new CGI;
68
my $searchfield = $input->param('searchfield');
89
my $searchfield = $input->param('searchfield');
69
my $script_name = '/cgi-bin/koha/tools/letter.pl';
90
my $script_name = '/cgi-bin/koha/tools/letter.pl';
91
my $branchcode  = $input->param('branchcode');
70
my $code        = $input->param('code');
92
my $code        = $input->param('code');
71
my $module      = $input->param('module');
93
my $module      = $input->param('module');
72
my $content     = $input->param('content');
94
my $content     = $input->param('content');
73
my $op          = $input->param('op');
95
my $op          = $input->param('op') || '';
74
my $dbh = C4::Context->dbh;
96
my $dbh = C4::Context->dbh;
75
if (!defined $module ) {
76
    $module = q{};
77
}
78
97
79
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
98
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
80
    {
99
    {
Lines 87-118 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
87
    }
106
    }
88
);
107
);
89
108
90
if (!defined $op) {
109
my $my_branch = C4::Context->preference("IndependantBranches")
91
    $op = q{}; # silence errors from eq
110
  ?  C4::Context->userenv()->{'branch'}
92
}
111
  : undef;
93
# we show only the TMPL_VAR names $op
112
# we show only the TMPL_VAR names $op
94
113
95
$template->param(
114
$template->param(
115
    independant_branch => $my_branch,
96
	script_name => $script_name,
116
	script_name => $script_name,
117
  searchfield => $searchfield,
97
	action => $script_name
118
	action => $script_name
98
);
119
);
99
120
121
if ($op eq 'copy') {
122
    add_copy();
123
    $op = 'add_form';
124
}
125
100
if ($op eq 'add_form') {
126
if ($op eq 'add_form') {
101
    add_form($module, $code);
127
    add_form($branchcode, $module, $code);
102
}
128
}
103
elsif ( $op eq 'add_validate' ) {
129
elsif ( $op eq 'add_validate' ) {
104
    add_validate();
130
    add_validate();
105
    $op = q{}; # next operation is to return to default screen
131
    $op = q{}; # next operation is to return to default screen
106
}
132
}
107
elsif ( $op eq 'delete_confirm' ) {
133
elsif ( $op eq 'delete_confirm' ) {
108
    delete_confirm($module, $code);
134
    delete_confirm($branchcode, $module, $code);
109
}
135
}
110
elsif ( $op eq 'delete_confirmed' ) {
136
elsif ( $op eq 'delete_confirmed' ) {
111
    delete_confirmed($module, $code);
137
    delete_confirmed($branchcode, $module, $code);
112
    $op = q{}; # next operation is to return to default screen
138
    $op = q{}; # next operation is to return to default screen
113
}
139
}
114
else {
140
else {
115
    default_display($searchfield);
141
    default_display($branchcode,$searchfield);
116
}
142
}
117
143
118
# Do this last as delete_confirmed resets
144
# Do this last as delete_confirmed resets
Lines 125-147 if ($op) { Link Here
125
output_html_with_http_headers $input, $cookie, $template->output;
151
output_html_with_http_headers $input, $cookie, $template->output;
126
152
127
sub add_form {
153
sub add_form {
128
    my ($module, $code ) = @_;
154
    my ($branchcode,$module, $code ) = @_;
129
155
130
    my $letter;
156
    my $letter;
131
    # if code has been passed we can identify letter and its an update action
157
    # if code has been passed we can identify letter and its an update action
132
    if ($code) {
158
    if ($code) {
133
        $letter = $dbh->selectrow_hashref(q{SELECT module, code, name, title, content FROM letter WHERE module=? AND code=?},
159
        $letter = letter_exists($branchcode,$module, $code);
134
            undef, $module, $code);
160
    }
161
    if ($letter) {
135
        $template->param( modify => 1 );
162
        $template->param( modify => 1 );
136
        $template->param( code   => $letter->{code} );
163
        $template->param( code   => $letter->{code} );
137
    }
164
    }
138
    else { # initialize the new fields
165
    else { # initialize the new fields
139
        $letter = {
166
        $letter = {
140
            module  => $module,
167
            branchcode => $branchcode,
141
            code    => q{},
168
            module     => $module,
142
            name    => q{},
143
            title   => q{},
144
            content => q{},
145
        };
169
        };
146
        $template->param( adding => 1 );
170
        $template->param( adding => 1 );
147
    }
171
    }
Lines 173-186 sub add_form { Link Here
173
            {value => q{},             text => '---ITEMS---'  },
197
            {value => q{},             text => '---ITEMS---'  },
174
            {value => 'items.content', text => 'items.content'},
198
            {value => 'items.content', text => 'items.content'},
175
            add_fields('issues','borrowers');
199
            add_fields('issues','borrowers');
200
        if ($module eq 'circulation') {
201
            push @{$field_selection}, add_fields('opac_news');
202
        }
176
    }
203
    }
177
204
178
    $template->param(
205
    $template->param(
179
        name    => $letter->{name},
206
        branchcode => $letter->{branchcode},
180
        title   => $letter->{title},
207
        name       => $letter->{name},
181
        content => $letter->{content},
208
        is_html    => $letter->{is_html},
182
        module  => $module,
209
        title      => $letter->{title},
183
        $module => 1,
210
        content    => $letter->{content},
211
        module     => $module,
212
        $module    => 1,
213
        branchloop => _branchloop($branchcode),
184
        SQLfieldname => $field_selection,
214
        SQLfieldname => $field_selection,
185
    );
215
    );
186
    return;
216
    return;
Lines 188-224 sub add_form { Link Here
188
218
189
sub add_validate {
219
sub add_validate {
190
    my $dbh        = C4::Context->dbh;
220
    my $dbh        = C4::Context->dbh;
191
    my $module     = $input->param('module');
221
    my $oldbranchcode = $input->param('oldbranchcode');
192
    my $oldmodule  = $input->param('oldmodule');
222
    my $branchcode    = $input->param('branchcode') || '';
193
    my $code       = $input->param('code');
223
    my $module        = $input->param('module');
194
    my $name       = $input->param('name');
224
    my $oldmodule     = $input->param('oldmodule');
195
    my $title      = $input->param('title');
225
    my $code          = $input->param('code');
196
    my $content    = $input->param('content');
226
    my $name          = $input->param('name');
197
    if (letter_exists($oldmodule, $code)) {
227
    my $is_html       = $input->param('is_html');
228
    my $title         = $input->param('title');
229
    my $content       = $input->param('content');
230
    if (letter_exists($oldbranchcode,$oldmodule, $code)) {
198
        $dbh->do(
231
        $dbh->do(
199
            q{UPDATE letter SET module = ?, code = ?, name = ?, title = ?, content = ? WHERE module = ? AND code = ?},
232
            q{UPDATE letter SET branchcode = ?, module = ?, name = ?, is_html = ?, title = ?, content = ? WHERE branchcode = ? AND module = ? AND code = ?},
200
            undef,
233
            undef,
201
            $module, $code, $name, $title, $content,
234
            $branchcode, $module, $name, $is_html || 0, $title, $content,
202
            $oldmodule, $code
235
            $oldbranchcode, $oldmodule, $code
203
        );
236
        );
204
    } else {
237
    } else {
205
        $dbh->do(
238
        $dbh->do(
206
            q{INSERT INTO letter (module,code,name,title,content) VALUES (?,?,?,?,?)},
239
            q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)},
207
            undef,
240
            undef,
208
            $module, $code, $name, $title, $content
241
            $branchcode, $module, $code, $name, $is_html || 0, $title, $content
209
        );
242
        );
210
    }
243
    }
211
    # set up default display
244
    # set up default display
212
    default_display();
245
    default_display($branchcode);
213
    return;
246
}
247
248
sub add_copy {
249
    my $dbh        = C4::Context->dbh;
250
    my $oldbranchcode = $input->param('oldbranchcode');
251
    my $branchcode    = $input->param('branchcode');
252
    my $module        = $input->param('module');
253
    my $code          = $input->param('code');
254
255
    return if letter_exists($branchcode,$module, $code);
256
257
    my $old_letter = letter_exists($oldbranchcode,$module, $code);
258
259
    $dbh->do(
260
        q{INSERT INTO letter (branchcode,module,code,name,is_html,title,content) VALUES (?,?,?,?,?,?,?)},
261
        undef,
262
        $branchcode, $module, $code, $old_letter->{name}, $old_letter->{is_html}, $old_letter->{title}, $old_letter->{content}
263
    );
214
}
264
}
215
265
216
sub delete_confirm {
266
sub delete_confirm {
217
    my ($module, $code) = @_;
267
    my ($branchcode, $module, $code) = @_;
218
    my $dbh = C4::Context->dbh;
268
    my $dbh = C4::Context->dbh;
219
    my $letter = $dbh->selectrow_hashref(q|SELECT  name FROM letter WHERE module = ? AND code = ?|,
269
    my $letter = letter_exists($branchcode, $module, $code);
220
        { Slice => {} },
270
    $template->param( branchcode => $branchcode, branchname => GetBranchName($branchcode) );
221
        $module, $code);
222
    $template->param( code => $code );
271
    $template->param( code => $code );
223
    $template->param( module => $module);
272
    $template->param( module => $module);
224
    $template->param( name => $letter->{name});
273
    $template->param( name => $letter->{name});
Lines 226-265 sub delete_confirm { Link Here
226
}
275
}
227
276
228
sub delete_confirmed {
277
sub delete_confirmed {
229
    my ($module, $code) = @_;
278
    my ($branchcode, $module, $code) = @_;
279
    my ($sql, $args) = _letter_from_where($branchcode, $module, $code);
230
    my $dbh    = C4::Context->dbh;
280
    my $dbh    = C4::Context->dbh;
231
    $dbh->do('DELETE FROM letter WHERE module=? AND code=?',{},$module,$code);
281
    $dbh->do("DELETE $sql", undef, @$args);
232
    # setup default display for screen
282
    # setup default display for screen
233
    default_display();
283
    default_display($branchcode);
234
    return;
284
    return;
235
}
285
}
236
286
237
sub retrieve_letters {
287
sub retrieve_letters {
238
    my $searchstring = shift;
288
    my ($branchcode, $searchstring) = @_;
289
290
    $branchcode = $my_branch if $branchcode && $my_branch;
291
239
    my $dbh = C4::Context->dbh;
292
    my $dbh = C4::Context->dbh;
240
    if ($searchstring) {
293
    my ($sql, @where, @args);
241
        if ($searchstring=~m/(\S+)/) {
294
    $sql = "SELECT branchcode, module, code, name, branchname
242
            $searchstring = $1 . q{%};
295
            FROM letter
243
            return $dbh->selectall_arrayref('SELECT module, code, name FROM letter WHERE code LIKE ? ORDER BY module, code',
296
            LEFT OUTER JOIN branches USING (branchcode)";
244
                { Slice => {} }, $searchstring);
297
    if ($searchstring && $searchstring=~m/(\S+)/) {
245
        }
298
        $searchstring = $1 . q{%};
299
        push @where, 'code LIKE ?';
300
        push @args, $searchstring;
246
    }
301
    }
247
    else {
302
    elsif ($branchcode) {
248
        return $dbh->selectall_arrayref('SELECT module, code, name FROM letter ORDER BY module, code', { Slice => {} });
303
        push @where, 'branchcode = ?';
304
        push @args, $branchcode || '';
249
    }
305
    }
250
    return;
306
    elsif ($my_branch) {
307
        push @where, "(branchcode = ? OR branchcode = '')";
308
        push @args, $my_branch;
309
    }
310
311
    $sql .= " WHERE ".join(" AND ", @where) if @where;
312
    $sql .= " ORDER BY module, code, branchcode";
313
#   use Data::Dumper; die Dumper($sql, \@args);
314
    return $dbh->selectall_arrayref($sql, { Slice => {} }, @args);
251
}
315
}
252
316
253
sub default_display {
317
sub default_display {
254
    my $searchfield = shift;
318
    my ($branchcode, $searchfield) = @_;
255
    my $results;
319
256
    if ( $searchfield  ) {
320
    if ( $searchfield  ) {
257
        $template->param( search      => 1 );
321
        $template->param( search      => 1 );
258
        $template->param( searchfield => $searchfield );
259
        $results = retrieve_letters($searchfield);
260
    } else {
261
        $results = retrieve_letters();
262
    }
322
    }
323
    my $results = retrieve_letters($branchcode,$searchfield);
324
263
    my $loop_data = [];
325
    my $loop_data = [];
264
    my $protected_letters = protected_letters();
326
    my $protected_letters = protected_letters();
265
    foreach my $row (@{$results}) {
327
    foreach my $row (@{$results}) {
Lines 267-274 sub default_display { Link Here
267
        push @{$loop_data}, $row;
329
        push @{$loop_data}, $row;
268
330
269
    }
331
    }
270
    $template->param( letter => $loop_data );
332
271
    return;
333
    $template->param(
334
        letter => $loop_data,
335
        branchloop => _branchloop($branchcode),
336
    );
337
}
338
339
sub _branchloop {
340
    my ($branchcode) = @_;
341
342
    my $branches = GetBranches();
343
    my @branchloop;
344
    for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
345
        push @branchloop, {
346
            value      => $thisbranch,
347
            selected   => $branchcode && $thisbranch eq $branchcode,
348
            branchname => $branches->{$thisbranch}->{'branchname'},
349
        };
350
    }
351
352
    return \@branchloop;
272
}
353
}
273
354
274
sub add_fields {
355
sub add_fields {
Lines 307-312 sub get_columns_for { Link Here
307
            text  => $tlabel,
388
            text  => $tlabel,
308
        };
389
        };
309
    }
390
    }
391
310
    my $sql = "SHOW COLUMNS FROM $table";# TODO not db agnostic
392
    my $sql = "SHOW COLUMNS FROM $table";# TODO not db agnostic
311
    my $table_prefix = $table . q|.|;
393
    my $table_prefix = $table . q|.|;
312
    my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} });
394
    my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} });
Lines 317-321 sub get_columns_for { Link Here
317
            text  => $table_prefix . $row->{Field},
399
            text  => $table_prefix . $row->{Field},
318
        }
400
        }
319
    }
401
    }
402
    if ($table eq 'borrowers') {
403
        if ( my $attributes = C4::Members::Attributes::GetAttributes() ) {
404
            foreach (@$attributes) {
405
                push @fields, {
406
                    value => "borrower-attribute:$_",
407
                    text  => "attribute:$_",
408
                }
409
            }
410
        }
411
    }
320
    return @fields;
412
    return @fields;
321
}
413
}
322
- 

Return to bug 7001