Bugzilla – Attachment 3695 Details for
Bug 6064
Improvement of default value usage in overdue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Change default value in overduerules table for delayn (NULL instead of 0) and fix GetBranchcodesWithOverdueRules function
0001-Bug-6064-Improvement-of-default-value-usage-in-overd.patch (text/plain), 4.55 KB, created by
Sophie MEYNIEUX
on 2011-04-05 14:08:51 UTC
(
hide
)
Description:
Change default value in overduerules table for delayn (NULL instead of 0) and fix GetBranchcodesWithOverdueRules function
Filename:
MIME Type:
Creator:
Sophie MEYNIEUX
Created:
2011-04-05 14:08:51 UTC
Size:
4.55 KB
patch
obsolete
>From 126d6edfd8a87a09d239d3fd3b63eeb2595346f7 Mon Sep 17 00:00:00 2001 >From: Sophie Meynieux <sophie.meynieux@biblibre.com> >Date: Tue, 5 Apr 2011 15:59:34 +0200 >Subject: [PATCH] Bug #6064 Improvement of default value usage in overdue > >Change default value in overduerules table for delayn (NULL instead of 0) and fix GetBranchcodesWithOverdueRules function >--- > C4/Overdues.pm | 6 +++++- > installer/data/mysql/kohastructure.sql | 6 +++--- > installer/data/mysql/updatedatabase.pl | 7 +++++++ > tools/overduerules.pl | 6 +++--- > 4 files changed, 18 insertions(+), 7 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index a9af9d6..28b135c 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -957,9 +957,13 @@ returns a list of branch codes for branches with overdue rules defined. > > sub GetBranchcodesWithOverdueRules { > my $dbh = C4::Context->dbh; >- my $rqoverduebranches = $dbh->prepare("SELECT DISTINCT branchcode FROM overduerules WHERE delay1 IS NOT NULL AND branchcode <> ''"); >+ my $rqoverduebranches = $dbh->prepare("SELECT DISTINCT branchcode FROM overduerules WHERE delay1 IS NOT NULL AND branchcode <> '' ORDER BY branchcode"); > $rqoverduebranches->execute; > my @branches = map { shift @$_ } @{ $rqoverduebranches->fetchall_arrayref }; >+ if (!$branches[0]) { >+ my $availbranches = C4::Branch::GetBranches(); >+ @branches = keys %$availbranches; >+ } > return @branches; > } > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 43ecf12..28dd5a6 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1407,13 +1407,13 @@ DROP TABLE IF EXISTS `overduerules`; > CREATE TABLE `overduerules` ( > `branchcode` varchar(10) NOT NULL default '', > `categorycode` varchar(10) NOT NULL default '', >- `delay1` int(4) default 0, >+ `delay1` int(4) default NULL, > `letter1` varchar(20) default NULL, > `debarred1` varchar(1) default 0, >- `delay2` int(4) default 0, >+ `delay2` int(4) default NULL, > `debarred2` varchar(1) default 0, > `letter2` varchar(20) default NULL, >- `delay3` int(4) default 0, >+ `delay3` int(4) default NULL, > `letter3` varchar(20) default NULL, > `debarred3` int(1) default 0, > PRIMARY KEY (`branchcode`,`categorycode`) >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 7931029..f501716 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4234,6 +4234,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.03.00.045"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("ALTER TABLE overduerules ALTER delay1 SET DEFAULT NULL, ALTER delay2 SET DEFAULT NULL, ALTER delay3 SET DEFAULT NULL"); >+ print "Upgrade to $DBversion done (Setting NULL default value for delayn columns in table overduerules)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/tools/overduerules.pl b/tools/overduerules.pl >index 22822c5..478a762 100755 >--- a/tools/overduerules.pl >+++ b/tools/overduerules.pl >@@ -142,13 +142,13 @@ if ($op eq 'save') { > my $res = $sth_search->fetchrow_hashref(); > if ($res->{'total'}>0) { > $sth_update->execute( >- ($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0), >+ ($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef), > ($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""), > ($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0), >- ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0), >+ ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef), > ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), > ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), >- ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0), >+ ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef), > ($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), > ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), > $branch ,$bor >-- >1.7.0.4 >
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 6064
: 3695