Adding user-feedback mailing to hotline. freed-rental check on booking-request

This commit is contained in:
ragu 2024-06-12 19:32:36 +02:00
parent 000acb8e35
commit b9b63c63e5
4 changed files with 44 additions and 24 deletions

View file

@ -157,7 +157,7 @@ sub select_dmsusers {
}
#node_select
sub template_select(){
sub template_select {
my $self = shift;
my $node = shift;
my $return={};
@ -180,7 +180,7 @@ sub template_select(){
}#end node_select
#Search one by key
sub service_work_search(){
sub service_work_search {
my $self = shift;
my $bike = shift || "";
my $station = shift || "";
@ -401,9 +401,10 @@ sub service_select {
#service_insert
sub service_insert(){
sub service_insert {
my $self = shift;
my $q = shift;
my $varenv = shift;
my $auth = shift;
my $node_template = shift || "";
my $crecord = shift || {};
@ -472,7 +473,17 @@ sub service_insert(){
$insert_contentpos->{txt01} = $q->escapeHTML($q->param('message')) if($q->param('message'));
my $c_id_contentpos = $dbt->insert_contentoid($dbh,$insert_contentpos,"");
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
#service_update
sub service_update(){
sub service_update {
my $self = shift;
my $q = shift;
my $auth = shift;
@ -666,7 +677,7 @@ sub service_update(){
}#end service_update
#bike_update for state update after servíce_work (cronjob) OR service_done
sub bikestate_update(){
sub bikestate_update {
my $self = shift;
my $auth = shift;
my $c_id = shift || "";
@ -892,7 +903,7 @@ sub service_work {
#bike adhock booking
sub booking_request(){
sub booking_request {
my $self = shift;
my $q = shift;
my $varenv = shift;
@ -1052,6 +1063,15 @@ sub booking_request(){
$response_text = "Abbruch, die Mietzeit liegt in der Vergangenheit";
}
}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);
$bw->log("booking_request insert_pos:",$pos_id,"");
}
@ -1806,7 +1826,7 @@ sub service_automatic {
if(!$service_id){
$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,"");
my $rows = $self->service_update($q,$authraw,$node_template,$response->{service_id});
}elsif($service_id){
@ -1817,7 +1837,7 @@ sub service_automatic {
}
#user rentals_history
sub user_rentals_history(){
sub user_rentals_history {
my $self = shift;
my $q = shift || "";
my $auth = shift;
@ -2004,7 +2024,7 @@ sub user_bikes_occupied {
#rentals
#called by user_bikes_occupied (bikes_occupied object)
sub rentals(){
sub rentals {
my $self = shift;
my $varenv_prim = shift;
my $record = shift;
@ -2264,7 +2284,7 @@ sub bikes_available {
}#end bikes_available
#bikes_all
sub bikes_all(){
sub bikes_all {
my $self = shift;
my $q = shift;
my $varenv = shift;
@ -2423,7 +2443,7 @@ sub stations_caching {
}
#stations_available
sub stations_available(){
sub stations_available {
my $self = shift;
my $q = shift || "";
my $varenv = shift;
@ -2683,7 +2703,7 @@ sub stations_available(){
#stations_all (should only called by shareetool)
sub stations_all(){
sub stations_all {
my $self = shift;
my $q = shift || "";
my $varenv = shift;
@ -2811,7 +2831,7 @@ sub stations_all(){
#collect all bike_ist
sub bikes_soll(){
sub bikes_soll {
my $self = shift;
my $record = shift;
my $bikes_on_station = shift;
@ -2839,7 +2859,7 @@ sub bikes_soll(){
#Collect Tarif to get users bike access ----------------------
sub fetch_tariff(){
sub fetch_tariff {
my $self = shift;
my $dbname = shift;
my $adr = shift || {};
@ -3076,7 +3096,7 @@ sub fetch_bike_tariff {
#authout
sub authout(){
sub authout {
my $self = shift;
my $q = shift;
my $coo = shift || "";
@ -3138,7 +3158,7 @@ sub authout(){
}#end authout
#auth_verify
sub auth_verify(){
sub auth_verify {
my $self = shift;
my $q = shift;
my $coo = shift || "";
@ -3415,7 +3435,7 @@ sub auth_verify(){
#authorization
sub authorization(){
sub authorization {
my $self = shift;
my $q = shift;
my $merchant_id = shift || $q->param('merchant_id') || "";