diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index 7cf2561..793e374 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -2171,22 +2171,23 @@ sub stations_available(){ my $auth = shift || ""; my $record_pos = shift || {}; + + my $authed = 0; + $authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id}); + my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie')); + #station_group and bike_group alias bike nodes.type_id - #my $station_group = ""; - #$station_group = $record_pos->{int29} if(ref($record_pos) eq "HASH" && $record_pos->{int29}); + my $station_group = ""; + $station_group = $record_pos->{int29} if(ref($record_pos) eq "HASH" && $record_pos->{int29}); #station_bike_node and bike_node alias bike nodes.main_id my $station_bike_node = ""; - $station_bike_node = $record_pos->{int21} if(ref($record_pos) eq "HASH" && $record_pos->{int21}); + $station_bike_node = $record_pos->{int12} if(ref($record_pos) eq "HASH" && $record_pos->{int12}); #take start station from pos my $aa_station = ""; $aa_station = $record_pos->{int06} if(ref($record_pos) eq "HASH" && $record_pos->{int06} && $record_pos->{int42}); - my $authed = 0; - $authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id}); - my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$q->param('authcookie')); - my $return = {}; my $pref = { table => "content", @@ -2199,33 +2200,44 @@ sub stations_available(){ #group_id must have 6 numbers like 300103 my $pref_sql = ""; $pref_sql .= " and ("; - foreach(@{$bike_node}){ + foreach my $type_id (@{$bike_group}){ #on rental end select only stations which are defined #A-A rental - if($station_bike_node && $_ =~ /(\d+)/ && $aa_station){ - my $node_id = $1; - if($node_id == $station_bike_node){ + if($station_group && $type_id =~ /(\d+)/ && $aa_station){ + my $group_id = $1; + if($group_id == $station_group){ $pref_sql .= " ct.int04 = $aa_station OR"; } #A-B rental - }elsif($station_bike_node && $_ =~ /(\d+)/){ - my $node_id = $1; - if($node_id == $station_bike_node){ - $pref_sql .= " ct.txt24 like '%$node_id%' OR"; + }elsif($station_group && $type_id =~ /(\d+)/){ + my $group_id = $1; + if($group_id == $station_group){ + $pref_sql .= " ct.txt25 like '%$group_id%' OR"; } #without a rental - }elsif($_ =~ /(\d+)/){ - my $node_id = $1; - $pref_sql .= " ct.txt24 like '%$node_id%' OR"; + }elsif(!$station_group && $type_id =~ /(\d+)/){ + my $group_id = $1; + $pref_sql .= " ct.txt25 like '%$group_id%' OR"; } } $pref_sql =~ s/OR$//; $pref_sql .= ")"; $pref_sql = "" if($pref_sql !~ /\d/); + $bw->log("stations_available --> station_bike_node:$station_bike_node|aa_station:$aa_station|bike_node:@{$bike_node}|bike_group:@{$bike_group}|pref_sql:\n",$pref_sql,""); + my $record = {}; $record = $dbt->fetch_record($dbh,$pref,$pref_sql) if(ref($bike_node) eq "ARRAY" && @{$bike_node}[0]); + my $hotline_hash = { + table => "contentuser", + fetch => "one", + template_id => 197, + c_id => "1", + }; + my $hotline_data = $dbt->fetch_record($dbh,$hotline_hash); + + my $op_return = {}; foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){ $return->{$id}->{authed} = "$authed"; @@ -2245,14 +2257,6 @@ sub stations_available(){ $return->{$id}->{station_group} = [@station_group]; } - my $hotline_hash = { - table => "contentuser", - fetch => "one", - template_id => 197, - c_id => "1", - }; - my $hotline_data = $dbt->fetch_record($dbh,$hotline_hash); - $return->{$id}->{operator_data} = { "operator_name" => "", "operator_hours" => "", diff --git a/copri4/main/src/Mod/APIsigclient.pm b/copri4/main/src/Mod/APIsigclient.pm index 6b47579..1f5757a 100755 --- a/copri4/main/src/Mod/APIsigclient.pm +++ b/copri4/main/src/Mod/APIsigclient.pm @@ -108,13 +108,15 @@ sub sig_available { #station (mainly using sigojson site object) my $station = "SX$resp->{site}->{id}"; + print FILE "---> Station: $station| bike_group: @{$bike_group}[0])\n"; if($station && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){ - print FILE "Station: $station\n"; + print FILE "Station: $station\n\n"; $response_out->{$station}->{station} = "$station"; $response_out->{$station}->{authed} = "$authed"; $response_out->{$station}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}"; #FIXME charset encoding + $response_out->{$station}->{description} = ""; #$response_out->{$station}->{description} = "$resp->{site}->{address}" || ""; #$response_out->{$station}->{description} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$resp->{site}->{address})) || ""; $response_out->{$station}->{station_group} = ["SX300101"];#Lastenrad alias type_id @@ -124,9 +126,9 @@ sub sig_available { #Other than Active status, should not be used to display information to a customer $response_out->{$station}->{state} = "defect"; - if(uc($resp->{site}->{status}) eq "ACTIVE"){ + if(uc($resp->{status}) =~ /ACTIVE|PRIVATE/i){ $response_out->{$station}->{state} = "available"; - }elsif(uc($resp->{site}->{status}) eq "MAINTANANCE"){ + }elsif(uc($resp->{status}) eq "MAINTANANCE"){ $response_out->{$station}->{state} = "maintanance"; } @@ -158,7 +160,9 @@ sub sig_available { $return2copri->{$station}->{int10} = $key; } } - delete $response_out->{$station} if(uc($resp->{site}->{status}) ne "ACTIVE" || !$resp->{site}->{lat} || !$resp->{site}->{lon}); + #print FILE "response_out:" . Dumper($response_out->{$station}) . "\n"; + #print FILE "return2copri:" . Dumper($return2copri->{$station}) . "\n"; + delete $response_out->{$station} if(uc($resp->{status}) !~ /ACTIVE|PRIVATE/i || !$resp->{site}->{lat} || !$resp->{site}->{lon}); } }#end stations_available @@ -173,7 +177,7 @@ sub sig_available { print FILE "bike-data $bike_id | $resp->{site}->{id} | @{$bike_group}[0]\n"; if($bike && looks_like_number($bike_id) && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){ - print FILE "Bike: $bike\n"; + print FILE "Bike: $bike\n\n"; if($ctpos->{barcode} && $ctpos->{barcode} == $bike_id){ $response_out->{$bike}->{user_miniquery} = $show_dialog->{user_miniquery} if($show_dialog->{user_miniquery}); $response_out->{$bike}->{co2saving} = ""; @@ -276,8 +280,7 @@ sub sig_available { $return2copri->{$bike}->{int20} = $key; } } - #delete if $resp->{status} ne "ACTIVE" || reservation_state ne Reserved|Active-Rental - delete $response_out->{$bike} if(uc($resp->{status}) ne "ACTIVE" || $resp->{reservation_state});#don't view not active bikes + delete $response_out->{$bike} if(uc($resp->{status}) !~ /ACTIVE|PRIVATE/i || $resp->{reservation_state});#don't view not active bikes } }#end bikes_available diff --git a/copri4/main/src/Mod/Prelogic.pm b/copri4/main/src/Mod/Prelogic.pm index d87f602..3f2424c 100755 --- a/copri4/main/src/Mod/Prelogic.pm +++ b/copri4/main/src/Mod/Prelogic.pm @@ -819,13 +819,6 @@ sub preinit(){ my $opos="null"; $u_rows += $db->update_tagesabschluss($table,$c_id4kasse,$journal_id,$journal_tpl,$tpl_vk,$parent_trans->{parent_id},"$main_ids","$s_owner_id","$opos"); - - #calculate and set counts - my @mainis = split(/,/,$main_ids); - foreach(@mainis){ - my $rows = $db->count_content($table,"$_","$tpl_vk"); - $db->updater("nodes","main_id",$_,"int10",$rows) if($_ > 300000 && $rows =~ /\d/); - } print $q->div({-class=>'elementwhite'},"1... redirecting to ... or CLICK ", $q->a({href=>"$varenv{wwwhost}/DMS/Faktura/Verkaufsjournal"},"$varenv{wwwhost}/DMS/Faktura/Verkaufsjournal")); print redirect("$varenv{wwwhost}/DMS/Faktura/Verkaufsjournal?redirected=1\&return=0-0-0|$i_rows-$u_rows-$d_rows"); exit 0; diff --git a/copri4/main/src/Mod/Shareework.pm b/copri4/main/src/Mod/Shareework.pm index 165e9b2..4ab8147 100755 --- a/copri4/main/src/Mod/Shareework.pm +++ b/copri4/main/src/Mod/Shareework.pm @@ -838,8 +838,8 @@ sub sigbike_cupdate { owner => "169", }; - $bw->log("sigbike_cupdate content from record_sig with bike nr:",$update,""); $rows = $dbt->update_record($dbh,$update,$record_sig->{$bid}); + $bw->log("rows: $rows | sigbike_cupdate content from record_sig with bike nr:",$update,""); if($rows != 1){ my $c_id = ""; $update->{itime} = "now()"; @@ -869,8 +869,8 @@ sub sigstation_cupdate { owner => "169", }; - $bw->log("sigstation_cupdate content from record_sig with bike nr:",$update,""); $rows = $dbt->update_record($dbh,$update,$record_sig->{$sid}); + $bw->log("rows: $rows | sigstation_cupdate content from record_sig with bike nr:",$update,""); if($rows != 1){ my $c_id = ""; $update->{itime} = "now()"; diff --git a/copri4/main/src/Tpl/Karte_osm.pm b/copri4/main/src/Tpl/Karte_osm.pm index db2ccfe..d681ab3 100755 --- a/copri4/main/src/Tpl/Karte_osm.pm +++ b/copri4/main/src/Tpl/Karte_osm.pm @@ -65,7 +65,7 @@ sub tpl(){ my $icon_green = "Open_Green.png"; my $icon_red = "Open_Red.png"; my $icon_blue = "Open_Blue.png"; - my $mapheight = "600px;"; + my $mapheight = "800px;"; if($project eq "Bayern"){ $icon_green = "LastenradBay_Standortpfeil_gruen_03a.png"; $icon_red = "LastenradBay_Standortpfeil_rot_03a.png"; diff --git a/copri4/main/src/Tpl/Liste3.pm b/copri4/main/src/Tpl/Liste3.pm index eb5a51e..d13f487 100755 --- a/copri4/main/src/Tpl/Liste3.pm +++ b/copri4/main/src/Tpl/Liste3.pm @@ -483,12 +483,13 @@ sub tpl(){ 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},""); + #$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}); + #$bw->log("return2copri",$return2copri->{stations},""); + $tk->sigstation_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); diff --git a/copri4/main/src/scripts/Ilockauth.class b/copri4/main/src/scripts/Ilockauth.class index 4a2ad72..c871a75 100755 Binary files a/copri4/main/src/scripts/Ilockauth.class and b/copri4/main/src/scripts/Ilockauth.class differ diff --git a/copri4/main/src/scripts/Ilockauth.java b/copri4/main/src/scripts/Ilockauth.java index 0e05944..47a4ac2 100755 --- a/copri4/main/src/scripts/Ilockauth.java +++ b/copri4/main/src/scripts/Ilockauth.java @@ -21,7 +21,7 @@ public class Ilockauth { //System.out.println("Opened database successfully"); stmt = c.createStatement(); - ResultSet rs = stmt.executeQuery( "SELECT * FROM content where barcode=" + bike_id + ";" ); + ResultSet rs = stmt.executeQuery( "SELECT * FROM content where barcode=" + bike_id + " and int11=2;" ); while ( rs.next() ) { byte[] randomNum = new byte[16]; diff --git a/copri4/main/src/scripts/Ilockkeygen.class b/copri4/main/src/scripts/Ilockkeygen.class index 6477d52..cbff239 100755 Binary files a/copri4/main/src/scripts/Ilockkeygen.class and b/copri4/main/src/scripts/Ilockkeygen.class differ diff --git a/copri4/main/src/scripts/Ilocktestauth.pl b/copri4/main/src/scripts/Ilocktestauth.pl index 5467597..2cb5567 100755 --- a/copri4/main/src/scripts/Ilocktestauth.pl +++ b/copri4/main/src/scripts/Ilocktestauth.pl @@ -13,7 +13,7 @@ BEGIN { $syshost = $ARGV[0] || exit 1; } -use lib "/var/www/copri4/$syshost/src"; +use lib "/var/www/copri-bike/$syshost/src"; my $dbname = $ARGV[1] || ""; my $bike = $ARGV[2] || ""; @@ -31,7 +31,7 @@ my %varenv = $cf->envonline("$syshost"); my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; -my @K_select = `cd /var/www/copri4/$varenv{syshost}/src/scripts && export CLASSPATH='.:/usr/share/java:/usr/share/java/postgresql.jar' && java Ilockauth $dbname $bike`; +my @K_select = `cd /var/www/copri-bike/$varenv{syshost}/src/scripts && export CLASSPATH='.:/usr/share/java:/usr/share/java/postgresql.jar' && java Ilockauth $dbname $bike`; foreach(@K_select){ my ($K_key,$K_val) = split(/ = /, $_); $K_val =~ s/\n//g; diff --git a/copri4/shareeapp-operator/src/Lib/Mlogic.pm b/copri4/shareeapp-operator/src/Lib/Mlogic.pm index 1cdf6db..33edc99 100755 --- a/copri4/shareeapp-operator/src/Lib/Mlogic.pm +++ b/copri4/shareeapp-operator/src/Lib/Mlogic.pm @@ -43,9 +43,9 @@ sub tpl(){ my $coo = $q->cookie('domcookie') || $q->param('sessionid') || ""; #my $api_test = "sharee_fr01"; my $bike="FR1538"; - my $api_test = "sharee_fr01"; my $bike="FR1005";#E-Lastenrad (bike_group=300101, bike_node=300102) + #my $api_test = "sharee_fr01"; my $bike="FR1005";#E-Lastenrad (bike_group=300101, bike_node=300102) #my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test - #my $api_test = "sharee_kn"; my $bike="KN205"; + my $api_test = "sharee_kn"; my $bike="KN205"; #my $api_test = "sharee_wue"; my $bike="WUE5525"; #my $api_test = "sharee_sx"; my $bike="S3X1001"; #my $api_test = "sharee_ren"; my $bike="REN2";