<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package kunde;

use template;
use umfrage;
#use strict;

@ISA = qw ( template );

####################################################################
####         Konstruktor der Kundenklasse
####         Argumente  : -
####         Returnwert : -
####################################################################
sub init {
	my $that = shift;
	my $class = ref($that) || $that;
	my $self = template-&gt;init(@_);
	bless $self, $class;	
	$self-&gt;{knr}      = shift;
	$self-&gt;{query}    = shift;
	$self-&gt;{pass}     = 0;
	$self-&gt;{template} = 0;
	$self-&gt;{sprache}  = 0;
	$self-&gt;{name}     = "";
	$self-&gt;{firma}    = "";	
	return $self;
}

####################################################################
####         Datenbanklader der Kundenklasse
####         Argumente  : knr
####         Returnwert : -
####################################################################
sub load {
	my $self = shift;	
	$self-&gt;log(4,"Entering: kunde:load");
	# Kunde aus der Datenbank laden
	my $sql = "select pass, name, firma, template, sprache from kunden where knr=$self-&gt;{knr}";
	($self-&gt;{pass}, $self-&gt;{name}, $self-&gt;{firma}, $self-&gt;{template}, $self-&gt;{sprache}) = $self-&gt;sqlselect($sql);
	if (! defined $self-&gt;{knr}) {$self-&gt;log(2,"Kunde ist nicht vorhanden");$self-&gt;exit;}
	$self-&gt;loadtmp;
	return $self;
}

####################################################################
####         Ermittelt eine neue umfid und speichert sich
####         Argumente  : -
####         Returnwert : -
####################################################################
sub new {
	my $self = shift;
	$self-&gt;log(4,"Entering: kunde:new");
	my $sql1 = "select max(knr) from kunden";
	($self-&gt;{id}) = ($self-&gt;sqlselect($sql1))+1;
        my $sql2 = "insert into kunden values ( $self-&gt;{knr} ,'$self-&gt;{pass}', '$self-&gt;{name}', '$self-&gt;{firma}', $self-&gt;{template}, $self-&gt;{sprache})";
	$self-&gt;sqldo($sql2);
}

####################################################################
####         Speichert sich mit Update
####         Argumente  : -
####         Returnwert : -
####################################################################
sub store {
	my $self = shift;
	$self-&gt;log(4,"Entering: kunde:store");
	my $sql = "update kunden set pass='$self-&gt;{pass}', name='$self-&gt;{name}', ".
		  "firma='$self-&gt;{firma}', ".
		  "template=$self-&gt;{template}, sprache=$self-&gt;{sprache} where knr=$self-&gt;{knr}";
	$self-&gt;sqldo($sql);
}

####################################################################
####         Löscht sich und alle seine Fragen aus der DB
####         Argumente  : evtl Fragentext und Fragentyp
####         Returnwert : -
####################################################################
sub delete {
	my $self = shift;
	$self-&gt;log(4,"Entering: kunde:delete");
	my $sql1  = "delete from kunden where knr=$self-&gt;{knr}";
	my $sql2  = "delete from palette where knr=$self-&gt;{knr}";
	my $sql3  = "delete from template where knr=$self-&gt;{knr}";
	$self-&gt;sqldo($sql1);
	$self-&gt;sqldo($sql2);
	$self-&gt;sqldo($sql3);
	$self-&gt;{knr} = undef;
}

####################################################################
####         Schreibt ins Logfile
####         Argumente  : Emergency und Logtext
####         Returnwert : -
####################################################################
sub log {
	my $self = shift;
        my $emer = shift;
	my $TEXT = shift;
	$self-&gt;printlog($emer, "[Kunde] $TEXT");
}

####################################################################
####         Gibt die Standardmaske aus
####         Argumente  : Emergency und Logtext
####         Returnwert : -
####################################################################
sub htmlbearb {
	my $self = shift;
	$self-&gt;{buttonwidth}=21;
	$self-&gt;log(4,"Entering: kunde:htmlbearb");
        my $TITLE=$self-&gt;trans("TI1");
        if ( $baseq::VARS{kumfrage}==0 &amp;&amp; $baseq::VARS{umfid} != 0 ) {$baseq::VARS{kumfrage}=$baseq::VARS{umfid};}
	$HTML=	"&lt;TABLE width=100%&gt;\n".
		$self-&gt;TR([ $self-&gt;sfont($self-&gt;trans("HI22").":"),
			    $self-&gt;sfont($self-&gt;{name}." bei ".$self-&gt;{firma}),
			    $self-&gt;SM("kbut","BU24")    ]).
		"&lt;/TABLE&gt;\n".
		
		"&lt;HR&gt;&lt;BR&gt;\n&lt;TABLE cellspacing=10&gt;\n".
		$self-&gt;TR([ $self-&gt;sfont($self-&gt;trans("HI23")),$self-&gt;sfont($self-&gt;trans("HI42")),$self-&gt;sfont($self-&gt;trans("HI1")) ]).
                $self-&gt;TR([
			$self-&gt;DDumfrage('kumfrage',$baseq::VARS{kumfrage}),
			$self-&gt;DDtemp('ktemplate',$self-&gt;{template},1),
	       		$self-&gt;DDsprache('ksprache',$self-&gt;{sprache})   ]).
                $self-&gt;TR([
	                $self-&gt;SM('kbut',"BU14"),
			$self-&gt;SM('tbut',"BU17"),
		        $self-&gt;SM('kbut',"BU20",14)  ]).

				$self-&gt;TR([
			$self-&gt;SM('kbut',"BU15"),
			$self-&gt;SM('kbut',"BU18"),
			$self-&gt;SM('kbut',"BU11",14)  ]).

				$self-&gt;TR([
			$self-&gt;SM('kbut',"BU16"),
		     	$self-&gt;SM('kbut',"BU19"),
		     	$self-&gt;SM('tbut',"BU21",14), ]).

		"&lt;/TABLE&gt;";
       $self-&gt;{helpkontext}="kunde"; 	 
       $self-&gt;printhtml($TITLE,$HTML);
}


####################################################################
####         Gibt die Standardmaske aus
####         Argumente  : Emergency und Logtext
####         Returnwert : -
####################################################################
sub getbearb {
	my $self = shift;
	my ($umf, $trans);
	$self-&gt;log(4,"Entering: kunde:getbearb");
	if ($baseq::VARS{lbut} eq $self-&gt;trans("BU11")) {$self-&gt;redirect;}
	if ($baseq::VARS{kbut} eq $self-&gt;trans("BU11")) {$self-&gt;redirect;}	
	if ($baseq::VARS{lbut} eq $self-&gt;trans("BU12")) {
		$self-&gt;{knr}=$baseq::VARS{apin};
		$baseq::VARS{knr}=$baseq::VARS{apin};
		$baseq::VARS{pass}=crypt($baseq::VARS{apass},"xy");
	}
	$self-&gt;log(4,"lbut=$baseq::VARS{lbut} but=$baseq::VARS{but} umfid=$baseq::VARS{umfid} template=$baseq::VARS{ktemplate}&nbsp;knr=$self-&gt;{knr}");
	if ($self-&gt;checkpass($baseq::VARS{knr}, $baseq::VARS{pass}) != 4) {$baseq::VARS{knr}=0; $self-&gt;login; $self-&gt;exit;};
        $self-&gt;load;
	if ( ($baseq::VARS{lbut} eq "") &amp;&amp; ($baseq::VARS{kbut} eq "") ) {
		if ($baseq::VARS{but} ne ""){$umf=umfrage-&gt;init($self, $baseq::VARS{umfid}); $umf-&gt;load; $umf-&gt;getbearb;$umf-&gt;exit;}
        	if ($baseq::VARS{tbut} ne ""){$tm=template-&gt;init($self, $baseq::VARS{ktemplate}); $tm-&gt;loadtmp; $tm-&gt;getbearb;$tm-&gt;exit;}
	}
        elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU14") ){$umf=umfrage-&gt;init($self, $baseq::VARS{kumfrage});$umf-&gt;load; $umf-&gt;kstatistik;$umf-&gt;exit;}
        elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU15") ){$umf=umfrage-&gt;init($self, $baseq::VARS{kumfrage});$umf-&gt;load; $umf-&gt;getbearb;$umf-&gt;exit;}
	elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU16") ){$umf=umfrage-&gt;init($self);$umf-&gt;loadtmp; $umf-&gt;new; $umf-&gt;getbearb;$umf-&gt;exit;}
	elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU18") ){$tm=template-&gt;init($self);$tm-&gt;{template}=$baseq::VARS{ktemplate};$tm-&gt;loadtmp; $tm-&gt;new; $tm-&gt;getbearb; $tm-&gt;exit;}
	elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU19") ){$self-&gt;{template}=$baseq::VARS{ktemplate}; $self-&gt;store; $self-&gt;load; $self-&gt;htmlbearb}
	elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU20") ){$self-&gt;{sprache}=$baseq::VARS{ksprache}; $self-&gt;store; $self-&gt;load; $self-&gt;htmlbearb}
	elsif ($baseq::VARS{kbut} eq $self-&gt;trans("BU24") ){$self-&gt;hilfe;}
	else {$self-&gt;htmlbearb;}
}
</pre></body></html>