[Koha-patches] [PATCH] Bug 4333 Fix erroneous message re Active Currency

2010-04-30 Thread Colin Campbell
Script was incorrectly asking user to define an active currency
Now test for active currency in the standard way
Use the currency routines in Budgets where applicable
Move the code paths in the if else to subroutines to clarify flow
Enable warnings
---
 admin/currency.pl |  257 +
 1 files changed, 139 insertions(+), 118 deletions(-)

diff --git a/admin/currency.pl b/admin/currency.pl
index 5c34d51..c55d006 100755
--- a/admin/currency.pl
+++ b/admin/currency.pl
@@ -38,34 +38,27 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
-#use warnings; FIXME - Bug 2505
+use warnings;
 use CGI;
 use C4::Context;
 use C4::Auth;
 use C4::Dates qw(format_date);
 use C4::Output;
+use C4::Budgets qw/GetCurrency GetCurrencies/;
 
-sub StringSearch  {
-my $query = SELECT * FROM currency WHERE (currency LIKE ?) ORDER BY 
currency;
-my $sth = C4::Context-dbh-prepare($query);
-$sth-execute((shift || '') . '%');
-return $sth-fetchall_arrayref({});
-}
-
-my $input = new CGI;
-my $searchfield = $input-param('searchfield') || $input-param('description') 
|| '';
+my $input = CGI-new;
+my $searchfield = $input-param('searchfield') || $input-param('description') 
|| q{};
 my $offset  = $input-param('offset') || 0;
-my $op  = $input-param('op') || '';
-my $script_name = /cgi-bin/koha/admin/currency.pl;
+my $op  = $input-param('op') || q{};
+my $script_name = '/cgi-bin/koha/admin/currency.pl';
 my $pagesize = 20;
 
 my ($template, $loggedinuser, $cookie) = get_template_and_user({
-template_name = admin/currency.tmpl,
+template_name = 'admin/currency.tmpl',
 query = $input,
-type = intranet,
+type = 'intranet',
 flagsrequired = {parameters = 1},
 authnotrequired = 0,
-debug = 1,
 });
 
 $searchfield=~ s/\,//g;
