[Koha-cvs] CVS: koha/admin letter.pl,1.1,1.2

Paul POULAIN tipaul at users.sourceforge.net
Tue Aug 2 18:15:36 CEST 2005


Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6511/admin

Modified Files:
	letter.pl 
Log Message:
adding 2 fields to letter system :
* module (acquisition, catalogue...) : it will be usefull to show the librarian only letters he may be interested by.
* title, that will be used as mail subject.

Index: letter.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/letter.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** letter.pl	28 Jul 2005 15:10:12 -0000	1.1
--- letter.pl	2 Aug 2005 16:15:34 -0000	1.2
***************
*** 54,58 ****
  	my @data=split(' ',$searchstring);
  	my $count=@data;
! 	my $sth=$dbh->prepare("Select * from letter where (code like ?) order by code");
  	$sth->execute("$data[0]%");
  	my @results;
--- 54,58 ----
  	my @data=split(' ',$searchstring);
  	my $count=@data;
! 	my $sth=$dbh->prepare("Select * from letter where (code like ?) order by module,code");
  	$sth->execute("$data[0]%");
  	my @results;
***************
*** 114,118 ****
  	while ((my $field) = $sth2->fetchrow_array) {
  		my %line = ('value' => "biblio.".$field, 'text' => "biblio.".$field);
- 		warn "$line{value}";
  		push @SQLfieldname, \%line;
  	}
--- 114,117 ----
***************
*** 123,127 ****
  	while ((my $field) = $sth2->fetchrow_array) {
  		my %line = ('value' => "biblioitems.".$field, 'text' => "biblioitems.".$field);
- 		warn "$line{value}";
  		push @SQLfieldname, \%line;
  	}
--- 122,125 ----
***************
*** 137,141 ****
  	while ((my $field) = $sth2->fetchrow_array) {
  		my %line = ('value' => "borrowers.".$field, 'text' => "borrowers.".$field);
- 		warn "$line{value}";
  		push @SQLfieldname, \%line;
  	}
--- 135,138 ----
***************
*** 146,150 ****
  	    $template->param(adding => 1);
  	}
! 	$template->param(name => $letter->{name},
  					content => $letter->{content},
  					SQLfieldname => \@SQLfieldname,);
--- 143,147 ----
  	    $template->param(adding => 1);
  	}
! 	$template->param(name => $letter->{name},title => $letter->{title},
  					content => $letter->{content},
  					SQLfieldname => \@SQLfieldname,);
***************
*** 154,159 ****
  } elsif ($op eq 'add_validate') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("replace letter (code,name,content) values (?,?,?)");
! 	$sth->execute($input->param('code'),$input->param('name'),$input->param('content'));
  	$sth->finish;
  	 print $input->redirect("letter.pl");
--- 151,156 ----
  } elsif ($op eq 'add_validate') {
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("replace letter (module,code,name,title,content) values (?,?,?,?,?)");
! 	$sth->execute($input->param('module'),$input->param('code'),$input->param('name'),$input->param('title'),$input->param('content'));
  	$sth->finish;
  	 print $input->redirect("letter.pl");
***************
*** 168,171 ****
--- 165,169 ----
  	my $data=$sth->fetchrow_hashref;
  	$sth->finish;
+ 	$template->param(module => $data->{module});
  	$template->param(code => $code);
  	$template->param(name => $data->{'name'});
***************
*** 177,182 ****
  	my $dbh = C4::Context->dbh;
  	my $code=uc($input->param('code'));
! 	my $sth=$dbh->prepare("delete from letter where code=?");
! 	$sth->execute($code);
  	$sth->finish;
  	 print $input->redirect("letter.pl");
--- 175,181 ----
  	my $dbh = C4::Context->dbh;
  	my $code=uc($input->param('code'));
! 	my $module=$input->param('module');
! 	my $sth=$dbh->prepare("delete from letter where module=? and code=?");
! 	$sth->execute($module,$code);
  	$sth->finish;
  	 print $input->redirect("letter.pl");
***************
*** 201,204 ****
--- 200,204 ----
  	   my %row_data;
  	   $row_data{toggle} = $toggle;
+ 	   $row_data{module} = $results->[$i]{'module'};
  	   $row_data{code} = $results->[$i]{'code'};
  	   $row_data{name} = $results->[$i]{'name'};





More information about the Koha-cvs mailing list