[Koha-cvs] koha/tools barcodes.pl barcodesGenerator.pl exc...

paul poulain paul at koha-fr.org
Fri Mar 9 16:14:48 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	paul poulain <tipaul>	07/03/09 15:14:47

Modified files:
	tools          : barcodes.pl barcodesGenerator.pl 
	                 exceptionHolidays.pl export.pl holidays.pl 
	                 import.pl koha-news.pl letter.pl newHolidays.pl 
	                 overduerules.pl printerConfig.pl tools-home.pl 

Log message:
	rel_3_0 moved to HEAD

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/tools/barcodes.pl?cvsroot=koha&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/barcodesGenerator.pl?cvsroot=koha&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/exceptionHolidays.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/tools/export.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/tools/holidays.pl?cvsroot=koha&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/koha/tools/import.pl?cvsroot=koha&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/koha/tools/koha-news.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/tools/letter.pl?cvsroot=koha&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/newHolidays.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/tools/overduerules.pl?cvsroot=koha&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/koha/tools/printerConfig.pl?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/tools/tools-home.pl?cvsroot=koha&r1=1.2&r2=1.3

Patches:
Index: barcodes.pl
===================================================================
RCS file: /sources/koha/koha/tools/barcodes.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- barcodes.pl	24 Feb 2006 11:52:38 -0000	1.1
+++ barcodes.pl	9 Mar 2007 15:14:47 -0000	1.2
@@ -25,8 +25,8 @@
 use C4::Auth;
 use C4::Output;
 use C4::Interface::CGI::Output;
-use C4::Database;
-use HTML::Template;
+
+
 use C4::Context;
 use C4::Barcodes::PrinterConfig;
 
@@ -123,7 +123,7 @@
 			                 type => "intranet",
 			                 query => $input,
 			                 authnotrequired => 0,
-			                 flagsrequired => {parameters => 1},
+			                 flagsrequired => {tools => 1},
 					         debug => 1,
 			               });
 

Index: barcodesGenerator.pl
===================================================================
RCS file: /sources/koha/koha/tools/barcodesGenerator.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- barcodesGenerator.pl	24 Feb 2006 11:52:38 -0000	1.1
+++ barcodesGenerator.pl	9 Mar 2007 15:14:47 -0000	1.2
@@ -27,7 +27,7 @@
 use CGI;
 use C4::Context;
 use C4::Output;
-use HTML::Template;
+
 use PDF::API2;
 use PDF::API2::Page;
 use PDF::API2::PDF::Utils;

Index: exceptionHolidays.pl
===================================================================
RCS file: /sources/koha/koha/tools/exceptionHolidays.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- exceptionHolidays.pl	27 Sep 2006 21:19:22 -0000	1.2
+++ exceptionHolidays.pl	9 Mar 2007 15:14:47 -0000	1.3
@@ -4,9 +4,11 @@
 use CGI;
 
 use C4::Auth;
-
+use C4::Output;
 use C4::Interface::CGI::Output;
-use C4::Calendar::Calendar;
+
+
+use C4::Calendar;
 
 my $input = new CGI;
 my $dbh = C4::Context->dbh();
@@ -19,7 +21,15 @@
 my $title = $input->param('showTitle');
 my $description = $input->param('showDescription');
 
