koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha C4/Letters.pm C4/Serials.pm koha-tmpl/intr... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha C4/Letters.pm C4/Serials.pm koha-tmpl/intr... [rel_3_0]
Date: Wed, 13 Dec 2006 19:45:05 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      06/12/13 19:45:05

Modified files:
        C4             : Letters.pm Serials.pm 
        koha-tmpl/intranet-tmpl/prog/en/serials: claims.tmpl 
        koha-tmpl/intranet-tmpl/prog/en/tools: letter.tmpl 
        serials        : claims.pl 
        tools          : letter.pl 

Log message:
        Adding letter features + bug fixing claims.tmpl in serials Module.
        May need some work to disable senging letters when no letter are 
defined.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Letters.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4.2.5&r2=1.4.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.15&r2=1.5.2.16
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/claims.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2&r2=1.2.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/tools/letter.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.3&r2=1.3.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/serials/claims.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/tools/letter.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2

Patches:
Index: C4/Letters.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Letters.pm,v
retrieving revision 1.4.2.5
retrieving revision 1.4.2.6
diff -u -b -r1.4.2.5 -r1.4.2.6
--- C4/Letters.pm       13 Dec 2006 14:14:12 -0000      1.4.2.5
+++ C4/Letters.pm       13 Dec 2006 19:45:04 -0000      1.4.2.6
@@ -24,6 +24,7 @@
 use Date::Manip;
 use C4::Suggestions;
 use C4::Members;
+use C4::Serials;
 use C4::Log;
 require Exporter;
 
@@ -307,16 +308,16 @@
         }
                warn "sending to From $userenv->{emailaddress} subj 
$innerletter->{title} Mess $innerletter->{content}";
     }
-       elsif ($type eq 'claimserial') {
+       elsif ($type eq 'claimissues') {
 #              warn "sending issues...";
-               my $letter = getletter('claimserial',$letter);
+               my $letter = getletter('claimissues',$letter);
                # prepare the letter...
                # search the biblionumber
-               my $strsth="select serial.*,subscription.* from serial LEFT 
JOIN subscription on serial.subscriptionid=subscription.subscriptionid LEFT 
JOIN biblio on serial.biblionumber=biblio.biblionumber where serial.serialid IN 
(".join(",",@$externalid).")";
+               my $strsth="select serial.*,subscription.*, biblio.title from 
serial LEFT JOIN subscription on 
serial.subscriptionid=subscription.subscriptionid LEFT JOIN biblio on 
serial.biblionumber=biblio.biblionumber where serial.serialid IN 
(".join(",",@$externalid).")";
         my $sthorders=$dbh->prepare($strsth);
                $sthorders->execute;
         my $dataorders=$sthorders->fetchall_arrayref({});
-               
parseletter($letter,'aqbooksellers',$dataorders->[0]->{booksellerid});
+               
parseletter($letter,'aqbooksellers',$dataorders->[0]->{aqbooksellerid});
                my $sthbookseller = $dbh->prepare("select * from aqbooksellers 
where id=?");
         $sthbookseller->execute($dataorders->[0]->{aqbooksellerid});
         my $databookseller=$sthbookseller->fetchrow_hashref;

Index: C4/Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.5.2.15
retrieving revision 1.5.2.16
diff -u -b -r1.5.2.15 -r1.5.2.16
--- C4/Serials.pm       5 Dec 2006 13:39:23 -0000       1.5.2.15
+++ C4/Serials.pm       13 Dec 2006 19:45:04 -0000      1.5.2.16
@@ -17,11 +17,12 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Serials.pm,v 1.5.2.15 2006/12/05 13:39:23 tipaul Exp $
+# $Id: Serials.pm,v 1.5.2.16 2006/12/13 19:45:04 hdl Exp $
 
 use strict;
 use C4::Date;
 use Date::Manip;
+use POSIX qw(strftime);
 use C4::Suggestions;
 use C4::Koha;
 use C4::Biblio;
@@ -32,7 +33,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.5.2.15 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5.2.16 $' =~ /\d+/g;
     shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
 };
 
@@ -65,6 +66,7 @@
     &ReNewSubscription  &GetLateIssues      &GetMissingIssues
     &GetSerialInformation                   &AddItem2Serial
     
+    &UpdateClaimdateIssues
     &GetSuppliersWithLateIssues             &getsupplierbyserialid
     &GetDistributedTo   &SetDistributedTo
     &getroutinglist     &delroutingmember   &addroutingmember
@@ -303,6 +305,31 @@
     return $rq->rows;
 }
 
+=head2 UpdateClaimdateIssues
+
+=over 4
+
+UpdateClaimdateIssues($serialids,[$date]);
+
+Update Claimdate for issues in @$serialids list with date $date 
+(Take Today if none)
+=back
+
+=cut
+
+sub UpdateClaimdateIssues {
+    my ( $serialids, $date ) = @_;
+    my $dbh   = C4::Context->dbh;
+    $date = strftime("%Y-%m-%d",localtime) unless ($date);
+    my $query = "
+        UPDATE serial SET claimdate=$date
+        WHERE  serialid in ".join (",",@$serialids);
+    ;
+    my $rq = $dbh->prepare($query);
+    $rq->execute;
+    return $rq->rows;
+}
+
 =head2 GetSubscription
 
 =over 4
@@ -1711,29 +1738,69 @@
     }
     if ($supplierid) {
         $sth = $dbh->prepare(
-"SELECT 
serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
-                                  FROM subscription, serial, biblio
-                                  LEFT JOIN aqbooksellers ON 
subscription.aqbooksellerid = aqbooksellers.id
-                                  WHERE subscription.subscriptionid = 
serial.subscriptionid AND
-                                  serial.STATUS = 4 and
-                                  subscription.aqbooksellerid=$supplierid and
+"SELECT 
+   serialid,
+   aqbooksellerid,
+   name,
+   biblio.title,
+   planneddate,
+   serialseq,
+   serial.subscriptionid,
+   claimdate
+FROM 
+   serial 
+     LEFT JOIN 
+       subscription 
+     ON serial.subscriptionid=subscription.subscriptionid 
+     LEFT JOIN 
+       biblio 
+     ON serial.biblionumber=biblio.biblionumber
+     LEFT JOIN
+       aqbooksellers 
+     ON subscription.aqbooksellerid = aqbooksellers.id
+WHERE 
+   subscription.subscriptionid = serial.subscriptionid 
+  AND
+   serial.STATUS = 4 
+  AND
+   subscription.aqbooksellerid=$supplierid 
+  AND
                                   biblio.biblionumber = 
subscription.biblionumber "
               . $byserial
-              . " order by title
-                                  "
+              . " 
+ORDER BY title"
         );
     }
     else {
         $sth = $dbh->prepare(
-"SELECT 
serialid,aqbooksellerid,name,title,planneddate,serialseq,serial.subscriptionid,claimdate
-                                  FROM subscription, serial, biblio
-                                  LEFT JOIN aqbooksellers ON 
subscription.aqbooksellerid = aqbooksellers.id
-                                  WHERE subscription.subscriptionid = 
serial.subscriptionid AND
-                                  serial.STATUS =4 and
+"SELECT 
+   serialid,
+   aqbooksellerid,
+   name,
+   biblio.title,
+   planneddate,
+   serialseq,
+   serial.subscriptionid,
+   claimdate
+FROM 
+   serial 
+     LEFT JOIN 
+       subscription 
+     ON serial.subscriptionid=subscription.subscriptionid 
+     LEFT JOIN 
+       biblio 
+     ON serial.biblionumber=biblio.biblionumber
+     LEFT JOIN
+       aqbooksellers 
+     ON subscription.aqbooksellerid = aqbooksellers.id
+WHERE 
+   subscription.subscriptionid = serial.subscriptionid 
+  AND
+   serial.STATUS = 4 
+  AND
                                   biblio.biblionumber = 
subscription.biblionumber "
-              . $byserial
-              . " order by title
-                                  "
+. $byserial
+. " ORDER BY title"
         );
     }
     $sth->execute;
@@ -1742,6 +1809,7 @@
     my $odd   = 0;
     my $count = 0;
     while ( my $line = $sth->fetchrow_hashref ) {
+        warn "".$line->{title};
         $odd++ unless $line->{title} eq $last_title;
         $last_title = $line->{title} if ( $line->{title} );
         $line->{planneddate} = format_date( $line->{planneddate} );

Index: koha-tmpl/intranet-tmpl/prog/en/serials/claims.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/claims.tmpl,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -b -r1.2 -r1.2.2.1
--- koha-tmpl/intranet-tmpl/prog/en/serials/claims.tmpl 20 Jul 2006 03:55:35 
-0000      1.2
+++ koha-tmpl/intranet-tmpl/prog/en/serials/claims.tmpl 13 Dec 2006 19:45:04 
-0000      1.2.2.1
@@ -15,22 +15,22 @@
 
        <p>
        <form action="claims.pl" method="post">
-       <input type="hidden" name="claimletter" value="<!-- TMPL_VAR 
NAME="claimletter"-->">
        <!-- TMPL_VAR name="CGIsupplier" -->
-       <input type="submit" value="Filter by Supplier" class="button">
-       </form>
        </p>
-<!--
        <p>
-       <form action="claims.pl" method="post">
-       <input type="hidden" name="supplierid" value="<!-- TMPL_VAR 
NAME="supplierid"-->">
-       <!-- TMPL_VAR name="CGIletter" -->
-       <input type="submit" value="Choose Claim Form" class="button">
-       </form>
-       </p> -->
+    <!--TMPL_IF Name="letter"-->
+    Select Letter :
+    <select name="letter_code">
+       <!-- TMPL_LOOP name="letters" -->
+      <option value="<!--TMPL_VAR Name="code"-->"><!--TMPL_VAR 
Name="name"--></option>
+    <!--/TMPL_LOOP-->
+    </select>
+    <!--TMPL_ELSE-->
+    No Letter defined. Please Define One
+    <!--/TMPL_IF-->
+       </p> 
 
-<form method="post" action="lateissues-excel.pl">
-<input type="hidden" name="op" value="claims" />
+<input type="hidden" name="op" value="send_alert" />
 
                <!-- TMPL_IF NAME="missingissues" -->
                <h3>Missing Issues</h3>
@@ -42,7 +42,6 @@
                                <th class="cell-header">Issue number</th>
                                <th class="cell-header">Missing since</th>
                                <th class="cell-header">Began Claim</th>
-                               <th class="cell-header">&nbsp;</th>
                        </tr>
                        <!-- TMPL_LOOP name="missingissues" -->
                                <tr>
@@ -53,7 +52,7 @@
                                        <!-- TMPL_VAR name="name" -->
                                        </td>
                                        <td class="cell">
-                                       <!-- TMPL_VAR name="Title" -->
+                                       <!-- TMPL_VAR name="title" -->
                                        </td>
                                        <td class="cell">
                                        <!-- TMPL_VAR name="serialseq" -->
@@ -64,11 +63,6 @@
                                        <td class="cell">
                                        <!-- TMPL_VAR name="claimdate" -->
                                        </td>
-                                       <td class="cell">
-                                       <a 
href="lateissues-excel.pl?supplierid=<!--TMPL_VAR 
NAME="supplierid"-->&amp;serialid=<!-- TMPL_VAR name="serialid" 
-->&amp;op=claims" class="button">Export Item Data</a>
-                                       <!--
-                                       <a href="claims.pl?serialid=<!-- 
TMPL_VAR name="serialid" -->&amp;supplierid=<!-- TMPL_VAR name="supplierid" 
-->&amp;op=preview" onclick="popup(<!-- TMPL_VAR name="supplierid" -->,<!-- 
TMPL_VAR name="serialid" -->); return false">Claim Letter</a> -->
-                                       </td>
                                </tr>
                        <!-- /TMPL_LOOP -->
                </table>
@@ -85,7 +79,7 @@
 name="supplierid" -->,''); return false" class="button">Supplier Group Claim 
Letter</a></p> -->
        <!-- /TMPL_IF -->
 <p><br/>
-               <input type="submit" name="submit" class="button" value="Export 
Selected Data" />
+               <input type="submit" name="submit" class="button" value="Send 
letter" />
 
 </form>
 <!-- TMPL_ELSE -->

Index: koha-tmpl/intranet-tmpl/prog/en/tools/letter.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/tools/letter.tmpl,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -b -r1.3.2.3 -r1.3.2.4
--- koha-tmpl/intranet-tmpl/prog/en/tools/letter.tmpl   5 Dec 2006 15:13:29 
-0000       1.3.2.3
+++ koha-tmpl/intranet-tmpl/prog/en/tools/letter.tmpl   13 Dec 2006 19:45:04 
-0000      1.3.2.4
@@ -146,46 +146,36 @@
                        <p>
                                <label class="label100">Koha module:</label>
                                <select name="module">
-                                       <!-- TMPL_IF name="acquisition" -->
-                                               <option value="acquisition" 
selected>Acquisition</option>
-                                       <!-- TMPL_ELSE -->
-                                               <option 
value="acquisition">Acquisition</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="catalogue" -->
+                                               <!--TMPL_IF Name="catalogue"-->
                                                <option value="catalogue" 
selected>Catalogue</option>
-                                       <!-- TMPL_ELSE -->
-                                               <option 
value="catalogue">Catalogue</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="serial" -->
+                                               <!--TMPL_ELSE-->
+                        <option value="catalogue" >Catalogue</option>
+                        <!--/TMPL_IF-->
+                                               <!--TMPL_IF Name="Serial"-->
                                                <option value="serial" 
selected>Serial</option>
-                                       <!-- TMPL_ELSE -->
+                                               <!--TMPL_ELSE-->
                                                <option 
value="serial">Serial</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="circulation" -->
+                                               <!--/TMPL_IF-->
+                                               <!--TMPL_IF 
Name="claimacquisition"-->
+                                               <option 
value="claimacquisition" selected>Claim Acquisition</option>
+                                               <!--TMPL_ELSE-->
+                                               <option 
value="claimacquisition">Claim Acquisition</option>
+                                               <!--/TMPL_IF -->
+                                               <!--TMPL_IF 
Name="claimserial"-->
+                                               <option value="claimissues" 
selected>Claim Issues</option>
+                                               <!--TMPL_ELSE-->
+                                               <option 
value="claimissues">Claim Issues</option>
+                                               <!--/TMPL_IF-->
+                                               <!--TMPL_IF 
Name="circulation"-->
                                                <option value="circulation" 
selected>Circulation</option>
-                                       <!-- TMPL_ELSE -->
+                                               <!--TMPL_ELSE-->
                                                <option 
value="circulation">Circulation</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="members" -->
+                                               <!--/TMPL_IF-->
+                                               <!--TMPL_IF Name="members"-->
                                                <option value="members" 
selected>Members</option>
-                                       <!-- TMPL_ELSE -->
+                                               <!--TMPL_ELSE-->
                                                <option 
value="members">Members</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="authorities" -->
-                                               <option value="authorities" 
selected>Authorities</option>
-                                       <!-- TMPL_ELSE -->
-                                               <option 
value="authorities">Authorities</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="reports" -->
-                                               <option value="reports" 
selected>Reports</option>
-                                       <!-- TMPL_ELSE -->
-                                               <option 
value="reports">Reports</option>
-                                       <!-- /TMPL_IF -->
-                                       <!-- TMPL_IF name="parameters" -->
-                                               <option value="parameters" 
selected>Parameters</option>
-                                       <!-- TMPL_ELSE -->
-                                               <option 
value="parameters">Parameters</option>
-                                       <!-- /TMPL_IF -->
+                                               <!--/TMPL_IF-->
                                </select>
                        </p>
                        <p>
@@ -196,15 +186,37 @@
                <!-- TMPL_IF NAME="adding" -->
                        <p>
                                <label class="label100">Koha module:</label>
-                               <select name="module">
-                                               <option 
value="acquisition">Acquisition</option>
-                                               <option 
value="catalogue">Catalogue</option>
+                               <select name="module" 
onchange="javascript:window.location.href = 
unescape(window.location.pathname)+'?op=add_form&amp;module='+this.value+'&amp;content='+window.document.forms['Aform'].elements['content'].value;">
+                                               <!--TMPL_IF Name="catalogue"-->
+                        <option value="catalogue" selected>Catalogue</option>
+                                               <!--TMPL_ELSE-->
+                        <option value="catalogue" >Catalogue</option>
+                        <!--/TMPL_IF-->
+                                               <!--TMPL_IF Name="Serial"-->
+                                               <option value="serial" 
selected>Serial</option>
+                                               <!--TMPL_ELSE-->
                                                <option 
value="serial">Serial</option>
+                                               <!--/TMPL_IF-->
+                                               <!--TMPL_IF 
Name="claimacquisition"-->
+                                               <option 
value="claimacquisition" selected>Claim Acquisition</option>
+                                               <!--TMPL_ELSE-->
+                                               <option 
value="claimacquisition">Claim Acquisition</option>
+                                               <!--/TMPL_IF -->
+                                               <!--TMPL_IF 
Name="claimserial"-->
+                                               <option value="claimissues" 
selected>Claim Issues</option>
+                                               <!--TMPL_ELSE-->
+                                               <option 
value="claimissues">Claim Issues</option>
+                                               <!--/TMPL_IF-->
+                                               <!--TMPL_IF 
Name="circulation"-->
+                                               <option value="circulation" 
selected>Circulation</option>
+                                               <!--TMPL_ELSE-->
                                                <option 
value="circulation">Circulation</option>
+                                               <!--/TMPL_IF-->
+                                               <!--TMPL_IF Name="members"-->
+                                               <option value="members" 
selected>Members</option>
+                                               <!--TMPL_ELSE-->
                                                <option 
value="members">Members</option>
-                                               <option 
value="authorities">Authorities</option>
-                                               <option 
value="reports">Reports</option>
-                                               <option 
value="parameters">Parameters</option>
+                                               <!--/TMPL_IF-->
                                </select>
                        </p>
                        <p>
@@ -221,13 +233,14 @@
                <p>
                        <label class="label100">Content (mail content):</label>
                </p>
-               <p><textarea name="content" cols="40" rows="8"><!-- TMPL_VAR 
NAME="content" --></textarea>
-               <input type="button" name="insert" value="&lt;&lt;" 
onclick="insertValueQuery()" title="Insert" />
+               <p>             
                <select name="SQLfieldname" size=9>
                        <!-- TMPL_LOOP name="SQLfieldname" -->
                                <option value="<!-- TMPL_VAR 
name="value"-->"><!-- TMPL_VAR name="text"--></option>
                        <!-- /TMPL_LOOP -->
                </select>
+        <input type="button" name="insert" value="&gt;&gt;" 
onclick="insertValueQuery()" title="Insert" />
+        <textarea name="content" cols="100" rows="15"><!-- TMPL_VAR 
NAME="content" --></textarea>
                </p>
                <p><input type="button" value="OK" onclick="Check(this.form)" 
class="button"></p>
                </form>

Index: serials/claims.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/claims.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- serials/claims.pl   21 Nov 2006 10:45:54 -0000      1.1.2.1
+++ serials/claims.pl   13 Dec 2006 19:45:04 -0000      1.1.2.2
@@ -8,15 +8,14 @@
 use C4::Output;
 use C4::Interface::CGI::Output;
 use C4::Context;
-use HTML::Template;
-use Data::Dumper;
+use C4::Letters;
 
-my $query = new CGI;
+my $input = new CGI;
 
