Browse Source

removing "department" and replacing by items.location

3.0.x
tipaul 17 years ago
parent
commit
5af8ae975b
  1. 32
      C4/Koha.pm
  2. 8
      C4/Overdues.pm
  3. 39
      circ/branchoverdues.pl
  4. 189
      koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl

32
C4/Koha.pm

@ -70,8 +70,6 @@ Koha.pm provides many functions for Koha scripts.
&getitemtypeimagesrcfromurl
&get_infos_of
&get_notforloan_label_of
&GetDepartments
&GetDepartmentLib
&getitemtypeimagedir
&getitemtypeimagesrc
&GetAuthorisedValues
@ -1090,36 +1088,6 @@ sub displaySecondaryServers {
return; #$secondary_servers_loop;
}
sub GetDepartments {
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
"SELECT authorised_value,lib FROM authorised_values WHERE category='DPT'
"
);
$sth->execute;
my @getdepartments;
my $i = 0;
while ( my $data = $sth->fetchrow_hashref ) {
$getdepartments[$i] = $data;
$i++;
}
$sth->finish;
return (@getdepartments);
}
sub GetDepartmentLib {
my ($authorisedvalue) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
"SELECT lib,authorised_value FROM authorised_values WHERE category='DPT' AND authorised_value=?
"
);
$sth->execute($authorisedvalue);
my (@lib) = $sth->fetchrow_array;
$sth->finish;
return (@lib);
}
=head2 GetAuthorisedValues
$authvalues = GetAuthorisedValues($category);

8
C4/Overdues.pm

