sig copri available

This commit is contained in:
ragu 2022-06-24 14:38:22 +02:00
parent 7d3c293f91
commit 9026241a24
5 changed files with 75 additions and 45 deletions

View file

@ -25,6 +25,9 @@ use Scalar::Util qw(looks_like_number);
use Storable;
use Mod::APIfunc;
use Mod::Pricing;
use Mod::Shareework;
use Mod::APIsigclient;
use Mod::Basework;
use Data::Dumper;
sub new {
@ -50,6 +53,9 @@ sub tpl(){
my $dbt = new DBtank;
my $apif = new APIfunc;
my $pri = new Pricing;
my $tk = new Shareework;
my $si = new APIsigclient;
my $bw = new Basework;
my %varenv = $cf->envonline();
my $script = $q->script_name();
@ -423,7 +429,7 @@ sub tpl(){
elsif(!$start_chck && !$end_chck){
#2020-12-01 changed to get last tablecontent, not only 1 by edit
#testing state
#if(!$start_chck && !$end_chck){
#if(!$start_chck && !$end_chck)
$rows = $db->count_content($table,"$main_ids","$tplids");
#collect search keys
@ -465,8 +471,23 @@ sub tpl(){
$ct_ids .= "$ct4rel_parts->{$cp_id}->{ct_id}," if($R::detail_search && ($R::s_kontext && $R::s_kontext eq "Waren" || $export eq "FiBu"));
}
}
$ct4rel = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{parent_id},$node_meta,$users_dms->{u_id},$lang,"$main_ids","$tplids","$ct_ids",$v_journal,$time,$R::s_kontext,$scol,$users_dms->{sort_updown},$offset,$limit,$export,$R::todo,$ck4ex,$opos);
#reload sig bikes and stations states
#$bw->log("Liste3 condition",$node_meta,"");
if($varenv{syshost} eq "shareedms-sx"){
my $ctadr = { c_id => $users_dms->{u_id} };
if($node_meta->{tpl_id} == 205 || $node_meta->{node_name} eq "Waren"){
$q->param(-name=>'request',-value=>"bikes_available");
(my $response->{bikes},my $return2copri->{bikes}) = $si->sig_available($q,\%varenv,$ctadr);
#$bw->log("return2copri",$return2copri->{bikes},"");
$tk->sigbike_cupdate($return2copri->{bikes});
}elsif($node_meta->{tpl_id} == 225){
$q->param(-name=>'request',-value=>"stations_available");
(my $response->{stations},my $return2copri->{stations}) = $si->sig_available($q,\%varenv,$ctadr);
$tk->sigbike_cupdate($return2copri->{stations});
}
}
$ct4rel = $db->search_content3($searchref,$table,$dbt->{shareedms_conf}->{parent_id},$node_meta,$users_dms->{u_id},$lang,"$main_ids","$tplids","$ct_ids",$v_journal,$time,$R::s_kontext,$scol,$users_dms->{sort_updown},$offset,$limit,$export,$R::todo,$ck4ex,$opos);
}#end $ct4rel collect
}else{
$return = "failure::Abbruch. Keine Zugriffsberechtigung";
@ -693,6 +714,8 @@ sub tpl(){
my $set_style4nr = "";
my $sum_error = 0;
my $ecol=0;
my $lock_system = 2;#defaults to Ilockit
$lock_system = $ct4rel->{$id}->{int11} if($ct4rel->{$id}->{int11});
# check sum_pos and sum_buchen
my $sum_pos = 0;
@ -928,11 +951,7 @@ sub tpl(){
if($table =~ /contenttrans|contenttver/){
print $q->td({-class=>'tdint',-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?ct_trans=open\&mode=manager\&c_id4trans=$ct4rel->{$id}->{c_id}\&tpl_id4trans=$ct4rel->{$id}->{template_id}\&kind_of_trans=$node_meta->{node_name}\&owner=$users_dms->{u_id}\&offset=$offset\&limit=$limit",-title=>"Terminal öffnen"},"$ct4rel->{$id}->{$key}"));
}elsif($table =~ /content$|contentadr|contentnel/){
if($varenv{wwwhost} =~ /regiox/ && $key =~ /ct_name/){
print $q->td({-class=>"tdtxt",-style=>"font-weight:normal;$set_style4nr"},"$ct4rel->{$id}->{$key}");
}else{
print $q->td({-class=>"tdint",-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&mode=manager\&rel_id=$ct4rel->{$id}->{rel_id}\&offset=$offset\&limit=$limit",-title=>"Terminal öffnen"},"$ct4rel->{$id}->{$key}")),"\n";
}
}elsif(($node_meta->{tpl_order} !~ /barcode/) || ("$ct4rel->{$id}->{$key}" ne "$ct4rel->{$id}->{barcode}")){
print $q->td({-class=>'tdint',-style=>"font-weight:bold;$set_style4nr"},"$ct4rel->{$id}->{$key}"),"\n";
}else{
@ -941,15 +960,15 @@ sub tpl(){
}elsif($key =~ /txt01/ && $table =~ /contenttrans|contenttver/){
print $q->td({-class=>'tdtxt',-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?ct_trans=open\&mode=manager\&c_id4trans=$ct4rel->{$id}->{c_id}\&tpl_id4trans=$ct4rel->{$id}->{template_id}\&kind_of_trans=$node_meta->{node_name}\&owner=$users_dms->{u_id}\&offset=$offset\&limit=$limit",-title=>"Terminal öffnen"},"$ct4rel->{$id}->{$key}")),"\n";
}elsif($key =~ /txt01/ && $table =~ /content$|contentadr/){
}elsif($key =~ /txt01/ && $table =~ /content$|contentadr/ && $lock_system != 3){
my $txt01 = "---";
$txt01 = "$ct4rel->{$id}->{$key}" if($ct4rel->{$id}->{$key});
print $q->td({-class=>'tdtxt',-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&mode=manager\&rel_id=$ct4rel->{$id}->{rel_id}\&offset=$offset\&limit=$limit",-title=>"Terminal öffnen"},"$txt01")),"\n";
}elsif($key =~ /barcode/ && $table =~ /content$|contentadr/ && $ct4rel->{$id}->{template_id} != 225){
}elsif($key =~ /barcode/ && $table =~ /content$|contentadr/ && $ct4rel->{$id}->{template_id} != 225 && $lock_system != 3){
print $q->td({-class=>'tdint',-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&mode=manager\&rel_id=$ct4rel->{$id}->{rel_id}\&offset=$offset\&limit=$limit",-title=>"Terminal öffnen"},"$ct4rel->{$id}->{$key}")),"\n";
}elsif($key =~ /int04/ && $table eq "content" && $ct4rel->{$id}->{template_id} == 225){
}elsif($key =~ /int04/ && $table eq "content" && $ct4rel->{$id}->{template_id} == 225 && $lock_system != 3){
print $q->td({-class=>'tdint',-style=>"font-weight:normal;$set_style4nr"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&mode=manager\&rel_id=$ct4rel->{$id}->{rel_id}\&offset=$offset\&limit=$limit",-title=>"Terminal öffnen"},"$ct4rel->{$id}->{$key}")),"\n";
}elsif($key =~ /int04/ && $table eq "content" && $ct4rel->{$id}->{template_id} == 205){
}elsif($key =~ /int04/ && $table eq "content" && $ct4rel->{$id}->{template_id} == 205 && $lock_system != 3){
print $q->td({-class=>'tdint',-style=>"font-weight:normal;"},$q->a({-class=>"linknav3",-style=>"",-href=>"?detail_search=1&s_int04=$ct4rel->{$id}->{$key}",-title=>"Rad Warenstamm nach Station filtern"},"$ct4rel->{$id}->{$key}"));
}elsif($key =~ /date_time/){
$ct4rel->{$id}->{start_time} = $lb->time4de($ct4rel->{$id}->{start_time},"1") if($ct4rel->{$id}->{start_time});
@ -1011,16 +1030,10 @@ sub tpl(){
print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$bonustarif"),"\n";
}elsif($key =~ /int|save|time$|sort|public/){
if($key eq "int06" && $ct4rel->{$id}->{int06}){
$ct4rel->{$id}->{int06} =~ s/,.*//;
}
#for all other withot matching integer type condition
}elsif($key =~ /int|barcode|save|time$|sort|public/){
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},"$ct4rel->{$id}->{$key}"),"\n";
#if($colorize && $ct4rel->{$id}->{$key} == 1){
# print $q->td({-class=>'tdicon',-style=>"$txtstyle $set_style color:$colorize;"},"•"),"\n";
#}else{
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},"$ct4rel->{$id}->{$key}"),"\n";
#}
}elsif($key =~ /txt01/ && $v_journal){
my $txt01 = "$ct4rel->{$id}->{$key}";
$txt01 = "<b>$txt01</b>" if($ct4rel->{$id}->{state} eq "Kassenbestand");