sharee.bike/copri4/main/src/Tpl/BaseEdit.pm

617 lines
29 KiB
Perl
Raw Normal View History

2021-12-30 12:05:56 +01:00
package BaseEdit;
#
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
#
#use lib "/var/www/copri4/shareedms-primary/src";
#
use strict;
use warnings;
use POSIX;
use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use Lib::Config;
use Mod::Buttons;
use Date::Calc qw(:all);
use Mod::Libenz;
use Mod::Libenzdb;
use Mod::Basework;
use Mod::DBtank;
use Mod::APIfunc;
use Data::Dumper;
sub new {
my $class = shift;
my $self = {};
bless($self,$class);
return $self;
}
#Template
sub tpl(){
my $node_meta = shift;
my $users_dms = shift;
my $u_group = shift;
my $return = shift;
my $q = new CGI;
my $cf = new Config;
my $lb = new Libenz;
my $db = new Libenzdb;
my $bw = new Basework;
my $dbt = new DBtank;
my $apif = new APIfunc;
my $but = new Buttons;
my %ib = $but->ibuttons();
my %varenv = $cf->envonline();
my $lang = "de";
my $dbh = "";
#print $dbt->{operator}->{$varenv{dbname}}->{oprefix};
my $rel_id = $1 if($R::rel_id && $R::rel_id =~ /(\d+)/);
my $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/);
$u_id = $1 if($R::c_idadr && $R::c_idadr =~ /(\d+)/ && $R::base_edit eq "new_dmsusers");
my ($edit,$copy_key,$save_key,$relate_key,$move_key,$delete_key,$package_key);
my $tpl;
my @tpl_order;
my $edit_template;
my $bg_color = "grey";
my $ctrel = {};
if($node_meta->{ct_table} eq "content" && $node_meta->{tpl_id}){
my $ref = {
table => "$node_meta->{ct_table}",
fetch => "one",
template_id => "$node_meta->{tpl_id}",
rel_id => "$rel_id",
};
$ctrel = $dbt->fetch_record($dbh,$ref);
print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ctrel->{c_id}");
print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$ctrel->{rel_id}");
$bg_color = $varenv{background_color2};
$edit = "rel_edit";
#$relate_key = "relate_dialog4menu";
$move_key = "move_dialog4menu" if($node_meta->{tpl_id} == 205);#only Waren
#$copy_key = "copy_content";
$save_key = "save_content";
$edit_template = "$ctrel->{template_id}";
$tpl = $db->get_tpl($edit_template);
}elsif($node_meta->{ct_table} eq "contentadr" && $node_meta->{tpl_id}){
my $ref = {
table => "$node_meta->{ct_table}",
fetch => "one",
template_id => "$node_meta->{tpl_id}",
rel_id => "$rel_id",
};
$ctrel = $dbt->fetch_record($dbh,$ref);
print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ctrel->{c_id}");
print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$ctrel->{rel_id}");
$bg_color = $varenv{background_color2};
$edit = "base_edit";
$save_key = "save_adr";
$edit_template = "$ctrel->{template_id}" . "000";
$tpl = $db->get_tpl($edit_template);
}elsif($node_meta->{ct_table} eq "users" && $u_id){
my $ref = {
table => "$node_meta->{ct_table}",
fetch => "one",
u_id => "$u_id",
};
$ctrel = $dbt->fetch_tablerecord($dbh,$ref);
print $q->hidden(-name=>'u_id',-override=>'1', -value=>"$ctrel->{u_id}");
$bg_color = $varenv{background_color2};
$edit = "base_edit";
$save_key = "save_dmsusers";
$tpl = $db->get_tpl($node_meta->{tpl_id});
#print Dumper($node_meta->{tpl_id}) . "\n u_id:" . $u_id;
}else{
print $q->div("Es konnten keine Daten gefunden werden"),"\n";
return "failure::Error, no table selected";
}
my $u_name = $dbt->sys_username($dbh,$ctrel->{owner});
if(ref($ctrel) ne "HASH" && !$ctrel->{c_id} && !$ctrel->{u_id}){
print $q->div("error: no content available");
}
$ctrel->{mtime} = $lb->time4de($ctrel->{mtime},"1") if($ctrel->{mtime});
my $selsize="200px";
#$db->users_up("rel_id4edit",$ctrel->{rel_id},$users_dms->{u_id});
print $q->hidden(-name=>'parent_id',-override=>'1', -value=>"$node_meta->{parent_id}");
print $q->hidden(-name=>'main_id',-override=>'1', -value=>"$node_meta->{main_id}");
print $q->hidden(-name=>'template_id',-override=>'1', -value=>"$node_meta->{template_id}");
print $q->hidden(-name=>'offset',-override=>'1', -value=>"$R::offset");
print $q->hidden(-name=>'limit', -override=>'1', -value=>"$R::limit");
print $q->hidden(-name=>'relids', -override=>'1', -value=>"$R::relids");
my ($start_date,$start_time,$s_dd,$s_mo,$s_yy,$s_hh,$s_mi,$end_date,$end_time,$e_yy,$e_mo,$e_dd,$e_hh,$e_mi);
my $today = strftime("%d.%m.%Y",localtime(time));
my $start_datetime = $ctrel->{start_time};
my $end_datetime = $ctrel->{end_time};
if($start_datetime){
($start_date,$start_time) = split(/ /,$start_datetime);
($s_yy,$s_mo,$s_dd) = split(/-/,$start_date);
$start_date = "$s_dd-$s_mo-$s_yy";
($s_hh,$s_mi) = split(/\:/,$start_time);
}
if($end_datetime){
($end_date,$end_time) = split(/ /,$end_datetime);
($e_yy,$e_mo,$e_dd) = split(/-/,$end_date);
$end_date = "$e_dd-$e_mo-$e_yy";
($e_hh,$e_mi) = split(/\:/,$end_time);
}
###
my $bike_nodes = {};
my $tariff_all = {};
if($varenv{systype} eq "sharee"){
my $node = { template_id => 205,#Leihrad_liste
parent_id => 200013,#Waren
fetch => "all",
keyfield => "main_id",
};
$bike_nodes = $dbt->fetch_rel4tpl4nd($dbh,$node);
$tariff_all = $db->collect_ct4rel("content","300026",$lang,"","","","","210");
}
print "<div id='Container_cms'>\n";
#1. table submit
print $q->start_table({-class=>'list', -border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'});
print $q->Tr();
print "<td style='background-color:$bg_color;padding:2px;border-bottom: 1px solid silver;'>";
print $but->singlesubmit7("$edit","$save_key","$ib{$save_key}","margin:0 5px;");
print $but->singlesubmit7("rel_edit","$relate_key","$ib{$relate_key}","margin:0 5px;");
print $but->singlesubmit7("rel_edit","$move_key","$ib{$move_key}","margin:0 5px;");
print $but->singlesubmit7("rel_edit","$copy_key","$ib{$copy_key}","margin:0 5px;");
print $but->singlesubmit7("$edit","remove_chk4rel","$ib{remove_chk4rel}","margin:0 5px;");
#print $q->div({-style=>'position:fixed;bottom:2%;right:1%;z-index:10;font-size:13px;'}," (c_id: $ctrel->{c_id} | rel_id: $ctrel->{rel_id} | tpl_id: $ctrel->{template_id} / $edit_template)"),"\n" if($users_dms->{u_id} eq $varenv{superu_id});
print "</td>\n";
print $q->td({-style=>"background-color:$bg_color;padding-right:10px;border-bottom: 1px solid silver;text-align:right;font-size:11px;"}, "$u_name / $ctrel->{mtime}");
print $q->end_table;
###Terminal target
my $c_key = "c_id";
my $add_trans = "add_transpos";
if("$node_meta->{ct_table}" =~ /contentadr/){
$add_trans = "add_transadr";
$c_key = "c_idadr";
}
my $tpath = "";
my $top = 70;
if($node_meta->{tpl_id} == 202){
my $cttrans = $db->collect_ct4rel4nd("contenttrans","","$lang","","","","ct.int10","$ctrel->{c_id}","209,218","","rel_id","");
foreach my $id (sort { $cttrans->{$b}->{c_id} <=> $cttrans->{$a}->{c_id} } keys (%$cttrans)){
my $toppx = $top . "px";
print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, " TXID $cttrans->{$id}->{txt16} ",$q->span({-style=>"background-color:$varenv{term_active_color}"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$cttrans->{$id}->{node_name}?ct_trans=open\&c_id4trans=$cttrans->{$id}->{c_id}\&tpl_id4trans=$cttrans->{$id}->{template_id}\&kind_of_trans=$users_dms->{kind_of_trans}&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $cttrans->{$id}->{node_name} #$cttrans->{$id}->{ct_name} ]"))),"\n";
$top += 22;
}
}elsif($node_meta->{tpl_id} == 205){
my $day = strftime "%d", localtime;
my $month = strftime "%m", localtime;
my $year = strftime "%Y", localtime;
my ($nyear,$nmonth,$nday) = Add_Delta_YMD($year,$month,$day, 0,0,-28);
my $toppx = $top . "px";
print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, $q->span({-style=>"background-color:$varenv{calendar_active_color}"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Mietjournal/?detail_search=1&barcode=$ctrel->{barcode}&start_date_time=$nday.$nmonth.$nyear",-title=>"Mietjournal der letzten 4 Wochen"},"[ Mietjournal zu Rad $dbt->{operator}->{$varenv{dbname}}->{oprefix}$ctrel->{barcode} ]"))),"\n";
$top += 22;
#}else{
#print $q->div({-style=>"position:absolute;top:$top;right:20px;"},"no valid users path definition: $tpath"),"\n";
}
###
#just for checking if ct_name or barcode still available
if($varenv{orga} eq "dms"){
print<<EOF
<style>
.ui-autocomplete {
text-align:left;
font-size:14px;
background:#eeeeee;
border:1px solid silver;
}
</style>
<script>
\$(function() {
\$('#json_select').autocomplete({
source: '/ajax_json?mandant_id=catch_equal&table=content',
minLength: 1,
response: function(event, ui) {
if (ui.content.length === 0) {
\$('#log').text(' neu');
}else{
\$('#log').text('bereits angelegt!');
}
}
});
});
</script>
EOF
;
}
#2. table content
print $q->start_table({-border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'});
print "<tr>\n";
my $j=0;
@tpl_order = split /,/,$tpl->{tpl_order};
#2.1 sub-table
print "<td style='border-bottom:1px solid silver;border-right:1px solid silver;vertical-align:top;padding:15px;'>\n";
print $q->start_table({-border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'});
$j++;
my @_service_valxx = ("","1","2","3","4");
foreach (@tpl_order){
my ($key,$des,$size,$postdes) = split /=/,$_;
my $seldes = $des;
$des .= " ($key)" if($users_dms->{u_id} eq $varenv{superu_id});
$ctrel->{$key} = $q->unescapeHTML("$ctrel->{$key}");
$ctrel->{$key} = $lb->newline($ctrel->{$key},"",1);
if($key =~ /c_id|ct_name|barcode|txt/ && $size eq "readonly"){
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$ctrel->{$key}", -readonly=>1)),"\n";
}elsif($key eq "u_id" && $size eq "readonly"){
my $adref = {
table => "contentadr",
fetch => "one",
template_id => "202",
c_id => "$ctrel->{$key}",
};
my $ctadr = $dbt->fetch_record($dbh,$adref);
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"ID"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$ctrel->{$key}", -readonly=>1)),"\n";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"Vorname Name"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"", -default=>"$ctadr->{txt01}", -readonly=>1)),"\n";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"eMail (Login)"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"", -default=>"$ctadr->{txt08}", -readonly=>1)),"\n";
}elsif($key eq "ct_name"){
#blank Teilenummer
my $ct_name = $ctrel->{$key};
if(($node_meta->{ct_table} eq "content") && ($tpl->{tpl_order} =~ /barcode/) && ("$ct_name" eq "$ctrel->{barcode}")){
$ct_name = "";
}
my $w = $size . "em";
my $oprefix = "";
$oprefix = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}-" if($node_meta->{tpl_id} == 224 || $node_meta->{tpl_id} == 228);
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>2}, "$oprefix", $q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1',-default=>"$ct_name")),"\n";
}
elsif($key eq "barcode"){
my $w = $size . "em";
my $oprefix = "";
$oprefix = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}" if($node_meta->{tpl_id} == 205);
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>1}, "$oprefix", $q->textfield(-class=>'etxt',-style=>"width:$w;",-id=>"json_select",-name=>"$key",-value=>"$ctrel->{$key}", -override=>'1',-size=>"25",-maxlength=>50),"");
print $q->td({-class=>'content1_cms',-id=>'log'},""),"\n";
}
elsif($key =~ /int/ && $size =~ /\w\+\w/ && $postdes eq "reverse"){
my ($a,$b) = split /\+/,$size;
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>1},$but->radiobox2reverse("$key","$ctrel->{$key}","$a","$b")),"\n";
}
elsif($key =~ /int/ && $size =~ /\w\+\w/){
2022-03-01 10:25:13 +01:00
#Ack digest
my $ack_code = "";
if($node_meta->{tpl_id} == 202 && $ctrel->{txt34}){
my $ack_digest = $q->unescapeHTML($ctrel->{txt34});
if($key eq "int04"){
$ack_code = " ($1)" if($ack_digest =~ /^(.{5})/);
}elsif($key eq "int13"){
$ack_code = " ($1)" if($ack_digest =~ /(.{5})$/);
}
}
2021-12-30 12:05:56 +01:00
my ($a,$b,$c) = split /\+/,$size;
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
2022-03-01 10:25:13 +01:00
print $q->td({-class=>'content1_cms',-colspan=>1},$but->radiobox2("$key","$ctrel->{$key}","$a","$b","$c"), $ack_code),"\n";
2021-12-30 12:05:56 +01:00
}
elsif($key =~ /int/ && $size =~ /checkbox/){
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms', -colspan=>'1'}, $but->checkbox("1","$key","$ctrel->{$key}"), $postdes),"\n";
print $q->hidden(-name=>"$key",-override=>1,-value=>"null");
}
elsif($key eq "int04"){
my $w = $size . "em";
my $oprefix = "";
$oprefix = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}" if($node_meta->{tpl_id} == 225 || $node_meta->{tpl_id} == 205);
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>1}, "$oprefix", $q->textfield(-class=>'etxt',-style=>"width:$w;",-name=>"$key",-value=>"$ctrel->{$key}", -override=>'1',-size=>"25",-maxlength=>50),"");
}
elsif($key =~ /int12/ && "$size" eq "select" && $node_meta->{tpl_id} == 210){#Flotte bike_group (bikenode.main_id)
my @_valxx = ("");
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-colspan=>'1'},"$des");
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector_class("$key","eselect","width:250px;",$ctrel->{$key},@_valxx));
}
elsif($key =~ /int21|int22/ && "$size" eq "select" && $node_meta->{tpl_id} == 228){#Bonus Tarif
my @_valxx = ("");
foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){
push (@_valxx, "$tariff_all->{$rid}->{barcode}:$tariff_all->{$rid}->{barcode} - $tariff_all->{$rid}->{txt01}");
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-colspan=>'1'},"$des");
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector_class("$key","eselect","width:350px;",$ctrel->{$key},@_valxx));
}
elsif($key =~ /int10/ && "$size" eq "select" && ($node_meta->{tpl_id} == 205 || $node_meta->{tpl_id} == 225)){#bike_state
my @_lock_valxx = ();
while (my ($key, $value) = each %{ $dbt->{copri_conf}->{bike_state} }) {
push @_lock_valxx, "$key:$value";#[1:available] ...
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$ctrel->{$key},@_lock_valxx));
}
elsif($key =~ /int18/ && "$size" eq "select" && $node_meta->{tpl_id} == 210){#sharing_type
my @_lock_valxx = ();
while (my ($key, $value) = each %{ $dbt->{copri_conf}->{sharing_type} }) {
push @_lock_valxx, "$key:$value";#[0:private] ...
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$ctrel->{$key},@_lock_valxx));
}
elsif($key =~ /int20/ && "$size" eq "select" && $node_meta->{tpl_id} == 205){#lock_state locked/unlocked
my @_lock_valxx = ();
while (my ($key, $value) = each %{ $dbt->{copri_conf}->{lock_state} }) {
push @_lock_valxx, "$key:$value";#[2:unlocked]
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$ctrel->{$key},@_lock_valxx));
}
elsif($key =~ /int11/ && "$size" eq "select" && $node_meta->{tpl_id} == 205){#lock_system BC Ilockit usw
my @_lock_valxx = ();
while (my ($key, $value) = each %{ $dbt->{copri_conf}->{lock_system} }) {
push @_lock_valxx, "$key:$value";#[2:Ilockit]
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$ctrel->{$key},@_lock_valxx));
}
elsif($key =~ /int/ && "$size" eq "select"){
my @_valxx;
my $selsize="50px";
@_valxx = split(/\|/,$varenv{$seldes});
$ctrel->{$key} =~ s/\.00//;
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector("$key","$selsize",$ctrel->{$key},@_valxx));
}
elsif($key =~ /int/){
my $w = $size . "em";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
}
elsif($key =~ /txt/ && "$size" eq "select" && "$des" =~ /Status|PiQuest|Zahlungsweise/){
my @_valxx;
my $selsize="150px";
@_valxx = split(/\|/,$varenv{$seldes}) if($varenv{$seldes});
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
if($des eq "PiQuest"){
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector("$key","$selsize","",@_valxx)," $ctrel->{$key}");
}else{
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector("$key","$selsize",$ctrel->{$key},@_valxx));
}
}
elsif($key =~ /txt/ && "$size" eq "select" && "$des" =~ /System|Ziel Datei/){
my @_valxx;
my $selsize="150px";
@_valxx = split(/\|/,$varenv{$seldes}) if($varenv{$seldes});
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector("$key","$selsize",$ctrel->{$key},@_valxx));
}
elsif($key =~ /txt/ && "$size" eq "select" && "$des" =~ /Land/){
my @_valxx;
my $selsize="150px";
my $country = $lb->country_code();
$ctrel->{$key} = "DE" if(!$ctrel->{$key});
foreach (sort { $country->{$a} cmp $country->{$b} } keys (%$country)){
push @_valxx, "$_:$country->{$_}";
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector("$key","$selsize",$ctrel->{$key},@_valxx));
}
elsif($node_meta->{tpl_id} == 205 && $key =~ /txt23/ && "$size" =~ /select/){#Service-Farbcode
my @_valxx = ("red","blue","green");
my @service_code = ("red","red","red","red","red","red");
@service_code = split(/\s/,$ctrel->{$key}) if($ctrel->{$key} =~ /\w+\s\w+\s\w+\s\w+\s\w+\s\w+/g);
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des");
print "<td class='content1_cms' colspan='1'>\n";
foreach(@service_code){
print $but->selector_color("$key","color:white;background-color:$_;width:60px;",$_,@_valxx);
}
print "</td>\n";
}
elsif($key =~ /txt/ && "$size" =~ /select/){
if($size =~ /_multiple/){
if($key =~ /txt18/ && $node_meta->{tpl_id} eq "202"){ #user defined service_tour alias user_tour
my $height = scalar(@_service_valxx);
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des");
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector2("$key","50px;","$height",$ctrel->{$key},@_service_valxx));
}
elsif($key =~ /txt07/ && $node_meta->{tpl_id} eq "225"){ # station defined Service Tour
2021-12-30 12:05:56 +01:00
my $height = scalar(@_service_valxx);
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des");
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector2("$key","50px;","$height",$ctrel->{$key},@_service_valxx));
}
elsif($key =~ /txt24/ && $node_meta->{tpl_id} == 225){ #Station on station_group (bikenode.main_ids)
2021-12-30 12:05:56 +01:00
my @_valxx = ("");
foreach my $rid (sort { $bike_nodes->{$a}->{node_name} cmp $bike_nodes->{$b}->{node_name} } keys (%$bike_nodes)){
push (@_valxx, "$bike_nodes->{$rid}->{main_id}:$bike_nodes->{$rid}->{node_name} - $bike_nodes->{$rid}->{main_id}");
}
my $height = scalar(@_valxx);
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des");
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector2("$key","250px;","$height",$ctrel->{$key},@_valxx));
}
#sharee user_group Tarif-2.0 (tarif.c_ids)
elsif($key =~ /txt30/ && $varenv{dbname} ne "sharee_primary"){
my @_valxx = ("");
foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){
if($tariff_all->{$rid}->{ct_name}){
push (@_valxx, "$tariff_all->{$rid}->{barcode}:$tariff_all->{$rid}->{barcode} - $tariff_all->{$rid}->{txt01} - $tariff_all->{$rid}->{int12}");
}
}
my $height = scalar(@_valxx);
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des");
print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector2("$key","350px;","$height",$ctrel->{$key},@_valxx));
}
}else{
my @_valxx = ("");
@_valxx = split(/,/,$varenv{$seldes}) if($varenv{$seldes});
my $selsize = "80px";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector("$key","$selsize",$ctrel->{$key},@_valxx));
}
#print $q->hidden(-name=>"$key",-override=>1,-value=>"null");#2021-06-02 select works without empty null
}
elsif($key =~ /txt/ && $size =~ /area$/){
my $h= 1;# if($size =~ /area(\d+)/);
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-colspan=>1},"$des"),"\n";
print $q->td({-class=>'content1_cms', -colspan=>'3'},$q->textarea(-class=>"autos", -style=>'border: 1px solid silver;background-color:#ededed;',-rows=>"$h",-cols=>'35em;', -name=>"$key", -override=>'1',-default=>"$ctrel->{$key}")),"\n";
}
elsif($key =~ /txt/ && $size =~ /area(\d+)/){
#my $h= $1 if($size =~ /area(\d+)/);
my $h= "height:" . $1 . "em;";
my $w = "width:25em;";
$w= "width:" . $2 . "em;" if($size =~ /area(\d+)-(\d+)/);
print $q->Tr();
print $q->td({-style=>'padding:4px 0 0 0px;',-colspan=>1},""),"\n";
print $q->td({-style=>'padding:4px 0 0 0px;',-colspan=>3},"$des"),"\n";
print $q->Tr();
print $q->td({-style=>'padding:4px 0 0 0px;',-colspan=>1},""),"\n";
if($key eq "txt28" && $ctrel->{$key} =~ /SEPA-Lastschriftmandat/){
use URI::Encode qw(uri_encode uri_decode);
$ctrel->{txt28} = uri_decode($ctrel->{txt28});
$ctrel->{txt28} =~ s/\+/ /g;
print $q->td({-style=>'border:1px solid silver;'},$ctrel->{txt28}),"\n";
}else{
print $q->td({-class=>'content1_cms', -colspan=>'3'},$q->textarea(-id=>"$key", -class=>"autos", -style=>"border: 1px solid silver;background-color:#ededed;$h $w", -name=>"$key", -override=>'1',-default=>"$ctrel->{$key}")),"\n";
}
}
elsif($key =~ /txt02/ && $varenv{syshost} =~ /sharee/){
#nothing txt02=Datei aktiv=10=sharee-APP aktivierte Dokument
}
elsif($key =~ /txt15/ && $varenv{syshost} =~ /sharee/ && $node_meta->{tpl_id} == 202){
my $w = $size . "em";
my $record_bonus = {c_id => 0};
my $pref_cc = {
table => "content",
fetch => "one",
template_id => "228",
ct_name => "$ctrel->{txt15}",
};
$record_bonus = $dbt->fetch_record($dbh,$pref_cc);
my @tariff = ("$ctrel->{txt30}");
@tariff = split(/\s/,$ctrel->{txt30}) if($ctrel->{txt30} =~ /\s/);
foreach my $tf_id (@tariff){
$tf_id =~ s/\s//g;
#print "$record_bonus->{int22} == $tf_id<br>";
if($record_bonus->{int22} == $tf_id){
$postdes = "Tarif: $record_bonus->{int21} - $record_bonus->{int22} (public - bonus)";
$postdes .= $q->span({-style=>'color:red;padding-left:10px;'},"Fehler: Bonusnummer") if(!$ctrel->{$key});
}
}
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
}
#Operators or Operators Antrag
elsif($key =~ /txt17|txt19/){
if($varenv{dbname} eq "sharee_primary"){
my $w = $size . "em";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
}
}
elsif($key =~ /txt/){
my $w = $size . "em";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$ctrel->{$key}"), $postdes),"\n";
}
elsif($key =~ /byte/){
my $K_int = unpack "H*", $ctrel->{$key};
#$K_int =~ s/(.)/sprintf( "%x", ord($1))/eg;
my $w = $size . "em";
print $q->Tr();
print $q->td({-class=>'left_italic_cms',-colspan=>1},"$des"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'2'},$q->textfield(-class=>'etxt', -style=>"width:$w;",-name=>"$key", -override=>'1', -default=>"$K_int"), $postdes),"\n";
}
if($key =~ /date_time/){
#print $q->hidden(-name=>'t_id', -override=>'1',-value=>"$times_id");
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"Datum Start"),"\n";
print $q->td({-class=>'content1_cms', -colspan=>'1'},$q->textfield(-id=>'datepicker1',-class=>'etxt',-name=>"start_date",-default=>"$start_date",-override=>'1',-size=>"10",-maxlength=>10)),"\n";
print $q->td({-class=>'content1_cms', -colspan=>'1'},"Ende", $q->textfield(-id=>'datepicker2',-class=>'etxt',-name=>"end_date",-default=>"$end_date",-override=>'1',-size=>"10",-maxlength=>10)),"\n";
print $q->Tr();
print $q->td({-class=>'left_italic_cms'},"Uhrzeit Start"),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'1'},
$q->textfield(-class=>'etxt',-name=>"s_hh", -override=>'1',-default=>"$s_hh",-size=>"2",-maxlength=>2),":",
$q->textfield(-class=>'etxt',-name=>"s_mi", -override=>'1',-default=>"$s_mi",-size=>"2",-maxlength=>2)),"\n";
print $q->td({-class=>'content1_cms',-colspan=>'1'},"Ende",
$q->textfield(-class=>'etxt',-name=>"e_hh", -override=>'1',-default=>"$e_hh",-size=>"2",-maxlength=>2),":",
$q->textfield(-class=>'etxt',-name=>"e_mi", -override=>'1',-default=>"$e_mi",-size=>"2",-maxlength=>2)),"\n";
}
}
print $q->end_table;
print "</td>\n";
print "</tr>\n";
print $q->end_table;
#2.table ende
print $q->div($but->singlesubmit7("$edit","$save_key","$ib{$save_key}","margin:10px 20px;")),"\n";
my $debug = "";
2022-01-09 18:31:20 +01:00
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | c_id: $ctrel->{c_id} | tpl_id: $tpl->{tpl_id} | rel_id: $ctrel->{rel_id})";
print $q->div({-style=>'z-index:10;font-size:13px;'},"$debug"),"\n" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
2021-12-30 12:05:56 +01:00
print "</div>";
}
1;