Bugzilla – Attachment 68477 Details for
Bug 10021
Remove dead code related to notifys
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10021: Drop table notifys and related code
Bug-10021-Drop-table-notifys-and-related-code.patch (text/plain), 9.19 KB, created by
Jonathan Druart
on 2017-10-24 15:42:56 UTC
(
hide
)
Description:
Bug 10021: Drop table notifys and related code
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-24 15:42:56 UTC
Size:
9.19 KB
patch
obsolete
>From 3c018a03a7d9bdb71ef8369d9df535fbd10230a5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 8 Aug 2016 16:24:21 +0100 >Subject: [PATCH] Bug 10021: Drop table notifys and related code > >This patch drops the notifys table and its related code in C4::Overdues. >A second patch should remove the 2 columns notify_id and notify_level >from the accountlines table. >--- > C4/Overdues.pm | 97 ++-------------------------------- > Koha/Schema/Result/Notify.pm | 94 -------------------------------- > circ/branchoverdues.pl | 15 +----- > installer/data/mysql/kohastructure.sql | 15 ------ > 4 files changed, 5 insertions(+), 216 deletions(-) > delete mode 100644 Koha/Schema/Result/Notify.pm > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index bbde4b87aa..b315511a82 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -55,10 +55,7 @@ BEGIN { > &UpdateFine > &GetFine > &get_chargeable_units >- &CheckItemNotify > &GetOverduesForBranch >- &RemoveNotifyLine >- &AddNotifyLine > &GetOverdueMessageTransportTypes > &parse_overdues_letter > ); >@@ -808,27 +805,6 @@ sub GetBranchcodesWithOverdueRules { > 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 >@@ -881,78 +857,13 @@ sub GetOverduesForBranch { > 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 >diff --git a/Koha/Schema/Result/Notify.pm b/Koha/Schema/Result/Notify.pm >deleted file mode 100644 >index 9be1b2a283..0000000000 >--- a/Koha/Schema/Result/Notify.pm >+++ /dev/null >@@ -1,94 +0,0 @@ >-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; >diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl >index 5f4f01f0f5..1430caaa32 100755 >--- a/circ/branchoverdues.pl >+++ b/circ/branchoverdues.pl >@@ -22,7 +22,7 @@ use C4::Context; > 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; >@@ -34,7 +34,6 @@ use Data::Dumper; > > 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 >@@ -84,18 +83,6 @@ my $location = $input->param('location'); > # 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); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 379c1002be..837d74bfaf 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1281,21 +1281,6 @@ CREATE TABLE `need_merge_authorities` ( -- keeping track of authority records st > ) 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` > -- > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10021
:
54194
|
68262
|
68263
|
68419
|
68420
|
68421
|
68422
|
68477
|
68478
|
68479
|
68480
|
68505
|
68506
|
68793
|
68794
|
68795
|
68796
|
68797
|
68798
|
68920
|
68953
|
68954
|
68955
|
68956
|
68957
|
68958
|
68959
|
69695
|
69696
|
69698