mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-07-01 11:46:49 +02:00
fixing some file links and creating standard dirs. Moving Service-Tour setup to DMS-Account
This commit is contained in:
parent
d6292aa09d
commit
bf83052322
51 changed files with 1275 additions and 436 deletions
|
@ -1256,7 +1256,10 @@ sub booking_update(){
|
|||
$update_cc->{txt13} = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}";
|
||||
|
||||
#return after booking_update
|
||||
#in real, we know freed accountable rentals only on rental end's
|
||||
$pri->count_freedrental($q,$varenv,$auth->{c_id},$record_pos);
|
||||
my ($pricing,$counting) = $pri->counting_rental(\%varenv,$record_pos);
|
||||
|
||||
#int03 only used for tarif counting backwards compatibility
|
||||
$update_pos->{int03} = "$pricing->{computed_hours}" if(looks_like_number($pricing->{computed_hours}));
|
||||
$update_pos->{int38} = "$counting->{int38}" if(looks_like_number($counting->{int38}));
|
||||
|
@ -1264,8 +1267,6 @@ sub booking_update(){
|
|||
$update_pos->{int40} = "$counting->{int40}" if(looks_like_number($counting->{int40}));
|
||||
$update_pos->{int41} = "$counting->{int41}" if(looks_like_number($counting->{int41}));
|
||||
|
||||
#in real, we know freed accountable rentals only on rental end's
|
||||
$pri->count_freedrental($q,$varenv,$auth->{c_id},$update_pos);
|
||||
$rows_end = $dbt->update_record($dbh,$update_pos,$record_pos);
|
||||
|
||||
if($rows_end > 0){
|
||||
|
@ -1276,7 +1277,9 @@ sub booking_update(){
|
|||
|
||||
$geo_debug .= "Matching station: $stations_raw->{$id}->{barcode}|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $gps_data->{geo_distance} Meter\n";
|
||||
last;
|
||||
}else{
|
||||
}
|
||||
#out of geofence
|
||||
else{
|
||||
if($gps_data->{geo_distance} <= $geo_distance_next){
|
||||
$geo_distance_next = $gps_data->{geo_distance};
|
||||
$station_next = "$dbt->{operator}->{$varenv{dbname}}->{oprefix}$stations_raw->{$id}->{int04}";
|
||||
|
@ -1302,22 +1305,21 @@ sub booking_update(){
|
|||
|
||||
$rows_end = $dbt->update_record($dbh,$update_pos,$record_pos);
|
||||
|
||||
$geo_debug .= "Out of station distance: $stations_raw->{$id}->{int04}|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $geo_distance_next Meter ($geo_distance_next <= $gps_data->{geo_distance}) station_next: $station_next\n";
|
||||
|
||||
$booking_values->{response_state} = "Failure 2178: bike " . $q->param('bike') . " out of GEO fencing. $geo_distance_next meter distance to next station $station_next .";
|
||||
$booking_values->{response_text} = "Achtung! Ihr aktueller Standort liegt außerhalb einer Fahrradstation. Die Miete Fahrrad Nr. " . $q->param('bike') . " kann nicht $state_text werden. $geo_distance_next Meter Entfernung zur nächsten Station $station_next . Falls Sie sich doch an einer Station befinden, dann wiederholen Sie \"Miete beenden\".";
|
||||
$geo_debug .= "Out of station distance: $stations_raw->{$id}->{int04}|rows_end:$rows_end|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $geo_distance_next Meter ($geo_distance_next <= $gps_data->{geo_distance}) station_next: $station_next\n";
|
||||
|
||||
if($record_pos->{int42} == 1){
|
||||
$booking_values->{response_state} = "Failure 2179: bike " . $q->param('bike') . " out of GEO fencing. $geo_distance_next meter distance to A-A station $station_next .";
|
||||
$booking_values->{response_text} = "Achtung! Dieses Mietrad darf nur an der Station zurück gegeben werden an der es ausgeliehen wurde. Die Miete zu Rad " . $q->param('bike') . " kann nicht $state_text werden. $geo_distance_next Meter Entfernung zur A-A Station $station_next . Falls Sie sich doch an der Station befinden, dann wiederholen Sie \"Miete beenden\".";
|
||||
}else{
|
||||
$booking_values->{response_state} = "Failure 2178: bike " . $q->param('bike') . " out of GEO fencing. $geo_distance_next meter distance to next station $station_next .";
|
||||
$booking_values->{response_text} = "Achtung! Ihr aktueller Standort liegt außerhalb einer für das Mietende freigegebenen Radstation. Die Miete zu Rad " . $q->param('bike') . " kann nicht $state_text werden. $geo_distance_next Meter Entfernung zur nächsten Station $station_next . Falls Sie sich doch an einer Station befinden, dann wiederholen Sie \"Miete beenden\".";
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$geo_debug .= "ERROR no station GPS: $stations_raw->{$id}->{int04}|$gps_data->{latitude},$gps_data->{longitude},$latitude_station,$longitude_station --> $gps_data->{geo_distance} Meter\n";
|
||||
}
|
||||
}
|
||||
#$geo_distance_next == 100000 defaults to if no station in stations_raw
|
||||
if($record_pos->{int42} == 0 && !$rows_end && $geo_distance_next == 100000){
|
||||
$geo_distance_next = "undefined";
|
||||
$booking_values->{response_state} = "Failure 2244: this bike not accepted on A-A station, state change forbidden.";
|
||||
$booking_values->{response_text} = "Ein Mietende mit diesem Rad ist an dieser Station nicht erlaubt, da es sich hier um eine sog. A-A Station handelt. An A-A Stationen dürfen nur Mieträder zurück gegeben werden die von dort gemietet wurden.";
|
||||
}
|
||||
$booking_values->{geo_distance} = "$geo_distance_next";
|
||||
#print "$geo_debug\n";
|
||||
$bw->log("GEOfencing geo_debug:$geo_debug",$q,"");
|
||||
|
@ -2540,10 +2542,10 @@ sub fetch_tariff(){
|
|||
#shareetool user_tour
|
||||
if($auth_operator->{c_id} && $merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{id} && $dbt->{merchant_ids}->{$merchant_id}->{id} == 187){
|
||||
my $users_serviceapp = $dbt->select_users($dbh,$auth_operator->{c_id},"and int09=1");
|
||||
if($users_serviceapp->{int09}){
|
||||
$auth_operator->{txt18} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g;
|
||||
@user_tour = ($auth_operator->{txt18});
|
||||
@user_tour = split(/\s/,$auth_operator->{txt18}) if($auth_operator->{txt18} =~ /\s/);
|
||||
if($users_serviceapp->{int09} && $users_serviceapp->{txt07}){
|
||||
$users_serviceapp->{txt07} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g;
|
||||
@user_tour = ($users_serviceapp->{txt07});
|
||||
@user_tour = split(/\s/,$users_serviceapp->{txt07}) if($users_serviceapp->{txt07} =~ /\s/);
|
||||
}
|
||||
}#end user_tour
|
||||
|
||||
|
@ -2557,7 +2559,7 @@ sub fetch_tariff(){
|
|||
}
|
||||
#else select all available user tarif entries
|
||||
$tariff_all = $dbt->fetch_record($dbh,$tariff);
|
||||
$bw->log("$dbname Tariff type for operator registered user with Tarif $auth_operator->{txt30} by int18:$tariff->{int18} select 4:",$tariff_all,"");
|
||||
$bw->log("$dbname Tariff type for operator registered user with Tarif in txt30:$auth_operator->{txt30} with s-type int18:$tariff->{int18} select 4:",$auth_operator->{txt30},"");
|
||||
}
|
||||
#end operators address
|
||||
else{
|
||||
|
@ -3065,7 +3067,6 @@ sub authorization(){
|
|||
$pass_name =~ s/\s//g;
|
||||
my $pwmd5=md5_hex($pass_name) || "";
|
||||
my $pwsha256=sha256_base64($pwmd5) || "";
|
||||
#$authref->{txt11} = "$pwmd5";
|
||||
$authref->{txt04} = "$pwsha256";
|
||||
|
||||
#Servicetool, only users with users.int09=1
|
||||
|
|
|
@ -151,7 +151,7 @@ sub update_operatorsloop {
|
|||
delete $record_primary->{txt30};#tarifs
|
||||
delete $record_primary->{txt15};#Bonusnr
|
||||
delete $record_primary->{int07};#Rabatt
|
||||
delete $record_primary->{txt18};#Service tour
|
||||
delete $record_primary->{int09};#Service App staff
|
||||
delete $record_primary->{int16};#payone-cron-interval
|
||||
delete $record_primary->{int19};#Ilockit Admin
|
||||
#delete $record_primary->{int05};#Web-Login
|
||||
|
@ -1049,9 +1049,9 @@ sub insert_contentoid {
|
|||
delete $insert->{txt17};#operators
|
||||
delete $insert->{txt30};#tarifs
|
||||
delete $insert->{txt15};#Bonusnr
|
||||
delete $insert->{int07};#Rabatt
|
||||
delete $insert->{txt18};#Service tour
|
||||
delete $insert->{int05};#Web-Login
|
||||
delete $insert->{int07};#Rabatt
|
||||
delete $insert->{int09};#Service App staff
|
||||
delete $insert->{int16};#payone-cron-interval
|
||||
delete $insert->{int19};#Ilockit Admin
|
||||
#delete $insert->{int12};#Vde (remove delete for global setting)
|
||||
|
@ -1454,7 +1454,7 @@ sub insert_pos(){
|
|||
my $user_name = $ctadr->{txt01};
|
||||
$user_name = $ctadr->{txt08} if(!$user_name || $user_name eq "no name");
|
||||
my $staff = 0;
|
||||
$staff = 1 if($ctadr->{txt18});#service staff (no sms message)
|
||||
$staff = 1 if($ctadr->{int09});#service staff (no sms message)
|
||||
|
||||
my $deviceId = $ct->{int13} || 0;
|
||||
my $bike_charge = $ct->{int19} || 0;
|
||||
|
|
|
@ -345,7 +345,7 @@ sub handler {
|
|||
}elsif(($R::u_id || $R::c_idadr) && $R::base_edit =~ /_dmsusers/){
|
||||
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");
|
||||
$feedb = $tk->manage_dmsusers($q,\%varenv,$R::base_edit,$u_id,$users_dms);
|
||||
$feedb = $pl->manage_dmsusers($q,\%varenv,$R::base_edit,$u_id,$users_dms);
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"DMS-Account\" verweigert.";
|
||||
|
|
|
@ -380,7 +380,6 @@ sub captureCC_main {
|
|||
#txt16=txid must be copied from last captured invoice.
|
||||
#int01 sum must be set!
|
||||
#sequenz = 2
|
||||
#sudo su www-data -c "./src/scripts/payone_post.pl tinkdms refund contenttrans '' 32332 2"
|
||||
sub refund {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
|
|
|
@ -51,6 +51,86 @@ my %varenv = $cf->envonline();
|
|||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $debug=1;
|
||||
|
||||
#insert/save/delete DMS users
|
||||
sub manage_dmsusers {
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $varenv = shift;
|
||||
my $base_edit = shift;
|
||||
my $u_id = shift;
|
||||
my $users_dms = shift || {};
|
||||
my $owner = $users_dms->{u_id} || 0;
|
||||
my $table = "users";
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $feedb = { message => "", i_rows => 0, u_rows => 0, d_rows => 0 };
|
||||
$bw->log("manage_dmsusers",$q,"");
|
||||
|
||||
my $dbh = "";
|
||||
my $adref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
c_id => "$u_id",
|
||||
};
|
||||
my $ctadr = $dbt->fetch_record($dbh,$adref);
|
||||
|
||||
#users have to be exist only if DMS activated
|
||||
my $uref = {
|
||||
table => "users",
|
||||
fetch => "one",
|
||||
u_id => "$u_id",
|
||||
};
|
||||
my $users = $dbt->fetch_tablerecord($dbh,$uref);
|
||||
|
||||
#datahash on update
|
||||
my $dmsusers = {
|
||||
table => "users",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
u_id => "$u_id",
|
||||
};
|
||||
if(ref($users) eq "HASH" && $users->{u_id} && (!$ctadr->{c_id} || $base_edit eq "delete_dmsusers")){
|
||||
$bw->log("delete DMS user from $varenv->{dbname}",$ctadr->{c_id},"");
|
||||
$feedb->{d_rows} = $dbt->delete_content($dbh,"users",$u_id);
|
||||
$dbt->update_one($dbh,$adref,"int07=null");
|
||||
$dbt->update_one($dbh,$adref,"int09=null");
|
||||
}elsif(ref($users) eq "HASH" && $users->{u_id} && $ctadr->{c_id} && $ctadr->{c_id} == $users->{u_id} && $base_edit eq "save_dmsusers"){
|
||||
$bw->log("update DMS user to $varenv->{dbname}",$ctadr->{c_id},"");
|
||||
foreach(@keywords){
|
||||
my $val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("$val");
|
||||
$valxx =~ s/^\s+//; $valxx =~ s/\s+$//;
|
||||
if($_ =~ /^int\d+/){
|
||||
$valxx =~ s/,/./g;
|
||||
$valxx = 0 if(!looks_like_number($valxx));# set to 0 for using == operator
|
||||
$feedb->{u_rows} = $dbt->update_one($dbh,$dmsusers,"$_=$valxx");
|
||||
if($_ eq "int09"){
|
||||
if($valxx == 1){
|
||||
$dbt->update_one($dbh,$adref,"int09=1");
|
||||
}else{
|
||||
$dbt->update_one($dbh,$adref,"int09=null");
|
||||
}
|
||||
}
|
||||
}elsif($_ =~ /^txt\d+/){
|
||||
my @val = $q->param($_);
|
||||
$valxx = $q->escapeHTML("@val");
|
||||
$feedb->{u_rows} = $dbt->update_one($dbh,$dmsusers,"$_='$valxx'");
|
||||
}
|
||||
}
|
||||
|
||||
}elsif($ctadr->{c_id} && !$users->{u_id} && $base_edit eq "new_dmsusers"){
|
||||
$bw->log("insert DMS user to $varenv->{dbname}",$ctadr->{c_id},"");
|
||||
$feedb->{i_rows} = $dbt->insert_users($dbh,$ctadr->{c_id},$owner);
|
||||
$dbt->update_one($dbh,$adref,"int07=100");
|
||||
}
|
||||
|
||||
return $feedb;
|
||||
}#end manage_dmsusers
|
||||
|
||||
|
||||
#insert content or contentuser
|
||||
sub new_content {
|
||||
my $self = shift;
|
||||
|
@ -1014,7 +1094,7 @@ sub set_usertarif {
|
|||
my $i = 0;
|
||||
my $dbh_operator = $dbt->dbconnect_extern($dbname);#operator connect
|
||||
|
||||
my $tariff_all = { barcode => 0, txt18 => 0};
|
||||
my $tariff_all = { barcode => 0, int18 => 0};
|
||||
my $tariff = {
|
||||
table => "content",
|
||||
fetch => "all",
|
||||
|
|
|
@ -151,7 +151,7 @@ sub counting_rental {
|
|||
my $rental_minute = $self->clock_minutes($computed_clock);
|
||||
|
||||
#if end_station == start_station and rental minutes < 5 minutes, then 0
|
||||
$rental_minute = 0 if($ctpos->{int04} == $ctpos->{int06} && $rental_minute && $rental_minute < 5);
|
||||
$rental_minute = 0 if($ctpos->{int04} && $ctpos->{int06} && $ctpos->{int04} == $ctpos->{int06} && $rental_minute && $rental_minute < 5);
|
||||
my $rental_minute_all = $rental_minute;
|
||||
|
||||
#init with some defaults
|
||||
|
|
|
@ -217,7 +217,6 @@ sub save_account(){
|
|||
$pw_dummy = "1";
|
||||
}elsif(length($valxx) >= 8){
|
||||
my $pwmd5 = md5_hex($valxx) || "";
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt11='$pwmd5'") if(length($pwmd5) > 20);
|
||||
my $pwsha256=sha256_base64($pwmd5) || "";
|
||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt04='$pwsha256'") if(length($pwsha256) > 20);
|
||||
}
|
||||
|
@ -244,12 +243,6 @@ sub save_account(){
|
|||
elsif($_ =~ /int07|int16|int19|int23/){
|
||||
$u_rows = $dbt->update_one("",$update_primary,"$_=$valxx");
|
||||
}
|
||||
#user_tour
|
||||
elsif($_ =~ /txt18/){
|
||||
my @txt18 = $q->param('txt18');
|
||||
@txt18 = grep {!/null/} @txt18;
|
||||
$u_rows = $dbt->update_one("",$update_primary,"$_='@txt18'");
|
||||
}
|
||||
#Text Sonstiges
|
||||
elsif($_ =~ /txt29/){
|
||||
$u_rows = $dbt->update_one("",$update_primary,"$_='$valxx'");
|
||||
|
@ -580,76 +573,6 @@ sub save_account(){
|
|||
return ($ret,$feedb);
|
||||
}#end save_account
|
||||
|
||||
#insert/save/delete DMS users
|
||||
sub manage_dmsusers {
|
||||
my $self = shift;
|
||||
my $q = shift;
|
||||
my $varenv = shift;
|
||||
my $base_edit = shift;
|
||||
my $u_id = shift;
|
||||
my $users_dms = shift || {};
|
||||
my $owner = $users_dms->{u_id} || 0;
|
||||
my $table = "users";
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $feedb = { message => "", i_rows => 0, u_rows => 0, d_rows => 0 };
|
||||
$bw->log("manage_dmsusers",$q,"");
|
||||
|
||||
my $dbh = "";
|
||||
my $adref = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
template_id => "202",
|
||||
c_id => "$u_id",
|
||||
};
|
||||
my $ctadr = $dbt->fetch_record($dbh,$adref);
|
||||
|
||||
#users have to be exist only if DMS activated
|
||||
my $uref = {
|
||||
table => "users",
|
||||
fetch => "one",
|
||||
u_id => "$u_id",
|
||||
};
|
||||
my $users = $dbt->fetch_tablerecord($dbh,$uref);
|
||||
|
||||
#datahash on update
|
||||
my $dmsusers = {
|
||||
table => "users",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
u_id => "$u_id",
|
||||
};
|
||||
|
||||
if(ref($users) eq "HASH" && $users->{u_id} && (!$ctadr->{c_id} || $base_edit eq "delete_dmsusers")){
|
||||
$bw->log("delete DMS user from $varenv->{dbname}",$ctadr->{c_id},"");
|
||||
$feedb->{d_rows} = $dbt->delete_content($dbh,"users",$u_id);
|
||||
$dbt->update_one($dbh,$adref,"int07=null");
|
||||
}elsif(ref($users) eq "HASH" && $users->{u_id} && $ctadr->{c_id} && $ctadr->{c_id} == $users->{u_id} && $base_edit eq "save_dmsusers"){
|
||||
$bw->log("update DMS user to $varenv->{dbname}",$ctadr->{c_id},"");
|
||||
foreach(@keywords){
|
||||
my $val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("$val");
|
||||
$valxx =~ s/^\s+//; $valxx =~ s/\s+$//;
|
||||
if($_ =~ /^int\d+/){
|
||||
$valxx =~ s/,/./g;
|
||||
#$valxx = "null" if(!looks_like_number($valxx));#empty
|
||||
$valxx = 0 if(!looks_like_number($valxx));# set to 0 for using == operator
|
||||
$feedb->{u_rows} = $dbt->update_one($dbh,$dmsusers,"$_=$valxx");
|
||||
}
|
||||
}
|
||||
|
||||
}elsif($ctadr->{c_id} && !$users->{u_id} && $base_edit eq "new_dmsusers"){
|
||||
$bw->log("insert DMS user to $varenv->{dbname}",$ctadr->{c_id},"");
|
||||
$feedb->{i_rows} = $dbt->insert_users($dbh,$ctadr->{c_id},$owner);
|
||||
$dbt->update_one($dbh,$adref,"int07=100");
|
||||
}
|
||||
|
||||
return $feedb;
|
||||
}
|
||||
|
||||
|
||||
#coupon alias Gutschein
|
||||
sub save_transact(){
|
||||
my $self = shift;
|
||||
|
@ -846,7 +769,6 @@ sub send_password(){
|
|||
my $pwmd5 = md5_hex($coo) || "";
|
||||
|
||||
if($email && $email =~ /\w\@\w/ && $pwmd5 && length($pwmd5) > 20 && $email !~ /$dbt->{copri_conf}->{test_accounts}/i){
|
||||
$db->updater("contentadr","1","1","txt11","$pwmd5","$owner","txt08","ilike","$email");
|
||||
my $pwsha256=sha256_base64($pwmd5) || "";
|
||||
$db->updater("contentadr","1","1","txt04","$pwsha256","$owner","txt08","ilike","$email");
|
||||
system(`$varenv{basedir}/src/Mod/newsletter_tink.pl "$varenv{basedir}" "$varenv{wwwhost}" "send_password" "$email" "$coo"`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue