From 247e04d204697126208d6142e02bd49307ef9e29 Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 19 Jan 2006 12:46:58 +0000 Subject: [PATCH] templating serials & moving them to a serials directory, more self-explanatory (bull being french) --- .../prog/en/serials/acqui-search-result.tmpl | 26 ++ .../prog/en/serials/acqui-search.tmpl | 8 + .../prog/en/serials/distributedto.tmpl | 86 ++++++ .../prog/en/serials/lateissues.tmpl | 46 ++++ .../prog/en/serials/serial-issues-full.tmpl | 68 +++++ .../prog/en/serials/serial-issues.tmpl | 115 ++++++++ .../prog/en/serials/serials-home.tmpl | 83 ++++++ .../prog/en/serials/subscription-add.tmpl | 258 ++++++++++++++++++ .../en/serials/subscription-bib-search.tmpl | 67 +++++ .../prog/en/serials/subscription-detail.tmpl | 231 ++++++++++++++++ serials/acqui-search-result.pl | 83 ++++++ serials/acqui-search.pl | 69 +++++ serials/distributedto.pl | 102 +++++++ serials/lateissues.pl | 54 ++++ serials/serial-issues.pl | 73 +++++ serials/serials-home.pl | 31 +++ serials/subscription-add.pl | 193 +++++++++++++ serials/subscription-bib-search.pl | 179 ++++++++++++ serials/subscription-detail.pl | 144 ++++++++++ 19 files changed, 1916 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search-result.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/distributedto.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/lateissues.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues-full.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/serials-home.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/subscription-bib-search.tmpl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl create mode 100755 serials/acqui-search-result.pl create mode 100755 serials/acqui-search.pl create mode 100755 serials/distributedto.pl create mode 100755 serials/lateissues.pl create mode 100755 serials/serial-issues.pl create mode 100755 serials/serials-home.pl create mode 100755 serials/subscription-add.pl create mode 100755 serials/subscription-bib-search.pl create mode 100755 serials/subscription-detail.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search-result.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search-result.tmpl new file mode 100644 index 0000000000..15447e828e --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search-result.tmpl @@ -0,0 +1,26 @@ +Koha -- Subscription edit -- Select supplier +

Supplier Search Results

+

You searched on supplier , results found

+ + + + + + + + + + + +
Book sellerSelect
,'')">Get It !
+ + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search.tmpl new file mode 100644 index 0000000000..aa6b464209 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/acqui-search.tmpl @@ -0,0 +1,8 @@ +Koha -- Subscription edit -- Search supplier + +

Search supplier for serial subscription

+
+ Supplier name : + +
+ \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/distributedto.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/distributedto.tmpl new file mode 100644 index 0000000000..c933f69593 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/distributedto.tmpl @@ -0,0 +1,86 @@ +Koha -- Subscription edit -- Select supplier + +
+

Select borrowers or enter manually the names

+

+

+ + + + + + + + +
+ "> + + +

Distributed to

+

+ +

+

+ + saved

+ + + "> + + +

+ + + +
+
+

+ +
+ diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/lateissues.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/lateissues.tmpl new file mode 100644 index 0000000000..2ddd5eaccb --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/lateissues.tmpl @@ -0,0 +1,46 @@ +Koha -- Subscription edit + + + + +

Late issues

+

+

+ + Phone: + Fax: +

"> + +

+

+ + + + + + + + + + + + + + + + + + + + + + +
TitleIssue numberLate since 
| + ">Detail + ">Recieve + + ">Detail + ">Recieve +
+ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues-full.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues-full.tmpl new file mode 100644 index 0000000000..68d4cd9695 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues-full.tmpl @@ -0,0 +1,68 @@ + + + + +

Subscription information for biblio # with title :

+

+ " class="button bull">Back to biblio + + + + )"> + + + &selectview=small">Compact view +

+ +
" id="" style="position:absolute; visibility:hidden; margin-top:0px; border:4px;" style="visibility:visible"> + + + + + + + + + + + + + + + +
Information + Date + Number + Status +
+ + + + + + + Arrived + Waited + Late + Missing +
+
+ + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues.tmpl new file mode 100644 index 0000000000..9ffb4c29fd --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/serial-issues.tmpl @@ -0,0 +1,115 @@ +Koha -- Subscription edit + + + + +

Issues for a subscription

+ +
"> +

Subscription information for

+

