#
# 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 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 3 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.
+# 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.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
=head1 tools/letter.pl
use strict;
use warnings;
-use CGI;
+use CGI qw ( -utf8 );
use C4::Auth;
use C4::Context;
use C4::Output;
if ($module eq 'reserves') {
push @{$field_selection}, add_fields('borrowers', 'reserves', 'biblio', 'items');
}
+ elsif ( $module eq 'acquisition' ) {
+ push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'items');
+ }
elsif ($module eq 'claimacquisition') {
push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'biblioitems');
}
push @{$field_selection}, {value => "biblio.$_", text => ucfirst $_ };
}
}
+ elsif ($module eq 'serial') {
+ push @{$field_selection}, add_fields('branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial');
+ }
elsif ($module eq 'suggestions') {
push @{$field_selection}, add_fields('suggestions', 'borrowers', 'biblio');
}
}
- if ( $module eq 'circulation' && $code eq "CHECKIN" ) {
+ if ( $module eq 'circulation' and $code and $code eq "CHECKIN" ) {
push @{$field_selection}, add_fields('old_issues');
} else {
push @{$field_selection}, add_fields('issues');
$template->param(
module => $module,
branchloop => _branchloop($branchcode),
- SQLfieldname => $field_selection,
+ SQLfieldnames => $field_selection,
+ branchcode => $branchcode,
);
return;
}
my $title = shift @title;
my $content = shift @content;
my $letter = C4::Letters::getletter( $oldmodule, $code, $branchcode, $mtt);
+
+ # getletter can return the default letter even if we pass a branchcode
+ # If we got the default one and we needed the specific one, we didn't get the one we needed!
+ if ( $letter and $branchcode ne $letter->{branchcode} ) {
+ $letter = undef;
+ }
unless ( $title and $content ) {
# Delete this mtt if no title or content given
delete_confirmed( $branchcode, $oldmodule, $code, $mtt );
next;
}
- elsif ( exists $letter->{$mtt} ) {
+ elsif ( $letter and $letter->{message_transport_type} eq $mtt ) {
$dbh->do(
q{
UPDATE letter
my $letter = C4::Letters::getletter($module, $code, $branchcode);
my @values = values %$letter;
$template->param(
- branchcode => $branchcode,
- branchname => GetBranchName($branchcode),
- code => $code,
- module => $module,
- name => $values[0]->{name},
+ letter => $letter,
);
return;
}
sub get_columns_for {
my $table = shift;
-# FIXME untranslateable
+# FIXME untranslatable
my %column_map = (
aqbooksellers => '---BOOKSELLERS---',
aqorders => '---ORDERS---',