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

(-)a/C4/Circulation.pm (-6 / +14 lines)
Lines 2667-2677 sub SendCirculationAlert { Link Here
2667
        borrowernumber => $borrower->{borrowernumber},
2667
        borrowernumber => $borrower->{borrowernumber},
2668
        message_name   => $message_name{$type},
2668
        message_name   => $message_name{$type},
2669
    });
2669
    });
2670
    my $letter = C4::Letters::getletter('circulation', $type);
2670
    my $letter =  C4::Letters::GetPreparedLetter (
2671
    C4::Letters::parseletter($letter, 'biblio',      $item->{biblionumber});
2671
        module => 'circulation',
2672
    C4::Letters::parseletter($letter, 'biblioitems', $item->{biblionumber});
2672
        letter_code => $type,
2673
    C4::Letters::parseletter($letter, 'borrowers',   $borrower->{borrowernumber});
2673
        branchcode => $branch,
2674
    C4::Letters::parseletter($letter, 'branches',    $branch);
2674
        tables => {
2675
            'biblio'      => $item->{biblionumber},
2676
            'biblioitems' => $item->{biblionumber},
2677
            'borrowers'   => $borrower,
2678
            'branches'    => $branch,
2679
        }
2680
    ) or return;
2681
2675
    my @transports = @{ $borrower_preferences->{transports} };
2682
    my @transports = @{ $borrower_preferences->{transports} };
2676
    # warn "no transports" unless @transports;
2683
    # warn "no transports" unless @transports;
2677
    for (@transports) {
2684
    for (@transports) {
Lines 2686-2692 sub SendCirculationAlert { Link Here
2686
            $message->update;
2693
            $message->update;
2687
        }
2694
        }
2688
    }
2695
    }
2689
    $letter;
2696
2697
    return $letter;
