From 145f21e9825fdd4daabf230fb69e50adced47ef0 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 2 Aug 2005 16:15:34 +0000 Subject: [PATCH] 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. --- admin/letter.pl | 18 ++--- .../default/en/parameters/letter.tmpl | 79 +++++++++++++++++-- updater/updatedatabase | 20 ++++- 3 files changed, 96 insertions(+), 21 deletions(-) diff --git a/admin/letter.pl b/admin/letter.pl index 1f87dc04c7..7089773b25 100755 --- a/admin/letter.pl +++ b/admin/letter.pl @@ -53,7 +53,7 @@ sub StringSearch { $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); my $count=@data; - my $sth=$dbh->prepare("Select * from letter where (code like ?) order by code"); + my $sth=$dbh->prepare("Select * from letter where (code like ?) order by module,code"); $sth->execute("$data[0]%"); my @results; my $cnt=0; @@ -113,7 +113,6 @@ if ($op eq 'add_form') { push @SQLfieldname, \%line; while ((my $field) = $sth2->fetchrow_array) { my %line = ('value' => "biblio.".$field, 'text' => "biblio.".$field); - warn "$line{value}"; push @SQLfieldname, \%line; } my $sth2=$dbh->prepare("SHOW COLUMNS from biblioitems"); @@ -122,7 +121,6 @@ if ($op eq 'add_form') { push @SQLfieldname, \%line; while ((my $field) = $sth2->fetchrow_array) { my %line = ('value' => "biblioitems.".$field, 'text' => "biblioitems.".$field); - warn "$line{value}"; push @SQLfieldname, \%line; } my %line = ('value' => "", 'text' => '---ITEMS---'); @@ -136,7 +134,6 @@ if ($op eq 'add_form') { push @SQLfieldname, \%line; while ((my $field) = $sth2->fetchrow_array) { my %line = ('value' => "borrowers.".$field, 'text' => "borrowers.".$field); - warn "$line{value}"; push @SQLfieldname, \%line; } if ($code) { @@ -145,7 +142,7 @@ if ($op eq 'add_form') { } else { $template->param(adding => 1); } - $template->param(name => $letter->{name}, + $template->param(name => $letter->{name},title => $letter->{title}, content => $letter->{content}, SQLfieldname => \@SQLfieldname,); # END $OP eq ADD_FORM @@ -153,8 +150,8 @@ if ($op eq 'add_form') { # called by add_form, used to insert/modify data in DB } 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')); + 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"); exit; @@ -167,6 +164,7 @@ if ($op eq 'add_form') { $sth->execute($code); my $data=$sth->fetchrow_hashref; $sth->finish; + $template->param(module => $data->{module}); $template->param(code => $code); $template->param(name => $data->{'name'}); $template->param(content => $data->{'content'}); @@ -176,8 +174,9 @@ if ($op eq 'add_form') { } elsif ($op eq 'delete_confirmed') { my $dbh = C4::Context->dbh; my $code=uc($input->param('code')); - my $sth=$dbh->prepare("delete from letter where code=?"); - $sth->execute($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"); return; @@ -200,6 +199,7 @@ if ($op eq 'add_form') { } 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'}; push(@loop_data, \%row_data); diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/letter.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/letter.tmpl index 6ec13d9bdc..56cb4128c0 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/letter.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/letter.tmpl @@ -4,12 +4,13 @@
-
+
You Searched for


+ @@ -17,6 +18,7 @@ > + @@ -143,14 +145,63 @@

- "> + +

- + ">

+

+ + +

@@ -160,7 +211,10 @@ ">

- + "> +

+

+

@@ -186,15 +240,16 @@

Module Code Name  
@@ -25,7 +27,7 @@ - "> + &code="> //images/edittrash.png" width="32" hspace="0" vspace="0" border="0">
" method="post">"> + "> @@ -203,7 +258,15 @@ - + +
/images/background-mem.gif"> - Code + module / Code /images/background-mem.gif"> - + /
Name CONFIRM DELETION
" method="post">
+ + + +
" method="post"> + +
+
diff --git a/updater/updatedatabase b/updater/updatedatabase index 82615f2b6c..38614fb57b 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -73,10 +73,12 @@ my %requiretables = ( PRIMARY KEY ( `timestamp` , `user` ) )", letter => "( - code varchar(20) NOT NULL, - name varchar(100) NOT NULL, - content TEXT, - PRIMARY KEY (code) + module varchar(20) NOT NULL default '', + code varchar(20) NOT NULL default '', + name varchar(100) NOT NULL default '', + title varchar(200) NOT NULL default '', + content text, + PRIMARY KEY (module,code) )", ); @@ -356,6 +358,11 @@ $sth->finish; exit; # $Log$ +# Revision 1.115 2005/08/02 16:15:34 tipaul +# 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. +# # Revision 1.114 2005/07/28 15:10:13 tipaul # Introducing new "Letters" system : Letters will be used everytime you want to sent something to someone (through mail or paper). For example, sending a mail for overdues use letter that you can put as parameters. Sending a mail to a borrower when a suggestion is validated uses a letter too. # the letter table contains 3 fields : @@ -737,6 +744,11 @@ $sth->finish; exit; # $Log$ +# Revision 1.115 2005/08/02 16:15:34 tipaul +# 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. +# # Revision 1.114 2005/07/28 15:10:13 tipaul # Introducing new "Letters" system : Letters will be used everytime you want to sent something to someone (through mail or paper). For example, sending a mail for overdues use letter that you can put as parameters. Sending a mail to a borrower when a suggestion is validated uses a letter too. # the letter table contains 3 fields : -- 2.39.5