[Koha-cvs] CVS: koha/admin branches.pl,1.6,1.7

David Strainchamps lavide at users.sourceforge.net
Tue Oct 15 22:37:30 CEST 2002


Update of /cvsroot/koha/koha/admin
In directory usw-pr-cvs1:/tmp/cvs-serv3647

Modified Files:
	branches.pl 
Log Message:
Yet the last version of branche.pl
after a good story with cvs using by a beginner
to use HTML::Template


Index: branches.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/branches.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** branches.pl	15 Oct 2002 20:27:18 -0000	1.6
--- branches.pl	15 Oct 2002 20:37:26 -0000	1.7
***************
*** 57,60 ****
--- 57,61 ----
      heading("Branches: Add Branch");
      editbranchform();
+ 
  } elsif ($op eq 'edit') {
  # if the user has pressed the "edit branch settings" button.
***************
*** 142,146 ****
  	if (grep {/^$tmp$/} @{$data->{'categories'}}) {
  	    $checked = "CHECKED";
- <<<<<<< branches.pl
  		}
      $template->param(categoryname => $cat->{'categoryname'});
--- 143,146 ----
***************
*** 149,195 ****
      }
     
- =======
- 	}
- 	$catcheckbox .= <<EOF;
- <tr><td>$cat->{'categoryname'}</td>
- <td><INPUT TYPE="checkbox" NAME="$cat->{'categorycode'}" VALUE="1" $checked>$cat->{'codedescription'}</td></tr>
- EOF
-     }
-     my $form = <<EOF;
- <form action='$script_name' name=Aform method=post>
- <input type=hidden name=op value='add_validate'>
- <table>
- <tr><td>Branch code</td><td><input type=text name=branchcode size=5 maxlength=5 value='$data->{'branchcode'}'></td></tr>
- <tr><td>Name</td><td><input type=text name=branchname size=40 maxlength=80 value='$data->{'branchname'}'>&nbsp;</td></tr>
- $catcheckbox
- <tr><td>Address</td><td><input type=text name=branchaddress1 value='$data->{'branchaddress1'}'></td></tr>
- <tr><td>&nbsp;</td><td><input type=text name=branchaddress2 value='$data->{'branchaddress2'}'></td></tr>
- <tr><td>&nbsp;</td><td><input type=text name=branchaddress3 value='$data->{'branchaddress3'}'></td></tr>
- <tr><td>Phone</td><td><input type=text name=branchphone value='$data->{'branchphone'}'></td></tr>
- <tr><td>Fax</td><td><input type=text name=branchfax value='$data->{'branchfax'}'></td></tr>
- <tr><td>E-mail</td><td><input type=text name=branchemail value='$data->{'branchemail'}'></td></tr>
- <tr><td>&nbsp;</td><td><input type=submit value='Submit'></td></tr>
- </table>
- </form>
- EOF
-     return $form;
- >>>>>>> 1.5
  }
  
  sub deleteconfirm {
! # message to print if the
      my ($branchcode) = @_;
- <<<<<<< branches.pl
- =======
-     my $output = <<EOF;
- Confirm delete:
- <form action='$script_name' method=post><input type='hidden' name='op' value='delete_confirmed'>
- <input type='hidden' name='branchcode' value=$branchcode>
- <input type=submit value=YES></form>
- <form action='$script_name' method=post><input type='hidden' name='op' value=''>
- <input type=submit value=NO></form>
- EOF
-     return $output;
- >>>>>>> 1.5
  }
  
--- 149,157 ----
      }
     
  }
  
  sub deleteconfirm {
! # message to print if the 
      my ($branchcode) = @_;
  }
  
***************
*** 205,224 ****
  	$branchinfo = getbranchinfo();
      }