2690
}
2698
}
2691
2699
2692
=head2 updateWrongTransfer
2700
=head2 updateWrongTransfer
(-)a/C4/Letters.pm (-194 / +355 lines)
Lines 24-29 use MIME::Lite; Link Here
24
use Mail::Sendmail;
24
use Mail::Sendmail;
25
25
26
use C4::Members;
26
use C4::Members;
27
use C4::Members::Attributes qw(GetBorrowerAttributes);
27
use C4::Branch;
28
use C4::Branch;
28
use C4::Log;
29
use C4::Log;
29
use C4::SMS;
30
use C4::SMS;
Lines 40-46 BEGIN { Link Here
40
	$VERSION = 3.01;
41
	$VERSION = 3.01;
41
	@ISA = qw(Exporter);
42
	@ISA = qw(Exporter);
42
	@EXPORT = qw(
43
	@EXPORT = qw(
43
	&GetLetters &getletter &addalert &getalert &delalert &findrelatedto &SendAlerts GetPrintMessages
44
	&GetLetters &GetPreparedLetter &GetWrappedLetter &addalert &getalert &delalert &findrelatedto &SendAlerts &GetPrintMessages
44
	);
45
	);
45
}
46
}
46
47
Lines 115-127 sub GetLetters (;$) { Link Here
115
    return \%letters;
116
    return \%letters;
116
}
117
}
117
118
118
sub getletter ($$) {
119
my %letter;
119
    my ( $module, $code ) = @_;
120
sub getletter ($$$) {
121
    my ( $module, $code, $branchcode ) = @_;
122
123
    if (C4::Context->preference('IndependantBranches') && $branchcode){
124
        $$branchcode = C4::Context->userenv->{'branch'};
125
    }
126
127
    if ( my $l = $letter{$module}{$code}{$branchcode} ) {
128
        return { %$l }; # deep copy
129
    }
130
120
    my $dbh = C4::Context->dbh;
131
    my $dbh = C4::Context->dbh;
121
    my $sth = $dbh->prepare("select * from letter where module=? and code=?");
132
    my $sth = $dbh->prepare("select * from letter where module=? and code=? and (branchcode = ? or branchcode = '') order by branchcode desc limit 1");
122
    $sth->execute( $module, $code );
133
    $sth->execute( $module, $code, $branchcode );
123
    my $line = $sth->fetchrow_hashref;
134
    my $line = $sth->fetchrow_hashref
124
    return $line;
135
      or return;
136
    $line->{'content-type'} = 'text/html; charset="UTF-8"' if $line->{is_html};
137
    $letter{$module}{$code}{$branchcode} = $line;
138
    return { %$line };
125
}
139
}
126
140
127
=head2 addalert ($borrowernumber, $type, $externalid)
141
=head2 addalert ($borrowernumber, $type, $externalid)
Lines 176-182 sub delalert ($) { Link Here
176
sub getalert (;$$$) {
190
sub getalert (;$$$) {
177
    my ( $borrowernumber, $type, $externalid ) = @_;
191
    my ( $borrowernumber, $type, $externalid ) = @_;
178
    my $dbh   = C4::Context->dbh;
192
    my $dbh   = C4::Context->dbh;
179
    my $query = "SELECT * FROM alert WHERE";
193
    my $query = "SELECT a.*, b.branchcode FROM alert a JOIN borrowers b USING(borrowernumber) WHERE";
180
    my @bind;
194
    my @bind;
181
    if ($borrowernumber and $borrowernumber =~ /^\d+$/) {
195
    if ($borrowernumber and $borrowernumber =~ /^\d+$/) {
182
        $query .= " borrowernumber=? AND ";
196
        $query .= " borrowernumber=? AND ";
Lines 232-304 sub findrelatedto ($$) { Link Here
232
    parameters :
246
    parameters :
233
    - $type : the type of alert
247
    - $type : the type of alert
234
    - $externalid : the id of the "object" to query
248
    - $externalid : the id of the "object" to query
235
    - $letter : the letter to send.
249
    - $letter_code : the letter to send.
236
250
237
    send an alert to all borrowers having put an alert on a given subject.
251
    send an alert to all borrowers having put an alert on a given subject.
238
252
239
=cut
253
=cut
240
254
241
sub SendAlerts {
255
sub SendAlerts {
242
    my ( $type, $externalid, $letter ) = @_;
256
    my ( $type, $externalid, $letter_code ) = @_;
243
    my $dbh = C4::Context->dbh;
257
    my $dbh = C4::Context->dbh;
244
    my $strsth;
258
    my $strsth;
245
    if ( $type eq 'issue' ) {
259
    if ( $type eq 'issue' ) {
246
260
247
        # 		warn "sending issues...";
248
        my $letter = getletter( 'serial', $letter );
249
250
        # prepare the letter...
261
        # prepare the letter...
251
        # search the biblionumber
262
        # search the biblionumber
252
        my $sth =
263
        my $sth =
253
          $dbh->prepare(
264
          $dbh->prepare(
254
            "SELECT biblionumber FROM subscription WHERE subscriptionid=?");
265
            "SELECT biblionumber FROM subscription WHERE subscriptionid=?");
255
        $sth->execute($externalid);
266
        $sth->execute($externalid);
256
        my ($biblionumber) = $sth->fetchrow;
267
        my ($biblionumber) = $sth->fetchrow
257
268
          or warn( "No subscription for '$externalid'" ),
258
        # parsing branch info
269
             return;
259
        my $userenv = C4::Context->userenv;
260
        parseletter( $letter, 'branches', $userenv->{branch} );
261
262
        # parsing librarian name
263
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/g;
264
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
265
        $letter->{content} =~
266
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
267
268
        # parsing biblio information
269
        parseletter( $letter, 'biblio',      $biblionumber );
270
        parseletter( $letter, 'biblioitems', $biblionumber );
271
270
271
        my %letter;
272
        # find the list of borrowers to alert
272
        # find the list of borrowers to alert
273
        my $alerts = getalert( '', 'issue', $externalid );
273
        my $alerts = getalert( '', 'issue', $externalid );
274
        foreach (@$alerts) {
274
        foreach (@$alerts) {
275
275
276
            # and parse borrower ...
277
            my $innerletter = $letter;
278
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
276
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
279
            parseletter( $innerletter, 'borrowers', $_->{'borrowernumber'} );
277
            my $email = $borinfo->{email} or next;
278
279
            # 		warn "sending issues...";
280
            my $userenv = C4::Context->userenv;
281
            my $letter = GetPreparedLetter (
282
                module => 'serial',
283
                letter_code => $letter_code,
284
                branchcode => $userenv->{branch},
285
                tables => {
286
                    'branches'    => $_->{branchcode},
287
                    'biblio'      => $biblionumber,
288
                    'biblioitems' => $biblionumber,
289
                    'borrowers'   => $borinfo,
290
                },
291
                want_librarian => 1,
292
            ) or return;
280
293
281
            # ... then send mail
294
            # ... then send mail
282
            if ( $borinfo->{email} ) {
295
            my %mail = (
283
                my %mail = (
296
                To      => $email,
284
                    To      => $borinfo->{email},
297
                From    => $email,
285
                    From    => $borinfo->{email},
298
                Subject => "" . $letter->{title},
286
                    Subject => "" . $innerletter->{title},
299
                Message => "" . $letter->{content},
287
                    Message => "" . $innerletter->{content},
300
                'Content-Type' => 'text/plain; charset="utf8"',
288
                    'Content-Type' => 'text/plain; charset="utf8"',
301
                );
289
                    );
302
            sendmail(%mail) or carp $Mail::Sendmail::error;
290
                sendmail(%mail) or carp $Mail::Sendmail::error;
291
292
            }
293
        }
303
        }
294
    }
304
    }
295
    elsif ( $type eq 'claimacquisition' ) {
305
    elsif ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
296
297
        $letter = getletter( 'claimacquisition', $letter );
298
306
299
        # prepare the letter...
307
        # prepare the letter...
300
        # search the biblionumber
308
        # search the biblionumber
301
        $strsth = qq{
309
        $strsth =  $type eq 'claimacquisition'
310
            ? qq{
302
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*,aqbooksellers.*
311
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*,aqbooksellers.*
303
            FROM aqorders
312
            FROM aqorders
304
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
313
            LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
Lines 306-419 sub SendAlerts { Link Here
306
            LEFT JOIN biblioitems ON aqorders.biblioitemnumber=biblioitems.biblioitemnumber
315
            LEFT JOIN biblioitems ON aqorders.biblioitemnumber=biblioitems.biblioitemnumber
307
            LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
316
            LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
308
            WHERE aqorders.ordernumber IN (
317
            WHERE aqorders.ordernumber IN (
309
        }
318
            }
310
          . join( ",", @$externalid ) . ")";
319
            : qq{
311
    }
312
    elsif ( $type eq 'claimissues' ) {
313
314
        $letter = getletter( 'claimissues', $letter );
315
316
        # prepare the letter...
317
        # search the biblionumber
318
        $strsth = qq{
319
            SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*
320
            SELECT serial.*,subscription.*, biblio.*, aqbooksellers.*
320
            FROM serial
321
            FROM serial
321
            LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid
322
            LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid
322
            LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber
323
            LEFT JOIN biblio ON serial.biblionumber=biblio.biblionumber
323
            LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
324
            LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
324
            WHERE serial.serialid IN (
325
            WHERE serial.serialid IN (
325
        }
326
            }
326
          . join( ",", @$externalid ) . ")";
327
          . join( ",", @$externalid ) . ")";
327
    }
328
329
    if ( $type eq 'claimacquisition' or $type eq 'claimissues' ) {
330
        my $sthorders = $dbh->prepare($strsth);
328
        my $sthorders = $dbh->prepare($strsth);
331
        $sthorders->execute;
329
        $sthorders->execute;
332
        my @fields = map {
330
        my $dataorders = $sthorders->fetchall_arrayref( {} );
333
            $sthorders->{mysql_table}[$_] . "." . $sthorders->{NAME}[$_] }
331
334
            (0 .. $#{$sthorders->{NAME}} ) ;
332
        my $sthbookseller =
335
333
          $dbh->prepare("select * from aqbooksellers where id=?");
336
        my @orders_infos;
334
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
337
        while ( my $row = $sthorders->fetchrow_arrayref() ) {
335
        my $databookseller = $sthbookseller->fetchrow_hashref;
338
            my %rec = ();
336
339
            @rec{@fields} = @$row;
337
        my @email;
340
            push @orders_infos, \%rec;
338
        push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail};
339
        push @email, $databookseller->{contemail}       if $databookseller->{contemail};
340
        unless (@email) {
341
            warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
342
            return;
341
        }
343
        }
342
344
343
        # parsing branch info
344
        my $userenv = C4::Context->userenv;
345
        my $userenv = C4::Context->userenv;
345
        parseletter( $letter, 'branches', $userenv->{branch} );
346
        my $letter = GetPreparedLetter (
346
347
            module => $type,
347
        # parsing librarian name
348
            letter_code => $letter_code,
348
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/g;
349
            branchcode => $userenv->{branch},
349
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
350
            tables => {
350
        $letter->{content} =~ s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
351
                'branches'    => $userenv->{branch},
351
352
                'aqbooksellers' => $databookseller,
352
        # Get Fields remplacement
353
            },
353
        my $order_format = $1 if ( $letter->{content} =~ m/(<order>.*<\/order>)/xms );
354
            repeat => $dataorders,
354
355
            want_librarian => 1,
355
        # Foreach field to remplace
356
        ) or return;
356
        while ( $letter->{content} =~ m/<<([^>]*)>>/g ) {
357
            my $field = $1;
358
            my $value = $orders_infos[0]->{$field} || "";
359
            $value = sprintf("%.2f", $value) if $field =~ /price/;
360
            $letter->{content} =~ s/<<$field>>/$value/g;
361
        }
362
363
        if ( $order_format ) {
364
            # For each order
365
            foreach my $infos ( @orders_infos ) {
366
                my $order_content = $order_format;
367
                # We replace by value
368
                while ( $order_content =~ m/<<([^>]*)>>/g ) {
369
                    my $field = $1;
370
                    my $value = $infos->{$field} || "";
371
                    $value = sprintf("%.2f", $value) if $field =~ /price/;
372
                    $order_content =~ s/(<<$field>>)/$value/g;
373
                }
374
                $order_content =~ s/<\/{0,1}?order>//g;
375
                $letter->{content} =~ s/<order>.*<\/order>/$order_content\n$order_format/xms;
376
            }
377
            $letter->{content} =~ s/<order>.*<\/order>//xms;
378
        }
379
380
        my $innerletter = $letter;
381
357
382
        # ... then send mail
358
        # ... then send mail
383
        if (   $orders_infos[0]->{'aqbooksellers.bookselleremail'}
359
        my %mail = (
384
            || $orders_infos[0]->{'aqbooksellers.contemail'} ) {
360
            To => join( ','. @email),
385
            my $to = $orders_infos[0]->{'aqbooksellers.bookselleremail'};
361
            From           => $userenv->{emailaddress},
386
            $to .= ", " if $to;
362
            Subject        => "" . $letter->{title},
387
            $to .= $orders_infos[0]->{'aqbooksellers.contemail'} || "";
363
            Message        => "" . $letter->{content},
388
            my %mail = (
364
            'Content-Type' => 'text/plain; charset="utf8"',
389
                To             => $to,
365
        );
390
                From           => $userenv->{emailaddress},
366
        sendmail(%mail) or carp $Mail::Sendmail::error;
391
                Subject        => Encode::encode( "utf8", "" . $innerletter->{title} ),
392
                Message        => Encode::encode( "utf8", "" . $innerletter->{content} ),
393
                'Content-Type' => 'text/plain; charset="utf8"',
394
            );
395
            sendmail(%mail) or carp $Mail::Sendmail::error;
396
            warn "sending to $mail{To} From $mail{From} subj $mail{Subject} Mess $mail{Message}" if $debug;
397
            if ( C4::Context->preference("LetterLog") ) {
398
                logaction( "ACQUISITION", "Send Acquisition claim letter", "", "order list : " . join( ",", @$externalid ) . "\n$innerletter->{title}\n$innerletter->{content}" ) if $type eq 'claimacquisition';
399
                logaction( "ACQUISITION", "CLAIM ISSUE", undef, "To=" . $mail{To} . " Title=" . $innerletter->{title} . " Content=" . $innerletter->{content} ) if $type eq 'claimissues';
400
            }
401
        } else {
402
            return {error => "no_email" };
403
        }
404
405
        warn "sending to From $userenv->{emailaddress} subj $innerletter->{title} Mess $innerletter->{content}" if $debug;
406
    }
407
367
408
    # send an "account details" notice to a newly created user
368
        logaction(
369
            "ACQUISITION",
370
            $type eq 'claimissues' ? "CLAIM ISSUE" : "ACQUISITION CLAIM",
371
            undef,
372
            "To="
373
                . $databookseller->{contemail}
374
                . " Title="
375
                . $letter->{title}
376
                . " Content="
377
                . $letter->{content}
378
        ) if C4::Context->preference("LetterLog");
379
    }    
380
   # send an "account details" notice to a newly created user 
409
    elsif ( $type eq 'members' ) {
381
    elsif ( $type eq 'members' ) {
410
        # must parse the password special, before it's hashed.
411
        $letter->{content} =~ s/<<borrowers.password>>/$externalid->{'password'}/g;
412
413
        parseletter( $letter, 'borrowers', $externalid->{'borrowernumber'});
414
        parseletter( $letter, 'branches', $externalid->{'branchcode'} );
415
416
        my $branchdetails = GetBranchDetail($externalid->{'branchcode'});
382
        my $branchdetails = GetBranchDetail($externalid->{'branchcode'});
383
        my $letter = GetPreparedLetter (
384
            module => 'members',
385
            letter_code => $letter_code,
386
            branchcode => $externalid->{'branchcode'},
387
            tables => {
388
                'branches'    => $branchdetails,
389
                'borrowers' => $externalid->{'borrowernumber'},
390
            },
391
            substitute => { 'borrowers.password' => $externalid->{'password'} },
392
            want_librarian => 1,
393
        ) or return;
394
417
        my %mail = (
395
        my %mail = (
418
                To      =>     $externalid->{'emailaddr'},
396
                To      =>     $externalid->{'emailaddr'},
419
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
397
                From    =>  $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"),
Lines 425-448 sub SendAlerts { Link Here
425
    }
403
    }
426
}
404
}
427
405
428
=head2 parseletter($letter, $table, $pk)
406
=head2 GetPreparedLetter( %params )
429
407
430
    parameters :
408
    %params hash:
431
    - $letter : a hash to letter fields (title & content useful)
409
      module => letter module, mandatory
432
    - $table : the Koha table to parse.
410
      letter_code => letter code, mandatory
433
    - $pk : the primary key to query on the $table table
411
      branchcode => for letter selection, if missing default system letter taken
434
    parse all fields from a table, and replace values in title & content with the appropriate value
412
      tables => a hashref with table names as keys. Values are either:
435
    (not exported sub, used only internally)
413
        - a scalar - primary key value
414
        - an arrayref - primary key values
415
        - a hashref - full record
416
      substitute => custom substitution key/value pairs
417
      repeat => records to be substituted on consecutive lines:
418
        - an arrayref - tries to guess what needs substituting by
419
          taking remaining << >> tokensr; not recommended
420
        - a hashref token => @tables - replaces <token> << >> << >> </token>
421
          subtemplate for each @tables row; table is a hashref as above
422
      want_librarian => boolean,  if set to true triggers librarian details
423
        substitution from the userenv
424
    Return value:
425
      letter fields hashref (title & content useful)
436
426
437
=cut
427
=cut
438
428
439
our %handles = ();
429
sub GetPreparedLetter {
440
our %columns = ();
430
    my %params = @_;
431
432
    my $module      = $params{module} or croak "No module";
433
    my $letter_code = $params{letter_code} or croak "No letter_code";
434
    my $branchcode  = $params{branchcode} || '';
435
436
    my $letter = getletter( $module, $letter_code, $branchcode )
437
        or warn( "No $module $letter_code letter"),
438
            return;
441
439
442
sub parseletter_sth {
440
    my $tables = $params{tables};
441
    my $substitute = $params{substitute};
442
    my $repeat = $params{repeat};
443
    $tables || $substitute || $repeat
444
      or carp( "ERROR: nothing to substitute - both 'tables' and 'substitute' are empty" ),
445
         return;
446
    my $want_librarian = $params{want_librarian};
447
448
    if ($substitute) {
449
        while ( my ($token, $val) = each %$substitute ) {
450
            $letter->{title} =~ s/<<$token>>/$val/g;
451
            $letter->{content} =~ s/<<$token>>/$val/g;
452
       }
453
    }
454
455
    if ($want_librarian) {
456
        # parsing librarian name
457
        my $userenv = C4::Context->userenv;
458
        $letter->{content} =~ s/<<LibrarianFirstname>>/$userenv->{firstname}/go;
459
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/go;
460
        $letter->{content} =~ s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/go;
461
    }
462
463
    my ($repeat_no_enclosing_tags, $repeat_enclosing_tags);
464
465
    if ($repeat) {
466
        if (ref ($repeat) eq 'ARRAY' ) {
467
            $repeat_no_enclosing_tags = $repeat;
468
        } else {
469
            $repeat_enclosing_tags = $repeat;
470
        }
471
    }
472
473
    if ($repeat_enclosing_tags) {
474
        while ( my ($tag, $tag_tables) = each %$repeat_enclosing_tags ) {
475
            if ( $letter->{content} =~ m!<$tag>(.*)</$tag>!s ) {
476
                my $subcontent = $1;
477
                my @lines = map {
478
                    my %subletter = ( title => '', content => $subcontent );
479
                    _substitute_tables( \%subletter, $_ );
480
                    $subletter{content};
481
                } @$tag_tables;
482
                $letter->{content} =~ s!<$tag>.*</$tag>!join( "\n", @lines )!se;
483
            }
484
        }
485
    }
486
487
    if ($tables) {
488
        _substitute_tables( $letter, $tables );
489
    }
490
491
    if ($repeat_no_enclosing_tags) {
492
        if ( $letter->{content} =~ m/[^\n]*<<.*>>[^\n]*/so ) {
493
            my $line = $&;
494
            my $i = 1;
495
            my @lines = map {
496
                my $c = $line;
497
                $c =~ s/<<count>>/$i/go;
498
                foreach my $field ( keys %{$_} ) {
499
                    $c =~ s/(<<[^\.]+.$field>>)/$_->{$field}/;
500
                }
501
                $i++;
502
                $c;
503
            } @$repeat_no_enclosing_tags;
504
505
            my $replaceby = join( "\n", @lines );
506
            $letter->{content} =~ s/\Q$line\E/$replaceby/s;
507
        }
508
    }
509
510
    $letter->{content} =~ s/<<\S*>>//go; #remove any stragglers
511
#   $letter->{content} =~ s/<<[^>]*>>//go;
512
513
    return $letter;
514
}
515
516
sub _substitute_tables {
517
    my ( $letter, $tables ) = @_;
518
    while ( my ($table, $param) = each %$tables ) {
519
        next unless $param;
520
521
        my $ref = ref $param;
522
523
        my $values;
524
        if ($ref && $ref eq 'HASH') {
525
            $values = $param;
526
        }
527
        else {
528
            my @pk;
529
            my $sth = _parseletter_sth($table);
530
            unless ($sth) {
531
                warn "_parseletter_sth('$table') failed to return a valid sth.  No substitution will be done for that table.";
532
                return;
533
            }
534
            $sth->execute( $ref ? @$param : $param );
535
536
            $values = $sth->fetchrow_hashref;
537
        }
538
539
        _parseletter ( $letter, $table, $values );
540
    }
541
}
542
543
my %handles = ();
544
sub _parseletter_sth {
443
    my $table = shift;
545
    my $table = shift;
444
    unless ($table) {
546
    unless ($table) {
445
        carp "ERROR: parseletter_sth() called without argument (table)";
547
        carp "ERROR: _parseletter_sth() called without argument (table)";
446
        return;
548
        return;
447
    }
549
    }
448
    # check cache first
550
    # check cache first
Lines 456-464 sub parseletter_sth { Link Here
456
    ($table eq 'borrowers'    ) ? "SELECT * FROM $table WHERE borrowernumber = ?"                      :
558
    ($table eq 'borrowers'    ) ? "SELECT * FROM $table WHERE borrowernumber = ?"                      :
457
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                      :
559
    ($table eq 'branches'     ) ? "SELECT * FROM $table WHERE     branchcode = ?"                      :
458
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                      :
560
    ($table eq 'suggestions'  ) ? "SELECT * FROM $table WHERE   suggestionid = ?"                      :
459
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                      : undef ;
561
    ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE             id = ?"                      :
562
    ($table eq 'aqorders'     ) ? "SELECT * FROM $table WHERE    ordernumber = ?"                      :
563
    ($table eq 'opac_news'    ) ? "SELECT * FROM $table WHERE          idnew = ?"                      :
564
    undef ;
460
    unless ($query) {
565
    unless ($query) {
461
        warn "ERROR: No parseletter_sth query for table '$table'";
566
        warn "ERROR: No _parseletter_sth query for table '$table'";
462
        return;     # nothing to get
567
        return;     # nothing to get
463
    }
568
    }
464
    unless ($handles{$table} = C4::Context->dbh->prepare($query)) {
569
    unless ($handles{$table} = C4::Context->dbh->prepare($query)) {
Lines 468-492 sub parseletter_sth { Link Here
468
    return $handles{$table};    # now cache is populated for that $table
573
    return $handles{$table};    # now cache is populated for that $table
469
}
574
}
470
575
471
sub parseletter {
576
=head2 _parseletter($letter, $table, $values)
472
    my ( $letter, $table, $pk, $pk2 ) = @_;
473
    unless ($letter) {
474
        carp "ERROR: parseletter() 1st argument 'letter' empty";
475
        return;
476
    }
477
    my $sth = parseletter_sth($table);
478
    unless ($sth) {
479
        warn "parseletter_sth('$table') failed to return a valid sth.  No substitution will be done for that table.";
480
        return;
481
    }
482
    if ( $pk2 ) {
483
        $sth->execute($pk, $pk2);
484
    } else {
485
        $sth->execute($pk);
486
    }
487
577
488
    my $values = $sth->fetchrow_hashref;
578
    parameters :
489
    
579
    - $letter : a hash to letter fields (title & content useful)
580
    - $table : the Koha table to parse.
581
    - $values : table record hashref
582
    parse all fields from a table, and replace values in title & content with the appropriate value
583
    (not exported sub, used only internally)
584
585
=cut
586
587
my %columns = ();
588
sub _parseletter {
589
    my ( $letter, $table, $values ) = @_;
590
   
490
    # TEMPORARY hack until the expirationdate column is added to reserves
591
    # TEMPORARY hack until the expirationdate column is added to reserves
491
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
592
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
492
        my @waitingdate = split /-/, $values->{'waitingdate'};
593
        my @waitingdate = split /-/, $values->{'waitingdate'};
Lines 500-515 sub parseletter { Link Here
500
        )->output();
601
        )->output();
501
    }
602
    }
502
603
604
    if ($letter->{content} && $letter->{content} =~ /<<today>>/) {
605
        my @da = localtime();
606
        my $todaysdate = "$da[2]:$da[1]  " . C4::Dates->today();
607
        $letter->{content} =~ s/<<today>>/$todaysdate/go;
608
    }
503
609
504
    # and get all fields from the table
610
    # and get all fields from the table
505
    my $columns = C4::Context->dbh->prepare("SHOW COLUMNS FROM $table");
611
#   my $columns = $columns{$table};
506
    $columns->execute;
612
#   unless ($columns) {
507
    while ( ( my $field ) = $columns->fetchrow_array ) {
613
#       $columns = $columns{$table} =  C4::Context->dbh->selectcol_arrayref("SHOW COLUMNS FROM $table");
508
        my $replacefield = "<<$table.$field>>";
614
#   }
509
        $values->{$field} =~ s/\p{P}(?=$)//g if $values->{$field};
615
#   foreach my $field (@$columns) {
510
        my $replacedby   = $values->{$field} || '';
616
511
        ($letter->{title}  ) and $letter->{title}   =~ s/$replacefield/$replacedby/g;
617
    while ( my ($field, $val) = each %$values ) {
512
        ($letter->{content}) and $letter->{content} =~ s/$replacefield/$replacedby/g;
618
        my $replacetablefield = "<<$table.$field>>";
619
        my $replacefield = "<<$field>>";
620
        $val =~ s/\p{P}(?=$)//g if $val;
621
        my $replacedby   = defined ($val) ? $val : '';
622
        ($letter->{title}  ) and do {
623
            $letter->{title}   =~ s/$replacetablefield/$replacedby/g;
624
            $letter->{title}   =~ s/$replacefield/$replacedby/g;
625
        };
626
        ($letter->{content}) and do {
627
            $letter->{content} =~ s/$replacetablefield/$replacedby/g;
628
            $letter->{content} =~ s/$replacefield/$replacedby/g;
629
        };
630
    }
631
632
    if ($table eq 'borrowers' && $letter->{content}) {
633
        if ( my $attributes = GetBorrowerAttributes($values->{borrowernumber}) ) {
634
            my %attr;
635
            foreach (@$attributes) {
636
                my $code = $_->{code};
637
                my $val  = $_->{value_description} || $_->{value};
638
                $val =~ s/\p{P}(?=$)//g if $val;
639
                next unless $val gt '';
640
                $attr{$code} ||= [];
641
                push @{ $attr{$code} }, $val;
642
            }
643
            while ( my ($code, $val_ar) = each %attr ) {
644
                my $replacefield = "<<borrower-attribute:$code>>";
645
                my $replacedby   = join ',', @$val_ar;
646
                $letter->{content} =~ s/$replacefield/$replacedby/g;
647
            }
648
        }
513
    }
649
    }
514
    return $letter;
650
    return $letter;
515
}
651
}
Lines 694-724 returns your letter object, with the content updated. Link Here
694
sub _add_attachments {
830
sub _add_attachments {
695
    my $params = shift;
831
    my $params = shift;
696
832
697
    return unless 'HASH' eq ref $params;
833
    my $letter = $params->{'letter'};
698
    foreach my $required_parameter (qw( letter attachments message )) {
834
    my $attachments = $params->{'attachments'};
699
        return unless exists $params->{$required_parameter};
835
    return $letter unless @$attachments;
700
    }
836
    my $message = $params->{'message'};
701
    return $params->{'letter'} unless @{ $params->{'attachments'} };
702
837
703
    # First, we have to put the body in as the first attachment
838
    # First, we have to put the body in as the first attachment
704
    $params->{'message'}->attach(
839
    $message->attach(
705
        Type => 'TEXT',
840
        Type => $letter->{'content-type'} || 'TEXT',
706
        Data => $params->{'letter'}->{'content'},
841
        Data => $letter->{'is_html'}
842
            ? _wrap_html($letter->{'content'}, $letter->{'title'})
843
            : $letter->{'content'},
707
    );
844
    );
708
845
709
    foreach my $attachment ( @{ $params->{'attachments'} } ) {
846
    foreach my $attachment ( @$attachments ) {
710
        $params->{'message'}->attach(
847
        $message->attach(
711
            Type     => $attachment->{'type'},
848
            Type     => $attachment->{'type'},
712
            Data     => $attachment->{'content'},
849
            Data     => $attachment->{'content'},
713
            Filename => $attachment->{'filename'},
850
            Filename => $attachment->{'filename'},
714
        );
851
        );
715
    }
852
    }
716
    # we're forcing list context here to get the header, not the count back from grep.
853
    # we're forcing list context here to get the header, not the count back from grep.
717
    ( $params->{'letter'}->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) );
854
    ( $letter->{'content-type'} ) = grep( /^Content-Type:/, split( /\n/, $params->{'message'}->header_as_string ) );
718
    $params->{'letter'}->{'content-type'} =~ s/^Content-Type:\s+//;
855
    $letter->{'content-type'} =~ s/^Content-Type:\s+//;
719
    $params->{'letter'}->{'content'} = $params->{'message'}->body_as_string;
856
    $letter->{'content'} = $message->body_as_string;
720
857
721
    return $params->{'letter'};
858
    return $letter;
722
859
723
}
860
}
724
861
Lines 785-798 sub _send_message_by_email ($;$$$) { Link Here
785
922
786
    my $utf8   = decode('MIME-Header', $message->{'subject'} );
923
    my $utf8   = decode('MIME-Header', $message->{'subject'} );
787
    $message->{subject}= encode('MIME-Header', $utf8);
924
    $message->{subject}= encode('MIME-Header', $utf8);
925
    my $subject = encode('utf8', $message->{'subject'});
788
    my $content = encode('utf8', $message->{'content'});
926
    my $content = encode('utf8', $message->{'content'});
927
    my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"';
928
    my $is_html = $content_type =~ m/html/io;
789
    my %sendmail_params = (
929
    my %sendmail_params = (
790
        To   => $to_address,
930
        To   => $to_address,
791
        From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'),
931
        From => $message->{'from_address'} || C4::Context->preference('KohaAdminEmailAddress'),
792
        Subject => encode('utf8', $message->{'subject'}),
932
        Subject => $subject,
793
        charset => 'utf8',
933
        charset => 'utf8',
794
        Message => $content,
934
        Message => $is_html ? _wrap_html($content, $subject) : $content,
795
        'content-type' => $message->{'content_type'} || 'text/plain; charset="UTF-8"',
935
        'content-type' => $content_type,
796
    );
936
    );
797
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
937
    $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
798
    if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) {
938
    if ( my $bcc = C4::Context->preference('OverdueNoticeBcc') ) {
Lines 812-817 sub _send_message_by_email ($;$$$) { Link Here
812
    }
952
    }
813
}
953
}
814
954
955
sub _wrap_html {
956
    my ($content, $title) = @_;
957
958
    my $css = C4::Context->preference("NoticeCSS") || '';
959
    $css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css;
960
    return <<EOS;
961
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
962
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
963
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
964
<head>
965
<title>$title</title>
966
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
967
$css
968
</head>
969
<body>
970
$content
971
</body>
972
</html>
973
EOS
974
}
975
815
sub _send_message_by_sms ($) {
976
sub _send_message_by_sms ($) {
816
    my $message = shift or return undef;
977
    my $message = shift or return undef;
817
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
978
    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 2229-2235 sub DeleteMessage { Link Here
2229
    logaction("MEMBERS", "DELCIRCMESSAGE", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog");
2233
    logaction("MEMBERS", "DELCIRCMESSAGE", $message->{'borrowernumber'}, $message->{'message'}) if C4::Context->preference("BorrowersLog");
2230
}
2234
}
2231
2235
2232
END { }    # module clean-up code here (global destructor)
2236
=head2 IssueSlip
2237
2238
  IssueSlip($branchcode, $borrowernumber, $quickslip)
2239
2240
  Returns letter hash ( see C4::Letters::GetPreparedLetter )
2241
2242
  $quickslip is boolean, to indicate whether we want a quick slip
2243
2244
=cut
2245
2246
sub IssueSlip {
2247
    my ($branch, $borrowernumber, $quickslip) = @_;
2248
2249
#   return unless ( C4::Context->boolean_preference('printcirculationslips') );
2250
2251
    my $today       = POSIX::strftime("%Y-%m-%d", localtime);
2252
2253
    my $issueslist = GetPendingIssues($borrowernumber);
2254
    foreach my $it (@$issueslist){
2255
        if ($it->{'issuedate'} eq $today) {
2256
            $it->{'today'} = 1;
2257
        }
2258
        elsif ($it->{'date_due'} le $today) {
2259
            $it->{'overdue'} = 1;
2260
        }
2261
2262
        $it->{'date_due'}=format_date($it->{'date_due'});
2263
    }
2264
    my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist;
2265
2266
    my ($letter_code, %repeat);
2267
    if ( $quickslip ) {
2268
        $letter_code = 'ISSUEQSLIP';
2269
        %repeat =  (
2270
            'checkedout' => [ map {
2271
                'biblio' => $_,
2272
                'items'  => $_,
2273
                'issues' => $_,
2274
            }, grep { $_->{'today'} } @issues ],
2275
        );
2276
    }
2277
    else {
2278
        $letter_code = 'ISSUESLIP';
2279
        %repeat =  (
2280
            'checkedout' => [ map {
2281
                'biblio' => $_,
2282
                'items'  => $_,
2283
                'issues' => $_,
2284
            }, grep { !$_->{'overdue'} } @issues ],
2285
2286
            'overdue' => [ map {
2287
                'biblio' => $_,
2288
                'items'  => $_,
2289
                'issues' => $_,
2290
            }, grep { $_->{'overdue'} } @issues ],
2291
2292
            'news' => [ map {
2293
                $_->{'timestamp'} = $_->{'newdate'};
2294
                { opac_news => $_ }
2295
            } @{ GetNewsToDisplay("slip") } ],
2296
        );
2297
    }
2298
2299
    return  C4::Letters::GetPreparedLetter (
2300
        module => 'circulation',
2301
        letter_code => $letter_code,
2302
        branchcode => $branch,
2303
        tables => {
2304
            'branches'    => $branch,
2305
            'borrowers'   => $borrowernumber,
2306
        },
2307
        repeat => \%repeat,
2308
    );
2309
}
2233
2310
2234
1;
2311
1;
2235
2312
(-)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 425-444 sub ModSuggestion { Link Here
425
    if ($suggestion->{STATUS}) {
425
    if ($suggestion->{STATUS}) {
426
        # fetch the entire updated suggestion so that we can populate the letter
426
        # fetch the entire updated suggestion so that we can populate the letter
427
        my $full_suggestion = GetSuggestion($suggestion->{suggestionid});
427
        my $full_suggestion = GetSuggestion($suggestion->{suggestionid});
428
        my $letter = C4::Letters::getletter('suggestions', $full_suggestion->{STATUS});
428
        if ( my $letter =  C4::Letters::GetPreparedLetter (
429
        if ($letter) {
429
            module => 'suggestions',
430
            C4::Letters::parseletter($letter, 'branches',    $full_suggestion->{branchcode});
430
            letter_code => $full_suggestion->{STATUS},
431
            C4::Letters::parseletter($letter, 'borrowers',   $full_suggestion->{suggestedby});
431
            branchcode => $full_suggestion->{branchcode},
432
            C4::Letters::parseletter($letter, 'suggestions', $full_suggestion->{suggestionid});
432
            tables => {
433
            C4::Letters::parseletter($letter, 'biblio',      $full_suggestion->{biblionumber});
433
                'branches'    => $full_suggestion->{branchcode},
434
            my $enqueued = C4::Letters::EnqueueLetter({
434
                'borrowers'   => $full_suggestion->{suggestedby},
435
                'suggestions' => $full_suggestion,
436
                'biblio'      => $full_suggestion->{biblionumber},
437
            },
438
        ) ) {
439
            C4::Letters::EnqueueLetter({
435
                letter                  => $letter,
440
                letter                  => $letter,
436
                borrowernumber          => $full_suggestion->{suggestedby},
441
                borrowernumber          => $full_suggestion->{suggestedby},
437
                suggestionid            => $full_suggestion->{suggestionid},
442
                suggestionid            => $full_suggestion->{suggestionid},
438
                LibraryName             => C4::Context->preference("LibraryName"),
443
                LibraryName             => C4::Context->preference("LibraryName"),
439
                message_transport_type  => 'email',
444
                message_transport_type  => 'email',
440
            });
445
            }) or warn "can't enqueue letter $letter";
441
            if (!$enqueued){warn "can't enqueue letter $letter";}
442
        }
446
        }
443
    }
447
    }
444
    return $status_update_table;
448
    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($session->param('branch') || $branch, $borrowernumber);
180
    $query->param( 'borrowernumber', '' );
179
    $query->param( 'borrowernumber', '' );
181
    $borrowernumber = '';
180
    $borrowernumber = '';
182
}
181
}
(-)a/circ/hold-transfer-slip.pl (-12 / +20 lines)
Lines 23-32 use strict; Link Here
23
use C4::Context;
23
use C4::Context;
24
use C4::Output;
24
use C4::Output;
25
use CGI;
25
use CGI;
26
use C4::Auth;
26
use C4::Auth qw/:DEFAULT get_session/;
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 35-47 BEGIN { Link Here
35
}
33
}
36
34
37
my $input = new CGI;
35
my $input = new CGI;
36
my $sessionID = $input->cookie("CGISESSID");
37
my $session = get_session($sessionID);
38
38
my $biblionumber = $input->param('biblionumber');
39
my $biblionumber = $input->param('biblionumber');
39
my $borrowernumber = $input->param('borrowernumber');
40
my $borrowernumber = $input->param('borrowernumber');
40
my $transfer = $input->param('transfer');
41
my $transfer = $input->param('transfer');
41
42
42
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
43
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
43
    {   
44
    {   
44
        template_name   => "circ/hold-transfer-slip.tmpl",
45
        template_name   => "circ/printslip.tmpl",
45
        query           => $input,
46
        query           => $input,
46
        type            => "intranet",
47
        type            => "intranet",
47
        authnotrequired => 0,
48
        authnotrequired => 0,
Lines 50-63 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
50
    }
51
    }
51
);
52
);
52
53
53
my $reserveinfo = GetReserveInfo($borrowernumber,$biblionumber );
54
my $userenv = C4::Context->userenv;
54
my $pulldate = C4::Dates->new();
55
my ($slip, $is_html);
55
$reserveinfo->{'pulldate'} = $pulldate->output();
56
if ( my $letter = ReserveSlip ($session->param('branch') || $userenv->{branch}, $borrowernumber, $biblionumber) ) {
56
$reserveinfo->{'branchname'} = GetBranchName($reserveinfo->{'branchcode'});
57
    $slip = $letter->{content};
57
$reserveinfo->{'transferrequired'} = $transfer;
58
    $is_html = $letter->{is_html};
58
59
}
59
$template->param( reservedata => [ $reserveinfo ] ,
60
else {
60
				);
61
    $slip = "Reserve not found";
62
}
63
$template->param(
64
    slip => $slip,
65
    plain => !$is_html,
66
    title => "Koha -- Circulation: Transfers",
67
    stylesheet => C4::Context->preference("SlipCSS"),
68
);
61
69
62
output_html_with_http_headers $input, $cookie, $template->output;
70
output_html_with_http_headers $input, $cookie, $template->output;
63
71
(-)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 1169-1178 DROP TABLE IF EXISTS `letter`; Link Here
1169
CREATE TABLE `letter` ( -- table for all notice templates in Koha
1169
CREATE TABLE `letter` ( -- table for all notice templates in Koha
1170
  `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1170
  `module` varchar(20) NOT NULL default '', -- Koha module that triggers this notice
1171
  `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1171
  `code` varchar(20) NOT NULL default '', -- unique identifier for this notice
1172
  `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
1172
  `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1173
  `name` varchar(100) NOT NULL default '', -- plain text name for this notice
1174
  `is_html` tinyint(1) default 0,
1173
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1175
  `title` varchar(200) NOT NULL default '', -- subject line of the notice
1174
  `content` text, -- body text for the notice
1176
  `content` text, -- body text for the notice
1175
  PRIMARY KEY  (`module`,`code`)
1177
  PRIMARY KEY  (`module`,`code`, `branchcode`)
1176
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1178
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1177
1179
1178
--
1180
--
Lines 2253-2264 CREATE TABLE `message_transports` ( Link Here
2253
  `is_digest` tinyint(1) NOT NULL default '0',
2255
  `is_digest` tinyint(1) NOT NULL default '0',
2254
  `letter_module` varchar(20) NOT NULL default '',
2256
  `letter_module` varchar(20) NOT NULL default '',
2255
  `letter_code` varchar(20) NOT NULL default '',
2257
  `letter_code` varchar(20) NOT NULL default '',
2258
  `branchcode` varchar(10) NOT NULL default '',
2256
  PRIMARY KEY  (`message_attribute_id`,`message_transport_type`,`is_digest`),
2259
  PRIMARY KEY  (`message_attribute_id`,`message_transport_type`,`is_digest`),
2257
  KEY `message_transport_type` (`message_transport_type`),
2260
  KEY `message_transport_type` (`message_transport_type`),
2258
  KEY `letter_module` (`letter_module`,`letter_code`),
2261
  KEY `letter_module` (`letter_module`,`letter_code`),
2259
  CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2262
  CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2260
  CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2263
  CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE,
2261
  CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`) REFERENCES `letter` (`module`, `code`) ON DELETE CASCADE ON UPDATE CASCADE
2264
  CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
2262
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2265
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2263
2266
2264
--
2267
--
(-)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 (+2 lines)
Lines 330-335 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');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
335
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
336
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
335
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
337
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
(-)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 4712-4717 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4712
    SetVersion($DBversion);
4711
    SetVersion($DBversion);
4713
}
4712
}
4714
4713
4714
$DBversion = "3.07.00.XXX";
4715
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4716
    $dbh->do("ALTER TABLE `message_transports` DROP FOREIGN KEY `message_transports_ibfk_3`");
4717
    $dbh->do("ALTER TABLE `letter` DROP PRIMARY KEY");
4718
    $dbh->do("ALTER TABLE `letter` ADD `branchcode` varchar(10) default NULL AFTER `code`");
4719
    $dbh->do("ALTER TABLE `letter` ADD PRIMARY KEY  (`module`,`code`, `branchcode`)");
4720
    $dbh->do("ALTER TABLE `message_transports` ADD `branchcode` varchar(10) NOT NULL default ''");
4721
    $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");
4722
    $dbh->do("ALTER TABLE `letter` ADD `is_html` tinyint(1) default 0 AFTER `name`");
4723
4724
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4725
              VALUES ('circulation','ISSUESLIP','Issue Slip','Issue Slip', '<h3><<branches.branchname>></h3>
4726
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
4727
(<<borrowers.cardnumber>>) <br />
4728
4729
<<today>><br />
4730
4731
<h4>Checked Out</h4>
4732
<checkedout>
4733
<p>
4734
<<biblio.title>> <br />
4735
Barcode: <<items.barcode>><br />
4736
Date due: <<issues.date_due>><br />
4737
</p>
4738
</checkedout>
4739
4740
<h4>Overdues</h4>
4741
<overdue>
4742
<p>
4743
<<biblio.title>> <br />
4744
Barcode: <<items.barcode>><br />
4745
Date due: <<issues.date_due>><br />
4746
</p>
4747
</overdue>
4748
4749
<hr>
4750
4751
<h4 style=\"text-align: center; font-style:italic;\">News</h4>
4752
<news>
4753
<div class=\"newsitem\">
4754
<h5 style=\"margin-bottom: 1px; margin-top: 1px\"><b><<opac_news.title>></b></h5>
4755
<p style=\"margin-bottom: 1px; margin-top: 1px\"><<opac_news.new>></p>
4756
<p class=\"newsfooter\" style=\"font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px\">Posted on <<opac_news.timestamp>></p>
4757
<hr />
4758
</div>
4759
</news>', 1)");
4760
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4761
              VALUES ('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '<h3><<branches.branchname>></h3>
4762
Checked out to <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br />
4763
(<<borrowers.cardnumber>>) <br />
4764
4765
<<today>><br />
4766
4767
<h4>Checked Out Today</h4>
4768
<checkedout>
4769
<p>
4770
<<biblio.title>> <br />
4771
Barcode: <<items.barcode>><br />
4772
Date due: <<issues.date_due>><br />
4773
</p>
4774
</checkedout>', 1)");
4775
    $dbh->do("INSERT INTO `letter` (module, code, name, title, content, is_html)
4776
              VALUES ('circulation','RESERVESLIP','Reserve Slip','Reserve Slip', '<h5>Date: <<today>></h5>
4777
4778
<h3> Transfer to/Hold in <<branches.branchname>></h3>
4779
4780
<h3><<borrowers.surname>>, <<borrowers.firstname>></h3>
4781
4782
<ul>
4783
    <li><<borrowers.cardnumber>></li>
4784
    <li><<borrowers.phone>></li>
4785
    <li> <<borrowers.address>><br />
4786
         <<borrowers.address2>><br />
4787
         <<borrowers.city >>  <<borrowers.zipcode>>
4788
    </li>
4789
    <li><<borrowers.email>></li>
4790
</ul>
4791
<br />
4792
<h3>ITEM ON HOLD</h3>
4793
<h4><<biblio.title>></h4>
4794
<h5><<biblio.author>></h5>
4795
<ul>
4796
   <li><<items.barcode>></li>
4797
   <li><<items.itemcallnumber>></li>
4798
   <li><<reserves.waitingdate>></li>
4799
</ul>
4800
<p>Notes:
4801
<pre><<reserves.reservenotes>></pre>
4802
</p>', 1)");
4803
4804
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free')");
4805
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free')");
4806
4807
    $dbh->do("UPDATE `letter` SET content = replace(content, '<<title>>', '<<biblio.title>>') WHERE code = 'HOLDPLACED'");
4808
4809
    print "Upgrade to $DBversion done (Add branchcode and is_html to letter table; Default ISSUESLIP and RESERVESLIP letters; Add NoticeCSS and SlipCSS sysprefs)\n";
4810
    SetVersion($DBversion);
4811
}
4812
4715
=head1 FUNCTIONS
4813
=head1 FUNCTIONS
4716
4814
4717
=head2 DropAllForeignKeys($table)
4815
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc (-1 / +3 lines)
Lines 42-49 function update_child() { Link Here
42
	 });
42
	 });
43
43
44
	// YUI Toolbar Functions
44
	// YUI Toolbar Functions
45
    var slip_re = /slip/;
45
	function printx_window(print_type) {
46
	function printx_window(print_type) {
46
		window.open("/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
47
        var handler = print_type.match(slip_re) ? "printslip" : "moremember";
48
		window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=[% borrowernumber %]&amp;print=" + print_type, "printwindow");
47
		return false;
49
		return false;
48
	}
50
	}
49
	function searchToHold(){
51
	function searchToHold(){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+5 lines)
Lines 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/tools/letter.tt (-44 / +118 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>
300
      [% IF is_html %]
301
      <input type="checkbox" id="is_html" name="is_html" value="1" checked />
302
      [% ELSE %]
303
      <input type="checkbox" id="is_html" name="is_html" value="1" />
304
      [% END %]
305
		</li>
306
		<li>
238
			<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
307
			<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
239
		</li>
308
		</li>
240
		<li>
309
		<li>
Lines 252-278 $(document).ready(function() { Link Here
252
		</ol>
321
		</ol>
253
		</fieldset>
322
		</fieldset>
254
		<fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
323
		<fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
324
		<fieldset class="action"><input type="button" value="Cancel" onclick="cancel(this.form)" class="button" /></fieldset>
325
      <input type="hidden" name="searchfield" value="[% searchfield %]" />
255
		</form>
326
		</form>
256
	[% END %]
327
[% END %]
257
	
328
	
258
	[% IF ( add_validate ) %]
329
[% IF ( add_validate ) %]
259
	Data recorded
330
	Data recorded
260
	<form action="[% action %]" method="post">
331
	<form action="[% action %]" method="post">
261
	<input type="submit" value="OK" />
332
	<input type="submit" value="OK" />
262
	</form>
333
	</form>
263
	[% END %]
334
[% END %]
264
	
335
	
265
	[% IF ( delete_confirm ) %]
336
[% IF ( delete_confirm ) %]
266
	<div class="dialog alert"><h3>Delete Notice?</h3>
337
	<div class="dialog alert"><h3>Delete Notice?</h3>
267
	<table>
338
	<table>
268
        <thead>
339
        <thead>
269
		<tr>
340
		<tr>
341
			<th>Branch</th>
270
			<th>Module</th>
342
			<th>Module</th>
271
			<th>Code</th>
343
			<th>Code</th>
272
			<th>Name</th>
344
			<th>Name</th>
273
		</tr>
345
		</tr>
274
        </thead>
346
        </thead>
275
		<tr>
347
		<tr>
348
			<td>[% branchname %]</td>
276
			<td>[% module %]</td>
349
			<td>[% module %]</td>
277
            <td>[% code %]</td>
350
            <td>[% code %]</td>
278
			<td>[% name %]</td>
351
			<td>[% name %]</td>
Lines 280-285 $(document).ready(function() { Link Here
280
	</table>
353
	</table>
281
		<form action="[% action %]" method="post">
354
		<form action="[% action %]" method="post">
282
		<input type="hidden" name="op" value="delete_confirmed">
355
		<input type="hidden" name="op" value="delete_confirmed">
356
		<input type="hidden" name="branchcode" value="[% branchcode %]" />
283
		<input type="hidden" name="code" value="[% code %]" />
357
		<input type="hidden" name="code" value="[% code %]" />
284
		<input type="hidden" name="module" value="[% module %]" />
358
		<input type="hidden" name="module" value="[% module %]" />
285
				<input type="submit" value="Yes, Delete" class="approve" />
359
				<input type="submit" value="Yes, Delete" class="approve" />
Lines 290-303 $(document).ready(function() { Link Here
290
				</form>
364
				</form>
291
		</div>
365
		</div>
292
366
293
	[% END %]
367
[% END %]
294
	
368
	
295
	[% IF ( delete_confirmed ) %]
369
[% IF ( delete_confirmed ) %]
296
	Data deleted
370
	Data deleted
297
	<form action="[% action %]" method="post">
371
	<form action="[% action %]" method="post">
298
	<input type="submit" value="OK" />
372
	<input type="submit" value="OK" />
299
	</form>
373
	</form>
300
	[% END %]
374
[% END %]
301
375
302
</div>
376
</div>
303
</div>
377
</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 347-356 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
347
            # if we manage to find a valid email address, send notice 
347
            # if we manage to find a valid email address, send notice 
348
            if ($emailaddr) {
348
            if ($emailaddr) {
349
                $newdata{emailaddr} = $emailaddr;
349
                $newdata{emailaddr} = $emailaddr;
350
                my $letter = getletter ('members', "ACCTDETAILS:$newdata{'branchcode'}") ;
350
                SendAlerts ( 'members', \%newdata, "ACCTDETAILS" );
351
                # if $branch notice fails, then email a default notice instead.
352
                $letter = getletter ('members', "ACCTDETAILS")  if !$letter;
353
                SendAlerts ( 'members' , \%newdata , $letter ) if $letter
354
            }
351
            }
355
        } 
352
        } 
356
353
(-)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 484-496 $template->param( Link Here
484
	activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
483
	activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
485
);
484
);
486
485
487
#Get the slip news items
488
my $all_koha_news   = &GetNewsToDisplay("slip");
489
my $koha_news_count = scalar @$all_koha_news;
490
491
$template->param(
492
    koha_news       => $all_koha_news,
493
    koha_news_count => $koha_news_count
494
);
495
496
output_html_with_http_headers $input, $cookie, $template->output;
486
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/members/printslip.pl (+92 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 qw/:DEFAULT get_session/;
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
my $sessionID = $input->cookie("CGISESSID");
55
my $session = get_session($sessionID);
56
57
$debug or $debug = $input->param('debug') || 0;
58
my $print = $input->param('print');
59
my $error = $input->param('error');
60
61
# circ staff who process checkouts but can't edit
62
# patrons still need to be able to print receipts
63
my $flagsrequired = { circulate => "circulate_remaining_permissions" };
64
65
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
66
    {
67
        template_name   => "circ/printslip.tmpl",
68
        query           => $input,
69
        type            => "intranet",
70
        authnotrequired => 0,
71
        flagsrequired   => $flagsrequired,
72
        debug           => 1,
73
    }
74
);
75
76
my $borrowernumber = $input->param('borrowernumber');
77
my $branch=C4::Context->userenv->{'branch'};
78
my ($slip, $is_html);
79
if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
80
    $slip = $letter->{content};
81
    $is_html = $letter->{is_html};
82
}
83
84
$template->param(
85
    slip => $slip,
86
    plain => !$is_html,
87
    title => "Print Receipt for $borrowernumber",
88
    stylesheet => C4::Context->preference("SlipCSS"),
89
    error           => $error,
90
);
91
92
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 (-70 / +161 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-82 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, $staffflags ) = get_template_and_user(
80
    {
99
    {
81
        template_name   => 'tools/letter.tmpl',
100
        template_name   => 'tools/letter.tmpl',
82
        query           => $input,
101
        query           => $input,
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") && !$staffflags->{'superlibrarian'}
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