@@ -76,121 +69,149 @@ $template-param(searchfield = $searchfield,
 
 my $dbh = C4::Context-dbh;
 
-## ADD_FORM ##
-# called by default. Used to create form to add or  modify a record
-if ($op eq 'add_form') {
-$template-param(add_form = 1);
-# if primkey exists, it's a modify action, so read values to modify...
-my $data;
+if ( $op eq 'add_form' ) {
+add_form($searchfield);
+} elsif ( $op eq 'add_validate' ) {
+add_validate();
+} elsif ( $op eq 'delete_confirm' ) {
+delete_confirm($searchfield);
+} elsif ( $op eq 'delete_confirmed' ) {
+delete_currency($searchfield);
+} else {
+default_path($searchfield);
+}
+
+output_html_with_http_headers $input, $cookie, $template-output;
+
+sub default_path {
+my $searchfield = shift;
+$template-param( else = 1 );
+
+my @currencies = GetCurrencies();
 if ($searchfield) {
-my $sth=$dbh-prepare(select * from currency where currency=?);
-$sth-execute($searchfield);
-$data=$sth-fetchrow_hashref;
-}
-foreach (keys %$data) {
-$template-param($_ = $data-{$_});
+@currencies = grep { $_-{currency} =~ m/^$searchfield/o } @currencies;
 }
-
-my $date = $template-param('timestamp');
-($date) and $template-param('timestamp' = format_date($date));
-# END $OP eq ADD_FORM
-## ADD_VALIDATE ##
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'save') {
-my $dbh = C4::Context-dbh;
-my $check = $dbh-prepare(select count(*) as count from currency where 
currency = ?);
-
-$dbh-do(UPDATE currency SET active = 0) if ($input-param('active') 
 == 1);
-
-$check-execute($input-param('currency'));
-my $count =   $check-fetchrow ;
-if ( $count  0  )
-{
-my $sth = $dbh-prepare(qq|
-UPDATE currency
-SET rate = ?,
-symbol = ?,
-active = ?
-WHERE currency = ?  |  );
-
-$sth-execute(  $input-param('rate'),
-$input-param('symbol')||'',
-$input-param('active')||0,
-$input-param('currency'),
-);
+my $end_of_page = $offset + $pagesize;
+if ( $end_of_page  @currencies ) {
+$end_of_page = @currencies;
+} else {
+$template-param(
+ltcount  = 1,
+nextpage = $end_of_page
+);
 }
-else
-{
-my $sth = $dbh-prepare(qq|
-INSERT INTO currency (currency, rate, symbol, active) 
VALUES (?,?,?,?)   |);
-
-$sth-execute(  $input-param('currency'),
-$input-param('rate'),
-$input-param('symbol')||'',
-$input-param('active')||0,
-);
+$end_of_page--;
+my @display_curr = @currencies[ $offset .. $end_of_page ];
+for my $c (@display_curr) {
+$c-{timestamp} = format_date( 

[Koha-patches] [PATCH] Bug 4333 Fix erroneous message re Active Currency

2010-04-30 Thread Colin Campbell
Script was incorrectly asking user to define an active currency
Now test for active currency in the standard way
Use the currency routines in Budgets where applicable
Move the code paths in the if else to subroutines to clarify flow
Enable warnings
---
 admin/currency.pl |  258 +
 1 files changed, 140 insertions(+), 118 deletions(-)

diff --git a/admin/currency.pl b/admin/currency.pl
index 5c34d51..003ff89 100755
--- a/admin/currency.pl
+++ b/admin/currency.pl
@@ -38,34 +38,27 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
-#use warnings; FIXME - Bug 2505
+use warnings;
 use CGI;
 use C4::Context;
 use C4::Auth;
 use C4::Dates qw(format_date);
 use C4::Output;
+use C4::Budgets qw/GetCurrency GetCurrencies/;
 
-sub StringSearch  {
-my $query = SELECT * FROM currency WHERE (currency LIKE ?) ORDER BY 
currency;
-my $sth = C4::Context-dbh-prepare($query);
-$sth-execute((shift || '') . '%');
-return $sth-fetchall_arrayref({});
-}
-
-my $input = new CGI;
-my $searchfield = $input-param('searchfield') || $input-param('description') 
|| '';
+my $input = CGI-new;
+my $searchfield = $input-param('searchfield') || $input-param('description') 
|| q{};
 my $offset  = $input-param('offset') || 0;
-my $op  = $input-param('op') || '';
-my $script_name = /cgi-bin/koha/admin/currency.pl;
+my $op  = $input-param('op') || q{};
+my $script_name = '/cgi-bin/koha/admin/currency.pl';
 my $pagesize = 20;
 
 my ($template, $loggedinuser, $cookie) = get_template_and_user({
-template_name = admin/currency.tmpl,
+template_name = 'admin/currency.tmpl',
 query = $input,
-type = intranet,
+type = 'intranet',
 flagsrequired = {parameters = 1},
 authnotrequired = 0,
-debug = 1,
 });
 
 $searchfield=~ s/\,//g;
@@ -76,121 +69,150 @@ $template-param(searchfield = $searchfield,
 
 my $dbh = C4::Context-dbh;
 
-## ADD_FORM ##
-# called by default. Used to create form to add or  modify a record
-if ($op eq 'add_form') {
-$template-param(add_form = 1);
-# if primkey exists, it's a modify action, so read values to modify...
-my $data;
+if ( $op eq 'add_form' ) {
+add_form($searchfield);
+} elsif ( $op eq 'save' ) {
+add_validate();
+print $input-redirect('/cgi-bin/koha/admin/currency.pl');
+} elsif ( $op eq 'delete_confirm' ) {
+delete_confirm($searchfield);
+} elsif ( $op eq 'delete_confirmed' ) {
+delete_currency($searchfield);
+} else {
+default_path($searchfield);
+}
+
+output_html_with_http_headers $input, $cookie, $template-output;
+
+sub default_path {
+my $searchfield = shift;
+$template-param( else = 1 );
+
+my @currencies = GetCurrencies();
 if ($searchfield) {
-my $sth=$dbh-prepare(select * from currency where currency=?);
-$sth-execute($searchfield);
-$data=$sth-fetchrow_hashref;
-}
-foreach (keys %$data) {
-$template-param($_ = $data-{$_});
+@currencies = grep { $_-{currency} =~ m/^$searchfield/o } @currencies;
 }
-
-my $date = $template-param('timestamp');
-($date) and $template-param('timestamp' = format_date($date));
-# END $OP eq ADD_FORM
-## ADD_VALIDATE ##
-# called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'save') {
-my $dbh = C4::Context-dbh;
-my $check = $dbh-prepare(select count(*) as count from currency where 
currency = ?);
-
-$dbh-do(UPDATE currency SET active = 0) if ($input-param('active') 
 == 1);
-
-$check-execute($input-param('currency'));
-my $count =   $check-fetchrow ;
-if ( $count  0  )
-{
-my $sth = $dbh-prepare(qq|
-UPDATE currency
-SET rate = ?,
-symbol = ?,
-active = ?
-WHERE currency = ?  |  );
-
-$sth-execute(  $input-param('rate'),
-$input-param('symbol')||'',
-$input-param('active')||0,
-$input-param('currency'),
-);
+my $end_of_page = $offset + $pagesize;
+if ( $end_of_page  @currencies ) {
+$end_of_page = @currencies;
+} else {
+$template-param(
+ltcount  = 1,
+nextpage = $end_of_page
+);
 }
-else
-{
-my $sth = $dbh-prepare(qq|
-INSERT INTO currency (currency, rate, symbol, active) 
VALUES (?,?,?,?)   |);
-
-$sth-execute(  $input-param('currency'),
-$input-param('rate'),
-$input-param('symbol')||'',
-$input-param('active')||0,
-);
+$end_of_page--;
+my @display_curr = @currencies[ $offset .. $end_of_page ];
+for my $c 

[Koha-patches] [PATCH] bug 4333 followup - fix an uninitialized value warning

2010-04-30 Thread Galen Charlton
Signed-off-by: Galen Charlton gmcha...@gmail.com
---
 admin/currency.pl |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/admin/currency.pl b/admin/currency.pl
index 003ff89..1e3f160 100755
--- a/admin/currency.pl
+++ b/admin/currency.pl
@@ -181,9 +181,6 @@ sub add_form {
 sub add_validate {
 $template-param( add_validate = 1 );
 
-if ( $input-param('active') == 1 ) {
-$dbh-do('UPDATE currency SET active = 0');
-}
 my $rec = {
 rate = $input-param('rate'),
 symbol   = $input-param('symbol') || q{},
@@ -191,6 +188,10 @@ sub add_validate {
 currency = $input-param('currency'),
 };
 
+if ( $rec-{active} == 1 ) {
+$dbh-do('UPDATE currency SET active = 0');
+}
+
 my ($row_count) = $dbh-selectrow_array(
 'select count(*) as count from currency where currency = ?',
 {}, $input-param('currency') );
-- 
1.7.0

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH] bug 4256: fix patron replication when using LDAP with auth_by_bind

2010-04-30 Thread Galen Charlton
Patch compiled from diffs created by Dobrica Pavlinušić dpav...@rot13.org to:

* enable patron replication when using LDAP with auth_by_bind
* not scribble over extended patron attributes
* fix failure logging in to OPAC if patron has no extended attributes

Signed-off-by: Galen Charlton gmcha...@gmail.com
---
 C4/Auth_with_ldap.pm |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm
index 78666e9..b25697c 100644
--- a/C4/Auth_with_ldap.pm
+++ b/C4/Auth_with_ldap.pm
@@ -58,7 +58,7 @@ my $prefhost  = $ldap-{hostname} or die 
ldapserver_error('hostname');
 my $base  = $ldap-{base}  or die ldapserver_error('base');
 $ldapname = $ldap-{user}  ;
 $ldappassword = $ldap-{pass}  ;
-our %mapping  = %{$ldap-{mapping}} || (); #   or die 
ldapserver_error('mapping');
+our %mapping  = %{$ldap-{mapping}}; # FIXME dpavlin -- don't die because of 
|| (); from 6eaf8511c70eb82d797c941ef528f4310a15e9f9
 my @mapkeys = keys %mapping;
 $debug and print STDERR Got , scalar(@mapkeys),  ldap mapkeys (  total  ): 
, join ' ', @mapkeys, \n;
 @mapkeys = grep {defined $mapping{$_}-{is}} @mapkeys;
@@ -122,6 +122,11 @@ sub checkpw_ldap {
 $debug and warn LDAP bind failed as kohauser $principal_name: . 
description($res);
 return 0;
 }
+
+   # FIXME dpavlin -- we really need $userldapentry leater on even if 
using auth_by_bind!
+   my $search = search_method($db, $userid) or return 0;   # warnings are 
in the sub
+   $userldapentry = $search-shift_entry;
+
} else {
 my $search = search_method($db, $userid) or return 0;   # warnings are 
in the sub
 $userldapentry = $search-shift_entry;
@@ -150,6 +155,7 @@ sub checkpw_ldap {
 ($cardnumber eq $c2) or warn update_local returned cardnumber 
'$c2' instead of '$cardnumber';
 } else { # C1, D1
 # maybe update just the password?
+   return(1, $cardnumber); # FIXME dpavlin -- don't destroy 
ExtendedPatronAttributes
 }
 } elsif ($config{replicate}) { # A2, C2
 $borrowernumber = AddMember(%borrower) or die AddMember failed;
@@ -160,6 +166,7 @@ sub checkpw_ldap {
my @types = C4::Members::AttributeTypes::GetAttributeTypes();
my @attributes = grep{my $key=$_; any{$_ eq $k...@types;} keys 
%borrower;
my $extended_patron_attributes = 
map{{code=$_,value=$borrower{$_...@attributes;
+   my $extended_patron_attributes = [] unless 
$extended_patron_attributes;
my @errors;
#Check before add
for (my $i; $i scalar(@$extended_patron_attributes)-1;$i++) {
-- 
1.7.0

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches

[Koha-patches] [PATCH 1/2] fix typo in DBrev - should be 3.01.00.129

2010-04-30 Thread Galen Charlton
Signed-off-by: Galen Charlton gmcha...@gmail.com
---
 installer/data/mysql/updatedatabase.pl |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 908bb7c..778319f 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3555,7 +3555,7 @@ if (C4::Context-preference('Version')  
TransformToNum($DBversion)){
 SetVersion ($DBversion);
 }
 
-$DBversion = 3.02.00.129;
+$DBversion = 3.01.00.129;
 if (C4::Context-preference(Version)  TransformToNum($DBversion)) {
$dbh-do(UPDATE `permissions` SET `code` = 'items_batchdel' WHERE 
`permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchdel' LIMIT 1 
;);
$dbh-do(UPDATE `permissions` SET `code` = 'items_batchmod' WHERE 
`permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchmod' LIMIT 1 
;);
-- 
1.7.0

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 2/2] bug 1532: ensure that empty hold request expiration is represented as NULL

2010-04-30 Thread Galen Charlton
Fixes bug reported by Colin Campbell where reserves.expiratedate
was defaulting to '-00-00' instead of NULL.

Signed-off-by: Galen Charlton gmcha...@gmail.com
---
 C4/Reserves.pm |6 +-
 installer/data/mysql/updatedatabase.pl |6 ++
 kohaversion.pl |2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index b4c6b43..6328d17 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -142,7 +142,11 @@ sub AddReserve {
 my $const   = lc substr( $constraint, 0, 1 );
 $resdate = format_date_in_iso( $resdate ) if ( $resdate );
 $resdate = C4::Dates-today( 'iso' ) unless ( $resdate );
-$expdate = format_date_in_iso( $expdate ) if ( $expdate );
+if ($expdate) {
+$expdate = format_date_in_iso( $expdate );
+} else {
+undef $expdate; # make reserves.expirationdate default to null rather 
than '-00-00'
+}
 if ( C4::Context-preference( 'AllowHoldDateInFuture' ) ) {
# Make room in reserves for this before those of a later reserve date
$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, 
$priority );
diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 778319f..d5ccfe2 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3564,6 +3564,12 @@ if (C4::Context-preference(Version)  
TransformToNum($DBversion)) {
 SetVersion ($DBversion);
 }
 
+$DBversion = 3.01.00.130;
+if (C4::Context-preference(Version)  TransformToNum($DBversion)) {
+$dbh-do(UPDATE reserves SET expirationdate = NULL WHERE expirationdate = 
'-00-00');
+print Upgrade done (change reserves.expirationdate values of -00-00 
to NULL (bug 1532); 
+SetVersion ($DBversion);
+}
 
 =item DropAllForeignKeys($table)
 
diff --git a/kohaversion.pl b/kohaversion.pl
index 884c0e2..509c6e2 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-our $VERSION = '3.01.00.129';
+our $VERSION = '3.01.00.130';
 # version needs to be set this way
 # so that it can be picked up by Makefile.PL
 # during install
-- 
1.7.0

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 01/12] MT3440: Display only borrower's messages in borrower's profile

2010-04-30 Thread Henri-Damien LAURENT
From: Matthias Meusburger matthias.meusbur...@biblibre.com

---
 members/notices.pl |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/members/notices.pl b/members/notices.pl
index dea577e..fb8e91b 100755
--- a/members/notices.pl
+++ b/members/notices.pl
@@ -50,7 +50,7 @@ my ($picture, $dberror) = 
GetPatronImage($borrower-{'cardnumber'});
 $template-param( picture = 1 ) if $picture;
 
 # Getting the messages
-my $queued_messages = C4::Letters::GetQueuedMessages({$borrowernumber});
+my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber = 
$borrowernumber});
 
 warn Data::Dumper::Dumper( $queued_messages );
 $template-param(
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 02/12] MT3448 : searchauthorities problems

2010-04-30 Thread Henri-Damien LAURENT
From: Paul Poulain paul.poul...@biblibre.com

Problems with searching authorities :
The same index was always used
---
 authorities/auth_finder.pl |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl
index 0e4f906..89f632f 100755
--- a/authorities/auth_finder.pl
+++ b/authorities/auth_finder.pl
@@ -60,7 +60,7 @@ if ( $op eq do_search ) {
 my @and_or= $query-param('and_or');
 my @excluding = $query-param('excluding');
 my @operator  = $query-param('operator');
-my @value = ($query-param('value_mainstr'), 
$query-param('value_main'), $query-param('value_any'));
+my @value = ($query-param('value_mainstr')||undef, 
$query-param('value_main')||undef, $query-param('value_any')||undef);
 my $orderby   = $query-param('orderby');
 
 $resultsperpage = $query-param('resultsperpage');
@@ -166,6 +166,9 @@ if ( $op eq do_search ) {
 }
 
 $template-param(
+value_mainstr = $query-param('value_mainstr') || , 
+value_main= $query-param('value_main') || ,
+value_any = $query-param('value_any') || ,
 tagid = $tagid,
 index = $index,
 authtypesloop = \...@authtypesloop,
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 03/12] MT3499 : cataloguing authid not reported

2010-04-30 Thread Henri-Damien LAURENT
authid would not be correctly updated in bibliorecord.
Biblio record would not receive the correct authid in subfield 9
but some erroneous data
---
 .../authorities/blinddetail-biblio-search.tmpl |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl
 
b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl
index 931aaa5..f0bcb38 100644
--- 
a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl
+++ 
b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl
@@ -23,9 +23,6 @@
 !-- TMPL_IF NAME=clear --
 if (subfield){subfield.value= ;}
 !--TMPL_ELSE--  
-if(code.value=='9'){
-subfield.value = !-- TMPL_VAR ESCAPE=JS 
NAME=authid --;
-}
 !-- TMPL_LOOP NAME=0XX --
 !-- TMPL_LOOP NAME=subfield --
 if (code.value == !-- TMPL_VAR ESCAPE=JS 
NAME=marc_subfield --){
@@ -33,6 +30,9 @@
 }
 !-- /TMPL_LOOP --
 !-- /TMPL_LOOP --
+if(code.value=='9'){
+subfield.value = !-- TMPL_VAR ESCAPE=JS 
NAME=authid --;
+}
 !--/TMPL_IF--
 }
 }
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 06/12] Transport_type print missing

2010-04-30 Thread Henri-Damien LAURENT
This type is quite important for all the print notices
---
 .../mysql/en/mandatory/message_transport_types.sql |3 ++-
 .../1-Obligatoire/message_transport_types.sql  |1 +
 installer/data/mysql/updatedatabase.pl |   10 ++
 kohaversion.pl |2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/installer/data/mysql/en/mandatory/message_transport_types.sql 
b/installer/data/mysql/en/mandatory/message_transport_types.sql
index 3b85a60..bbcb64c 100644
--- a/installer/data/mysql/en/mandatory/message_transport_types.sql
+++ b/installer/data/mysql/en/mandatory/message_transport_types.sql
@@ -3,4 +3,5 @@ INSERT INTO message_transport_types
 values
 ('email'),
 ('print'),
-('sms');
+('sms'),
+('feed');
diff --git 
a/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql 
b/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql
index 0c61bb8..a355b48 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql
@@ -1,6 +1,7 @@
 INSERT INTO message_transport_types
 (message_transport_type)
 values
+('print'),
 ('email'),
 ('sms'),
 ('feed');
diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index d5ccfe2..9aa760b 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3571,6 +3571,16 @@ if (C4::Context-preference(Version)  
TransformToNum($DBversion)) {
 SetVersion ($DBversion);
 }
 
+$DBversion = 3.01.00.131;
+if (C4::Context-preference(Version)  TransformToNum($DBversion)) {
+   $dbh-do(q{
+INSERT IGNORE INTO message_transport_types (message_transport_type) VALUES 
('print'),('feed');
+});
+print Upgrade to $DBversion done (Adding index to language_descriptions 
table)\n;
+SetVersion ($DBversion);
+}
+
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index 509c6e2..381bc45 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-our $VERSION = '3.01.00.130';
+our $VERSION = '3.01.00.131';
 # version needs to be set this way
 # so that it can be picked up by Makefile.PL
 # during install
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 08/12] Performance enhancing : C4/Languages.pm

2010-04-30 Thread Henri-Damien LAURENT
removing a call unused to getAllLanguages
Doing better job at enabled languages
---
 C4/Languages.pm |   72 ++
 1 files changed, 24 insertions(+), 48 deletions(-)

diff --git a/C4/Languages.pm b/C4/Languages.pm
index 9ef2439..7e3b0d5 100644
--- a/C4/Languages.pm
+++ b/C4/Languages.pm
@@ -23,6 +23,7 @@ use strict;
 #use warnings; FIXME - Bug 2505
 use Carp;
 use C4::Context;
+use List::MoreUtils qw/any uniq/;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
 
 eval {
@@ -123,49 +124,35 @@ Returns a reference to an array of hashes:
 sub getTranslatedLanguages {
 my ($interface, $theme, $current_language, $which) = @_;
 my $htdocs;
-my $all_languages = getAllLanguages();
 my @languages;
 my @enabled_languages;
  
-if ($interface  $interface eq 'opac' ) {
-@enabled_languages = split ,, 
C4::Context-preference('opaclanguages');
-$htdocs = C4::Context-config('opachtdocs');
-if ( $theme and -d $htdocs/$theme ) {
-(@languages) = _get_language_dirs($htdocs,$theme);
-}
-else {
-for my $theme ( _get_themes('opac') ) {
-push @languages, _get_language_dirs($htdocs,$theme);
-}
-}
+my ($preference,$config);
+if ($interface  $interface eq 'intranet' ) {
+$preference=language;
+$config='intrahtdocs';
 }
-elsif ($interface  $interface eq 'intranet' ) {
-@enabled_languages = split ,, C4::Context-preference('language');
-$htdocs = C4::Context-config('intrahtdocs');
-if ( $theme and -d $htdocs/$theme ) {
-@languages = _get_language_dirs($htdocs,$theme);
-}
-else {
-foreach my $theme ( _get_themes('intranet') ) {
-push @languages, _get_language_dirs($htdocs,$theme);
-}
-}
+else {
+$preference=opaclanguages;
+$config='opachtdocs';
+$interface ||='opac';
+
+}
+
+my $languages= C4::Context-preference($preference) ||'en';
+@enabled_languages = split ,, $languages;
+$htdocs = C4::Context-config($config);
+if ( $theme and -d $htdocs/$theme ) {
+(@languages) = _get_language_dirs($htdocs,$theme);
 }
 else {
-@enabled_languages = split ,, 
C4::Context-preference('opaclanguages');
-my $htdocs = C4::Context-config('intrahtdocs');
-foreach my $theme ( _get_themes('intranet') ) {
+for my $theme ( _get_themes($interface) ) {
 push @languages, _get_language_dirs($htdocs,$theme);
 }
-$htdocs = C4::Context-config('opachtdocs');
-foreach my $theme ( _get_themes('opac') ) {
-push @languages, _get_language_dirs($htdocs,$theme);
-}
-my %seen;
-$seen{$_}++ for @languages;
-@languages = keys %seen;
+@languages=uniq @languages;
 }
-return 
_build_languages_arrayref($all_languages,\...@languages,$current_language,\...@enabled_languages);
+@enabled_languages=grep{my $enabled_language=$_;any{$_ eq 
$enabled_langua...@languages}@enabled_languages;
+return _build_languages_arrayref(\...@enabled_languages,$current_language);
 }
 
 =head2 getAllLanguages
@@ -280,10 +267,9 @@ FIXME: this could be rewritten and simplified using map
 =cut
 
 sub _build_languages_arrayref {
-my 
($all_languages,$translated_languages,$current_language,$enabled_languages) = 
@_;
+my ($translated_languages,$current_language) = @_;
 my @translated_languages = @$translated_languages;
 my @languages_loop; # the final reference to an array of hashrefs
-my @enabled_languages = @$enabled_languages;
 # how many languages are enabled, if one, take note, some contexts 
won't need to display it
 my %seen_languages; # the language tags we've seen
 my %found_languages;
@@ -295,15 +281,10 @@ sub _build_languages_arrayref {
 # separate the language string into its subtag types
 my $language_subtags_hashref = 
regex_lang_subtags($translated_language);
 
-# is this language string 'enabled'?
-for my $enabled_language (@enabled_languages) {
-#warn Checking out if $translated_language eq 
$enabled_language;
-$language_subtags_hashref-{'enabled'} = 1 if 
$translated_language eq $enabled_language;
-}
-
 # group this language, key by langtag
 $language_subtags_hashref-{'sublanguage_current'} = 1 if 
$translated_language eq $current_language;
 $language_subtags_hashref-{'rfc4646_subtag'} = 
$translated_language;
+$language_subtags_hashref-{'enabled'} = 1;
 $language_subtags_hashref-{'native_description'} = 
language_get_description($language_subtags_hashref-{language},$language_subtags_hashref-{language},'language');
 

[Koha-patches] [PATCH 09/12] Performance enhancing DBRev:132

2010-04-30 Thread Henri-Damien LAURENT
Adding an index on language_descriptions table in order to boost searches
---
 installer/data/mysql/updatedatabase.pl |   10 ++
 kohaversion.pl |2 +-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 9aa760b..554ca0b 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3580,6 +3580,16 @@ INSERT IGNORE INTO message_transport_types 
(message_transport_type) VALUES ('pri
 SetVersion ($DBversion);
 }
 
+$DBversion = 3.01.00.132;
+#3.02.00.023
+if (C4::Context-preference(Version)  TransformToNum($DBversion)) {
+   $dbh-do(q{
+ALTER TABLE language_descriptions ADD INDEX LANG (subtag, type, lang);
+});
+print Upgrade to $DBversion done (Adding index to language_descriptions 
table)\n;
+SetVersion ($DBversion);
+}
+
 
 =item DropAllForeignKeys($table)
 
diff --git a/kohaversion.pl b/kohaversion.pl
index 381bc45..386a158 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-our $VERSION = '3.01.00.131';
+our $VERSION = '3.01.00.132';
 # version needs to be set this way
 # so that it can be picked up by Makefile.PL
 # during install
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 10/12] (MT #3081) permit loans for today

2010-04-30 Thread Henri-Damien LAURENT
From: Nahuel ANGELINETTI nahuel.angeline...@biblibre.com

The specify due date calendar, doesn't accept today. This patch fix this 
issue and permit librarian to loan a book for one day.

Signed-off-by: Henri-Damien LAURENT henridamien.laur...@biblibre.com
---
 .../prog/en/modules/circ/circulation.tmpl  |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl 
b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
index 6c6d14b..740b27b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -124,10 +124,10 @@ if (nodename ==barcodes[]){
 }
 function validate1(date) {
 var today = new Date();
-if ( date  today ) {
-return true;
- } else {
+if ( today  date || date.toDateString() == today.toDateString() ) {
 return false;
+ } else {
+return true;
  }
 };
 function refocus(calendar) {
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH 11/12] (bug #4319) allow reserves on waiting items

2010-04-30 Thread Henri-Damien LAURENT
This add a function to check the reserve status, and add a check in 
IsAvailableForItemLevelRequest() to allow request on items that are waiting

Conflicts solved:

C4/Reserves.pm

Signed-off-by: Henri-Damien LAURENT henridamien.laur...@biblibre.com
---
 C4/Reserves.pm |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 6328d17..e347295 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -100,7 +100,8 @@ BEGIN {
 GetReserveCount
 GetReserveFee
GetReserveInfo
-
+GetReserveStatus
+
 GetOtherReserves
 
 ModReserveFill
@@ -780,6 +781,18 @@ sub GetReservesForBranch {
 return (@transreserv);
 }
 
+sub GetReserveStatus {
+my ($itemnumber) = @_;
+
+my $dbh = C4::Context-dbh;
+
+my $itemstatus = $dbh-prepare(SELECT found FROM reserves WHERE 
itemnumber = ?);
+
+$itemstatus-execute($itemnumber);
+my ($found) = $itemstatus-fetchrow_array;
+return $found;
+}
+
 =item CheckReserves
 
   ($status, $reserve) = CheckReserves($itemnumber);
@@ -1415,7 +1428,7 @@ sub IsAvailableForItemLevelRequest {
 if (C4::Context-preference('AllowOnShelfHolds')) {
 return $available_per_item;
 } else {
-return ($available_per_item and $item-{onloan}); 
+return ($available_per_item and ($item-{onloan} or 
GetReserveStatus($itemnumber) eq W)); 
 }
 }
 
-- 
1.6.3.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches