use strict;
use warnings;
+use Carp;
use C4::Context;
use C4::Debug;
use C4::Dates qw(format_date format_date_in_iso);
# if these parameters are missing, we can't continue
for my $key (qw/basketno quantity biblionumber budget_id/) {
- die "Mandatory parameter $key missing" unless $orderinfo->{$key};
+ croak "Mandatory parameter $key missing" unless $orderinfo->{$key};
}
if ( defined $orderinfo->{subscription} && $orderinfo->{'subscription'} eq 'yes' ) {
=head3 GetHistory
- (\@order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( $title, $author, $name, $from_placed_on, $to_placed_on );
+ (\@order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( %params );
Retreives some acquisition history information
+params:
+ title
+ author
+ name
+ from_placed_on
+ to_placed_on
+ basket - search both basket name and number
+ booksellerinvoicenumber
+
returns:
$order_loop is a list of hashrefs that each look like this:
{
=cut
sub GetHistory {
- my ( $title, $author, $name, $from_placed_on, $to_placed_on ) = @_;
+# don't run the query if there are no parameters (list would be too long for sure !)
+ croak "No search params" unless @_;
+ my %params = @_;
+ my $title = $params{title};
+ my $author = $params{author};
+ my $name = $params{name};
+ my $from_placed_on = $params{from_placed_on};
+ my $to_placed_on = $params{to_placed_on};
+ my $basket = $params{basket};
+ my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
+
my @order_loop;
my $total_qty = 0;
my $total_qtyreceived = 0;
my $total_price = 0;
-# don't run the query if there are no parameters (list would be too long for sure !)
- if ( $title || $author || $name || $from_placed_on || $to_placed_on ) {
- my $dbh = C4::Context->dbh;
- my $query ="
- SELECT
- biblio.title,
- biblio.author,
- aqorders.basketno,
- aqbasket.basketname,
- aqbasket.basketgroupid,
- aqbasketgroups.name as groupname,
- aqbooksellers.name,
- aqbasket.creationdate,
- aqorders.datereceived,
- aqorders.quantity,
- aqorders.quantityreceived,
- aqorders.ecost,
- aqorders.ordernumber,
- aqorders.booksellerinvoicenumber as invoicenumber,
- aqbooksellers.id as id,
- aqorders.biblionumber
- FROM aqorders
- LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
- LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
- LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
- LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber";
-
- $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
- if ( C4::Context->preference("IndependantBranches") );
-
- $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
-
- my @query_params = ();
-
- if ( defined $title ) {
- $query .= " AND biblio.title LIKE ? ";
- $title =~ s/\s+/%/g;
- push @query_params, "%$title%";
- }
+ my $dbh = C4::Context->dbh;
+ my $query ="
+ SELECT
+ biblio.title,
+ biblio.author,
+ aqorders.basketno,
+ aqbasket.basketname,
+ aqbasket.basketgroupid,
+ aqbasketgroups.name as groupname,
+ aqbooksellers.name,
+ aqbasket.creationdate,
+ aqorders.datereceived,
+ aqorders.quantity,
+ aqorders.quantityreceived,
+ aqorders.ecost,
+ aqorders.ordernumber,
+ aqorders.booksellerinvoicenumber as invoicenumber,
+ aqbooksellers.id as id,
+ aqorders.biblionumber
+ FROM aqorders
+ LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
+ LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
+ LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
+ LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber";
- if ( defined $author ) {
- $query .= " AND biblio.author LIKE ? ";
- push @query_params, "%$author%";
- }
+ $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
+ if ( C4::Context->preference("IndependantBranches") );
- if ( defined $name ) {
- $query .= " AND aqbooksellers.name LIKE ? ";
- push @query_params, "%$name%";
- }
+ $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
- if ( defined $from_placed_on ) {
- $query .= " AND creationdate >= ? ";
- push @query_params, $from_placed_on;
- }
+ my @query_params = ();
- if ( defined $to_placed_on ) {
- $query .= " AND creationdate <= ? ";
- push @query_params, $to_placed_on;
- }
+ if ( defined $title ) {
+ $query .= " AND biblio.title LIKE ? ";
+ $title =~ s/\s+/%/g;
+ push @query_params, "%$title%";
+ }
- if ( C4::Context->preference("IndependantBranches") ) {
- my $userenv = C4::Context->userenv;
- if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
- $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
- push @query_params, $userenv->{branch};
- }
+ if ( defined $author ) {
+ $query .= " AND biblio.author LIKE ? ";
+ push @query_params, "%$author%";
+ }
+
+ if ( defined $name ) {
+ $query .= " AND aqbooksellers.name LIKE ? ";
+ push @query_params, "%$name%";
+ }
+
+ if ( defined $from_placed_on ) {
+ $query .= " AND creationdate >= ? ";
+ push @query_params, $from_placed_on;
+ }
+
+ if ( defined $to_placed_on ) {
+ $query .= " AND creationdate <= ? ";
+ push @query_params, $to_placed_on;
+ }
+
+ if ($basket) {
+ if ($basket =~ m/^\d+$/) {
+ $query .= " AND aqorders.basketno = ? ";
+ push @query_params, $basket;
+ } else {
+ $query .= " AND aqbasket.basketname LIKE ? ";
+ push @query_params, "%$basket%";
}
- $query .= " ORDER BY id";
- my $sth = $dbh->prepare($query);
- $sth->execute( @query_params );
- my $cnt = 1;
- while ( my $line = $sth->fetchrow_hashref ) {
- $line->{count} = $cnt++;
- $line->{toggle} = 1 if $cnt % 2;
- push @order_loop, $line;
- $line->{creationdate} = format_date( $line->{creationdate} );
- $line->{datereceived} = format_date( $line->{datereceived} );
- $total_qty += $line->{'quantity'};
- $total_qtyreceived += $line->{'quantityreceived'};
- $total_price += $line->{'quantity'} * $line->{'ecost'};
+ }
+
+ if ($booksellerinvoicenumber) {
+ $query .= " AND (aqorders.booksellerinvoicenumber LIKE ? OR aqbasket.booksellerinvoicenumber LIKE ?)";
+ push @query_params, "%$booksellerinvoicenumber%", "%$booksellerinvoicenumber%";
+ }
+
+ if ( C4::Context->preference("IndependantBranches") ) {
+ my $userenv = C4::Context->userenv;
+ if ( $userenv && ($userenv->{flags} || 0) != 1 ) {
+ $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
+ push @query_params, $userenv->{branch};
}
}
+ $query .= " ORDER BY id";
+ my $sth = $dbh->prepare($query);
+ $sth->execute( @query_params );
+ my $cnt = 1;
+ while ( my $line = $sth->fetchrow_hashref ) {
+ $line->{count} = $cnt++;
+ $line->{toggle} = 1 if $cnt % 2;
+ push @order_loop, $line;
+ $line->{creationdate} = format_date( $line->{creationdate} );
+ $line->{datereceived} = format_date( $line->{datereceived} );
+ $total_qty += $line->{'quantity'};
+ $total_qtyreceived += $line->{'quantityreceived'};
+ $total_price += $line->{'quantity'} * $line->{'ecost'};
+ }
return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
}
my $data;
while (my $hashRef = $sth->fetchrow_hashref) {
for (@fields) {
+ $hashRef->{$_} =~ s/[\r\n]//g;
$$strCSV .= '"' . $hashRef->{$_} . '",';
}
chop $$strCSV;
my $line;
my $numLines = 0;
while (<$dom>) {
- chomp $_;
+ s/[\r\n]+$//;
$line = $_;
# we don't want to execute any sql statement, only the ones dealing with frameworks
next unless ($line =~ /^\s*(?i:DELETE\s+FROM|INSERT\s+INTO)\s+(?:marc_tag_structure|marc_subfield_structure)/);
my ($dbh, $table, $frameworkcode, $dom, $PKArray, $fields2Delete, $fields) = @_;
my $row = '';
+ my $partialRow = '';
my $numFields = @$fields;
my $fieldsNameRead = 0;
my @arrData;
my $pos = 0;
while (<$dom>) {
$row = $_;
+ # Check whether the line has an unfinished field, i.e., a field with CR/LF in its data
+ if ($row =~ /,"[^"]*[\r\n]+$/ || $row =~ /^[^"]+[\r\n]+$/) {
+ $row =~ s/[\r\n]+$//;
+ $partialRow .= $row;
+ next;
+ }
+ if ($partialRow) {
+ $row = $partialRow . $row;
+ $partialRow = '';
+ }
+ # Line OK, process it
if ($row =~ /(?:".*?",?)+/) {
@arrData = split('","', $row);
$arrData[0] = substr($arrData[0], 1) if ($arrData[0] =~ /^"/);
- chomp $arrData[$#arrData];
+ $arrData[$#arrData] =~ s/[\r\n]+$//;
chop $arrData[$#arrData] if ($arrData[$#arrData] =~ /"$/);
if (@arrData) {
if ($arrData[0] eq '#-#' && $arrData[$#arrData] eq '#-#') {
# This file is part of Koha.
#
+# Parts copyright 2011 Catalyst IT Ltd.
+#
# 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
use C4::Dates;
use C4::Debug;
-my $input = new CGI;
-my $title = $input->param( 'title');
-my $author = $input->param('author');
-my $name = $input->param( 'name' );
-my $from_placed_on = C4::Dates->new($input->param('from'));
-my $to_placed_on = C4::Dates->new($input->param( 'to'));
+my $input = new CGI;
+my $title = $input->param( 'title');
+my $author = $input->param('author');
+my $name = $input->param( 'name' );
+my $basket = $input->param( 'basket' );
+my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' );
+my $from_placed_on = C4::Dates->new($input->param('from')) if $input->param('from');
+my $to_placed_on = C4::Dates->new($input->param( 'to')) if $input->param('to');
my $dbh = C4::Context->dbh;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
$to_iso = C4::Dates->new($d)->output('iso');
}
-my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) =
- GetHistory( $title, $author, $name, $from_iso, $to_iso );
+my ( $order_loop, $total_qty, $total_price, $total_qtyreceived );
+# If we're supplied any value then we do a search. Otherwise we don't.
+my $do_search = $title || $author || $name || $basket || $booksellerinvoicenumber ||
+ $from_placed_on || $to_placed_on;
+if ($do_search) {
+ ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory(
+ title => $title,
+ author => $author,
+ name => $name,
+ from_placed_on => $from_iso,
+ to_placed_on => $to_iso,
+ basket => $basket,
+ booksellerinvoicenumber => $booksellerinvoicenumber,
+ );
+}
+
+my $from_date = $from_placed_on->output('syspref') if $from_placed_on;
+my $to_date = $to_placed_on->output('syspref') if $to_placed_on;
$template->param(
suggestions_loop => $order_loop,
total_qty => $total_qty,
total_qtyreceived => $total_qtyreceived,
total_price => sprintf( "%.2f", $total_price ),
- numresults => scalar(@$order_loop),
+ numresults => $order_loop ? scalar(@$order_loop) : undef,
title => $title,
author => $author,
name => $name,
- from_placed_on => $from_placed_on->output('syspref'),
- to_placed_on => $to_placed_on->output('syspref'),
+ basket => $basket,
+ booksellerinvoicenumber => $booksellerinvoicenumber,
+ from_placed_on => $from_date,
+ to_placed_on => $to_date,
DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(),
dateformat => C4::Dates->new()->format(),
debug => $debug || $input->param('debug') || 0,
size=\"67\"
maxlength=\"$max_length\"
\/>
- <a href=\"#\" class=\"buttonDot\"
- onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
+ <span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\"
+ onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
";
} else {
$subfield_data{marc_value} =
size=\"67\"
maxlength=\"$max_length\"
readonly=\"readonly\"
- \/><a href=\"#\" class=\"buttonDot\"
- onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
+ \/><span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\"
+ onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
";
}
# it's a plugin field
size=\"67\"
maxlength=\"$max_length\"
onblur=\"Blur$function_name($index_tag); \" \/>
- <a href=\"#\" class=\"buttonDot\" onclick=\"Clic$function_name('$subfield_data{id}'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
+ <span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\" onclick=\"Clic$function_name('$subfield_data{id}'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
$javascript";
} else {
warn "Plugin Failed: $plugin";
done
# Load the configfile given on the command line
-if [ -e "$configfile" ]
+if [ "$configfile" != "" ]
then
- . "$configfile"
-else
- die "$configfile does not exist.";
+ if [ -e "$configfile" ]
+ then
+ . "$configfile"
+ else
+ die "$configfile does not exist.";
+ fi
fi
# Make sure options from the command line get the highest precedence
July 25 2011 Koha 3.4.3 released releases
July 28 2011 John Seymour becomes the 147th developer to have a patch pushed
August 2 2011 General IRC meeting http://wiki.koha-community.org/wiki/General_IRC_Meeting,_2_August_2011
-August 3 2011 Speaking speaking community meeting http://wiki.koha-community.org/wiki/Spanish_speaking_community_Mail_List_IRC_Meeting,_3_August_2011
+August 3 2011 Spanish speaking community meeting http://wiki.koha-community.org/wiki/Spanish_speaking_community_Mail_List_IRC_Meeting,_3_August_2011
August 11 2011 Juan Romay Sieira becomes the 148th developer to have a patch pushed
August 11 2011 Nuño López Ansótegui becomes the 149th developer to have a patch pushed
+August 26 2011 Ward van Wanrooij becomes the 150th developer to have a patch pushed
+++ /dev/null
-
-<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1>
-<!-- Begin Acquisitions Resident Search Box -->
-<div id="header_search">
-<div id="supplier_search" class="residentsearch" style="display:none;">
- <p class="tip">Search vendors:</p>
- <form name="findsupplier" action="/cgi-bin/koha/acqui/booksellers.pl" method="post">
- <input type="text" size="25" name="supplier" id="supplier" class="focus" />
- <input type="submit" class="submit" value="Submit" /></form>
-</div>
- <div id="orders_search" class="residentsearch">
- <p class="tip">Search orders:</p>
-
- <form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
- <label for="title">Title: </label><input type="text" id="title" name="title" size="15" value="[% title %]" /> <label for="searchsupplier">Vendor:</label> <input type="text" id="searchsupplier" name="name" size="15" value="[% name %]" />
- <input value="Submit" class="submit" type="submit" /> <a href="/cgi-bin/koha/acqui/histsearch.pl">Advanced Search</a>
- </form>
- </div>
- <ul>
- <li><a href="/cgi-bin/koha/acqui/booksellers.pl#supplier_search">Vendor Search</a></li>
- <li class="ui-tabs-selected"><a href="/cgi-bin/koha/acqui/histsearch.pl#orders_search">Orders Search</a></li>
- </ul>
-</div>
-<!-- End Acquisitions Resident Search Box -->
<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
<label for="title">Title: </label><input type="text" id="title" name="title" size="15" value="[% title %]" /> <label for="searchsupplier">Vendor:</label> <input type="text" id="searchsupplier" name="name" size="15" value="[% name %]" />
+ <span class="filteraction" id="filteraction_off" style="display:none"> <a href="#" onclick="$('#filters').toggle();$('.filteraction').hide();">[-]</a></span>
+ <span class="filteraction" id="filteraction_on"> <a href="#" onclick="$('#filters').show();$('.filteraction').toggle();">[+]</a></span>
<input value="Submit" class="submit" type="submit" /> <a href="/cgi-bin/koha/acqui/histsearch.pl">Advanced Search</a>
+ <p id="filters" style="display:none">
+ <label for="basket">Basket: </label><input type="text" name="basket" id="basket">
+ <label for="booksellerinvoicenumber">Invoice No.: </label><input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber">
+ </p>
</form>
</div>
- <ul>
+ <ul id="tabtriggers">
<li><a href="/cgi-bin/koha/acqui/booksellers.pl#supplier_search">Vendor Search</a></li>
<li><a href="/cgi-bin/koha/acqui/histsearch.pl#orders_search">Orders Search</a></li>
</ul>
</head>
<body>
[% INCLUDE 'header.inc' %]
-[% INCLUDE 'acquisitions-history-search.inc' %]
+[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › [% IF ( suggestions_loop ) %]<a href="/cgi-bin/koha/acqui/histsearch.pl">Orders search</a> › Search Results[% ELSE %]Order search[% END %]</div>
<li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% title %]" /></li>
<li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% author %]" /></li>
<li><label for="name">Vendor: </label> <input type="text" name="name" id="name" value="[% name %]" /></li>
+ <li><label for="basket">Basket: </label> <input type="text" name="basket" id="basket" value="[% basket %]" /></li>
+ <li><label for="booksellerinvoicenumber ">Bookseller Invoice No: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% booksellerinvoicenumber %]" /></li>
<li><label for="from">From: </label>
<input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" />
<img src="[% themelang %]/lib/calendar/cal.gif" id="openCalendarFrom" style="cursor: pointer;" alt="Show Calendar" />
}
//]]>
</script>
+<style type="text/css">#enrolmentmessage.hint { display : none; }</style>
</head>
<body>
[% INCLUDE 'header.inc' %]
<li><span class="label">Category code</span>[% categorycode |html %]
<input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li>
[% ELSE %]
- <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
+ <li><label for="categorycode">Category code: </label> <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /></li>
[% END %]
- <li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
- <li><label for="enrolmentperiod">Enrollment period: </label>
- <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months <br />
- <label for="enrolmentperioddate">Until date: </label>
+ <li><label for="description">Description: </label> <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /></li>
+ <li><label for="enrolmentperiod">Enrollment period: </label>
+ <fieldset>
+ <legend>Choose one</legend>
+ <ol>
+ <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
+ <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
+ <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
<input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" /> <img src="[% themelang %]/lib/calendar/cal.gif" id="enrolmentperioddate_button" alt="Show Calendar" />
<script type="text/javascript">
//<![CDATA[
});
//]]>
</script>
- <div id="enrolmentmessage" class="hint">Cannot have "months" and "until date" at the same time</div>
+ <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
</li>
- <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
- <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
+ </ol>
+ </fieldset>
+ </li>
+ <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li>
+ <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li>
<li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li>
- <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
+ <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired">
[% IF ( overduenoticerequired ) %]
<option value="0">No</option>
<option value="1" selected="selected">Yes</option>
<option value="1">Yes</option>
[% END %]
</select></li>
- <li><label for="hidelostitems">Lost items in staff client</label> <select name="hidelostitems" id="hidelostitems">
+ <li><label for="hidelostitems">Lost items in staff client</label> <select name="hidelostitems" id="hidelostitems">
[% IF ( hidelostitems ) %]
<option value="0">Shown</option>
<option value="1" selected="selected">Hidden by default</option>
[% END %]
</select></li>
<li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
- <li><label for="category_type">Category type: </label> <select name="category_type" id="category_type">
+ <li><label for="category_type">Category type: </label> <select name="category_type" id="category_type">
[% IF ( type_n ) %]<option value="" selected="selected">Select a Category type</option>[% ELSE %]<option value="">Select a Category type</option>[% END %]
[% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
[% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
<a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a>
[% END %]
[% IF ( innerloo.repeatable ) %]
- <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Repeat this Tag">+</a>
+ <span class="subfield_controls"><a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Repeat this Tag"><img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" /></a>
[% END %]
- <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag">−</a>
+ <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag"><img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" /></a></span>
+
</div>
[% INCLUDE 'help-top.inc' %]
<h1>Notices</h1>
+All notices sent by Koha can be customized using the Notices Tool. The system comes with several predefined templates that will appear when you first visit the Notices Tool
-<p>Notices are messages sent to patrons, vendors and staff to notify them at key times.</p>
-<h2>Add a new notice</h2>
- <ul>
- <li>Click 'New Notice'</li>
- <li>Choose a 'Koha Module' to associate your notice with from the dropdown box</li>
- <li>Enter a 'Code' abbreviation for your new notice (for example: 'ODUE' for Overdue Notice)</li>
- <li>Enter a 'Name' for your new notice (for example 'Overdue Notice')</li>
- <li>Enter a 'Message Subject' (for example 'Item Overdue')</li>
- <li>Design your 'Message Body'</li>
- </ul>
- <ul>
- <li>
- <ul>
- <li>Choose a field from the scroll down menu on the left side
- <ul>
- <li>
- <span style="background-color: #ffe599">
-TIP: For help with what each field is, see the Notices: Database Fields section of this manual</span></li>
- </ul></li>
- <li>Click the '>>' button to insert that field into your text message where you'd like it to appear in the notice.</li>
- <li>Continue adding 'field's and clicking '>>' to insert them into the notice until your message is completed.</li>
- <li>Then, click 'Submit'</li>
- </ul></li>
- <li>
- <span style="color: #ff0000">
-IMPORTANT: Currently, Koha can not reference multiple biblios in a single notice (in other words--in the example below-- there is not just ONE email sent that describes ALL currently overdue items, but an email sent for EACH overdue item) </span></li>
- </ul><h3>
- How do I schedule overdue notices?</h3>To schedule overdue notices, you must use Koha's 'Notice/Status Trigger' tool.<br/>
- <ul>
- <li><em>Get there:</em> More > Tools > Overdue notice/status triggers</li>
- </ul> [% INCLUDE 'help-bottom.inc' %]
\ No newline at end of file
+Each notice can be edited, but only a few can be deleted, this is to prevent system errors should a message try to send without a template.
+<h2>Adding Notices</h2>
+<ul>
+ <li>To add a new notice
+<ul>
+ <li>Click 'New Notice'</li>
+ <li>Choose the module this notice is related to</li>
+ <li>The Code is limited to 20 characters</li>
+ <li>Use the name field to expand on your Code</li>
+ <li>Message Subject is what will appear in the subject line of the email</li>
+ <li>In the message body feel free to type whatever message you feel is best, use the fields on the left hand side to enter individualized data from the from database.
+<ul>
+ <li style="color: #ff0000;">Important: On overdue notices make sure to use <<items.content>> to print out the data related to all items that are overdue. The other option is to use the <item></item> tags to span the line so that it will print out multiple lines</li>
+ <li style="color: #ff0000;">Important: Only the overdue notices take advantage of the <item></item> tags, all other notices referencing items need to use <<items.content>></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+<h3>Notice Markup</h3>
+When creating your overdue notices there are two tags in addition to the various database fields that you can use in your notices.
+<p style="color: #ff0000;">Important: These new tags only work on the overdue notices, not other circulation related notices at this time.</p>
+
+<ul>
+ <li><item></item> which should enclose all fields from the biblio, biblioitems, and items tables.</li>
+ <li><fine></fine> which should be enclosed by the item tag and should enclose a currency identifier per ISO 4217. If this tag is present with a proper identifier, the fine for that item will be displayed in the proper currency format.
+<ul>
+ <li>Note: ISO 4217 changes from time to time therefore all currencies may not be supported. If you find one that is not supported, please file a bug with the Locale::Currency::Format author Tan D Nguyen <tnguyen at cpan doe org>.</li>
+</ul>
+</li>
+</ul>
+An example of using these two tags in a notice template might be like:
+<pre>The following item(s) is/are currently overdue:
+
+ <item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <fine>GBP</fine></item></pre>
+Which, assuming two items were overdue, would result in a notice like:
+<pre>The following item(s) is/are currently overdue:
+
+ "A Short History of Western Civilization" by Harrison, John B, 909.09821 H2451, Barcode: 08030003 Fine: £3.50
+ "History of Western Civilization" by Hayes, Carlton Joseph Huntley, 909.09821 H3261 v.1, Barcode: 08030004 Fine: £3.50</pre>
+<h2>Existing Notices</h2>
+Among the default notices are notices for several common actions within Koha, here are some of what those notices do
+<ul>
+ <li>ACCTDETAILS
+<ul>
+ <li>Sent to patrons when their account is set up if the AutoEmailOPACUser preference is set to 'Send'</li>
+</ul>
+</li>
+ <li>ACQCLAIM (Acquisition Claim)
+<ul>
+ <li>Used in the claim acquisition module</li>
+ <li>Get there: More > Acquisitions > Late issues</li>
+</ul>
+</li>
+ <li>HOLD (Hold Available for Pickup)
+<ul>
+ <li>This notice is used if two criteria are met:
+<ul>
+ <li>The EnhancedMessagingPreferences is set to 'Allow'</li>
+ <li>The patron has requested to receive this notice
+<ul>
+ <li>Get there: OPAC > Login > my messaging</li>
+ <li>Get there: Staff Client > Patron Record > Messaging</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+ <li>HOLDPLACED (a notice to the library staff that a hold has been placed)
+<ul>
+ <li>This notice requires the emailLibrarianWhenHoldIsPlaced system preference to be set to 'Enable'</li>
+</ul>
+</li>
+ <li>HOLD_PRINT (Printed notice when hold available for pickup)
+<ul>
+ <li>This notice is used for hold confirmation notices that are sent out in print format. This will not effect what the email notice looks like.</li>
+</ul>
+</li>
+ <li>ODUE (Overdue Notice)
+<ul>
+ <li>This notice is used to send Overdue Notices to Patrons</li>
+ <li>See a Sample Overdue Notice</li>
+ <li>Requires that you set Overdue Notice/Status Triggers</li>
+</ul>
+</li>
+ <li>RLIST (Routing List)
+<ul>
+ <li>Used in the serials module to notify patrons/staff of new issues of a serial
+<ul>
+ <li>Get there: More > Serials > New Subscription</li>
+</ul>
+</li>
+ <li>You have the option to select the 'Routing List' notice when creating a new subscription (Choose from the 'Patron notification' drop down).</li>
+ <li style="background-color: #ffe599;">Tip: Notice also that if you'd like to notify patrons of new serial issues, you can click on 'define a notice' which will take you to the 'Notices' tool</li>
+</ul>
+</li>
+</ul>
+[% INCLUDE 'help-bottom.inc' %]
\ No newline at end of file
function setStatus(serialid){
$("#status"+serialid).val("2").attr("selected","selected");
}
-function changeDate(adate) {
- var elem = document.getElementById("expecteddate");
- elem.value = adate;
+function changeDate(elem, adate) {
+ $(elem).closest('tr').find('#expecteddate').val(adate);
}
function changeDate2(adate) {
var elem = document.getElementById("supexpecteddate");
<select name="status" size="1" disabled="disabled">
[% ELSE %]
[% IF ( serialslis.serialsadditems ) %]
- <select name="status" size="1" id="status[% serialslis.serialid %]" onchange="if (this.value==2){unHideItems('items'+[% serialslis.subscriptionid %][% serialslis.serialid %],'label[% serialslis.subscriptionid %][% serialslis.serialid %]','[% serialslis.serialid %]'); changeDate('[% serialslis.arriveddate %]')} else if (this.value==7){changeDate('[% serialslis.arriveddate %]')} else { HideItems('items'+[% serialslis.subscriptionid %]+[% serialslis.serialid %],'label[% serialslis.subscriptionid %][% serialslis.serialid %]'); changeDate('[% serialslis.planneddate %]')}" >
+ <select name="status" size="1" id="status[% serialslis.serialid %]" onchange="if (this.value==2){unHideItems('items'+[% serialslis.subscriptionid %][% serialslis.serialid %],'label[% serialslis.subscriptionid %][% serialslis.serialid %]','[% serialslis.serialid %]'); changeDate(this, '[% serialslis.arriveddate %]')} else if (this.value==7){changeDate(this, '[% serialslis.arriveddate %]')} else { HideItems('items'+[% serialslis.subscriptionid %]+[% serialslis.serialid %],'label[% serialslis.subscriptionid %][% serialslis.serialid %]'); changeDate(this, '[% serialslis.planneddate %]')}" >
[% ELSE %]
- <select name="status" size="1" id="status[% serialslis.serialid %]" onchange="if (this.value==2 || this.value==7){changeDate('[% serialslis.arriveddate %]')} else {changeDate('[% serialslis.planneddate %]')}" >
+ <select name="status" size="1" id="status[% serialslis.serialid %]" onchange="if (this.value==2 || this.value==7){changeDate(this, '[% serialslis.arriveddate %]')} else {changeDate(this, '[% serialslis.planneddate %]')}" >
[% END %]
[% END %]
[% IF ( serialslis.status1 ) %]
<div id="privateshelves" class="ui-tabs-panel" style="display:none;">
[% END %]
[% IF ( shelveslooppriv ) %]
- [% pagination_bar %]
+ <div class="pages">[% pagination_bar %]</div>
<table>
<tr><th>List Name</th><th>Contents</th><th>Sort by</th><th>Type</th><th>Options</th></tr>
[% FOREACH shelveslooppri IN shelveslooppriv %]
<div id="publicshelves" class="ui-tabs-panel" style="display:none;">
[% END %]
[% IF ( shelvesloop ) %]
- [% pagination_bar %]
+ <div class="pages">[% pagination_bar %]</div>
<table>
<tr><th>List Name</th><th>Contents</th><th>Sort By</th><th>Type</th><th>Options</th></tr>
[% FOREACH shelvesloo IN shelvesloop %]
if ($type eq 'DATE' || $type eq 'DATETIME'){
$tmp_hash{'date'}=1;
}
- if ($type eq 'TEXT'){
+ if ($type eq 'TEXT' || $type eq 'MEDIUMTEXT'){
$tmp_hash{'text'}=1;
}
# else {
my $date = C4::Dates->today('iso');
my $action = $input->param('action');
+$action ||= q{};
if ( $action eq 'move' ) {
my $where = $input->param('where');
ethnicity
issues
issuingrules
- labels
- labels_profile
matchchecks
notifys
nozebra
is in the skeleton database. free to use this one, or insert your
own.
-=cut
-
sub startup_22_add_bookfund : Test(startup => 2) {
my $self = shift;
return;
}
+=cut
+
=head2 startup_24_add_branch
=cut
use Test::More;
use C4::Acquisition;
+use C4::Budgets;
use C4::Context;
use C4::Members;
use Time::localtime;
GetOrder
NewOrder
ModOrder
- ModOrderBiblioNumber
ModReceiveOrder
SearchOrder
DelOrder
$self->add_biblios( add_items => 1 );
ok( scalar @{$self->{'biblios'}} > 0, 'we have added at least one biblio' );
- my ( $basketno, $ordernumber ) = NewOrder( undef, # $basketno,
- $self->{'biblios'}[0], # $bibnum,
- undef, # $title,
- 1, # $quantity,
- undef, # $listprice,
- $self->{'booksellerid'}, # $booksellerid,
- $param{'authorizedby'}, # $authorisedby,
- undef, # $notes,
- $self->{'bookfundid'}, # $bookfund,
- undef, # $bibitemnum,
- 1, # $rrp,
- 1, # $ecost,
- undef, # $gst,
- undef, # $budget,
- undef, # $cost,
- undef, # $sub,
- $param{'invoice'}, # $invoice,
- undef, # $sort1,
- undef, # $sort2,
- undef, # $purchaseorder
- );
+ my $rand = int(rand(10000));
+ my $basketno = NewBasket( $self->{'booksellerid'}, $param{'authorizedby'}, "Basket $rand");
+# $basketnote, $basketbooksellernote, $basketcontractnumber );
+# The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "biblioitemnumber", "rrp", "ecost", "gst", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "bookfundid".
+ my $budget_id = AddBudget( { budget_name => "Budget $rand" } );
+ my ( undef, $ordernumber ) = NewOrder( {
+ basketno => $basketno,
+ budget_id => $budget_id,
+ biblionumber => $self->{'biblios'}[0],
+ quantity => 1,
+ bookfundid => $self->{'bookfundid'},
+ rrp => 1,
+ ecost => 1,
+ booksellerinvoicenumber => $param{'invoice'},
+ } );
ok( $basketno, "my basket number is $basketno" );
ok( $ordernumber, "my order number is $ordernumber" );
=cut
-sub one_order : Test( 50 ) {
+my $INVOICE = "1234-56 AB";
+sub one_order : Test( 55 ) {
my $self = shift;
- my ( $basketno, $ordernumber ) = $self->create_new_basket();
+ my ( $basketno, $ordernumber ) = $self->create_new_basket(invoice => $INVOICE);
ok( $basketno, "basketno is $basketno" );
ok( $ordernumber, "ordernumber is $ordernumber" );
# No arguments fetches no history.
{
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory();
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = eval { GetHistory() };
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
- is( scalar @$order_loop, 0, 'order_loop is empty' );
- is( $total_qty, 0, 'total_qty' );
- is( $total_price, 0, 'total_price' );
- is( $total_qtyreceived, 0, 'total_qtyreceived' );
+ is( $order_loop, undef, 'order_loop is empty' );
}
my $bibliodata = GetBiblioData( $self->{'biblios'}[0] );
# searching by title should find it.
{
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( $bibliodata->{'title'} );
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( title => $bibliodata->{'title'} );
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
is( scalar @$order_loop, 1, 'order_loop searched by title' );
# diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) );
}
+ # searching by basket number
+ {
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( basket => $basketno );
+ # diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
+
+ is( scalar @$order_loop, 1, 'order_loop searched by basket no' );
+ is( $total_qty, 1, 'total_qty searched by basket no' );
+ is( $total_price, 1, 'total_price searched by basket no' );
+ is( $total_qtyreceived, 0, 'total_qtyreceived searched by basket no' );
+
+ # diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) );
+ }
+
+ # searching by invoice number
+ {
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( booksellerinvoicenumber => $INVOICE );
+ # diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
+
+ is( scalar @$order_loop, 1, 'order_loop searched by invoice no' );
+ is( $total_qty, 1, 'total_qty searched by invoice no' );
+ is( $total_price, 1, 'total_price searched by invoice no' );
+ is( $total_qtyreceived, 0, 'total_qtyreceived searched by invoice no' );
+
+ # diag( Data::Dumper->Dump( [ $order_loop ], [ 'order_loop' ] ) );
+ }
+
# searching by author
{
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, $bibliodata->{'author'} );
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( author => $bibliodata->{'author'} );
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
is( scalar @$order_loop, 1, 'order_loop searched by author' );
ok( $bookseller->{'name'}, 'bookseller name' )
or diag( Data::Dumper->Dump( [ $bookseller ], [ 'bookseller' ] ) );
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, undef, $bookseller->{'name'} );
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( name => $bookseller->{'name'} );
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
is( scalar @$order_loop, 1, 'order_loop searched by name' );
my $tomorrow = $self->tomorrow();
# diag( "tomorrow is $tomorrow" );
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, undef, undef, undef, $tomorrow );
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( to_placed_on => $tomorrow );
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
is( scalar @$order_loop, 1, 'order_loop searched by to_date' );
my $yesterday = $self->yesterday();
# diag( "yesterday was $yesterday" );
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( undef, undef, undef, $yesterday );
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( from_placed_on => $yesterday );
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
is( scalar @$order_loop, 1, 'order_loop searched by from_date' );
# just search by title here, we need to search by something.
{
- my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( $bibliodata->{'title'} );
+ my ( $order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( title => $bibliodata->{'title'} );
# diag( Data::Dumper->Dump( [ $order_loop, $total_qty, $total_price, $total_qtyreceived ], [ qw( order_loop total_qty total_price total_qtyreceived ) ] ) );
is( scalar @$order_loop, 1, 'order_loop searched by title' );