-my $calendar = C4::Calendar::Calendar->new(branchcode => $branchcode);
+my $calendar = C4::Calendar->new(branchcode => $branchcode);
+
+$title || ($title = '');
+if ($description) {
+    $description =~ s/\r/\\r/g;
+    $description =~ s/\n/\\n/g;
+} else {
+    $description = '';
+}   
 
 if ($input->param('showOperation') eq 'exception') {
 	$calendar->insert_exception_holiday(day => $day,

Index: export.pl
===================================================================
RCS file: /sources/koha/koha/tools/export.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- export.pl	11 Sep 2006 17:41:56 -0000	1.2
+++ export.pl	9 Mar 2007 15:14:47 -0000	1.3
@@ -1,46 +1,170 @@
 #!/usr/bin/perl
-use strict;
 
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+# $Id: export.pl,v 1.3 2007/03/09 15:14:47 tipaul Exp $
+
+use strict;
+require Exporter;
 use C4::Auth;
 use C4::Interface::CGI::Output;
-use C4::Biblio;
+use C4::Output;  # contains gettemplate
+use C4::Biblio;  # GetMarcBiblio GetXmlBiblio
 use CGI;
-use C4::Auth;
-use MARC::Record;
-use MARC::File::XML;
+use C4::Koha;    # GetItemTypes
+use C4::Branch;  # GetBranches
+
 my $query = new CGI;
 my $op=$query->param("op");
+my $dbh=C4::Context->dbh;
+my $marcflavour = C4::Context->preference("marcflavour");
+
 if ($op eq "export") {
+
 	print $query->header('Content-Type: text/marc');
-	my $start_bib = $query->param("start_bib");
-	my $end_bib = $query->param("end_bib");
-	my $dbh=C4::Context->dbh;
-	my $sth;
-	if ($start_bib && $end_bib) {
-		$sth=$dbh->prepare("select marcxml from biblio where biblionumber >=? and biblionumber <=? order by biblionumber");
-		$sth->execute($start_bib,$end_bib);
-	} elsif ($start_bib ) {
-		$sth=$dbh->prepare("select marcxml from biblio where biblionumber >=?  order by biblionumber");
-		$sth->execute($start_bib);
-	}else {
-		$sth=$dbh->prepare("select marcxml from biblio order by biblionumber");
-		$sth->execute();
+    
+    my $StartingBiblionumber  = $query->param("StartingBiblionumber");
+    my $EndingBiblionumber    = $query->param("EndingBiblionumber");
+    my $output_format         = $query->param("output_format");
+    my $branch                = $query->param("branch");
+    my $itemtype              = $query->param("itemtype");
+    my $start_callnumber      = $query->param("start_callnumber");
+    my $end_callnumber        = $query->param("end_callnumber");
+    my $dont_export_items     = $query->param("dont_export_item");
+    my $dont_export_fields    = $query->param("dont_export_fields");
+    my @sql_params;
+    my $query = " SELECT DISTINCT biblioitems.biblionumber
+                  FROM biblioitems,items
+                  WHERE biblioitems.biblionumber=items.biblionumber ";
+                  
+    if ( $StartingBiblionumber ) {
+        $query .= " AND biblioitems.biblionumber >= ? ";
+        push @sql_params, $StartingBiblionumber;
 	}
-	while (my ($marc) = $sth->fetchrow) {
-my $record=MARC::Record->new_from_xml($marc,"UTF-8");
 	
-		print $record->as_usmarc;;
+    if ( $EndingBiblionumber ) {
+        $query .= " AND biblioitems.biblionumber <= ? ";
+        push @sql_params, $EndingBiblionumber;    
+    }
+    
+    if ( $branch ) {
+        $query .= " AND biblioitems.biblionumber = items.biblionumber AND homebranch = ? ";
+        push @sql_params, $branch;
+    }
+    
+    if ( $start_callnumber ) {
+        $query .= " AND biblioitems.biblionumber = items.biblionumber AND itemcallnumber <= ? ";
+        push @sql_params, $start_callnumber;
+    }
+    
+    if ( $end_callnumber ) {
+        $query .= " AND biblioitems.biblionumber = items.biblionumber AND itemcallnumber >= ? ";
+        push @sql_params, $end_callnumber;
+    }
+    
+    if ( $itemtype ) {
+        $query .= " AND biblioitems.itemtype = ?";
+        push @sql_params, $itemtype;
+    }
+
+    my $sth = $dbh->prepare($query);
+    $sth->execute(@sql_params);
+    
+    while (my ($biblionumber) = $sth->fetchrow) {
+        my $record = GetMarcBiblio($biblionumber);
+        if ( $dont_export_items ) {
+            # now, find where the itemnumber is stored & extract only the item
+            my ( $itemnumberfield, $itemnumbersubfield ) =
+                MARCfind_marc_from_kohafield( $dbh, 'items.itemnumber', '' );
 	
+            # and delete it.
+            foreach ($record->field($itemnumberfield)){
+                $record->delete_field($record->field($itemnumberfield));
 	}
-} else {
+        }
+        
+        if ( $dont_export_fields ) {
+            my @fields = split " ", $dont_export_fields;
+            foreach ( @fields ) {
+                /^(\d*)(\w)?$/;
+                my $field = $1;
+                my $subfield = $2;
+                if( $subfield ) {
+                    $record->field($field)->delete_subfields($subfield);
+                }
+                else {
+                    $record->delete_field($record->field($field));
+                }
+            }
+        }
+        if ( $output_format eq "xml" ) {
+            print $record->as_xml_record($marcflavour);
+        }
+        else {
+            print $record->as_formatted; 
+        }
+    }
+    exit;
+    
+} # if export
+
+else {
+
+    my $itemtypes = GetItemTypes;
+    my @itemtypesloop;
+    foreach my $thisitemtype (sort keys %$itemtypes) {
+        my %row =
+            (
+                value => $thisitemtype,
+                description => $itemtypes->{$thisitemtype}->{'description'},
+            );
+       push @itemtypesloop, \%row;
+    }
+    
+    my $branches = GetBranches;
+    my $branch   = GetBranch($query,$branches);
+    my @branchloop;
+    foreach my $thisbranch (keys %$branches) {
+        my $selected = 1 if $thisbranch eq $branch;
+        my %row = (
+            value => $thisbranch,
+            selected => $selected,
+            branchname => $branches->{$thisbranch}->{'branchname'},
+       );
+       push @branchloop, \%row;
+    }
+    
 	my ($template, $loggedinuser, $cookie)
-	= get_template_and_user({template_name => "tools/marc.tmpl",
+    = get_template_and_user
+    (
+        {
+            template_name => "tools/export.tmpl",
 					query => $query,
 					type => "intranet",
 					authnotrequired => 0,
-					flagsrequired => {parameters => 1, management => 1, tools => 1},
+            flagsrequired => {tools => 1},
 					debug => 1,
-					});
+         }
+    );
+    
+    $template->param(
+        branchloop   => \@branchloop,
+        itemtypeloop => \@itemtypesloop
+    );
+    
 	output_html_with_http_headers $query, $cookie, $template->output;
 }
-

Index: holidays.pl
===================================================================
RCS file: /sources/koha/koha/tools/holidays.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- holidays.pl	27 Sep 2006 21:19:22 -0000	1.3
+++ holidays.pl	9 Mar 2007 15:14:47 -0000	1.4
@@ -1,18 +1,44 @@
 #!/usr/bin/perl
 
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+#####Sets holiday periods for each branch. Datedues will be extended if branch is closed -TG
 use strict;
 use CGI;
 
 use C4::Auth;
-
+use C4::Output;
 use C4::Interface::CGI::Output;
 
-use C4::Calendar::Calendar;
+
+use C4::Calendar;
 
 my $input = new CGI;
-my $branch = $input->param('branch');
-$branch=C4::Context->preference('defaultBranch') unless $branch;
+#my $branch = $input->param('branch');
+my $branch=C4::Context->preference('defaultbranch') || $input->param('branch');
 my $dbh = C4::Context->dbh();
+# Get the template to use
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "tools/holidays.tmpl",
+                             type => "intranet",
+                             query => $input,
+                             authnotrequired => 0,
+                             flagsrequired => {tools => 1},
+                             debug => 1,
+                           });
 
 # Set all the branches.
 my $branches = $dbh->prepare("select branchcode, branchname from branches");
@@ -26,21 +52,24 @@
 if (!defined($branch)) {
 	$branch =$listValues[4];
 }
-my $branchesList = CGI::scrolling_list(-name => 'branch', -id=>'branch',
+my $branchesList = CGI::scrolling_list(-name => 'branch',
                            		       -values => \@listValues,
 			                           -labels => \%list,
 			                           -size => 1,
 					 -default => [$branch],
 			                           -multiple => 0,
+                                       -id => "branch",
 					 -onChange => "changeBranch()");
 
 $branches->finish;
 
 # Get all the holidays
-my $calendar = C4::Calendar::Calendar->new(branchcode => $branch);
+# warn "BRANCH : $branch";
+my $calendar = C4::Calendar->new(branchcode => $branch);
 my $week_days_holidays = $calendar->get_week_days_holidays();
 my @week_days;
 foreach my $weekday (keys %$week_days_holidays) {
+# warn "WEEK DAY : $weekday";
 	my %week_day;
 	%week_day = (KEY => $weekday,
 		         TITLE => $week_days_holidays->{$weekday}{title},
@@ -78,16 +107,6 @@
 	push @holidays, \%holiday;
 }
 
-# Get the template to use
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "tools/holidays.tmpl",
-			                 type => "intranet",
-			                 query => $input,
-			                 authnotrequired => 0,
-			                 flagsrequired => {parameters => 1},
-					         debug => 1,
-			               });
-
 # Replace the template values with the real ones
 $template->param(BRANCHES => $branchesList);
 $template->param(WEEK_DAYS_LOOP => \@week_days);

Index: import.pl
===================================================================
RCS file: /sources/koha/koha/tools/import.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- import.pl	27 Sep 2006 21:19:22 -0000	1.3
+++ import.pl	9 Mar 2007 15:14:47 -0000	1.4
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: import.pl,v 1.3 2006/09/27 21:19:22 tgarip1957 Exp $
+# $Id: import.pl,v 1.4 2007/03/09 15:14:47 tipaul Exp $
 
 # Script for handling import of MARC data into Koha db
 #   and Z39.50 lookups
@@ -31,17 +31,25 @@
 
 # standard or CPAN modules used
 use CGI;
+use DBI;
 
 # Koha modules used
 use C4::Context;
+use C4::Output;
 use C4::Interface::CGI::Output;
+use C4::Input;
+use C4::Biblio;
+use MARC::File::USMARC;
+
+use C4::Output;
 use C4::Auth;
 use C4::Breeding;
 
 #------------------
 # Constants
 
-
+my $includes = C4::Context->config('includes') ||
+	"/usr/local/www/hdl/htdocs/includes";
 
 # HTML colors for alternating lines
 my $lc1='#dddddd';
@@ -61,11 +69,11 @@
 my $filename = $input->param('filename');
 my $syntax = $input->param('syntax');
 my ($template, $loggedinuser, $cookie)
-	= get_template_and_user({template_name => "tools/breeding.tmpl",
+	= get_template_and_user({template_name => "tools/import.tmpl",
 					query => $input,
 					type => "intranet",
 					authnotrequired => 0,
-					flagsrequired => {parameters => 1, management => 1, tools => 1},
+					flagsrequired => {tools => 1},
 					debug => 1,
 					});
 
@@ -76,7 +84,7 @@
 	while (<$uploadmarc>) {
 		$marcrecord.=$_;
 	}
-	my ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported) = ImportBreeding($marcrecord,$overwrite_biblio,$filename,$syntax,"");
+	my ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported) = ImportBreeding($marcrecord,$overwrite_biblio,$filename,$syntax,int(rand(99999)));
 
 	$template->param(imported => $imported,
 							alreadyindb => $alreadyindb,
@@ -88,16 +96,34 @@
 }
 
 output_html_with_http_headers $input, $cookie, $template->output;
-my $menu;
-my $file;
 
 
 #---------------
 # log cleared, as marcimport is (almost) rewritten from scratch.
 # $Log: import.pl,v $
-# Revision 1.3  2006/09/27 21:19:22  tgarip1957
-# Finalized XML version for intranet
+# Revision 1.4  2007/03/09 15:14:47  tipaul
+# rel_3_0 moved to HEAD
+#
+# Revision 1.1.2.4  2006/12/22 17:13:49  tipaul
+# removing "management" permission, that is useless (replaced by tools & admin)
+#
+# Revision 1.1.2.3  2006/12/18 16:35:20  toins
+# removing use HTML::Template from *.pl.
+#
+# Revision 1.1.2.2  2006/10/03 12:27:32  toins
+# the script was written twice into the file !
+#
+# Revision 1.1.2.1  2006/09/26 13:42:54  toins
+# fix wrong link to breeding.tmpl
+#
+# Revision 1.1  2006/02/24 11:52:38  hdl
+# Adding tools directory template and scripts
+# Changing barcodes, export and import and letters directory.
+# Changing export script name (marc.pl) to export.pl
+# Changing import script name (breeding.pl) to import.pl
 #
-# Revision 1.2.4.1  2005/04/07 10:10:52  tipaul
-# copying processz3950queue from 2.0 branch. The 2.2 version misses an important fix
+# Revision 1.4  2005/05/04 08:52:13  tipaul
+# synch'ing 2.2 and head
 #
+# Revision 1.3  2005/03/23 09:57:47  doxulting
+# Adding a parameter to allow acces to people with management/tools flags

Index: koha-news.pl
===================================================================
RCS file: /sources/koha/koha/tools/koha-news.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- koha-news.pl	11 Sep 2006 17:41:56 -0000	1.2
+++ koha-news.pl	9 Mar 2007 15:14:47 -0000	1.3
@@ -23,76 +23,96 @@
 
 use strict;
 use CGI;
-
 use C4::Auth;
 use C4::Koha;
 use C4::Context;
 use C4::Output;
 use C4::Interface::CGI::Output;
 use C4::NewsChannels;
-
+use C4::Languages;
+use Date::Calc qw/Date_to_Days Today/;
 
 my $cgi = new CGI;
 
 my $id		= $cgi->param('id');
 my $title	= $cgi->param('title');
 my $new		= $cgi->param('new');
+my $expirationdate = $cgi->param('expirationdate');
+my $number         = $cgi->param('number');
 my $lang	= $cgi->param('lang');
+
 my $new_detail = get_opac_new($id);
 
-my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name => "tools/koha-news.tmpl",
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+    {
+        template_name   => "tools/koha-news.tmpl",
 			     query => $cgi,
 			     type => "intranet",
 			     authnotrequired => 0,
-			     flagsrequired => {management => 1},
+        flagsrequired   => { tools => 1 },
 			     debug => 1,
-			     });
+    }
+);
 
 # get lang list
 my @lang_list;