It began on and is issued every + + + day + + + week + + + 2 weeks + + + 3 weeks + + + month + + + 2 months + + + 3 months + + + quarter + + + 2 quarters + + + year + + + 2 years + + + + on monday + + + on tuesday + + + on wednesday + + + on thursday + + + on friday + + + on saturday + + + on sunday + + for + issues + weeks + months + +

+

Last renewal of subscription was

+

This subscription is now ended. The last issue was recieved on

+ +

+ +

Issues summary

+

+ +

+ + +

Recieved issues

+

+ +

+ + +

Missing issues

+

+ +

+ +
+ + + +
+
+ " /> + +
+
" /> + +
+
+ "> + + +
+
+ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/serials-home.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/serials-home.tmpl new file mode 100644 index 0000000000..9c6a720602 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/serials-home.tmpl @@ -0,0 +1,83 @@ +Koha -- Serials + + + + +

Serials

+
+

Serials subscriptions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ISSNTitle + Note + +  
+ " title="type ISSN here to filter subscription"> + + " title="type a title -complete or partial- to filter subscription"> + +   + + +
+ + + + + " class="button bull" title="Issues history"> + + + + + + + + + + | + + + + + + () + + + + + " class="button bull" title="subscription detail">Detail + + + + + " class="button bull" title="receive issues for this subscription">Receive +
+ Add subscription +
+ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl new file mode 100644 index 0000000000..5c014c4101 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl @@ -0,0 +1,258 @@ +Koha -- Subscription edit + + + + + + +

Modify subscription

+ + + " /> + +

Add a subscription

+ + +
+

Subscription information

+ + " /> +

Librarian

+

" size=4 /> (" disabled readonly />)...

+

" size=4 /> (" disabled readonly />)...

+

+ +

+ +

+ +

...

+

warning

+ +
+
+

Planning

+

" size=13 maxlength=10 />

+

+ +

+

+ +

+
+

Subscription length

+

* fill 1 from :

+ +
+
+

Numbering calculation

+

+

Numbering formula: ">

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 XYZ
Add + " /> + + " /> + + " /> +
once every" />" />" />
When more than" />" />" />
The loop is for instance" />" />" />
Set back to" />" />" />
+ + Last value + + Begins with + + " />" />" />
+

+
+ + + + + + + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-bib-search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-bib-search.tmpl new file mode 100644 index 0000000000..ee2f08e670 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-bib-search.tmpl @@ -0,0 +1,67 @@ +Koha -- Subscription edit + +

Catalogue search

+ +

Search on

+
+ + + "> +

+ + + + + + +

+

+ + + "> + + + + + "> +

+

Results per page : + + Ordered by + +

+

+ + Suggestions +

+
+ + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl new file mode 100644 index 0000000000..ca0eafd5f2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl @@ -0,0 +1,231 @@ +Koha -- Subscription detail + + + + +

Subscription for

+
+

Subscription information

+

Librarian identity :

+

+

+

+

()

+

+

+ + + + Borrowers can't subscribe to issue alerts + +

+

+

+
+
+

Planning

+

+

+ + 1/day + + + 1/week + + + 1/2 weeks + + + 1/3 weeks + + + 1/Month + + + 1/2 Months (6/year) + + + 1/quarter + + + 1/quarter + + + 2/year + + + 1/year + + + 1/2 years + +

+

+ + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + Saturday + + + Sunday + +

+
+

Subscription length

+

+

+

+ +
+
+

Numbering calculation

+

+

Numbering formula:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
     X        Y        Z    
Add + + + + + +
once every
When more than
+ (is )

+ (is )

+ (is )
Set back to
+ Last value +
+
+
+

Issues

+ + + + + + + + + + + + + + + +
    Issue number        Planned date        Status        Note    
+ + + + + + Waited + + + Arrived + + + Late + + + Missing + + + + +
+
+ +
+
+ " /> + + +
+
+ " /> + +
+
+ " /> + +
+
+ " /> + +
+ +
+ " /> + +
+ +
+ " /> + +
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/serials/acqui-search-result.pl b/serials/acqui-search-result.pl new file mode 100755 index 0000000000..5206c47268 --- /dev/null +++ b/serials/acqui-search-result.pl @@ -0,0 +1,83 @@ +#!/usr/bin/perl + +# $Id$ + +#script to show suppliers and orders +#written by chris@katipo.co.nz 23/2/2000 + + +# Copyright 2000-2002 Katipo Communications +# +# 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 C4::Auth; +use C4::Biblio; +use C4::Output; +use CGI; +use C4::Interface::CGI::Output; +use C4::Database; +use HTML::Template; +use C4::Acquisition; +use C4::Date; + +my $query=new CGI; +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "serials/acqui-search-result.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); + +my $supplier=$query->param('supplier'); +my ($count,@suppliers)=bookseller($supplier); + +#build reult page +my $toggle=0; +my @loop_suppliers; +for (my $i=0; $i<$count; $i++) { + my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'}); + my %line; + if ($toggle==0){ + $line{even}=1; + $toggle=1; + } else { + $line{even}=0; + $toggle=0; + } + $line{aqbooksellerid} =$suppliers[$i]->{'id'}; + $line{name} = $suppliers[$i]->{'name'}; + $line{active} = $suppliers[$i]->{'active'}; + my @loop_basket; + for (my $i2=0;$i2<$ordcount;$i2++){ + my %inner_line; + $inner_line{basketno} =$orders->[$i2]->{'basketno'}; + $inner_line{total} =$orders->[$i2]->{'count(*)'}; + $inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'}; + $inner_line{creationdate} = format_date($orders->[$i2]->{'creationdate'}); + $inner_line{closedate} = format_date($orders->[$i2]->{'closedate'}); + push @loop_basket, \%inner_line; + } + $line{loop_basket} = \@loop_basket; + push @loop_suppliers, \%line; +} +$template->param(loop_suppliers => \@loop_suppliers, + supplier => $supplier, + count => $count); + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/serials/acqui-search.pl b/serials/acqui-search.pl new file mode 100755 index 0000000000..7aa636f2b5 --- /dev/null +++ b/serials/acqui-search.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Database; +use HTML::Template; +use C4::Acquisition; +my $query = new CGI; +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "serials/acqui-search.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); + +#FIXME : Is this page still used ???? +# looks like no. + +# budget +my $dbh = C4::Context->dbh; +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($loggedinuser); +my ($flags, $homebranch)=$sthtemp->fetchrow; +my ($count,@results)=bookfunds($homebranch); +my $classlist=''; +my $total=0; +my $totspent=0; +my $totcomtd=0; +my $totavail=0; +my @loop_budget = (); +for (my $i=0;$i<$count;$i++){ + my ($spent,$comtd)=bookfundbreakdown($results[$i]->{'bookfundid'}); + my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd); + my %line; + $line{bookfundname} = $results[$i]->{'bookfundname'}; + $line{budgetamount} = $results[$i]->{'budgetamount'}; + $line{spent} = sprintf ("%.2f", $spent); + $line{comtd} = sprintf ("%.2f",$comtd); + $line{avail} = sprintf ("%.2f",$avail); + push @loop_budget, \%line; + $total+=$results[$i]->{'budgetamount'}; + $totspent+=$spent; + $totcomtd+=$comtd; + $totavail+=$avail; +} +#currencies +my ($count,$rates)=getcurrencies(); +my @loop_currency = (); +for (my $i=0;$i<$count;$i++){ + my %line; + $line{currency} = $rates->[$i]->{'currency'}; + $line{rate} = $rates->[$i]->{'rate'}; + push @loop_currency, \%line; +} +$template->param(classlist => $classlist, + type => 'intranet', + loop_budget => \@loop_budget, + loop_currency => \@loop_currency, + total => sprintf("%.2f",$total), + totspent => sprintf("%.2f",$totspent), + totcomtd => sprintf("%.2f",$totcomtd), + totavail => sprintf("%.2f",$totavail)); + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/serials/distributedto.pl b/serials/distributedto.pl new file mode 100755 index 0000000000..df8e8e6ed7 --- /dev/null +++ b/serials/distributedto.pl @@ -0,0 +1,102 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# +# 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::Date; +use C4::Auth; +use C4::Context; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Search; +use HTML::Template; + +sub StringSearch { + my ($searchstring)=@_; + my $dbh = C4::Context->dbh; + $searchstring=~ s/\'/\\\'/g; + my @data=split(' ',$searchstring); + my $count=@data; + my $sth=$dbh->prepare("Select surname,firstname from borrowers where (surname like ?) order by surname"); + $sth->execute("$data[0]%"); + my @results; + my $cnt=0; + while (my $data=$sth->fetchrow_hashref){ + push(@results,$data); + $cnt ++; + } + $sth->finish; + return($cnt,\@results); +} + +my $input = new CGI; +my $searchfield=$input->param('searchfield'); +defined $searchfield or $searchfield=''; +my $distributedto=$input->param('distributedto'); +my $subscriptionid = $input->param('subscriptionid'); +$searchfield=~ s/\,//g; +my $SaveList=$input->param('SaveList'); +my $dbh = C4::Context->dbh; + +unless ($distributedto) { + # read the previous distributedto + my $sth = $dbh->prepare('select distributedto from subscription where subscriptionid=?'); + $sth->execute($subscriptionid); + ($distributedto) = $sth->fetchrow; +} + +if ($SaveList) { + my $sth = $dbh->prepare("update subscription set distributedto=? where subscriptionid=?"); + $sth->execute($distributedto,$subscriptionid); +} +my ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "serials/distributedto.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {cataloguing => 1}, + debug => 1, + }); + +my $env; +my $count=0; +my $results; +($count,$results)=StringSearch($searchfield) if $searchfield; +my $toggle="0"; +my @loop_data =(); +for (my $i=0; $i < $count; $i++){ + if ($i % 2){ + $toggle=1; + } else { + $toggle=0; + } + my %row_data; + $row_data{toggle} = $toggle; + $row_data{firstname} = $results->[$i]{'firstname'}; + $row_data{surname} = $results->[$i]{'surname'}; + push(@loop_data, \%row_data); +} +$template->param(borlist => \@loop_data, + searchfield => $searchfield, + distributedto => $distributedto, + SaveList => $SaveList, + subscriptionid => $subscriptionid, + ); +output_html_with_http_headers $input, $cookie, $template->output; + diff --git a/serials/lateissues.pl b/serials/lateissues.pl new file mode 100755 index 0000000000..6a79a3c290 --- /dev/null +++ b/serials/lateissues.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Bull; +use C4::Acquisition; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; + +my $query = new CGI; +# my $title = $query->param('title'); +# my $ISSN = $query->param('ISSN'); +# my @subscriptions = getsubscriptions($title,$ISSN); + +my $supplierid = $query->param('supplierid'); +my %supplierlist = getSupplierListWithLateIssues; +my @select_supplier; +push @select_supplier,""; +foreach my $supplierid (keys %supplierlist){ + push @select_supplier, $supplierid +} +my $CGIsupplier=CGI::scrolling_list( -name => 'supplierid', + -values => \@select_supplier, + -default => $supplierid, + -labels => \%supplierlist, + -size => 1, + -multiple => 0 ); + +my @lateissues; +@lateissues = GetLateIssues($supplierid) if $supplierid; +my @supplierinfo; +my $nothing; +($nothing,@supplierinfo)=bookseller($supplierid) if $supplierid; + +my ($template, $loggedinuser, $cookie) += get_template_and_user({template_name => "serials/lateissues.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + +$template->param( + CGIsupplier => $CGIsupplier, + lateissues => \@lateissues, + phone => $supplierinfo[0]->{phone}, + booksellerfax => $supplierinfo[0]->{booksellerfax}, + bookselleremail => $supplierinfo[0]->{bookselleremail}, + ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/serials/serial-issues.pl b/serials/serial-issues.pl new file mode 100755 index 0000000000..f829b134f4 --- /dev/null +++ b/serials/serial-issues.pl @@ -0,0 +1,73 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Koha; +use C4::Date; +use C4::Bull; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; + +my $query = new CGI; +my $op = $query->param('op'); +my $dbh = C4::Context->dbh; +my $selectview = $query->param('selectview'); +$selectview = C4::Context->preference("SubscriptionHistory") unless $selectview; + +my $sth; +# my $id; +my ($template, $loggedinuser, $cookie); +my $biblionumber = $query->param('biblionumber'); +if ($selectview eq "full"){ + my $subscriptions = get_full_subscription_list_from_biblionumber($biblionumber); + + my $title = $subscriptions->[0]{bibliotitle}; + my $yearmin=$subscriptions->[0]{year}; + my $yearmax=$subscriptions->[scalar(@$subscriptions)-1]{year}; + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "serials/serial-issues-full.tmpl", + query => $query, + type => "intranet", + authnotrequired => 1, + debug => 1, + }); + + # replace CR by
in librarian note + # $subscription->{opacnote} =~ s/\n/\/g; + + $template->param( + biblionumber => $query->param('biblionumber'), + years => $subscriptions, + yearmin => $yearmin, + yearmax =>$yearmax, + bibliotitle => $title, + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + ); + +} else { + my $subscriptions = get_subscription_list_from_biblionumber($biblionumber); + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "serials/serial-issues.tmpl", + query => $query, + type => "intranet", + authnotrequired => 1, + debug => 1, + }); + + # replace CR by
in librarian note + # $subscription->{opacnote} =~ s/\n/\/g; + + $template->param( + biblionumber => $query->param('biblionumber'), + subscription_LOOP => $subscriptions, + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + ); +} +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/serials/serials-home.pl b/serials/serials-home.pl new file mode 100755 index 0000000000..8782c16221 --- /dev/null +++ b/serials/serials-home.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Bull; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; + +my $query = new CGI; +my $title = $query->param('title'); +my $ISSN = $query->param('ISSN'); +my $biblionumber = $query->param('biblionumber'); +my @subscriptions = getsubscriptions($title,$ISSN,$biblionumber); +my ($template, $loggedinuser, $cookie) += get_template_and_user({template_name => "serials/serials-home.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + +$template->param( + subscriptions => \@subscriptions, + title => $title, + ISSN => $ISSN, + ); +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl new file mode 100755 index 0000000000..e8ea5612f5 --- /dev/null +++ b/serials/subscription-add.pl @@ -0,0 +1,193 @@ +#!/usr/bin/perl + + +use strict; +use CGI; +use C4::Koha; +use C4::Auth; +use C4::Date; +use C4::Output; +use C4::Bull; +use C4::Acquisition; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; +use C4::Bull; +use C4::Letters; + +my $query = new CGI; +my $op = $query->param('op'); +my $dbh = C4::Context->dbh; +my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity, + $dow, $numberlength, $weeklength, $monthlength, + $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, + $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, + $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, + $numberingmethod, $status, $biblionumber, + $bibliotitle, $notes, $letter); + + my @budgets; +my ($template, $loggedinuser, $cookie) += get_template_and_user({template_name => "serials/subscription-add.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + + +#FIXME : If Budgets are never used, then these lines are useless. +$dbh = C4::Context->dbh; +my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); +$sthtemp->execute($loggedinuser); +my ($flags, $homebranch)=$sthtemp->fetchrow; +#FIXME : END added by hdl on July,14 2005 + +if ($op eq 'mod') { + my $subscriptionid = $query->param('subscriptionid'); + my $subs = &getsubscription($subscriptionid); + $auser = $subs->{'user'}; + $librarian = $subs->{'librarian'}; + $cost = $subs->{'cost'}; + $aqbooksellerid = $subs->{'aqbooksellerid'}; + $aqbooksellername = $subs->{'aqbooksellername'}; + $bookfundid = $subs->{'bookfundid'}; + $aqbudgetid = $subs->{'aqbudgetid'}; + defined $aqbudgetid or $aqbudgetid=''; + $startdate = $subs->{'startdate'}; + $periodicity = $subs->{'periodicity'}; + $dow = $subs->{'dow'}; + $numberlength = $subs->{'numberlength'}; + $weeklength = $subs->{'weeklength'}; + $monthlength = $subs->{'monthlength'}; + $add1 = $subs->{'add1'}; + $every1 = $subs->{'every1'}; + $whenmorethan1 = $subs->{'whenmorethan1'}; + $setto1 = $subs->{'setto1'}; + $lastvalue1 = $subs->{'lastvalue1'}; + $innerloop1 = $subs->{'innerloop1'}; + $add2 = $subs->{'add2'}; + $every2 = $subs->{'every2'}; + $whenmorethan2 = $subs->{'whenmorethan2'}; + $setto2 = $subs->{'setto2'}; + $lastvalue2 = $subs->{'lastvalue2'}; + $innerloop2 = $subs->{'innerloop2'}; + $add3 = $subs->{'add3'}; + $every3 = $subs->{'every3'}; + $whenmorethan3 = $subs->{'whenmorethan3'}; + $setto3 = $subs->{'setto3'}; + $lastvalue3 = $subs->{'lastvalue3'}; + $innerloop3 = $subs->{'innerloop3'}; + $numberingmethod = $subs->{'numberingmethod'}; + $status = $subs->{status}; + $biblionumber = $subs->{'biblionumber'}; + $bibliotitle = $subs->{'bibliotitle'}, + $notes = $subs->{'notes'}; + $letter = $subs->{'letter'}; + defined $letter or $letter=''; + $template->param( + $op => 1, + user => $auser, + librarian => $librarian, + aqbooksellerid => $aqbooksellerid, + aqbooksellername => $aqbooksellername, + cost => $cost, + aqbudgetid => $aqbudgetid, + bookfundid => $bookfundid, + startdate => format_date($startdate), + periodicity => $periodicity, + dow => $dow, + numberlength => $numberlength, + weeklength => $weeklength, + monthlength => $monthlength, + add1 => $add1, + every1 => $every1, + whenmorethan1 => $whenmorethan1, + setto1 => $setto1, + lastvalue1 => $lastvalue1, + innerloop1 => $innerloop1, + add2 => $add2, + every2 => $every2, + whenmorethan2 => $whenmorethan2, + setto2 => $setto2, + lastvalue2 => $lastvalue2, + innerloop2 => $innerloop2, + add3 => $add3, + every3 => $every3, + whenmorethan3 => $whenmorethan3, + setto3 => $setto3, + lastvalue3 => $lastvalue3, + innerloop3 => $innerloop3, + numberingmethod => $numberingmethod, + status => $status, + biblionumber => $biblionumber, + bibliotitle => $bibliotitle, + notes => $notes, + letter => $letter, + subscriptionid => $subscriptionid, + ); + $template->param( + "periodicity$periodicity" => 1, + "dow$dow" => 1, + ); +} +##FIXME : Looks like never used. +(my $temp,@budgets) = bookfunds($homebranch); +# find default value & set it for the template +for (my $i=0;$i<$#budgets;$i++) { + if ($budgets[$i]->{'aqbudgetid'} eq $aqbudgetid) { + $budgets[$i]->{'selected'}=1; + } +} +$template->param(budgets => \@budgets); +#FIXME : END Added by hdl on July, 14 2005 + +my @letterlist = GetLetterList('serial'); +for (my $i=0;$i<=$#letterlist;$i++) { + $letterlist[$i]->{'selected'} =1 if $letterlist[$i]->{'code'} eq $letter; +} +$template->param(letters => \@letterlist); + +if ($op eq 'addsubscription') { + my $auser = $query->param('user'); + my $aqbooksellerid = $query->param('aqbooksellerid'); + my $cost = $query->param('cost'); + my $aqbudgetid = $query->param('aqbudgetid'); + my $startdate = $query->param('startdate'); + my $periodicity = $query->param('periodicity'); + my $dow = $query->param('dow'); + my $numberlength = $query->param('numberlength'); + my $weeklength = $query->param('weeklength'); + my $monthlength = $query->param('monthlength'); + my $add1 = $query->param('add1'); + my $every1 = $query->param('every1'); + my $whenmorethan1 = $query->param('whenmorethan1'); + my $setto1 = $query->param('setto1'); + my $lastvalue1 = $query->param('lastvalue1'); + my $add2 = $query->param('add2'); + my $every2 = $query->param('every2'); + my $whenmorethan2 = $query->param('whenmorethan2'); + my $setto2 = $query->param('setto2'); + my $lastvalue2 = $query->param('lastvalue2'); + my $add3 = $query->param('add3'); + my $every3 = $query->param('every3'); + my $whenmorethan3 = $query->param('whenmorethan3'); + my $setto3 = $query->param('setto3'); + my $lastvalue3 = $query->param('lastvalue3'); + my $numberingmethod = $query->param('numberingmethod'); + my $status = 1; + my $biblionumber = $query->param('biblionumber'); + my $notes = $query->param('notes'); + my $letter = $query->param('letter'); + my $subscriptionid = newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, + $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength, + $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, + $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, + $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, + $numberingmethod, $status, $notes, $letter + ); + print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); +} else { + output_html_with_http_headers $query, $cookie, $template->output; +} diff --git a/serials/subscription-bib-search.pl b/serials/subscription-bib-search.pl new file mode 100755 index 0000000000..51b235df89 --- /dev/null +++ b/serials/subscription-bib-search.pl @@ -0,0 +1,179 @@ +#!/usr/bin/perl +# WARNING: 4-character tab stops here + +# Copyright 2000-2002 Katipo Communications +# +# 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; +require Exporter; +use CGI; +use C4::Koha; +use C4::Auth; +use HTML::Template; +use C4::Context; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::SearchMarc; + +my $query=new CGI; +my $type=$query->param('type'); +my $op = $query->param('op'); +my $dbh = C4::Context->dbh; + +my $startfrom=$query->param('startfrom'); +$startfrom=0 if(!defined $startfrom); +my ($template, $loggedinuser, $cookie); +my $resultsperpage; + +if ($op eq "do_search") { + my @marclist = $query->param('marclist'); + my @and_or = $query->param('and_or'); + my @excluding = $query->param('excluding'); + my @operator = $query->param('operator'); + my @value = $query->param('value'); + + $resultsperpage= $query->param('resultsperpage'); + $resultsperpage = 19 if(!defined $resultsperpage); + my $orderby = $query->param('orderby'); + + # builds tag and subfield arrays + my @tags; + + foreach my $marc (@marclist) { + if ($marc) { + my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc); + if ($tag) { + push @tags,$dbh->quote("$tag$subfield"); + } else { + push @tags, $dbh->quote(substr($marc,0,4)); + } + } else { + push @tags, ""; + } + } + my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, + \@excluding, \@operator, \@value, + $startfrom*$resultsperpage, $resultsperpage,$orderby); + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "serials/result.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {borrowers => 1}, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + + # multi page display gestion + my $displaynext=0; + my $displayprev=$startfrom; + if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){ + $displaynext = 1; + } + + my @field_data = (); + + + for(my $i = 0 ; $i <= $#marclist ; $i++) + { + push @field_data, { term => "marclist", val=>$marclist[$i] }; + push @field_data, { term => "and_or", val=>$and_or[$i] }; + push @field_data, { term => "excluding", val=>$excluding[$i] }; + push @field_data, { term => "operator", val=>$operator[$i] }; + push @field_data, { term => "value", val=>$value[$i] }; + } + + my @numbers = (); + + if ($total>$resultsperpage) + { + for (my $i=1; $i<$total/$resultsperpage+1; $i++) + { + if ($i<16) + { + my $highlight=0; + ($startfrom==($i-1)) && ($highlight=1); + push @numbers, { number => $i, + highlight => $highlight , + searchdata=> \@field_data, + startfrom => ($i-1)}; + } + } + } + + my $from = $startfrom*$resultsperpage+1; + my $to; + + if($total < (($startfrom+1)*$resultsperpage)) + { + $to = $total; + } else { + $to = (($startfrom+1)*$resultsperpage); + } + $template->param(result => $results, + startfrom=> $startfrom, + displaynext=> $displaynext, + displayprev=> $displayprev, + resultsperpage => $resultsperpage, + startfromnext => $startfrom+1, + startfromprev => $startfrom-1, + searchdata=>\@field_data, + total=>$total, + from=>$from, + to=>$to, + numbers=>\@numbers, + ); +} else { + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "serials/subscription-bib-search.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + my $sth=$dbh->prepare("Select itemtype,description from itemtypes order by description"); + $sth->execute; + my @itemtype; + my %itemtypes; + push @itemtype, ""; + $itemtypes{''} = ""; + while (my ($value,$lib) = $sth->fetchrow_array) { + push @itemtype, $value; + $itemtypes{$value}=$lib; + } + + my $CGIitemtype=CGI::scrolling_list( -name => 'value', + -values => \@itemtype, + -labels => \%itemtypes, + -size => 1, + -multiple => 0 ); + $sth->finish; + + $template->param( + CGIitemtype => $CGIitemtype, + ); +} + + +# Print the page +output_html_with_http_headers $query, $cookie, $template->output; + +# Local Variables: +# tab-width: 4 +# End: diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl new file mode 100755 index 0000000000..4c44c889fb --- /dev/null +++ b/serials/subscription-detail.pl @@ -0,0 +1,144 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use C4::Auth; +use C4::Koha; +use C4::Date; +use C4::Bull; +use C4::Output; +use C4::Interface::CGI::Output; +use C4::Context; +use HTML::Template; + +my $query = new CGI; +my $op = $query->param('op') || ''; +my $dbh = C4::Context->dbh; +my $sth; +# my $id; +my ($template, $loggedinuser, $cookie, $subs, $user, $sessionID, $flags); +my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity, + $dow, $numberlength, $weeklength, $monthlength, + $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, + $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, + $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, + $numberingmethod, $status, $biblionumber, $bibliotitle, $notes,$letter); + +$subscriptionid = $query->param('subscriptionid'); + +if ($op eq 'modsubscription') { + $auser = $query->param('user'); + $librarian = $query->param('librarian'); + $cost = $query->param('cost'); + $aqbooksellerid = $query->param('aqbooksellerid'); + $biblionumber = $query->param('biblionumber'); + $aqbudgetid = $query->param('aqbudgetid'); + $startdate = format_date_in_iso($query->param('startdate')); + $periodicity = $query->param('periodicity'); + $dow = $query->param('dow'); + $numberlength = $query->param('numberlength'); + $weeklength = $query->param('weeklength'); + $monthlength = $query->param('monthlength'); + $add1 = $query->param('add1'); + $every1 = $query->param('every1'); + $whenmorethan1 = $query->param('whenmorethan1'); + $setto1 = $query->param('setto1'); + $lastvalue1 = $query->param('lastvalue1'); + $innerloop1 = $query->param('innerloop1'); + $add2 = $query->param('add2'); + $every2 = $query->param('every2'); + $whenmorethan2 = $query->param('whenmorethan2'); + $setto2 = $query->param('setto2'); + $lastvalue2 = $query->param('lastvalue2'); + $innerloop2 = $query->param('innerloop2'); + $add3 = $query->param('add3'); + $every3 = $query->param('every3'); + $whenmorethan3 = $query->param('whenmorethan3'); + $setto3 = $query->param('setto3'); + $lastvalue3 = $query->param('lastvalue3'); + $innerloop3 = $query->param('innerloop3'); + $numberingmethod = $query->param('numberingmethod'); + $status = 1; + $notes = $query->param('notes'); + $letter = $query->param('letter'); + + &modsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate, + $periodicity,$dow,$numberlength,$weeklength,$monthlength, + $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, + $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, + $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, + $numberingmethod, $status, $biblionumber, $notes, $letter, $subscriptionid); +} + +if ($op eq 'del') { + &delsubscription($subscriptionid); + print "Content-Type: text/html\n\n"; + exit; + +} +$subs = &getsubscription($subscriptionid); +# html'ize distributedto +$subs->{distributedto}=~ s/\n/
/g; +my ($totalissues,@serialslist) = getserials($subscriptionid); +$totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue) + +($template, $loggedinuser, $cookie) += get_template_and_user({template_name => "serials/subscription-detail.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + +($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, "intranet"); + +$template->param( + user => $subs->{auser}, + librarian => $subs->{librarian}, + aqbooksellerid => $subs->{aqbooksellerid}, + aqbooksellername => $subs->{aqbooksellername}, + cost => $subs->{cost}, + aqbudgetid => $subs->{aqbudgetid}, + bookfundid => $subs->{bookfundid}, + startdate => format_date($subs->{startdate}), + periodicity => $subs->{periodicity}, + dow => $subs->{dow}, + numberlength => $subs->{numberlength}, + weeklength => $subs->{weeklength}, + monthlength => $subs->{monthlength}, + add1 => $subs->{add1}, + every1 => $subs->{every1}, + whenmorethan1 => $subs->{whenmorethan1}, + innerloop1 => $subs->{innerloop1}, + setto1 => $subs->{setto1}, + lastvalue1 => $subs->{lastvalue1}, + add2 => $subs->{add2}, + every2 => $subs->{every2}, + whenmorethan2 => $subs->{whenmorethan2}, + setto2 => $subs->{setto2}, + lastvalue2 => $subs->{lastvalue2}, + innerloop2 => $subs->{innerloop2}, + add3 => $subs->{add3}, + every3 => $subs->{every3}, + whenmorethan3 => $subs->{whenmorethan3}, + setto3 => $subs->{setto3}, + lastvalue3 => $subs->{lastvalue3}, + innerloop3 => $subs->{innerloop3}, + numberingmethod => $subs->{numberingmethod}, + status => $subs->{status}, + biblionumber => $subs->{biblionumber}, + bibliotitle => $subs->{bibliotitle}, + notes => $subs->{notes}, + letter => $subs->{letter}, + distributedto => $subs->{distributedto}, + subscriptionid => $subs->{subscriptionid}, + serialslist => \@serialslist, + totalissues => $totalissues, + ); +$template->param( + "periodicity$subs->{periodicity}" => 1, + "arrival$subs->{dow}" => 1, + ); + +output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.2