OpenXE/www/widgets/widget.anfrage.php
2021-05-21 08:49:41 +02:00

76 lines
2.7 KiB
PHP

<?php
include ("_gen/widget.gen.anfrage.php");
class WidgetAnfrage extends WidgetGenanfrage
{
private $app;
function __construct(&$app,$parsetarget)
{
$this->app = &$app;
$this->parsetarget = $parsetarget;
parent::__construct($app,$parsetarget);
$this->ExtendsForm();
}
function ExtendsForm()
{
$id = $this->app->Secure->GetGET('id');
$this->app->YUI->AutoComplete("adresse","kunde",1);
$this->app->YUI->AutoComplete("projekt","projektname",1);
// $this->app->YUI->AutoComplete("auftragid","auftrag",1);
$this->app->YUI->CkEditor("bodyzusatz","belege");
$this->app->YUI->CkEditor("freitext","belege");
$this->app->YUI->CkEditor("internebemerkung","internal");
$this->app->YUI->DatePicker("datum");
$this->form->ReplaceFunction("datum",$this,"ReplaceDatum");
$this->form->ReplaceFunction("projekt",$this,"ReplaceProjekt");
$this->form->ReplaceFunction("adresse",$this,"ReplaceKunde");
// $this->form->ReplaceFunction("auftragid",$this,"ReplaceAuftrag");
//$this->app->Tpl->Add('JQUERY','$("#adresse").keyup(function (e) {if (e.keyCode == 13) {document.getElementById("eprooform").submit();}});');
$sprachenOptions = $this->app->erp->GetSprachenSelect($id?$this->app->DB->Select("SELECT sprache FROM adresse WHERE id = '$id' LIMIT 1"):null);
$field = new HTMLSelect("sprache",0,"sprache",false,false,"1");
//$field->onchange="onchange_typ(this.form.typ.options[this.form.typ.selectedIndex].value);";
$field->AddOptionsSimpleArray($sprachenOptions);
$this->form->NewField($field);
if($this->app->erp->ModulVorhanden('bundesstaaten'))
{
$typOptions = $this->app->erp->GetTypSelect();
$field = new HTMLSelect("bundesstaat",0,"bundesstaat",false,false,"1");
$this->form->NewField($field);
if($id > 0){
$schreibschutz = $this->app->DB->Select("SELECT schreibschutz FROM anfrage WHERE id = '$id' LIMIT 1");
}else{
$schreibschutz = 0;
}
$this->app->YUI->BundeslaenderSelect('EPROO_SELECT_BUNDESSTAAT', 'land', 'bundesstaat',$this->app->DB->Select("SELECT land FROM anfrage WHERE id = '$id' LIMIT 1"),$this->app->DB->Select("SELECT bundesstaat FROM anfrage WHERE id = '$id' LIMIT 1"),$schreibschutz?true:false);
}else{
$this->app->Tpl->Set('VORBUNDESSTAAT','<!--');
$this->app->Tpl->Set('NACHBUNDESSTAAT','-->');
}
}
function ReplaceProjekt($db,$value,$fromform)
{
return $this->app->erp->ReplaceProjekt($db,$value,$fromform);
}
function ReplaceKunde($db,$value,$fromform)
{
return $this->app->erp->ReplaceKundennummer($db,$value,$fromform);
}
function ReplaceDatum($db,$value,$fromform)
{
return $this->app->erp->ReplaceDatum($db,$value,$fromform);
}
}
?>