From 5af8ae975b102531ea0de1576848655a23dcc342 Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 18 Apr 2007 14:20:54 +0000 Subject: [PATCH] removing "department" and replacing by items.location --- C4/Koha.pm | 32 --- C4/Overdues.pm | 8 +- circ/branchoverdues.pl | 39 ++-- .../prog/en/circ/branchoverdues.tmpl | 189 +++++++++--------- 4 files changed, 108 insertions(+), 160 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index aa9761ca40..4511c464ab 100644 --- a/C4/Koha.pm +++ b/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); diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 226ec8e9f6..27fb39c6bd 100644 --- a/C4/Overdues.pm +++ b/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 ) { diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index 2519389e73..cc2ff76abb 100755 --- a/circ/branchoverdues.pl +++ b/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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl b/koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl index afc9f24f64..982ee90998 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/circ/branchoverdues.tmpl @@ -4,51 +4,43 @@ -

Circulation: Branch Overdues

+

Circulation: Branch Overdues at

- -
- -department selected -
+ + +location selected +
  • - You are working actually on the overdues for the department : - + You are working actually on the overdues for the location : +
-Select your department -
    -
  • -
    - - -
    -
  • -
+

Select a location +

+ + +
+

-
- -
- Overdues at
- - - - - - + + + + + + @@ -88,24 +80,24 @@
Date_dueTitleBorrowerLocalisationOverdue statusNotify byDate_dueTitleBorrowerLocationOverdue statusNotify by
- &itemnumber=&method=mail&department=&overduelevel=¬ifyId=">mail + &itemnumber=&method=mail&location=&overduelevel=¬ifyId=">mail mail  |  - &itemnumber=&method=phone&department=&overduelevel=¬ifyId= + &itemnumber=&method=phone&location=&overduelevel=¬ifyId= ">phone  |  - &itemnumber=&method=letter&department=&overduelevel= + &itemnumber=&method=letter&location=&overduelevel= ¬ifyId=">letter - &itemnumber=&method=letter&department=&overduelevel=¬ifyId=">letter + &itemnumber=&method=letter&location=&overduelevel=¬ifyId=">letter - &itemnumber=&method=lost&department=&overduelevel= + &itemnumber=&method=lost&location=&overduelevel= ¬ifyId=">Considered lost @@ -114,68 +106,67 @@
- There are no overdues for your library today + There is no overdue for today + + +
+ Today's notifications + + + + + + + + + + + + + + + + + + + + + + +
Date_dueTitleBorrowerLocalisationOverdue statusNotified byCancel
+

+ +

+
+

+ "> +   () +
Barcode : +

+
+

">  

+ ?subject=Overdue: "> + +

+

+
+ + + first overdue + + + second overdue + + + considered lost + + + + + + &itemnumber=&method=phone&location=¬ify_date=">cancel notification +
+
-
- -
- Today's notifications - - - - - - - - - - - - - - - - - - - - - - -
Date_dueTitleBorrowerLocalisationOverdue statusNotified byCancel
-

- -

-
-

- "> -   () -
Barcode : -

-
-

">  

- ?subject=Overdue: "> - -

-

-
- - - first overdue - - - second overdue - - - considered lost - - - - - - &itemnumber=&method=phone&department=¬ify_date=">cancel notification -
-
-
-- 2.39.5