diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm
index 6f40a9a..2904c4d 100755
--- a/copri4/main/src/Mod/APIfunc.pm
+++ b/copri4/main/src/Mod/APIfunc.pm
@@ -1186,7 +1186,8 @@ sub booking_update(){
my $geo_distance_next = 100000;
my $station_next = 0;
my $geo_debug="";
- my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth);
+ my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth,$record_pos);
+
foreach my $id (sort { $stations_raw->{$a}->{barcode} <=> $stations_raw->{$b}->{barcode} } keys (%$stations_raw)){
my $latitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /^(\d+\.\d+)/);
my $longitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /(\d+\.\d+)$/);
@@ -1376,7 +1377,7 @@ sub booking_update(){
#geofencing for Ilockit
my $geo_distance_next = $geo_distance;
my $geo_debug="";
- my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth);
+ my ($stations,$stations_raw) = $self->stations_available($q,$varenv,$auth,$record_pos);
foreach my $id (sort { $stations_raw->{$a}->{barcode} <=> $stations_raw->{$b}->{barcode} } keys (%$stations_raw)){
my $latitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /^(\d+\.\d+)/);
my $longitude_station = $1 if($stations_raw->{$id}->{txt06} =~ /(\d+\.\d+)$/);
@@ -1935,6 +1936,12 @@ sub stations_available(){
my $q = shift || "";
my $varenv = shift;
my $auth = shift || "";
+ my $record_pos = shift || {};
+
+ my $station_group = "";
+ $station_group = $record_pos->{int12} if(ref($record_pos) eq "HASH" && $record_pos->{int12});
+
+ $bw->log("stations_available by station_group: $station_group",$record_pos,"");
my $authed = 0;
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
@@ -1949,12 +1956,19 @@ sub stations_available(){
int10 => "1",#1 = "available"
};
+ #group_id must have 6 numbers like 300103
my $pref_sql = "";
$pref_sql .= " and (";
foreach(@{$bike_group}){
- if($_ =~ /(\d+)/){
- $pref_sql .= " ct.txt24 like '%$1%' OR";
+ if($station_group && $_ =~ /(\d+)/){
+ my $group_id = $1;
+ if($group_id == $station_group){
+ $pref_sql .= " ct.txt24 like '%$group_id%' OR";
}
+ }elsif($_ =~ /(\d+)/){
+ my $group_id = $1;
+ $pref_sql .= " ct.txt24 like '%$group_id%' OR";
+ }
}
$pref_sql =~ s/OR$//;
$pref_sql .= ")";
diff --git a/copri4/main/src/Mod/APIjsonserver.pm b/copri4/main/src/Mod/APIjsonserver.pm
index 441f6c8..b9c52f8 100755
--- a/copri4/main/src/Mod/APIjsonserver.pm
+++ b/copri4/main/src/Mod/APIjsonserver.pm
@@ -715,7 +715,7 @@ elsif($q->param('request') eq "stations_available"){
($response->{stations},my $return2copri->{stations}) = $si->sig_available($q,\%varenv,$authraw);
$tk->sigstation_cupdate($return2copri->{stations});
}else{
- ($response->{stations}, my $response_raw) = $apif->stations_available($q,\%varenv,$authraw);
+ ($response->{stations}, my $response_raw) = $apif->stations_available($q,\%varenv,$authraw,"");
}
}
}
diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm
index 7f0224a..3c1c5ba 100755
--- a/copri4/main/src/Mod/DBtank.pm
+++ b/copri4/main/src/Mod/DBtank.pm
@@ -1111,7 +1111,7 @@ sub collect_transpos {
$where .= " and cp.$key = $search->{$key}" if($key eq "int20" && looks_like_number($search->{$key}));#lock_state
$where .= " and cp.$key = $search->{$key}" if($key eq "barcode" && looks_like_number($search->{$key}));
$where .= " and cp.$key = $search->{$key}" if($key eq "int12" && looks_like_number($search->{$key}));#bike_group
- $where .= " and cp.$key = $search->{$key}" if($key eq "owner" && looks_like_number($search->{$key}));
+ $where .= " and (cp.$key = $search->{$key} OR cp.owner_end = $search->{$key})" if($key eq "owner" && looks_like_number($search->{$key}));
$where .= " and (cp.$key is $search->{$key} OR cp.$key = 0)" if($key eq "int34" && $search->{$key} eq "null");
}
diff --git a/copri4/main/src/Mod/Shareework.pm b/copri4/main/src/Mod/Shareework.pm
index ae5bddf..4f8c426 100755
--- a/copri4/main/src/Mod/Shareework.pm
+++ b/copri4/main/src/Mod/Shareework.pm
@@ -638,14 +638,6 @@ sub save_transact(){
};
my $ctadr = $dbt->fetch_record($dbh,$authref);
- my $update_primary = {
- table => "contentadr",
- mtime => "now()",
- owner => "$owner",
- c_id => "$c_id",
- };
-
-
my $pos_id="";
my $ret;
my $fkeys;
@@ -688,6 +680,28 @@ sub save_transact(){
$ctadr_operator = $dbt->fetch_record($dbh_operator,$authref);
if(!$ctadr_operator->{c_id}){
+
+ my %operator_hash = ();
+ if($ctadr->{txt17} && $ctadr->{txt17} =~ /\w\s\w/){#append DB's
+ %operator_hash = map { $_ => 1 } split(/\s+/,$ctadr->{txt17});
+ }elsif($ctadr->{txt17}){
+ $operator_hash{$ctadr->{txt17}} = 1;
+ }
+ $operator_hash{$operator_conf->{database}->{dbname}} = 1;
+ my @operator_array = keys %operator_hash;
+
+ $bw->log("save_transact update operator keys by array: @operator_array",\%operator_hash,"");
+ print FILE "save_transact update operator keys by array: @operator_array | pri $ctadr->{c_id}\n" if($debug);
+
+ my $update_primary = {
+ table => "contentadr",
+ txt17 => "@operator_array",#operator ids
+ txt19 => "$operator_conf->{database}->{dbname}",
+ atime => "now()",
+ owner => "198",#update initiated by primary
+ };
+ my $rows = $dbt->update_record($dbh,$update_primary,$ctadr);
+
print FILE "Gutschein oprefix address INSERT adr from record_primary to operator $operator_conf->{database}->{dbname} , c_id:$ctadr->{c_id}\n";
my $insert_op = {
%$ctadr,
diff --git a/copri4/main/src/Tpl/Calorin.pm b/copri4/main/src/Tpl/Calorin.pm
index 7286a0f..858b062 100755
--- a/copri4/main/src/Tpl/Calorin.pm
+++ b/copri4/main/src/Tpl/Calorin.pm
@@ -386,7 +386,7 @@ sub tpl(){
$pos_id = $q->div({-class=>"popup",-onclick=>"toggle_box('$pid')"},"$cttpos->{$pid}->{c_id}", $q->span({-class=>"popuptext",-id=>"$pid"},"$pos_details"));
my $txt26 = $cttpos->{$pid}->{txt26};
my $txt21 = $cttpos->{$pid}->{txt21};
- $txt26 = substr($cttpos->{$pid}->{txt26},0,20) . " ..." if(length($cttpos->{$pid}->{txt26}) > 20);
+ $txt26 = substr($cttpos->{$pid}->{txt26},0,25) . " ..." if(length($cttpos->{$pid}->{txt26}) > 20);
$txt21 = substr($cttpos->{$pid}->{txt21},0,50) . " ..." if(length($cttpos->{$pid}->{txt21}) > 50);
$user_device = "";
$user_device .= " → lock charge $cttpos->{$pid}->{int14} %" if($cttpos->{$pid}->{int14});
diff --git a/copri4/main/src/scripts/tests/index.pl b/copri4/main/src/scripts/tests/index.pl
index 7abf4be..eb6c458 100755
--- a/copri4/main/src/scripts/tests/index.pl
+++ b/copri4/main/src/scripts/tests/index.pl
@@ -38,20 +38,21 @@ my %varenv = $cf->envonline();
#$bike = "FR1002";
my $lang = "de";
- my $dyn_js = "
- function onLoad() {
- console.log('hallo');
-
- if ('geolocation' in navigator) {
- console.log('geon');
- /* geolocation funktioniert */
- } else {
- console.log('geoff');
- /* geolocation funktioniert NICHT */
- }
- \$( '#no_javascript' ).hide();
- }
- \n";
+ my $dyn_js = "";
+ #my $dyn_js = "
+ #function onLoad() {
+ # console.log('hallo');
+ #
+ # if ('geolocation' in navigator) {
+ # console.log('geon');
+ # /* geolocation funktioniert */
+ # } else {
+ # console.log('geoff');
+ # /* geolocation funktioniert NICHT */
+ # }
+ # \$( '#no_javascript' ).hide();
+ # }
+ # \n";
my $dyn_css = "";
my $local_style = "$varenv{metahost}/$dbt->{shareeapp_conf}->{local_style}";
@@ -69,7 +70,7 @@ my %varenv = $cf->envonline();
my $html5 = $q->start_html(
-title => "shareetest",
-lang => '',
- -onload => "onLoad();",
+ #-onload => "onLoad();",
-encoding => "utf-8",
-base => 'true',
-head => Link(
@@ -86,25 +87,28 @@ my %varenv = $cf->envonline();
'copyright' => "",
},
-script=>[
- {-language=>'JAVASCRIPT',
- -src=>"$jquery"},
- {-language=>'JAVASCRIPT',
- -src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_ui}"},
- {-language=>'JAVASCRIPT',
- -src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_resize}"},
- {-language=>'JAVASCRIPT',
- -src=>"$varenv{metahost}/$dbt->{copri_conf}->{jsscript}"},
+ #{-language=>'JAVASCRIPT',
+ #-src=>"$jquery"},
+ #{-language=>'JAVASCRIPT',
+ #-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_ui}"},
+ #{-language=>'JAVASCRIPT',
+ #-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_resize}"},
+ #{-language=>'JAVASCRIPT',
+ #-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jsscript}"},
+ #{-language=>'JAVASCRIPT',
+ #-src=>"https://unpkg.com/leaflet\@1.8.0/dist/leaflet.js"},
{-language=>'JAVASCRIPT',
-code=>"$dyn_js"}
],
-STYLE=>{
-code=>"$dyn_css",
- -src=>[
- "$local_style",
- "$style_bootstrap",
- "$varenv{metahost}/$dbt->{copri_conf}->{style_bootstrap_icons}",
- "$varenv{metahost}/$dbt->{copri_conf}->{style_jquery_ui}"
- ],
+ #-src=>[
+ #"$local_style",
+ #"$style_bootstrap",
+ #"$varenv{metahost}/$dbt->{copri_conf}->{style_bootstrap_icons}",
+ #"$varenv{metahost}/$dbt->{copri_conf}->{style_jquery_ui}"
+ #"https://unpkg.com/leaflet\@1.8.0/dist/leaflet.css"
+ #],
-verbatim=>"\@import url(\"$local_style\");",
-media=>'screen'
}
@@ -120,6 +124,49 @@ my $uri = "$dbt->{primary}->{sharee_primary}->{primaryApp}/APIjsonserver";
#print $q->div({-style=>'margin:15px;'},$q->a({-href=>"/src/scripts/tests/index.pl"},"[ index ]")),"\n";
print $q->div({-style=>'margin:15px;'},"sharee API tests", $q->b("operator_key: $operator_key | bike: $bike")),"\n";
+print<