&UpdateFine
&GetFine
&get_chargeable_units
- &CheckItemNotify
&GetOverduesForBranch
- &RemoveNotifyLine
- &AddNotifyLine
&GetOverdueMessageTransportTypes
&parse_overdues_letter
);
return @$branchcodes;
}
-=head2 CheckItemNotify
-
-Sql request to check if the document has alreday been notified
-this function is not exported, only used with GetOverduesForBranch
-
-=cut
-
-sub CheckItemNotify {
- my ($notify_id,$notify_level,$itemnumber) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("
- SELECT COUNT(*)
- FROM notifys
- WHERE notify_id = ?
- AND notify_level = ?
- AND itemnumber = ? ");
- $sth->execute($notify_id,$notify_level,$itemnumber);
- my $notified = $sth->fetchrow;
- return ($notified);
-}
-
=head2 GetOverduesForBranch
Sql request for display all information for branchoverdues.pl
AND (issues.branchcode = ? )
AND (issues.date_due < NOW())
";
- my @getoverdues;
- my $i = 0;
- my $sth;
if ($location) {
- $sth = $dbh->prepare("$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname");
- $sth->execute($branch, $location);
+ my $q = "$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname";
+ return @{ $dbh->selectall_arrayref($q, { Slice => {} }, $branch, $location ) };
} else {
- $sth = $dbh->prepare("$select ORDER BY borrowers.surname, borrowers.firstname");
- $sth->execute($branch);
+ my $q = "$select ORDER BY borrowers.surname, borrowers.firstname";
+ return @{ $dbh->selectall_arrayref($q, { Slice => {} }, $branch ) };
}
- while ( my $data = $sth->fetchrow_hashref ) {
- #check if the document has already been notified
- my $countnotify = CheckItemNotify($data->{'notify_id'}, $data->{'notify_level'}, $data->{'itemnumber'});
- if ($countnotify eq '0') {
- $getoverdues[$i] = $data;
- $i++;
- }
- }
- return (@getoverdues);
-}
-
-
-=head2 AddNotifyLine
-
- &AddNotifyLine($borrowernumber, $itemnumber, $overduelevel, $method, $notifyId)
-
-Create a line into notify, if the method is phone, the notification_send_date is implemented to
-
-=cut
-
-sub AddNotifyLine {
- my ( $borrowernumber, $itemnumber, $overduelevel, $method, $notifyId ) = @_;
- my $dbh = C4::Context->dbh;
- if ( $method eq "phone" ) {
- my $sth = $dbh->prepare(
- "INSERT INTO notifys (borrowernumber,itemnumber,notify_date,notify_send_date,notify_level,method,notify_id)
- VALUES (?,?,now(),now(),?,?,?)"
- );
- $sth->execute( $borrowernumber, $itemnumber, $overduelevel, $method,
- $notifyId );
- }
- else {
- my $sth = $dbh->prepare(
- "INSERT INTO notifys (borrowernumber,itemnumber,notify_date,notify_level,method,notify_id)
- VALUES (?,?,now(),?,?,?)"
- );
- $sth->execute( $borrowernumber, $itemnumber, $overduelevel, $method,
- $notifyId );
- }
- return 1;
-}
-
-=head2 RemoveNotifyLine
-
- &RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date );
-
-Cancel a notification
-
-=cut
-
-sub RemoveNotifyLine {
- my ( $borrowernumber, $itemnumber, $notify_date ) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare(
- "DELETE FROM notifys
- WHERE
- borrowernumber=?
- AND itemnumber=?
- AND notify_date=?"
- );
- $sth->execute( $borrowernumber, $itemnumber, $notify_date );
- return 1;
}
=head2 GetOverdueMessageTransportTypes
+++ /dev/null
-use utf8;
-package Koha::Schema::Result::Notify;
-
-# Created by DBIx::Class::Schema::Loader
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
-
-=head1 NAME
-
-Koha::Schema::Result::Notify
-
-=cut
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class::Core';
-
-=head1 TABLE: C<notifys>
-
-=cut
-
-__PACKAGE__->table("notifys");
-
-=head1 ACCESSORS
-
-=head2 notify_id
-
- data_type: 'integer'
- default_value: 0
- is_nullable: 0
-
-=head2 borrowernumber
-
- data_type: 'integer'
- default_value: 0
- is_nullable: 0
-
-=head2 itemnumber
-
- data_type: 'integer'
- default_value: 0
- is_nullable: 0
-
-=head2 notify_date
-
- data_type: 'date'
- datetime_undef_if_invalid: 1
- is_nullable: 1
-
-=head2 notify_send_date
-
- data_type: 'date'
- datetime_undef_if_invalid: 1
- is_nullable: 1
-
-=head2 notify_level
-
- data_type: 'integer'
- default_value: 0
- is_nullable: 0
-
-=head2 method
-
- data_type: 'varchar'
- default_value: (empty string)
- is_nullable: 0
- size: 20
-
-=cut
-
-__PACKAGE__->add_columns(
- "notify_id",
- { data_type => "integer", default_value => 0, is_nullable => 0 },
- "borrowernumber",
- { data_type => "integer", default_value => 0, is_nullable => 0 },
- "itemnumber",
- { data_type => "integer", default_value => 0, is_nullable => 0 },
- "notify_date",
- { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
- "notify_send_date",
- { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
- "notify_level",
- { data_type => "integer", default_value => 0, is_nullable => 0 },
- "method",
- { data_type => "varchar", default_value => "", is_nullable => 0, size => 20 },
-);
-
-
-# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sQc1HF4rGwsMBh6uFNKUnQ
-
-
-# You can replace this text with custom content, and it will be preserved on regeneration
-1;
use CGI qw ( -utf8 );
use C4::Output;
use C4::Auth;
-use C4::Overdues; # AddNotifyLine
+use C4::Overdues;
use C4::Biblio;
use C4::Koha;
use C4::Debug;
this module is a new interface, allow to the librarian to check all items on overdues (based on the acountlines type 'FU' )
this interface is filtered by branches (automatically), and by location (optional) ....
- all informations are stocked in the notifys BDD
FIXME for this time, we have only four methods to notify :
- mail : work with a batch programm
# FIXME: better check that borrowernumber is defined and valid.
# FIXME: same for itemnumber and other variables passed in here.
-# now create the line in bdd (notifys)
-if ( $input->param('action') eq 'add' ) {
- my $addnotify =
- AddNotifyLine( $borrowernumber, $itemnumber, $overduelevel, $method,
- $notifyId ) # FIXME: useless variable, no TMPL code for "action" exists.;
-}
-elsif ( $input->param('action') eq 'remove' ) {
- my $notify_date = $input->param('notify_date');
- my $removenotify =
- RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date ); # FIXME: useless variable, no TMPL code for "action" exists.
-}
-
my @overduesloop;
my @getoverdues = GetOverduesForBranch( $default, $location );
$debug and warn "HERE : $default / $location" . Dumper(@getoverdues);
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
--- Table structure for table `notifys`
---
-
-DROP TABLE IF EXISTS `notifys`;
-CREATE TABLE `notifys` (
- `notify_id` int(11) NOT NULL default 0,
- `borrowernumber` int(11) NOT NULL default 0,
- `itemnumber` int(11) NOT NULL default 0,
- `notify_date` date default NULL,
- `notify_send_date` date default NULL,
- `notify_level` int(1) NOT NULL default 0,
- `method` varchar(20) NOT NULL default ''
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-
---
-- Table structure for table `oai_sets`
--