@ -1131,14 +1131,14 @@ return ($notified);
=head2 GetOverduesForBranch
Sql request for display all information for branchoverdues.pl
2 possibilities : with or without department .
2 possibilities : with or without location .
display is filtered by branch
=cut
sub GetOverduesForBranch {
my ( $branch, $department) = @_;
if ( not $department ) {
my ( $branch, $location) = @_;
if ( not $location ) {
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("
SELECT
@ -1229,7 +1229,7 @@ sub GetOverduesForBranch {
AND (issues.date_due <= NOW())
ORDER BY borrowers.surname
" );
$sth->execute( $branch, $department);
$sth->execute( $branch, $location);
my @getoverdues;
my $i = 0;
while ( my $data = $sth->fetchrow_hashref ) {

39
circ/branchoverdues.pl

@ -24,7 +24,8 @@ use C4::Interface::CGI::Output;
use C4::Auth;
use C4::Date;
use C4::Overdues; # AddNotifyLine
use C4::Koha; # GetDepartment...
use C4::Biblio;
use C4::Koha;
use Mail::Sendmail;
use Getopt::Long;
use Date::Calc qw/Today Today_and_Now Now/;
@ -32,7 +33,7 @@ use Date::Calc qw/Today Today_and_Now Now/;
=head1 branchoverdues.pl
this module is a new interface, allow to the librarian to check all items on overdues (based on the acountlines type 'FU' )
this interface is filtered by branches (automaticly), and by department (optional) ....
this interface is filtered by branches (automaticly), and by location (optional) ....
all informations are stocked in the notifys BDD
FIXME for this time, we have only four methods to notify :
@ -55,6 +56,8 @@ use Date::Calc qw/Today Today_and_Now Now/;
=cut
my $input = new CGI;
my $dbh = C4::Context->dbh;
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@ -80,7 +83,7 @@ my $itemnumber = $input->param('itemnumber');
my $method = $input->param('method');
my $overduelevel = $input->param('overduelevel');
my $notifyId = $input->param('notifyId');
my $department = $input->param('department');
my $location = $input->param('location');
# now create the line in bdd (notifys)
if ( $input->param('action') eq 'add' ) {
@ -100,30 +103,15 @@ my @overduesloop;
my @todayoverduesloop;
my $counter = 0;
my @getoverdues = GetOverduesForBranch( $default, $department );
my @getoverdues = GetOverduesForBranch( $default, $location );
# filter by department
if ($department) {
my ( $departmentlib, $departmentValue ) = GetDepartmentLib($department);
$template->param(
department => $departmentlib,
departmentValue => $departmentValue,
);
}
else {
# initiate the selector of departments .....
my @getdepartments = GetDepartments();
my @departmentsloop;
foreach my $dpt (@getdepartments) {
my %department;
$department{'authorised_value'} = $dpt->{'authorised_value'};
$department{'lib'} = $dpt->{'lib'};
push( @departmentsloop, \%department );
}
$template->param( departmentsloop => \@departmentsloop, );
# search for location authorised value
my ($tag,$subfield) = GetMarcFromKohaField($dbh,'items.location','');
my $tagslib = &GetMarcStructure($dbh,1,'');
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
my $values= GetAuthorisedValues($tagslib->{$tag}->{$subfield}->{authorised_value});
$template->param(locationsloop => $values);
}
# now display infos
foreach my $num (@getoverdues) {
@ -165,6 +153,7 @@ foreach my $num (@getoverdues) {
$template->param(
overduesloop => \@overduesloop,
show_date => format_date($todaysdate),
location => $location,
);
output_html_with_http_headers $input, $cookie, $template->output;

189
koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl

@ -4,51 +4,43 @@
<!-- TMPL_INCLUDE NAME="menus.inc" -->
<!-- TMPL_INCLUDE NAME="menu-circ.inc" -->
<h1>Circulation: Branch Overdues</h1>
<h1>Circulation: Branch Overdues at <!-- TMPL_VAR NAME="LoginBranchname" --></h1>
<div id="mainbloc">
<!-- selector of department -->
<fieldset id="branch_odues_select_department">
<!-- TMPL_IF NAME="department" -->
<legend>department selected</legend>
<form name="changedepartment" action="branchoverdues.pl">
<!-- selector of location -->
<!-- TMPL_IF NAME="location" -->
<legend>location selected</legend>
<form name="changelocation" action="branchoverdues.pl">
<ul>
<li>
You are working actually on the overdues for the department : <b><!-- TMPL_VAR NAME="department" --></b>
<input type="submit" name="changedepartment" class="button" value="change department">
You are working actually on the overdues for the location : <b><!-- TMPL_VAR NAME="location" --></b>
<input type="submit" name="changelocation" class="button" value="change location">
</li>
</ul>
</form>
<!-- TMPL_ELSE -->
<legend>Select your department</legend>
<ul>
<li>
<form name="selectdepartment" action="branchoverdues.pl" method="post">
<select id="department" name="department">
<option value="">All departments</option>
<!-- TMPL_LOOP NAME="departmentsloop" -->
<option value="<!-- TMPL_VAR NAME="authorised_value" -->"><!-- TMPL_VAR NAME="lib" --></option>
<!-- /TMPL_LOOP -->
</select>
<input type="submit" name="department" class="button" value="change department">
</form>
</li>
</ul>
<p>Select a location
<form name="selectlocation" action="branchoverdues.pl" method="post">
<select id="location" name="location">
<option value="">All locations</option>
<!-- TMPL_LOOP NAME="locationsloop" -->
<option value="<!-- TMPL_VAR NAME="authorised_value" -->"><!-- TMPL_VAR NAME="lib" --></option>
<!-- /TMPL_LOOP -->
</select>
<input type="submit" name="location" class="button" value="OK">
</form>
</p>
<!-- /TMPL_IF -->
</fieldset>
<fieldset id="branch_odues_global_odues">
<legend>Overdues at <!-- TMPL_VAR NAME="LoginBranchname" --></legend>
<form name="sendnotify" action="branchoverdues.pl" method="post">
<!-- TMPL_IF name="overduesloop" -->
<table>
<tr>
<th class="circulation">Date_due</th>
<th class="circulation">Title</th>
<th class="circulation">Borrower</th>
<th class="circulation">Localisation</th>
<th class="circulation">Overdue status</th>
<th class="circulation">Notify by</th>
<th>Date_due</th>
<th>Title</th>
<th>Borrower</th>
<th>Location</th>
<th>Overdue status</th>
<th>Notify by</th>
</tr>
<!-- TMPL_LOOP NAME="overduesloop" -->
<tr>
@ -88,24 +80,24 @@
<td align="center">
<!-- TMPL_IF NAME="overdue1" -->
<!-- TMPL_IF NAME="borroweremail" -->
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=mail&department=<!-- TMPL_VAR NAME="departmentValue" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->&notifyId=<!-- TMPL_VAR NAME="notify_id" -->">mail</a>
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=mail&location=<!-- TMPL_VAR NAME="location" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->&notifyId=<!-- TMPL_VAR NAME="notify_id" -->">mail</a>
<!-- TMPL_ELSE -->
mail
<!-- /TMPL_IF -->
&nbsp;|&nbsp;
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=phone&department=<!-- TMPL_VAR NAME="departmentValue" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->&notifyId=<!-- TMPL_VAR NAME="notify_id" -->
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=phone&location=<!-- TMPL_VAR NAME="location" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->&notifyId=<!-- TMPL_VAR NAME="notify_id" -->
">phone</a>
&nbsp;|&nbsp;
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=letter&department=<!-- TMPL_VAR NAME="departmentValue" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=letter&location=<!-- TMPL_VAR NAME="location" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->
&notifyId=<!-- TMPL_VAR NAME="notify_id" -->">letter</a>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="overdue2" -->
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=letter&department=<!-- TMPL_VAR NAME="departmentValue" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->&notifyId=<!-- TMPL_VAR NAME="notify_id" -->">letter</a>
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=letter&location=<!-- TMPL_VAR NAME="location" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->&notifyId=<!-- TMPL_VAR NAME="notify_id" -->">letter</a>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="overdue3" -->
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=lost&department=<!-- TMPL_VAR NAME="departmentValue" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->
<a href="branchoverdues.pl?action=add&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=lost&location=<!-- TMPL_VAR NAME="location" -->&overduelevel=<!-- TMPL_VAR NAME="overdueLevel" -->
&notifyId=<!-- TMPL_VAR NAME="notify_id" -->">Considered lost</a>
<!-- /TMPL_IF -->
@ -114,68 +106,67 @@
<!-- /TMPL_LOOP -->
</table>
<!-- TMPL_ELSE -->
There are no overdues for your library today
There is no overdue for today
<!-- /TMPL_IF -->
<!-- TMPL_IF name="todayoverduesloop" -->
<fieldset id="branch_odues_today_odues">
<legend>Today's notifications</legend>
<table>
<tr>
<th>Date_due</th>
<th>Title</th>
<th>Borrower</th>
<th>Localisation</th>
<th>Overdue status</th>
<th>Notified by</th>
<th>Cancel</th>
</tr>
<!-- TMPL_LOOP NAME="todayoverduesloop" -->
<tr>
<td>
<p>
<!-- TMPL_VAR NAME="date_due" -->
</p>
</td>
<td>
<p>
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a>
&nbsp; (<b><!-- TMPL_VAR NAME="description" --></b>)
<br />Barcode : <!-- TMPL_VAR NAME="barcode" -->
</p>
</td>
<td>
<p><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="borrowernumber"-->"><!-- TMPL_VAR NAME="borrowersurname" --> &nbsp; <!-- TMPL_VAR NAME="borrowerfirstname" --></a><br /><!-- TMPL_VAR NAME="borrowerphone" --><br />
<!-- TMPL_IF NAME="borroweremail" --><a href="mailto:<!-- TMPL_VAR NAME="borroweremail" -->?subject=Overdue: <!-- TMPL_VAR NAME="title" -->">
<!-- TMPL_VAR NAME="borroweremail" --></a><!--/TMPL_IF-->
</p>
</td>
<td><p><!-- TMPL_VAR NAME="homebranch" --> <!-- TMPL_VAR NAME="itemcallnumber" --></p>
</td>
<td align="center">
<b>
<!-- TMPL_IF NAME="overdue1" -->
first overdue
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="overdue2" -->
second overdue
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="overdue3" -->
considered lost
<!-- /TMPL_IF -->
</b>
</td>
<td align="center">
<b><!-- TMPL_VAR NAME="notify_method" --></b>
</td>
<td>
<a href="branchoverdues.pl?action=remove&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=phone&location=<!-- TMPL_VAR NAME="location" -->&notify_date=<!-- TMPL_VAR NAME="notify_date" -->">cancel notification</a>
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
</fieldset>
<!-- /TMPL_IF -->
</fieldset>
<!-- TMPL_IF name="todayoverduesloop" -->
<fieldset id="branch_odues_today_odues">
<legend>Today's notifications</legend>
<table>
<tr>
<th class="circulation">Date_due</th>
<th class="circulation">Title</th>
<th class="circulation">Borrower</th>
<th class="circulation">Localisation</th>
<th class="circulation">Overdue status</th>
<th class="circulation">Notified by</th>
<th class="circulation">Cancel</th>
</tr>
<!-- TMPL_LOOP NAME="todayoverduesloop" -->
<tr>
<td>
<p>
<!-- TMPL_VAR NAME="date_due" -->
</p>
</td>
<td>
<p>
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a>
&nbsp; (<b><!-- TMPL_VAR NAME="description" --></b>)
<br />Barcode : <!-- TMPL_VAR NAME="barcode" -->
</p>
</td>
<td>
<p><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="borrowernumber"-->"><!-- TMPL_VAR NAME="borrowersurname" --> &nbsp; <!-- TMPL_VAR NAME="borrowerfirstname" --></a><br /><!-- TMPL_VAR NAME="borrowerphone" --><br />
<!-- TMPL_IF NAME="borroweremail" --><a href="mailto:<!-- TMPL_VAR NAME="borroweremail" -->?subject=Overdue: <!-- TMPL_VAR NAME="title" -->">
<!-- TMPL_VAR NAME="borroweremail" --></a><!--/TMPL_IF-->
</p>
</td>
<td><p><!-- TMPL_VAR NAME="homebranch" --> <!-- TMPL_VAR NAME="itemcallnumber" --></p>
</td>
<td align="center">
<b>
<!-- TMPL_IF NAME="overdue1" -->
first overdue
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="overdue2" -->
second overdue
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="overdue3" -->
considered lost
<!-- /TMPL_IF -->
</b>
</td>
<td align="center">
<b><!-- TMPL_VAR NAME="notify_method" --></b>
</td>
<td>
<a href="branchoverdues.pl?action=remove&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber"-->&itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->&method=phone&department=<!-- TMPL_VAR NAME="departmentValue" -->&notify_date=<!-- TMPL_VAR NAME="notify_date" -->">cancel notification</a>
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
</fieldset>
<!-- /TMPL_IF -->
</div>
<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->

Loading…
Cancel
Save