diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index 3fb764e..ec89400 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -550,7 +550,7 @@ sub service_update(){ }; my $record_pos = $dbt->fetch_tablerecord($dbh,$pref_pos) if($c_id); if($record_pos->{txt01} ne "NaN"){ - $update->{$key} = $q->escapeHTML($q->param('work_val')) . " " . $record_pos->{txt01}; + $update->{$key} = $q->escapeHTML($q->param('work_val')) . " " . $record_pos->{txt01} if($record_pos->{txt01} !~ /::erledigt::/); }else{ $update->{$key} = $q->escapeHTML($q->param('work_val')); } @@ -779,6 +779,7 @@ sub booking_update(){ my $owner = shift || 0; my $state = $q->escapeHTML($q->param('state')) || ""; my $lock_state = $q->escapeHTML($q->param('lock_state')) || ""; + my $station_state = $q->escapeHTML($q->param('station_state')) || ""; my %varenv = $cf->envonline(); my $rows = 0; my $user_agent = $q->user_agent(); @@ -801,6 +802,7 @@ sub booking_update(){ bike => "$bike", state => "", lock_state => "", + station_state => "", co2saving => "", response_state => "OK 1017: No update", response_text => "Es wurden keine Daten aktualisiert", @@ -960,7 +962,9 @@ sub booking_update(){ $geo_distance = $lb->geo_fencing($latitude,$longitude,$latitude_station,$longitude_station); #$station_next = $stations_raw->{$id}->{int04}; - if($geo_distance <= $stations_raw->{$id}->{int06}){ + #if($geo_distance <= $stations_raw->{$id}->{int06}){ + #sigo development workaround without geofence + if(($geo_distance <= $stations_raw->{$id}->{int06}) || ($record_pos->{int11} == 3)){ $geo_distance_next = $geo_distance; #end-Station $update_pos->{int04} = "$stations_raw->{$id}->{int04}"; @@ -1169,12 +1173,13 @@ sub booking_update(){ $booking_values->{response_text} = "Abschließen von Fahrrad Nr. " . $q->param('bike') . " bestätigt"; } }elsif($lock_state eq "unlocked"){ + #int11=system >= 3 (sigo) with station_lock #int30=Station Id #int31=Slot Id #int27=velofactur bike Id - if($record_cc->{int30} && $record_cc->{int31} && $record_cc->{int27}){ - $bw->log("unlock velofactur station lock with: '$record_cc->{int30}' '$record_cc->{int31}' '$record_cc->{int27}' 'Freigeben' '$record_pos->{c_id}'","",""); - system(`$varenv{basedir}/src/scripts/velofaktur_client.pl $varenv{syshost} post_velo "$record_cc->{int30}" "$record_cc->{int31}" "$record_cc->{int27}" "Freigeben" "$record_pos->{c_id}"`); + if($record_cc->{int11} && $record_cc->{int11} >=3 && $record_cc->{int30} && $record_cc->{int31} && $record_cc->{int27}){ + $bw->log("unlock station lock with: '$record_cc->{int30}' '$record_cc->{int31}' '$record_cc->{int27}' 'Freigeben' '$record_pos->{c_id}'","",""); + #system(`$varenv{basedir}/src/scripts/velofaktur_client.pl $varenv{syshost} post_velo "$record_cc->{int30}" "$record_cc->{int31}" "$record_cc->{int27}" "Freigeben" "$record_pos->{c_id}"`); } $lock_value = 2; $update_cc->{int20} = "$lock_value"; diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm index de0022a..785098f 100755 --- a/copri4/main/src/Mod/DBtank.pm +++ b/copri4/main/src/Mod/DBtank.pm @@ -1079,7 +1079,7 @@ sub collect_transpos { $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 is $search->{$key}" if($key eq "int34" && $search->{$key} eq "null"); + $where .= " and (cp.$key is $search->{$key} OR cp.$key = 0)" if($key eq "int34" && $search->{$key} eq "null"); } $where .= " ORDER BY cp.end_time $updown LIMIT $search->{limit} OFFSET $search->{offset}" if($search->{limit}); diff --git a/copri4/main/src/Mod/NodeEdit.pm b/copri4/main/src/Mod/NodeEdit.pm index 71ec02b..ffff0b6 100755 --- a/copri4/main/src/Mod/NodeEdit.pm +++ b/copri4/main/src/Mod/NodeEdit.pm @@ -60,8 +60,6 @@ sub admin_tpl(){ my $change = $lb->time4de($node_meta->{change},"1") if($node_meta->{change}); my $subid = $1 if($node_meta->{main_id} =~ /^(\d)/); - my $ctf = $db->get_content1("contentuser",$dbt->{shareedms_conf}->{parent_id}); - #Node templates my $tpl_id = 97;#Standard for CMS #Selektierbare Tabellen Layout templates @@ -79,7 +77,6 @@ sub admin_tpl(){ $tpl_lists4selection = 210; }else{ $tpl_lists4selection = "224,226,227,228,229"; - #$tpl_lists4selection .= "," . $ctf->{txt35} if($ctf->{txt35});#pos tpl-id's } }elsif($node_meta->{ct_table} eq "contenttrans"){ $tpl_id = "101"; @@ -89,8 +86,7 @@ sub admin_tpl(){ $tpl_lists4selection = "221,222"; }elsif($node_meta->{ct_table} eq "contentadr" || $node_meta->{ct_table} eq "contentadrpos"){ $tpl_id = "101"; - $tpl_lists4selection = $ctf->{txt38}; - $tpl_lists4selection .= "," . $ctf->{txt31} if($ctf->{txt31});#pos tpl-id's + $tpl_lists4selection = "401,402,403"; } #Defaults to tpl_id=97 diff --git a/copri4/main/src/Tpl/Liste3.pm b/copri4/main/src/Tpl/Liste3.pm index 0a4719c..012dca6 100755 --- a/copri4/main/src/Tpl/Liste3.pm +++ b/copri4/main/src/Tpl/Liste3.pm @@ -597,6 +597,7 @@ sub tpl(){ $s_hash = $dbt->{copri_conf}->{station_state} if($tpl_id == 225 && $key eq "int10"); $s_hash = $dbt->{copri_conf}->{lock_system} if($tpl_id == 205 && $key eq "int11"); $s_hash = $dbt->{copri_conf}->{sharing_type} if($tpl_id == 210 && $key eq "int18"); + #$s_hash = $dbt->{copri_conf}->{tariff_unit} if($tpl_id == 210 && $key eq "int01"); $s_hash = { 1 => 1, 2 => 2, 3 => 3, 4 => 4 } if($tpl_id == 225 && $key eq "txt07"); #while (my ($key, $value) = each %{ $s_hash }) { foreach my $s_key (sort keys (%{ $s_hash })) { @@ -1018,6 +1019,8 @@ sub tpl(){ print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style $colorize"},"$dbt->{copri_conf}->{lock_state}->{$ct4rel->{$id}->{$key}}"),"\n"; }elsif($ct4rel->{$id}->{template_id} == 205 && $key eq "int11"){#lock_system print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$dbt->{copri_conf}->{lock_system}->{$ct4rel->{$id}->{$key}}"),"\n"; + #}elsif($ct4rel->{$id}->{template_id} == 210 && $key eq "int01"){#tariff_unit + # print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$dbt->{copri_conf}->{tariff_unit}->{$ct4rel->{$id}->{$key}}"),"\n"; }elsif($ct4rel->{$id}->{template_id} == 210 && $key eq "int18"){#sharing_type print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style"},"$dbt->{copri_conf}->{sharing_type}->{$ct4rel->{$id}->{$key}}"),"\n"; }elsif($ct4rel->{$id}->{template_id} =~ /225|210/ && $key =~ /txt24|int12/){ diff --git a/copri4/main/src/Tpl/MandantConf.pm b/copri4/main/src/Tpl/MandantConf.pm index 619a71c..33bf964 100755 --- a/copri4/main/src/Tpl/MandantConf.pm +++ b/copri4/main/src/Tpl/MandantConf.pm @@ -100,6 +100,7 @@ sub tpl(){ $size = "60" if($key =~ /ct_name|txt|img/ && !$size); $ct->{$key} = $q->unescapeHTML("$ct->{$key}"); $ct->{$key} = $lb->newline($ct->{$key}); + $des .= " ($key)" if($users_dms->{u_id} eq $varenv{superu_id}); my $value = ""; if($R::config2edit){ if($size eq "area"){ @@ -122,16 +123,13 @@ sub tpl(){ $value = "$ct->{$key}"; } print $q->Tr(); - if($key =~ /header01/){ - print $q->td({-class=>'tdval2',-colspan=>'2'},$q->b("
$dbt->{operator}->{$varenv{dbname}}->{project} $dbt->{operator}->{$varenv{dbname}}->{oprefix} $dbt->{operator}->{$varenv{dbname}}->{database}->{dbname}")),"\n"; - }elsif($key =~ /header/){ - print $q->td({-class=>'tdval2',-colspan=>'2'},$q->b("
$des")),"\n"; - }elsif($users_dms->{u_id} eq $varenv{superu_id}){ - print $q->td({-class=>'tdescr2'},"$des ($key)"),"\n"; + if($key =~ /ct_name/){ + print $q->td({-class=>'tdescr2'}, ""),"\n"; + print $q->td({-class=>'tdval2'},"Project: $dbt->{operator}->{$varenv{dbname}}->{project} | Prefix: $dbt->{operator}->{$varenv{dbname}}->{oprefix} | DB: $dbt->{operator}->{$varenv{dbname}}->{database}->{dbname}"),"\n"; }else{ print $q->td({-class=>'tdescr2'},"$des"),"\n"; + print $q->td({-class=>'tdval2'}, "$value"),"\n"; } - print $q->td({-class=>'tdval2'}, "$value"),"\n" if($key !~ /header/); } print $q->end_table; print $q->end_form; diff --git a/copri4/main/src/scripts/Ilockit_CSV2DB.pl b/copri4/main/src/scripts/Ilockit_CSV2DB.pl index 5acf02d..1beb57b 100755 --- a/copri4/main/src/scripts/Ilockit_CSV2DB.pl +++ b/copri4/main/src/scripts/Ilockit_CSV2DB.pl @@ -47,7 +47,7 @@ my $dbt = new DBtank; my $lang = "de"; my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; my $dbh = ""; -my $main_id = 300101;#TODO Lastenrad Flotten ID +my $main_id = 300103;#TODO Flotten ID my $template_id = 205; ### @@ -96,8 +96,8 @@ my $template_id = 205; int10 => "5",#defect int11 => "2",#Ilockit int20 => "2",#unlocked - txt01 => "Lastenrad neu", #Bezeichnung #TODO - txt04 => "aus Lieferung vom 08.03.2022", #Besonderheiten + txt01 => "Mietrad neu", #Bezeichnung #TODO + txt04 => "", #Besonderheiten txt15 => "", #Firmware txt17 => "", #GUID from APP txt23 => "$csv->{$id}->{c1} $csv->{$id}->{c2} $csv->{$id}->{c3} $csv->{$id}->{c4} $csv->{$id}->{c5} $csv->{$id}->{c6}", diff --git a/copri4/main/src/scripts/tests/index.pl b/copri4/main/src/scripts/tests/index.pl index fb872c6..7066e9d 100755 --- a/copri4/main/src/scripts/tests/index.pl +++ b/copri4/main/src/scripts/tests/index.pl @@ -153,9 +153,23 @@ print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_m print $q->div({-style=>'margin:15px;'}," "),"\n"; #config my $uriop = "$dbt->{operator}->{$operator_key}->{operatorApp}/APIjsonserver"; -my $bike = "FR1003"; +my $bike = "FR1006"; my $latitude = "47.927738"; my $longitude = "7.973855"; +my $system = "Ilockit"; +my $and_station_state_locking = ""; +my $and_station_state_locked = ""; +my $and_station_state_unlocked = ""; + +#sigo test lock +if(1==1){ + $bike = "FR1006"; + $system = "sigo"; + #$and_station_state_locking = "&station_state=locking"; + #$and_station_state_locked = "&station_state=locked"; + #$and_station_state_unlocked = "&station_state=unlocked"; +} + if($operator_key eq "sharee_kn"){ $bike = "KN259"; $latitude = "47.66267"; @@ -169,20 +183,20 @@ print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$bookin my $booking_update_cancel = "$uriop?request=booking_update&bike=$bike&state=canceled&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_cancel"},"[ booking_update_cancel ]---> $booking_update_cancel")),"\n"; -my $booking_update_locking = "$uriop?request=booking_update&bike=$bike&lock_state=locking&authcookie=$coo"; +my $booking_update_locking = "$uriop?request=booking_update&bike=$bike&lock_state=locking$and_station_state_locking&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locking"},"[ booking_update_locking ]---> $booking_update_locking")),"\n"; -my $booking_update_locked = "$uriop?request=booking_update&bike=$bike&lock_state=locked&authcookie=$coo"; +my $booking_update_locked = "$uriop?request=booking_update&bike=$bike&lock_state=locked$and_station_state_locked&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locked"},"[ booking_update_locked ]---> $booking_update_locked")),"\n"; -my $booking_update_unlocked = "$uriop?request=booking_update&bike=$bike&lock_state=unlocked&voltage=39&authcookie=$coo"; +my $booking_update_unlocked = "$uriop?request=booking_update&bike=$bike&lock_state=unlocked$and_station_state_unlocked&voltage=39&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_unlocked"},"[ booking_update_unlocked ]---> $booking_update_unlocked")),"\n"; -my $booking_update_oc_ul = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocked&authcookie=$coo"; +my $booking_update_oc_ul = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocked$and_station_state_unlocked&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_oc_ul"},"[ booking_update_oc_ul ]---> $booking_update_oc_ul")),"\n"; -my $booking_request_oc_ul = "$uriop?request=booking_request&bike=$bike&state=occupied&lock_state=unlocked&authcookie=$coo"; +my $booking_request_oc_ul = "$uriop?request=booking_request&bike=$bike&state=occupied&lock_state=unlocked$and_station_state_unlocked&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request_oc_ul"},"[ booking_request_oc_ul ]---> $booking_request_oc_ul")),"\n"; -my $booking_update_av_lo = "$uriop?request=booking_update&bike=$bike&state=available&lock_state=locked&latitude=$latitude&longitude=$longitude&gps_age=300&user_device_manufaturer=samsung)&user_device_model=SM-G398FN&user_device_platform=Android&user_device_version=10&user_device_id=90af86831c10374d&authcookie=$coo"; +my $booking_update_av_lo = "$uriop?request=booking_update&bike=$bike&state=available&lock_state=locked$and_station_state_locked&latitude=$latitude&longitude=$longitude&gps_age=300&user_device_manufaturer=samsung)&user_device_model=SM-G398FN&user_device_platform=Android&user_device_version=10&user_device_id=90af86831c10374d&authcookie=$coo"; print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_av_lo"},"[ booking_update_av_lo ]---> $booking_update_av_lo")),"\n"; my $user_feedback = "$uriop?request=user_feedback&bike=$bike&bike_broken=1&message=testnachricht äöü&authcookie=$coo"; diff --git a/copri4/shareedms-operator/src/Lib/Mlogic.pm b/copri4/shareedms-operator/src/Lib/Mlogic.pm index 181ce2d..d7f566a 100755 --- a/copri4/shareedms-operator/src/Lib/Mlogic.pm +++ b/copri4/shareedms-operator/src/Lib/Mlogic.pm @@ -191,7 +191,7 @@ sub tpl(){ print "
  • \n"; my $lmenu1; foreach my $id1 (sort {$node1->{$a}->{n_sort} <=> $node1->{$b}->{n_sort}} keys (%$node1)){ - if(($node1->{$id1}->{node_name} !~ /Firma|System/) || ($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id})){ + if($node1->{$id1}->{node_name} !~ /Firma|System|Servicetechnik/){ my $node2 = $db->collect_noderel($node1->{$id1}->{main_id},$lang,$users_dms->{u_id}); $mclass = ""; $mstyle = "";