koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/admin branches.pl,1.12,1.13


From: Ambrose Li
Subject: [Koha-cvs] CVS: koha/admin branches.pl,1.12,1.13
Date: Sat, 08 Feb 2003 22:14:35 -0800

Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv15884/admin

Modified Files:
        branches.pl 
Log Message:
Noted most likely correct tab size
Fixed some strange indentation
Noted stuff that needs to be fixed
Partial stub for "add new branch category" action


Index: branches.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/branches.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** branches.pl 2 Feb 2003 07:18:38 -0000       1.12
--- branches.pl 9 Feb 2003 06:14:32 -0000       1.13
***************
*** 1,3 ****
--- 1,18 ----
  #!/usr/bin/perl
+ # NOTE: Use standard 8-space tabs for this file (indents are 4 spaces)
+ 
+ #require '/u/acli/lib/cvs.pl';#DEBUG
+ open(DEBUG,'>/tmp/koha.debug');
+ 
+ # FIXME: individual fields in branch address need to be exported to templates,
+ #        in order to fix bug 180; need to notify translators
+ # FIXME: looped html (e.g., list of checkboxes) need to be properly
+ #        TMPL_LOOP'ized; doing this properly will fix bug 130; need to
+ #        notify translators
+ # FIXME: need to implement the branch categories stuff
+ # FIXME: heading() need to be moved to templates, need to notify translators
+ # FIXME: there are too many TMPL_IF's; the proper way to do it is to have
+ #        separate templates for each individual action; need to notify
+ #        translators
  
  # Finlay working on this file from 26-03-2002
***************
*** 54,62 ****
                             });
  if ($op) {
! $template->param(script_name => $script_name,
!                                               $op              => 1); # we 
show only the TMPL_VAR names $op
  } else {
! $template->param(script_name => $script_name,
!                                               else              => 1); # we 
show only the TMPL_VAR names $op
  }
  $template->param(action => $script_name);
--- 69,77 ----
                             });
  if ($op) {
!     $template->param(script_name => $script_name,
!                    $op         => 1); # we show only the TMPL_VAR names $op
  } else {
!     $template->param(script_name => $script_name,
!                    else        => 1); # we show only the TMPL_VAR names $op
  }
  $template->param(action => $script_name);
***************
*** 102,105 ****
--- 117,125 ----
      default("The branch with code $branchcode has been deleted.");
  
+ } elsif ($op eq 'add_cat') {
+ # If the user has pressed the "add new category" button.
+     heading("Branches: Add Branch");
+     editcatform();
+ 
  } else {
  # if no operation has been set...
***************
*** 123,126 ****
--- 143,147 ----
  }
  
+ # FIXME: this function should not exist; otherwise headings are untranslatable
  sub heading {
      my ($head) = @_;
***************
*** 145,150 ****
--- 166,173 ----
      }
  # make the checkboxs.....
+ # FIXME: this way of doing it is wrong (bug 130)
      my $catinfo = getcategoryinfo();
      my $catcheckbox;
+     print DEBUG "catinfo=".cvs($catinfo)."\n";
      foreach my $cat (@$catinfo) {
        my $checked = "";
***************
*** 152,159 ****
        if (grep {/^$tmp$/} @{$data->{'categories'}}) {
            $checked = "CHECKED";
!               }
!     $template->param(categoryname => $cat->{'categoryname'});
!     $template->param(categorycode => $cat->{'categorycode'});
!     $template->param(codedescription => $checked>$cat->{'codedescription'});  
  
      }
     
--- 175,182 ----
        if (grep {/^$tmp$/} @{$data->{'categories'}}) {
            $checked = "CHECKED";
!       }
!       $template->param(categoryname => $cat->{'categoryname'});
!       $template->param(categorycode => $cat->{'categorycode'});
!       $template->param(codedescription => $checked>$cat->{'codedescription'});
      }
     
