[Koha-cvs] CVS: koha/admin systempreferences.pl,1.14,1.15

Paul POULAIN tipaul at users.sourceforge.net
Fri Aug 1 16:24:49 CEST 2003


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

Modified Files:
	systempreferences.pl 
Log Message:
demo mode added

Index: systempreferences.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/systempreferences.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** systempreferences.pl	11 Jun 2003 18:57:18 -0000	1.14
--- systempreferences.pl	1 Aug 2003 14:24:47 -0000	1.15
***************
*** 97,150 ****
  
  if ($op eq 'update_and_reedit') {
!     foreach ($input->param) {
! 	warn "$_: ".$input->param($_)."\n";
!     }
!     my $value='';
!     if (my $currentorder=$input->param('currentorder')) {
! 	my @currentorder=split /\|/, $currentorder;
! 	my $orderchanged=0;
! 	foreach my $param ($input->param) {
! 	    if ($param=~m#up-(\d+).x#) {
! 		my $temp=$currentorder[$1];
! 		$currentorder[$1]=$currentorder[$1-1];
! 		$currentorder[$1-1]=$temp;
! 		$orderchanged=1;
! 		last;
! 	    } elsif ($param=~m#down-(\d+).x#) {
! 		my $temp=$currentorder[$1];
! 		$currentorder[$1]=$currentorder[$1+1];
! 		$currentorder[$1+1]=$temp;
! 		$orderchanged=1;
! 		last;
! 	    }
! 	}
! 	$value=join ' ', @currentorder;
! 	if ($orderchanged) {
! 	    $op='add_form';
! 	    $template->param(script_name => $script_name,
! 						    $op              => 1); # we show only the TMPL_VAR names $op
! 	} else {
! 	    $op='';
! 	    $searchfield='';
! 	    $template->param(script_name => $script_name,
! 						else              => 1); # we show only the TMPL_VAR names $op
! 	}
!     }
!     my $dbh = C4::Context->dbh;
!     my $query="select * from systempreferences where variable=?";
!     my $sth=$dbh->prepare($query);
!     $sth->execute($input->param('variable'));
!     if ($sth->rows) {
! 	    my $query = "update systempreferences set value=?,explanation=? where variable=?";
! 	    my $sth=$dbh->prepare($query);
! 	    $sth->execute($value, $input->param('explanation'), $input->param('variable'));
! 	    $sth->finish;
      } else {
! 	    my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
! 	    my $sth=$dbh->prepare($query);
! 	    $sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
! 	    $sth->finish;
!     }
!     $sth->finish;
  
  }
--- 97,153 ----
  
  if ($op eq 'update_and_reedit') {
! 	foreach ($input->param) {
! 	}
! 	my $value='';
! 	if (my $currentorder=$input->param('currentorder')) {
! 		my @currentorder=split /\|/, $currentorder;
! 		my $orderchanged=0;
! 		foreach my $param ($input->param) {
! 			if ($param=~m#up-(\d+).x#) {
! 				my $temp=$currentorder[$1];
! 				$currentorder[$1]=$currentorder[$1-1];
! 				$currentorder[$1-1]=$temp;
! 				$orderchanged=1;
! 				last;
! 			} elsif ($param=~m#down-(\d+).x#) {
! 				my $temp=$currentorder[$1];
! 				$currentorder[$1]=$currentorder[$1+1];
! 				$currentorder[$1+1]=$temp;
! 				$orderchanged=1;
! 				last;
! 			}
! 		}
! 		$value=join ' ', @currentorder;
! 		if ($orderchanged) {
! 			$op='add_form';
! 			$template->param(script_name => $script_name,
! 							$op              => 1); # we show only the TMPL_VAR names $op
! 		} else {
! 			$op='';
! 			$searchfield='';
! 			$template->param(script_name => $script_name,
! 							else              => 1); # we show only the TMPL_VAR names $op
! 		}
! 	}
! 	my $dbh = C4::Context->dbh;
! 	my $query="select * from systempreferences where variable=?";
! 	my $sth=$dbh->prepare($query);
! 	$sth->execute($input->param('variable'));
! 	if ($sth->rows) {
! 		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "update systempreferences set value=?,explanation=? where variable=?";
! 			my $sth=$dbh->prepare($query);
! 			$sth->execute($value, $input->param('explanation'), $input->param('variable'));
! 			$sth->finish;
! 		}
      } else {
! 		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
! 			my $sth=$dbh->prepare($query);
! 			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
! 			$sth->finish;
! 		}
! 	}
! 	$sth->finish;
  
  }
***************
*** 238,250 ****
  	$sth->execute($input->param('variable'));
  	if ($sth->rows) {
! 		my $query = "update systempreferences set value=?,explanation=? where variable=?";
! 		my $sth=$dbh->prepare($query);
! 		$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
! 		$sth->finish;
  	} else {
! 		my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
! 		my $sth=$dbh->prepare($query);
! 		$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
! 		$sth->finish;
  	}
  	$sth->finish;
--- 241,257 ----
  	$sth->execute($input->param('variable'));
  	if ($sth->rows) {
! 		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "update systempreferences set value=?,explanation=? where variable=?";
! 			my $sth=$dbh->prepare($query);
! 			$sth->execute($input->param('value'), $input->param('explanation'), $input->param('variable'));
! 			$sth->finish;
! 		}
  	} else {
! 		unless (C4::Context->config('demo') eq 1) {
! 			my $query = "insert into systempreferences (variable,value,explanation) values (?,?,?)";
! 			my $sth=$dbh->prepare($query);
! 			$sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'));
! 			$sth->finish;
! 		}
  	}
  	$sth->finish;





More information about the Koha-cvs mailing list