Skip to content

Commit

Permalink
Merge branch 'ptfs-master' of github.com:pjones9/ptfs-master into ptf…
Browse files Browse the repository at this point in the history
…s-master
  • Loading branch information
ctfliblime committed Jun 16, 2011
2 parents bf6cf83 + 3f46c2c commit 6d99db1
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 61 deletions.
12 changes: 0 additions & 12 deletions C4/Letters.pm
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,6 @@ sub CreateTALKINGtechMESSAGE {

$notelevel = 0 if ($code eq "FINE");
my $due_date;
my ($tmpfh,$tmpname) = tempfile( DIR => "/tmp/itivamsg" );
# Append additional info into file that will be sent to i-tiva server
my $filename = C4::Context->preference('TalkingTechFileName');
open(MSG,">>$filename") or warn "Can't open $filename";
foreach my $item (@$items) {
my $branch = C4::Branch::GetBranchDetail($item->{holdingbranch});
my $temppath = C4::Context->preference('TalkingTechMessagePath')
Expand All @@ -822,11 +818,6 @@ sub CreateTALKINGtechMESSAGE {
$due_date = '';
}
$branch->{branchname} =~ s/Public Library/PL/;
printf MSG "\"V\",\"EN\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%12.12s\",\"%s\",\"%s\",\"%s\",\"\"\r\n",
$code,$notelevel,$borrower->{cardnumber},$borrower->{title},
$borrower->{firstname},$borrower->{surname},$borrower->{phone},
$borrower->{email},$item->{holdingbranch},$branch->{branchname},
$item->{barcode},$due_date,$item->{title};
if (defined $tmpfh) {
printf $tmpfh "\"V\",\"EN\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"\",\"%s\",\"%12.12s\",\"%s\",\"%s\",\"%s\",\"\"\r\n",
$code,$notelevel,$borrower->{cardnumber},$borrower->{title},
Expand All @@ -837,9 +828,6 @@ sub CreateTALKINGtechMESSAGE {
close($tmpfh);
}
}
close(MSG);
chmod(0666,$tmpfh);
close($tmpfh);

return 1;
}
Expand Down
6 changes: 4 additions & 2 deletions C4/SIP/ILS/Item.pm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ sub new {
my ($whatever, $arrayref) = GetReservesFromBiblionumber($item->{biblionumber});
$item->{hold_queue} = [ sort priority_sort @$arrayref ];
$item->{hold_shelf} = [( grep { defined $_->{found} and $_->{found} eq 'W' } @{$item->{hold_queue}} )];
$item->{pending_queue} = [( grep {(! defined $_->{found}) or $_->{found} ne 'W' } @{$item->{hold_queue}} )];
$item->{pending_queue} = [( grep {(! defined $_->{found}) or ($_->{found} ne 'W' and $_->{found} ne 'S') } @{$item->{hold_queue}} )];
$self = $item;
bless $self, $type;

Expand Down Expand Up @@ -176,7 +176,9 @@ sub hold_patron_name {
($email or $phone) ? " ($email$phone)" : # only 1 populated, we don't care which: no comma
"" ; # neither populated, empty string
my $name = $holder->{firstname} ? $holder->{firstname} . ' ' : '';
$name .= $holder->{surname} . $extra;
# Previously extra was concatenated on. Have removed for now,
# syspref in the future?
$name .= $holder->{surname};
# $self->{hold_patron_name} = $name; # TODO: consider caching
return $name;
}
Expand Down
10 changes: 9 additions & 1 deletion C4/SIP/ILS/Transaction/Checkin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ sub do_checkin {
my $barcode = $self->{item}->id;
$debug and warn "do_checkin() calling AddReturn($barcode, $branch)";
my ($return, $messages, $iteminformation, $borrower) = AddReturn($barcode, $branch);
$self->alert(!$return);
$debug and warn "AddReturn return value: $return";
$self->alert(0);
# ignoring messages: NotIssued, IsPermanent, WasLost, WasTransfered

# biblionumber, biblioitemnumber, itemnumber
Expand Down Expand Up @@ -99,6 +100,13 @@ sub do_checkin {
$branch,
$messages->{ResFound}->{branchcode});
}
# If item is already in transit to another branch, do not alert
if (($branch ne $messages->{ResFound}->{branchcode}) &&
($messages->{ResFound}->{found} eq 'T')) {
$debug and warn "Alert type set to undefined";
$self->alert_type(undef);
$self->screen_msg(undef);
}
}
$self->alert(1) if defined $self->alert_type; # alert_type could be "00", hypothetically
$self->ok($return);
Expand Down
5 changes: 5 additions & 0 deletions C4/SIP/Sip/MsgType.pm
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,11 @@ sub handle_checkin {
$status->alert(1);
if ($item->destination_loc and $item->destination_loc ne $current_loc) {
$status->alert_type('02'); # hold at other library
# If item is already in transit to another branch, do not alert
if ($status->{hold}->{found} eq 'T') {
$status->alert(0);
$status->alert_type(undef);
}
} else {
$status->alert_type('01'); # hold at this library
}
Expand Down
10 changes: 8 additions & 2 deletions installer/data/syspref_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,10 @@
"value" : "0",
"type" : "YesNo"
},
"TalkingTechFileName" : {
"TalkingTechMessagePath" : {
"explanation" : "Set the file system path for the Talking Tech MESSAGE file",
"options" : "",
"value" : "/tmp/TtMESSAGE.csv",
"value" : "/tmp",
"type" : "free"
},
"DisplayStafficonsXSLT" : {
Expand Down Expand Up @@ -2056,5 +2056,11 @@
"options" : null,
"value" : "1",
"type" : "YesNo"
},
"PrintNoticesMaxLines" : {
"explanation" : "If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.",
"options" : "",
"value" : "0",
"type" : "Integer"
}
}
34 changes: 25 additions & 9 deletions misc/cronjobs/advance_notices.pl
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ BEGIN
my @Ttitems;
if ( 0 == $upcoming->{'days_until_due'} ) {
# This item is due today. Send an 'item due' message.
$borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
message_name => 'item due' } );
$borrower_preferences = C4::Members::Messaging::GetMessagingPreferences(
{ borrowernumber => $upcoming->{'borrowernumber'},
message_name => 'Item Due'
}
);
# warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
next DUEITEM unless $borrower_preferences;