-
-foreach my $language (getalllanguages()) {
-	push @lang_list, { language => $language,
-						selected => ($new_detail->{lang} eq $language?1:0),
+my $tlangs = getTranslatedLanguages() ;
+foreach my $language ( @$tlangs ) {
+    push @lang_list,
+      {
+        language => $language->{'language_code'},
+        selected => ( $new_detail->{lang} eq $language->{'language_code'} ? 1 : 0 ),
 					};
 }
-$template->param(lang_list => \@lang_list);
+
+$template->param( lang_list => \@lang_list );
 
 my $op = $cgi->param('op');
 
-if ($op eq 'add_form') {
-	$template->param(add_form => 1);
+if ( $op eq 'add_form' ) {
+    $template->param( add_form => 1 );
 	if ($id) {
-		$template->param(op => 'edit');
+        $template->param( 
+            op => 'edit',
+            id => $new_detail->{'idnew'}
+        );
 		$template->param($new_detail);
-		$template->param(id => $new_detail->{'idnew'});
-	} else {
-		$template->param(op => 'add');
 	}
-	
-} elsif ($op eq 'add') {
-
-	add_opac_new($title, $new, $lang);
-	print $cgi->redirect('/cgi-bin/koha/tools/koha-news.pl');
-
-} elsif ($op eq 'edit') {
-
-	upd_opac_new($id, $title, $new, $lang);
-	print $cgi->redirect('/cgi-bin/koha/tools/koha-news.pl');
-
-} elsif ($op eq 'del') {
+    else {
+        $template->param( op => 'add' );
+    }
+}
+elsif ( $op eq 'add' ) {
+    add_opac_new( $title, $new, $lang, $expirationdate, $number );
+    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
+}
+elsif ( $op eq 'edit' ) {
+    upd_opac_new( $id, $title, $new, $lang, $expirationdate, $number );
+    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
+}
+elsif ( $op eq 'del' ) {
 	my @ids = $cgi->param('ids');
-	del_opac_new(join ",", @ids);
-	print $cgi->redirect('/cgi-bin/koha/tools/koha-news.pl');
+    del_opac_new( join ",", @ids );
+    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
+}
+
+else {
 
-} else { 
+    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang );
 
-	my ($opac_news_count, $opac_news) = &get_opac_news(undef, $lang);
-	$template->param($lang => 1);
-	$template->param(opac_news => $opac_news);
-	$template->param(opac_news_count => $opac_news_count);
+    foreach my $new ( @$opac_news ) {
+        next unless $new->{'expirationdate'};
+        next if $new->{'expirationdate'} eq '0000-00-00';
+        if (Date_to_Days( split "-" ,$new->{'expirationdate'} ) < Date_to_Days(&Today) ){
+            $new->{'hasexpirated'} = 1;
+        }
+    }
 
+    $template->param(
+        $lang           => 1,
+        opac_news       => $opac_news,
+        opac_news_count => $opac_news_count 
+    );
 }
 
 output_html_with_http_headers $cgi, $cookie, $template->output;

Index: letter.pl
===================================================================
RCS file: /sources/koha/koha/tools/letter.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- letter.pl	24 Feb 2006 11:52:38 -0000	1.1
+++ letter.pl	9 Mar 2007 15:14:47 -0000	1.2
@@ -44,8 +44,7 @@
 use C4::Context;
 use C4::Output;
 use C4::Interface::CGI::Output;
-use C4::Search;
-use HTML::Template;
+
 
 sub StringSearch  {
 	my ($env,$searchstring,$type)=@_;
@@ -72,6 +71,7 @@
 my $script_name="/cgi-bin/koha/tools/letter.pl";
 my $code=$input->param('code');
 my $module = $input->param('module');
+my $content = $input->param('content');
 my $pagesize=20;
 my $op = $input->param('op');
 $searchfield=~ s/\,//g;
@@ -122,6 +122,52 @@
 		my %line = ('value' => "branches.".$field, 'text' => "branches.".$field);
 		push @SQLfieldname, \%line;
 	}
+    # add acquisition specific tables
+    if (index($module,"acquisition")>0){
+    my $sth2=$dbh->prepare("SHOW COLUMNS from aqbooksellers");
+    $sth2->execute;
+    my %line = ('value' => "", 'text' => '---BOOKSELLERS---');
+    push @SQLfieldname, \%line;
+    while ((my $field) = $sth2->fetchrow_array) {
+        my %line = ('value' => "aqbooksellers.".$field, 'text' => "aqbooksellers.".$field);
+        push @SQLfieldname, \%line;
+    }
+    my $sth2=$dbh->prepare("SHOW COLUMNS from aqorders");
+    $sth2->execute;
+    my %line = ('value' => "", 'text' => '---ORDERS---');
+    push @SQLfieldname, \%line;
+    while ((my $field) = $sth2->fetchrow_array) {
+        my %line = ('value' => "aqorders.".$field, 'text' => "aqorders.".$field);
+        push @SQLfieldname, \%line;
+    }
+    # add issues specific tables
+    }elsif (index($module,"issues")>0){
+    my $sth2=$dbh->prepare("SHOW COLUMNS from aqbooksellers");
+    $sth2->execute;
+    my %line = ('value' => "", 'text' => '---BOOKSELLERS---');
+    push @SQLfieldname, \%line;
+    while ((my $field) = $sth2->fetchrow_array) {
+        my %line = ('value' => "aqbooksellers.".$field, 'text' => "aqbooksellers.".$field);
+        push @SQLfieldname, \%line;
+    }
+    my $sth2=$dbh->prepare("SHOW COLUMNS from serial");
+    $sth2->execute;
+    my %line = ('value' => "", 'text' => '---SERIALS---');
+    push @SQLfieldname, \%line;
+    while ((my $field) = $sth2->fetchrow_array) {
+        my %line = ('value' => "serial.".$field, 'text' => "serial.".$field);
+        push @SQLfieldname, \%line;
+    }
+    my $sth2=$dbh->prepare("SHOW COLUMNS from subscription");
+    $sth2->execute;
+    my %line = ('value' => "", 'text' => '---SUBSCRIPTION---');
+    push @SQLfieldname, \%line;
+    while ((my $field) = $sth2->fetchrow_array) {
+        my %line = ('value' => "subscription.".$field, 'text' => "subscription.".$field);
+        push @SQLfieldname, \%line;
+    }
+    # add biblio specific tables.
+    } else {
 	my $sth2=$dbh->prepare("SHOW COLUMNS from biblio");
 	$sth2->execute;
 	my %line = ('value' => "", 'text' => '---BIBLIO---');
@@ -153,6 +199,7 @@
 		my %line = ('value' => "borrowers.".$field, 'text' => "borrowers.".$field);
 		push @SQLfieldname, \%line;
 	}
+    }
 	if ($code) {
 	    $template->param(modify => 1);
 	    $template->param(code => $letter->{code});
@@ -160,8 +207,8 @@
 	    $template->param(adding => 1);
 	}
 	$template->param(name => $letter->{name},title => $letter->{title},
-					content => $letter->{content},
-					$letter->{module} => 1,
+                    content => ($content?$content:$letter->{content}),
+                    ($module?$module:$letter->{module}) => 1,
 					SQLfieldname => \@SQLfieldname,);
 													# END $OP eq ADD_FORM
 ################## ADD_VALIDATE ##################################

Index: newHolidays.pl
===================================================================
RCS file: /sources/koha/koha/tools/newHolidays.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- newHolidays.pl	11 Sep 2006 17:41:56 -0000	1.2
+++ newHolidays.pl	9 Mar 2007 15:14:47 -0000	1.3
@@ -6,7 +6,9 @@
 use C4::Auth;
 use C4::Output;
 use C4::Interface::CGI::Output;
-use C4::Calendar::Calendar;
+
+
+use C4::Calendar;
 
 my $input = new CGI;
 my $dbh = C4::Context->dbh();
@@ -19,7 +21,15 @@
 my $title = $input->param('newTitle');
 my $description = $input->param('newDescription');
 
-my $calendar = C4::Calendar::Calendar->new(branchcode => $branchcode);
+$title || ($title = '');
+if ($description) {
+	$description =~ s/\r/\\r/g;
+	$description =~ s/\n/\\n/g;
+} else {
+	$description = '';
+}
+
+my $calendar = C4::Calendar->new(branchcode => $branchcode);
 
 if ($input->param('newOperation') eq 'weekday') {
 	$calendar->insert_week_day_holiday(weekday => $weekday,

Index: overduerules.pl
===================================================================
RCS file: /sources/koha/koha/tools/overduerules.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- overduerules.pl	11 Sep 2006 17:41:56 -0000	1.4
+++ overduerules.pl	9 Mar 2007 15:14:47 -0000	1.5
@@ -20,10 +20,14 @@
 use strict;
 use CGI;
 use C4::Context;
+use C4::Output;
+
 use C4::Auth;
+use C4::Output;
 use C4::Koha;
 use C4::Interface::CGI::Output;
-
+use C4::Branch; # GetBranches
+use C4::Letters;
 
 my $input = new CGI;
 my $dbh = C4::Context->dbh;
@@ -118,7 +122,7 @@
 	}
 	unless ($err) {$template->param(datasaved=>1);}
 }
-my $branches = getbranches;
+my $branches = GetBranches();
 my @branchloop;
 foreach my $thisbranch (keys %$branches) {
 	my $selected = 1 if $thisbranch eq $branch;
@@ -129,7 +133,9 @@
 	push @branchloop, \%row;
 }
 
-my ($countletters,$letters) = getletters("circulation");
+my $letters = GetLetters("circulation");
+
+my $countletters = scalar $letters;
 
 my $sth=$dbh->prepare("Select description,categorycode from categories where overduenoticerequired>0 order by description");
 $sth->execute;

Index: printerConfig.pl
===================================================================
RCS file: /sources/koha/koha/tools/printerConfig.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- printerConfig.pl	27 Sep 2006 21:19:22 -0000	1.2
+++ printerConfig.pl	9 Mar 2007 15:14:47 -0000	1.3
@@ -27,6 +27,7 @@
 use C4::Context;
 use C4::Output;
 use C4::Auth;
+
 use PDF::API2;
 use PDF::API2::Page;
 use PDF::API2::PDF::Utils;

Index: tools-home.pl
===================================================================
RCS file: /sources/koha/koha/tools/tools-home.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- tools-home.pl	27 Sep 2006 21:19:22 -0000	1.2
+++ tools-home.pl	9 Mar 2007 15:14:47 -0000	1.3
@@ -1,19 +1,35 @@
 #!/usr/bin/perl
 
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
 use strict;
 use CGI;
 use C4::Auth;
 use C4::Interface::CGI::Output;
 
-
 my $query = new CGI;
-my ($template, $loggedinuser, $cookie)
-    = get_template_and_user({template_name => "tools/tools-home.tmpl",
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "tools/tools-home.tmpl",
 			     query => $query,
 			     type => "intranet",
 			     authnotrequired => 0,
-			     flagsrequired => {tools => 1},
+        flagsrequired   => { tools => 1 },
 			     debug => 1,
-			     });
+    }
+);
 
 output_html_with_http_headers $query, $cookie, $template->output;





More information about the Koha-cvs mailing list