***************
*** 209,222 ****
        push(@action,"/cgi-bin/koha/admin/branches.pl");
        while (@colors and @branch_name and @branch_code and @address and 
@categories and @value and @action) {
!       my %row_data;
!       $row_data{color} = shift @colors;
!       $row_data{branch_name} = shift @branch_name;
!       $row_data{branch_code} = shift @branch_code;
!       $row_data{address} = shift @address;
!       $row_data{categories} = shift @categories;
!       $row_data{value} = shift @value;
!       $row_data{action} = shift @action;
!       push(@loop_data, \%row_data);
!     }
      
      }
--- 232,245 ----
        push(@action,"/cgi-bin/koha/admin/branches.pl");
        while (@colors and @branch_name and @branch_code and @address and 
@categories and @value and @action) {
!           my %row_data;
!           $row_data{color} = shift @colors;
!           $row_data{branch_name} = shift @branch_name;
!           $row_data{branch_code} = shift @branch_code;
!           $row_data{address} = shift @address;
!           $row_data{categories} = shift @categories;
!           $row_data{value} = shift @value;
!           $row_data{action} = shift @action;
!           push(@loop_data, \%row_data);
!       }
      
      }
***************
*** 225,239 ****
  }
  
  sub branchcategoriestable {
  #Needs to be implemented...
  
      my $categoryinfo = getcategoryinfo();
! my $color;
      foreach my $cat (@$categoryinfo) {
        ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
! $template->param(color => $color);
! $template->param(categoryname => $cat->{'categoryname'});
! $template->param(categorycode => $cat->{'categorycode'});
! $template->param(codedescription => $cat->{'codedescription'});
      }
  }
--- 248,263 ----
  }
  
+ # FIXME logic seems wrong
  sub branchcategoriestable {
  #Needs to be implemented...
  
      my $categoryinfo = getcategoryinfo();
!     my $color;
      foreach my $cat (@$categoryinfo) {
        ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
!       $template->param(color => $color);
!       $template->param(categoryname => $cat->{'categoryname'});
!       $template->param(categorycode => $cat->{'categorycode'});
!       $template->param(codedescription => $cat->{'codedescription'});
      }
  }
***************
*** 252,257 ****
        my $bc = $dbh->quote($branchcode);
        $query = "Select * from branches where branchcode = $bc";
      }
-     else {$query = "Select * from branches";}
      my $sth = $dbh->prepare($query);
      $sth->execute;
--- 276,282 ----
        my $bc = $dbh->quote($branchcode);
        $query = "Select * from branches where branchcode = $bc";
+     } else {
+       $query = "Select * from branches";
      }
      my $sth = $dbh->prepare($query);
      $sth->execute;
***************
*** 274,277 ****
--- 299,303 ----
  }
  
+ # FIXME This doesn't belong here; it should be moved into a module
  sub getcategoryinfo {
  # returns a reference to an array of hashes containing branches,
***************
*** 279,282 ****
--- 305,309 ----
      my $dbh = C4::Context->dbh;
      my $query;
+     print DEBUG "getcategoryinfo: entry: catcode=".cvs($catcode)."\n";
      if ($catcode) {
        my $cc = $dbh->quote($catcode);
***************
*** 285,288 ****
--- 312,316 ----
        $query = "Select * from branchcategories";
      }
+     print DEBUG "getcategoryinfo: query=".cvs($query)."\n";
      my $sth = $dbh->prepare($query);
      $sth->execute;
***************
*** 292,295 ****
--- 320,324 ----
      }
      $sth->finish;
+     print DEBUG "getcategoryinfo: exit: returning ".cvs(address@hidden)."\n";
      return address@hidden;
  }
***************
*** 379,380 ****
--- 408,413 ----
  
  output_html_with_http_headers $input, $cookie, $template->output;
+ 
+ # Local Variables:
+ # tab-width: 8
+ # End:




reply via email to

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