- <<<<<<< branches.pl
- =======
-     my $table = <<EOF;
- <table border='1' cellpadding='5' cellspacing='0' width='550'>
- <tr> <th colspan='5' align='left' bgcolor='#99cc33' background=$backgroundimage>
- <font size='5'><b>Branches</b></font></th> </tr>
- <tr bgcolor='#889999'>
- <td width='175'><b>Name</b></td>
- <td width='25'><b>Code</b></td>
- <td width='175'><b>Address</b></td>
- <td width='175'><b>Categories</b></td>
- <td width='50'><b>&nbsp;</b></td>
- </tr>
- EOF
- 
- >>>>>>> 1.5
      my $color;
      foreach my $branch (@$branchinfo) {
--- 167,170 ----
***************
*** 238,242 ****
  	}
  	$categories = '(no categories set)' unless ($categories);
- <<<<<<< branches.pl
  $template->param(color => $color);
  $template->param(branch_name => $branch->{'branchname'});
--- 184,187 ----
***************
*** 245,268 ****
  $template->param(branch_code => $branch->{'branchcode'});
  $template->param(value => $branch->{'branchcode'});
- =======
- 	$table .= <<EOF;
- <tr bgcolor='$color'>
-     <td align='left' valign='top'>$branch->{'branchname'}</td>
-     <td align='left' valign='top'>$branch->{'branchcode'}</td>
-     <td align='left' valign='top'>$address</td>
-     <td align='left' valign='top'>$categories</td>
-     <td align='left' valign='top'>
- <form action='$script_name' method=post>
- <input type='hidden' name='op' value='edit'>
- <input type='hidden' name='branchcode' value='$branch->{'branchcode'}'>
- <input type=submit value=Edit>
- </form>
- <form action='$script_name' method=post>
- <input type='hidden' name='branchcode' value='$branch->{'branchcode'}'>
- <input type='hidden' name='op' value='delete'><input type=submit value=Delete>
- </form></td>
- </tr>
- EOF
- >>>>>>> 1.5
      }
  
--- 190,193 ----
***************
*** 273,289 ****
  
      my $categoryinfo = getcategoryinfo();
- <<<<<<< branches.pl
- =======
-     my $table = <<EOF;
- <table border='1' cellpadding='5' cellspacing='0'>
- <tr> <th colspan='5' align='left' bgcolor='#99cc33' background=$backgroundimage>
- <font size='5'><b>Branches Categories</b></font></th> </tr>
- <tr bgcolor='#889999'>
- <td width='175'><b>Name</b></td>
- <td width='25'><b>Code</b></td>
- <td width='200'><b>Description</b></td>
- </tr>
- EOF
- >>>>>>> 1.5
  my $color;
      foreach my $cat (@$categoryinfo) {
--- 198,201 ----
***************
*** 314,318 ****
      $sth->execute;
      my @results;
!     while (my $data = $sth->fetchrow_hashref) {
  	my $tmp = $data->{'branchcode'}; my $brc = $dbh->quote($tmp);
  	$query = "select categorycode from branchrelations where branchcode = $brc";
--- 226,230 ----
      $sth->execute;
      my @results;
!     while (my $data = $sth->fetchrow_hashref) { 
  	my $tmp = $data->{'branchcode'}; my $brc = $dbh->quote($tmp);
  	$query = "select categorycode from branchrelations where branchcode = $brc";
***************
*** 345,349 ****
      $sth->execute;
      my @results;
!     while (my $data = $sth->fetchrow_hashref) {
  	push(@results, $data);
      }
--- 257,261 ----
      $sth->execute;
      my @results;
!     while (my $data = $sth->fetchrow_hashref) { 
  	push(@results, $data);
      }
***************
*** 393,397 ****
  	    push(@addcats, $ccat);
  	}
!     }
      # FIXME - There's already a $dbh in this scope.
      my $dbh = C4::Context->dbh;
--- 305,309 ----
  	    push(@addcats, $ccat);
  	}
!     }	
      # FIXME - There's already a $dbh in this scope.
      my $dbh = C4::Context->dbh;
***************
*** 431,435 ****
      if ($total) {
  	$message = "Branch cannot be deleted because there are $total items using that branch.";
!     }
      return $message;
  }
--- 343,347 ----
      if ($total) {
  	$message = "Branch cannot be deleted because there are $total items using that branch.";
!     } 
      return $message;
  }





More information about the Koha-cvs mailing list