mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-23 12:16:29 +01:00
Adding user-feedback mailing to hotline. freed-rental check on booking-request
This commit is contained in:
parent
000acb8e35
commit
b9b63c63e5
4 changed files with 44 additions and 24 deletions
|
@ -157,7 +157,7 @@ sub select_dmsusers {
|
||||||
}
|
}
|
||||||
|
|
||||||
#node_select
|
#node_select
|
||||||
sub template_select(){
|
sub template_select {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $node = shift;
|
my $node = shift;
|
||||||
my $return={};
|
my $return={};
|
||||||
|
@ -180,7 +180,7 @@ sub template_select(){
|
||||||
}#end node_select
|
}#end node_select
|
||||||
|
|
||||||
#Search one by key
|
#Search one by key
|
||||||
sub service_work_search(){
|
sub service_work_search {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $bike = shift || "";
|
my $bike = shift || "";
|
||||||
my $station = shift || "";
|
my $station = shift || "";
|
||||||
|
@ -401,9 +401,10 @@ sub service_select {
|
||||||
|
|
||||||
|
|
||||||
#service_insert
|
#service_insert
|
||||||
sub service_insert(){
|
sub service_insert {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
|
my $varenv = shift;
|
||||||
my $auth = shift;
|
my $auth = shift;
|
||||||
my $node_template = shift || "";
|
my $node_template = shift || "";
|
||||||
my $crecord = shift || {};
|
my $crecord = shift || {};
|
||||||
|
@ -472,7 +473,17 @@ sub service_insert(){
|
||||||
$insert_contentpos->{txt01} = $q->escapeHTML($q->param('message')) if($q->param('message'));
|
$insert_contentpos->{txt01} = $q->escapeHTML($q->param('message')) if($q->param('message'));
|
||||||
my $c_id_contentpos = $dbt->insert_contentoid($dbh,$insert_contentpos,"");
|
my $c_id_contentpos = $dbt->insert_contentoid($dbh,$insert_contentpos,"");
|
||||||
if($crecord_content->{fleed_email} && $crecord_content->{fleed_email} =~ /\w\@\w/){
|
if($crecord_content->{fleed_email} && $crecord_content->{fleed_email} =~ /\w\@\w/){
|
||||||
$mailtrans->mail_feedback2garage($crecord_content,$insert_contentpos);
|
$mailtrans->mail_feedback2garage($crecord_content->{fleed_email},$insert_contentpos);
|
||||||
|
}elsif($dbt->{operator}->{$varenv->{dbname}}->{project} eq "Freiburg"){
|
||||||
|
my $hotline_hash = {
|
||||||
|
table => "contentuser",
|
||||||
|
fetch => "one",
|
||||||
|
template_id => 197,
|
||||||
|
c_id => "1",
|
||||||
|
};
|
||||||
|
my $hotline_data = { txt08 => "" };
|
||||||
|
$hotline_data = $dbt->fetch_record($dbh,$hotline_hash);
|
||||||
|
$mailtrans->mail_feedback2garage($hotline_data->{txt08},$insert_contentpos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,7 +505,7 @@ sub service_insert(){
|
||||||
}#end service_insert
|
}#end service_insert
|
||||||
|
|
||||||
#service_update
|
#service_update
|
||||||
sub service_update(){
|
sub service_update {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $auth = shift;
|
my $auth = shift;
|
||||||
|
@ -666,7 +677,7 @@ sub service_update(){
|
||||||
}#end service_update
|
}#end service_update
|
||||||
|
|
||||||
#bike_update for state update after servíce_work (cronjob) OR service_done
|
#bike_update for state update after servíce_work (cronjob) OR service_done
|
||||||
sub bikestate_update(){
|
sub bikestate_update {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $auth = shift;
|
my $auth = shift;
|
||||||
my $c_id = shift || "";
|
my $c_id = shift || "";
|
||||||
|
@ -892,7 +903,7 @@ sub service_work {
|
||||||
|
|
||||||
|
|
||||||
#bike adhock booking
|
#bike adhock booking
|
||||||
sub booking_request(){
|
sub booking_request {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
|
@ -1052,6 +1063,15 @@ sub booking_request(){
|
||||||
$response_text = "Abbruch, die Mietzeit liegt in der Vergangenheit";
|
$response_text = "Abbruch, die Mietzeit liegt in der Vergangenheit";
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
my $adjust_freedtime = 0;
|
||||||
|
my $further_freedtime_available = 1;
|
||||||
|
my ($cttpos,$operator_hash) = $self->user_rentals_history($q,$auth,1,0);
|
||||||
|
foreach my $id (sort { lc($cttpos->{$b}->{itime}) cmp lc($cttpos->{$a}->{itime}) } keys(%$cttpos)){
|
||||||
|
$further_freedtime_available = $pri->count_freedrental($q,$varenv,$auth->{c_id},$cttpos->{$id},$adjust_freedtime);
|
||||||
|
}
|
||||||
|
if(!$further_freedtime_available){
|
||||||
|
$ct_tariff->{time02} = "00:00";
|
||||||
|
}
|
||||||
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$ct_station,$auth,$ct_tariff,$request_para,$bike,$booking_state,$owner,$sig_book);
|
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$ct_station,$auth,$ct_tariff,$request_para,$bike,$booking_state,$owner,$sig_book);
|
||||||
$bw->log("booking_request insert_pos:",$pos_id,"");
|
$bw->log("booking_request insert_pos:",$pos_id,"");
|
||||||
}
|
}
|
||||||
|
@ -1806,7 +1826,7 @@ sub service_automatic {
|
||||||
|
|
||||||
if(!$service_id){
|
if(!$service_id){
|
||||||
$crecord->{int04} = "null";#empty station
|
$crecord->{int04} = "null";#empty station
|
||||||
($response->{service_id}) = $self->service_insert($q,$authraw,$node_template,$crecord);
|
($response->{service_id}) = $self->service_insert($q,$varenv,$authraw,$node_template,$crecord);
|
||||||
$bw->log("service_automatic insert ($response->{service_id}) ",$response,"");
|
$bw->log("service_automatic insert ($response->{service_id}) ",$response,"");
|
||||||
my $rows = $self->service_update($q,$authraw,$node_template,$response->{service_id});
|
my $rows = $self->service_update($q,$authraw,$node_template,$response->{service_id});
|
||||||
}elsif($service_id){
|
}elsif($service_id){
|
||||||
|
@ -1817,7 +1837,7 @@ sub service_automatic {
|
||||||
}
|
}
|
||||||
|
|
||||||
#user rentals_history
|
#user rentals_history
|
||||||
sub user_rentals_history(){
|
sub user_rentals_history {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift || "";
|
my $q = shift || "";
|
||||||
my $auth = shift;
|
my $auth = shift;
|
||||||
|
@ -2004,7 +2024,7 @@ sub user_bikes_occupied {
|
||||||
|
|
||||||
#rentals
|
#rentals
|
||||||
#called by user_bikes_occupied (bikes_occupied object)
|
#called by user_bikes_occupied (bikes_occupied object)
|
||||||
sub rentals(){
|
sub rentals {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $varenv_prim = shift;
|
my $varenv_prim = shift;
|
||||||
my $record = shift;
|
my $record = shift;
|
||||||
|
@ -2264,7 +2284,7 @@ sub bikes_available {
|
||||||
}#end bikes_available
|
}#end bikes_available
|
||||||
|
|
||||||
#bikes_all
|
#bikes_all
|
||||||
sub bikes_all(){
|
sub bikes_all {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
|
@ -2423,7 +2443,7 @@ sub stations_caching {
|
||||||
}
|
}
|
||||||
|
|
||||||
#stations_available
|
#stations_available
|
||||||
sub stations_available(){
|
sub stations_available {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift || "";
|
my $q = shift || "";
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
|
@ -2683,7 +2703,7 @@ sub stations_available(){
|
||||||
|
|
||||||
|
|
||||||
#stations_all (should only called by shareetool)
|
#stations_all (should only called by shareetool)
|
||||||
sub stations_all(){
|
sub stations_all {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift || "";
|
my $q = shift || "";
|
||||||
my $varenv = shift;
|
my $varenv = shift;
|
||||||
|
@ -2811,7 +2831,7 @@ sub stations_all(){
|
||||||
|
|
||||||
|
|
||||||
#collect all bike_ist
|
#collect all bike_ist
|
||||||
sub bikes_soll(){
|
sub bikes_soll {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $record = shift;
|
my $record = shift;
|
||||||
my $bikes_on_station = shift;
|
my $bikes_on_station = shift;
|
||||||
|
@ -2839,7 +2859,7 @@ sub bikes_soll(){
|
||||||
|
|
||||||
|
|
||||||
#Collect Tarif to get users bike access ----------------------
|
#Collect Tarif to get users bike access ----------------------
|
||||||
sub fetch_tariff(){
|
sub fetch_tariff {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $dbname = shift;
|
my $dbname = shift;
|
||||||
my $adr = shift || {};
|
my $adr = shift || {};
|
||||||
|
@ -3076,7 +3096,7 @@ sub fetch_bike_tariff {
|
||||||
|
|
||||||
|
|
||||||
#authout
|
#authout
|
||||||
sub authout(){
|
sub authout {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $coo = shift || "";
|
my $coo = shift || "";
|
||||||
|
@ -3138,7 +3158,7 @@ sub authout(){
|
||||||
}#end authout
|
}#end authout
|
||||||
|
|
||||||
#auth_verify
|
#auth_verify
|
||||||
sub auth_verify(){
|
sub auth_verify {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $coo = shift || "";
|
my $coo = shift || "";
|
||||||
|
@ -3415,7 +3435,7 @@ sub auth_verify(){
|
||||||
|
|
||||||
|
|
||||||
#authorization
|
#authorization
|
||||||
sub authorization(){
|
sub authorization {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
my $merchant_id = shift || $q->param('merchant_id') || "";
|
my $merchant_id = shift || $q->param('merchant_id') || "";
|
||||||
|
|
|
@ -831,7 +831,7 @@ elsif($q->param('request') eq "user_feedback" || $q->param('request') eq "user_m
|
||||||
#if(!$back_id)#disabled because of every feedback have to be saved
|
#if(!$back_id)#disabled because of every feedback have to be saved
|
||||||
if(1==1){
|
if(1==1){
|
||||||
#INSERT just dadaset
|
#INSERT just dadaset
|
||||||
$back_id = $apif->service_insert($q,$authraw,$node_template,$crecord,$aowner);
|
$back_id = $apif->service_insert($q,\%varenv,$authraw,$node_template,$crecord,$aowner);
|
||||||
$rows = $apif->service_update($q,$authraw,$node_template,$back_id);
|
$rows = $apif->service_update($q,$authraw,$node_template,$back_id);
|
||||||
if($rows && $rows > 0){
|
if($rows && $rows > 0){
|
||||||
$response->{response_state} = "OK, feedback insert and update";
|
$response->{response_state} = "OK, feedback insert and update";
|
||||||
|
@ -893,7 +893,7 @@ elsif($q->param('request') eq "service_done"){
|
||||||
if(!$service_id){
|
if(!$service_id){
|
||||||
|
|
||||||
#INSERT just dadaset (without work values)
|
#INSERT just dadaset (without work values)
|
||||||
($response->{service_id}) = $apif->service_insert($q,$authraw,$node_template,$crecord);
|
($response->{service_id}) = $apif->service_insert($q,\%varenv,$authraw,$node_template,$crecord);
|
||||||
$bw->log("service insert ",$response,"");
|
$bw->log("service insert ",$response,"");
|
||||||
|
|
||||||
#once again to get node_record template
|
#once again to get node_record template
|
||||||
|
|
|
@ -307,11 +307,11 @@ sub mail_hours_occupied {
|
||||||
#we use just db-selector hashes
|
#we use just db-selector hashes
|
||||||
sub mail_feedback2garage {
|
sub mail_feedback2garage {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $crecord_content = shift;
|
my $mail_to = shift;
|
||||||
my $contentpos = shift;
|
my $contentpos = shift;
|
||||||
my $sendref = $self->sendrefhash();
|
my $sendref = $self->sendrefhash();
|
||||||
|
|
||||||
$sendref->{mail_to} = $crecord_content->{fleed_email};
|
$sendref->{mail_to} = $mail_to;
|
||||||
$sendref->{subject} = "sharee.bike App Meldung";
|
$sendref->{subject} = "sharee.bike App Meldung";
|
||||||
$sendref->{message} = "Es ist folgende sharee.bike App Nachricht zu Mietrad $contentpos->{ct_name} an Station $contentpos->{int04} eingegangen:\n\n$contentpos->{txt01}\n\nFreundliche Grüße,\nIhr sharee.bike Mietradsystem";
|
$sendref->{message} = "Es ist folgende sharee.bike App Nachricht zu Mietrad $contentpos->{ct_name} an Station $contentpos->{int04} eingegangen:\n\n$contentpos->{txt01}\n\nFreundliche Grüße,\nIhr sharee.bike Mietradsystem";
|
||||||
$sendref->{message} =~ s/\n/\<br \/\>/g;#TOD prepare_content
|
$sendref->{message} =~ s/\n/\<br \/\>/g;#TOD prepare_content
|
||||||
|
|
|
@ -71,7 +71,7 @@ sub count_freedrental {
|
||||||
open(FILE,">>$varenv->{logdir}/count_freedrental.log") if($debug);
|
open(FILE,">>$varenv->{logdir}/count_freedrental.log") if($debug);
|
||||||
print FILE "\n*-->$today4db $varenv->{dbname}\n" if($debug);
|
print FILE "\n*-->$today4db $varenv->{dbname}\n" if($debug);
|
||||||
print FILE Dumper($q) if($debug);
|
print FILE Dumper($q) if($debug);
|
||||||
print FILE "--> pos.c_id:$pos->{c_id}, ca_id:$ca_id=pos.ca_id:$pos->{ca_id}, bike:$pos->{ct_name} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} >= 5\n" if($debug);
|
print FILE "--> LASTitime pos.c_id:$pos->{c_id}, ca_id:$ca_id=pos.ca_id:$pos->{ca_id}, bike:$pos->{ct_name} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} >= 5\n" if($debug);
|
||||||
|
|
||||||
#2023-10-10 changed from 0min to rental_minute_all >= 5min to keep freed time on rentals >=5min
|
#2023-10-10 changed from 0min to rental_minute_all >= 5min to keep freed time on rentals >=5min
|
||||||
#freed mangement will be only dony on accountable rental
|
#freed mangement will be only dony on accountable rental
|
||||||
|
@ -121,7 +121,7 @@ sub count_freedrental {
|
||||||
print FILE "--> NO freed_count if($freed_count > $max_freed_count && $pos->{c_id} != $record_pos->{$pid}->{c_id})\n" if($debug);
|
print FILE "--> NO freed_count if($freed_count > $max_freed_count && $pos->{c_id} != $record_pos->{$pid}->{c_id})\n" if($debug);
|
||||||
}
|
}
|
||||||
$further_freedtime_available = 0 if($freed_count >= $max_freed_count);
|
$further_freedtime_available = 0 if($freed_count >= $max_freed_count);
|
||||||
print FILE "if($freed_count >= $max_freed_count && $pos->{c_id} != $record_pos->{$pid}->{c_id})\nfurther_freedtime_available:$further_freedtime_available\n" if($debug);
|
print FILE "if($freed_count >= $max_freed_count && $pos->{c_id} != $record_pos->{$pid}->{c_id})\nadjust_freedtime:$adjust_freedtime\nfurther_freedtime_available:$further_freedtime_available\n" if($debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(FILE) if($debug);
|
close(FILE) if($debug);
|
||||||
|
|
Loading…
Add table
Reference in a new issue