Expand Down Expand Up @@ -174,8 +177,11 @@ BEGIN
} );
}
} else {
$borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
message_name => 'advance notice' } );
$borrower_preferences = C4::Members::Messaging::GetMessagingPreferences(
{ borrowernumber => $upcoming->{'borrowernumber'},
message_name => 'Advance Notice'
}
);
# warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
next UPCOMINGITEM unless $borrower_preferences && exists $borrower_preferences->{'days_in_advance'};
next UPCOMINGITEM unless $borrower_preferences->{'days_in_advance'} == $upcoming->{'days_until_due'};
Expand Down Expand Up @@ -241,21 +247,25 @@ BEGIN
END_SQL

PATRON: for my $borrowernumber ( keys %{ $upcoming_digest} ) {
my @Ttitems;
my @items = @{$upcoming_digest->{$borrowernumber}};
my $count = scalar @items;
my $borrower = C4::Members::GetMember($borrowernumber);
my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
message_name => 'advance notice' } );
my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences(
{ borrowernumber => $borrowernumber,
message_name => 'Advance Notice'
}
);
# warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
next PATRON unless $borrower_preferences; # how could this happen?


my $letter_type = 'PREDUEDGST';
my $letter = C4::Letters::getletter( 'circulation', $letter_type );
die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter;
$sth->execute($borrowernumber,$borrower_preferences->{'days_in_advance'});
my $titles = "";
while ( my $item_info = $sth->fetchrow_hashref()) {
push (@Ttitems, $item_info);
my @item_info = map { $_ =~ /^date|date$/ ? format_date($item_info->{$_}) : $item_info->{$_} || '' } @item_content_fields;
$titles .= join("\t",@item_info) . "\n";
}
Expand All @@ -266,6 +276,9 @@ BEGIN
'items.content' => $titles
}
} );
if (($letter) && (C4::Context->preference('TalkingTechEnabled'))) {
C4::Letters::CreateTALKINGtechMESSAGE($borrowernumber,\@Ttitems,$letter->{ttcode},'0');
}
if ($nomail) {
local $, = "\f";
print $letter->{'content'};
Expand All @@ -284,8 +297,11 @@ BEGIN
my @items = @{$due_digest->{$borrowernumber}};
my $count = scalar @items;
my $borrower = C4::Members::GetMember($borrowernumber);
my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
message_name => 'item due' } );
my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences(
{ borrowernumber => $borrowernumber,
message_name => 'Item Due'
}
);
# warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
next PATRON unless $borrower_preferences; # how could this happen?

Expand Down
35 changes: 0 additions & 35 deletions misc/cronjobs/overdue_notices.pl
Original file line number Diff line number Diff line change
Expand Up @@ -546,41 +546,6 @@ =head1 SEE ALSO
}
}

# if (@output_chunks) {
# if ($nomail) {
# if ( defined $csvfilename ) {
# print $csv_fh @output_chunks;
# } elsif ( defined $htmlfilename ) {
# } elsif ( defined $htmlfilename) {
# print $html_fh @output_chunks;
# } else {
# local $, = "\f"; # pagebreak
# print @output_chunks;
# }
# } elsif ( defined $htmlfilename ) {
# print $html_fh @output_chunks;
# } else {
# my $attachment = {
# filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
# type => 'text/plain',
# content => join( "\n", @output_chunks )
# };
#
# my $letter = {
# title => 'Overdue Notices',
# content => 'These messages were not sent directly to the patrons.',
# };
# C4::Letters::EnqueueLetter(
# { letter => $letter,
# borrowernumber => undef,
# message_transport_type => 'email',
# attachments => [$attachment],
# to_address => $admin_email_address,
# }
# );
# }
# }

# Examine overdueitemrules table

$rqoverduerules = $dbh->prepare("SELECT * FROM overdueitemrules WHERE delay1 IS NOT NULL AND branchcode = ? ");
Expand Down

0 comments on commit 6d99db1

Please sign in to comment.