koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha C4/Koha.pm C4/Overdues.pm circ/branchoverd...


From: paul poulain
Subject: [Koha-cvs] koha C4/Koha.pm C4/Overdues.pm circ/branchoverd...
Date: Wed, 18 Apr 2007 14:20:55 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     paul poulain <tipaul>   07/04/18 14:20:55

Modified files:
        C4             : Koha.pm Overdues.pm 
        circ           : branchoverdues.pl 
        koha-tmpl/intranet-tmpl/prog/en/circ: branchoverdues.tmpl 

Log message:
        removing "department" and replacing by items.location

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Overdues.pm?cvsroot=koha&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/koha/circ/branchoverdues.pl?cvsroot=koha&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl?cvsroot=koha&r1=1.5&r2=1.6

Patches:
Index: C4/Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- C4/Koha.pm  18 Mar 2007 03:50:15 -0000      1.50
+++ C4/Koha.pm  18 Apr 2007 14:20:54 -0000      1.51
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Koha.pm,v 1.50 2007/03/18 03:50:15 kados Exp $
+# $Id: Koha.pm,v 1.51 2007/04/18 14:20:54 tipaul Exp $
 
 use strict;
 require Exporter;
@@ -25,7 +25,7 @@
 use C4::Output;
 use vars qw($VERSION @ISA @EXPORT);
 
-$VERSION = do { my @v = '$Revision: 1.50 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.51 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -70,8 +70,6 @@
   &getitemtypeimagesrcfromurl
   &get_infos_of
   &get_notforloan_label_of
-  &GetDepartments
-  &GetDepartmentLib
   &getitemtypeimagedir
   &getitemtypeimagesrc
   &GetAuthorisedValues
@@ -1090,36 +1088,6 @@
     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);

Index: C4/Overdues.pm
===================================================================
RCS file: /sources/koha/koha/C4/Overdues.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- C4/Overdues.pm      17 Apr 2007 08:48:00 -0000      1.2
+++ C4/Overdues.pm      18 Apr 2007 14:20:54 -0000      1.3
@@ -1,6 +1,6 @@
 package C4::Overdues;
 
-# $Id: Overdues.pm,v 1.2 2007/04/17 08:48:00 tipaul Exp $
+# $Id: Overdues.pm,v 1.3 2007/04/18 14:20:54 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -29,7 +29,7 @@
 use C4::Log; # logaction
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.2 $' =~ /\d+/g; 
+$VERSION = do { my @v = '$Revision: 1.3 $' =~ /\d+/g; 
 shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -1131,14 +1131,14 @@
 =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 @@
              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 ) {

Index: circ/branchoverdues.pl
===================================================================
RCS file: /sources/koha/koha/circ/branchoverdues.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- circ/branchoverdues.pl      4 Apr 2007 16:46:23 -0000       1.5
+++ circ/branchoverdues.pl      18 Apr 2007 14:20:54 -0000      1.6
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: branchoverdues.pl,v 1.5 2007/04/04 16:46:23 tipaul Exp $
+# $Id: branchoverdues.pl,v 1.6 2007/04/18 14:20:54 tipaul Exp $
 #
 # This file is part of Koha.
 #
@@ -24,7 +24,8 @@
 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 @@
 =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 @@
 =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 $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 @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,
-    );
+# 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);
 }
-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 => address@hidden, );
-}
-
 # now display infos
 foreach my $num (@getoverdues) {
 
@@ -165,6 +153,7 @@
 $template->param(
     overduesloop => address@hidden,
     show_date    => format_date($todaysdate),
+    location     => $location,
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;

Index: koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl    11 Mar 2007 
21:08:12 -0000      1.5
+++ koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl    18 Apr 2007 
14:20:54 -0000      1.6
@@ -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" -->
+<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="department" class="button" value="change 
department">
-        </form>
-    </li>
-</ul>
+    <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,21 +106,20 @@
             <!-- /TMPL_LOOP -->
         </table>
     <!-- TMPL_ELSE -->
-        There are no overdues for your library today
+        There is no overdue for today
     <!-- /TMPL_IF -->
-    </fieldset>
-<!-- TMPL_IF name="todayoverduesloop" -->
+    <!-- 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>                        
+                <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>
@@ -170,12 +161,12 @@
                     </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>
+                        <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 -->
+    <!-- /TMPL_IF -->
 </div>
 <!-- TMPL_INCLUDE name="intranet-bottom.inc" -->




reply via email to

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