-my $serialid = $query->param('serialid');
-my $op = $query->param('op');
-my $claimletter = $query->param('claimletter');
-my $supplierid = $query->param('supplierid');
+my $serialid = $input->param('serialid');
+my $op = $input->param('op');
+my $claimletter = $input->param('claimletter');
+my $supplierid = $input->param('supplierid');
 my %supplierlist = GetSuppliersWithLateIssues;
 my @select_supplier;
 
@@ -27,8 +26,8 @@
        push @select_supplier, $supplierid
 }
 
-my @select_letter = (1,2,3,4);
-my %letters = (1=>'Claim Form 1',2=>'Claim Form 2',3=>'Claim Form 3',4=>'Claim 
Form 4');
+my @letters = GetLetters("claimissues");
+my $letter=((scalar(@letters)>1)||($letters[0]->{name}||$letters[0]->{code}));
 my ($count2, @missingissues) = GetMissingIssues($supplierid,$serialid);
 
 my $CGIsupplier=CGI::scrolling_list( -name     => 'supplierid',
@@ -38,12 +37,6 @@
                        -size     => 1,
                        -multiple => 0 );
 
-my $CGIletter=CGI::scrolling_list( -name     => 'claimletter',
-                       -values   => address@hidden,
-                       -default  => $claimletter,
-                       -labels   => \%letters,
-                       -size     => 1,
-                       -multiple => 0 );
 my ($singlesupplier,@supplierinfo);
 if($supplierid){
    ($singlesupplier,@supplierinfo)=bookseller($supplierid);
@@ -59,18 +52,25 @@
     $preview = 1;
 }
 
+if ($op eq "send_alert"){
+  my @serialnums=$input->param("serialid");
+  SendAlerts('claimissues',address@hidden,$input->param("letter_code"));
+  my $cntupdate=UpdateClaimdateIssues(address@hidden);
+  ### $cntupdate SHOULD be equal to scalar(@$serialnums)
+}
+
 my ($template, $loggedinuser, $cookie)
 = get_template_and_user({template_name => "serials/claims.tmpl",
-                               query => $query,
+                               query => $input,
                                type => "intranet",
                                authnotrequired => 0,
                                flagsrequired => {serials => 1},
                                debug => 1,
                                });
 
+$template->param('letters'=>address@hidden,'letter'=>$letter);
 $template->param(
        CGIsupplier => $CGIsupplier,
-       CGIletter => $CGIletter,
         preview => $preview,
         missingissues => address@hidden,
         supplierid => $supplierid,
@@ -81,4 +81,4 @@
                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
                IntranetNav => C4::Context->preference("IntranetNav"),
        );
-output_html_with_http_headers $query, $cookie, $template->output;
+output_html_with_http_headers $input, $cookie, $template->output;

Index: tools/letter.pl
===================================================================
RCS file: /cvsroot/koha/koha/tools/letter.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- tools/letter.pl     30 Nov 2006 18:23:52 -0000      1.1.2.1
+++ tools/letter.pl     13 Dec 2006 19:45:04 -0000      1.1.2.2
@@ -71,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;
@@ -121,6 +122,49 @@
                my %line = ('value' => "branches.".$field, 'text' => 
"branches.".$field);
                push @SQLfieldname, \%line;
        }
+    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;
+      }
+    }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;
+      }
+    } else {
        my $sth2=$dbh->prepare("SHOW COLUMNS from biblio");
        $sth2->execute;
        my %line = ('value' => "", 'text' => '---BIBLIO---');
@@ -152,6 +196,7 @@
                my %line = ('value' => "borrowers.".$field, 'text' => 
"borrowers.".$field);
                push @SQLfieldname, \%line;
        }
+    }
        if ($code) {
            $template->param(modify => 1);
            $template->param(code => $letter->{code});
@@ -159,8 +204,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 => address@hidden,);
                                                                                
                        # END $OP eq ADD_FORM
 ################## ADD_VALIDATE ##################################




reply via email to

[Prev in Thread] Current Thread [Next in Thread]