counting position on delete and agb

This commit is contained in:
ragu 2022-05-19 16:00:41 +02:00
parent 7a6f57a2ef
commit d1badd0dca
6 changed files with 54 additions and 22 deletions

View file

@ -866,6 +866,7 @@ sub fetch_bike_tariff {
#2022-04-05 refactored bike reservation
sub booking_request(){
my $self = shift;
my $q = shift;
my $varenv = shift;
my $auth = shift;#app API auth
my $bike = shift || "";#app API request
@ -875,13 +876,17 @@ sub booking_request(){
my $gps = shift || "";
my $sig_book = shift || {};
my $state = $q->escapeHTML($q->param('state')) || "";
my $lock_state = $q->escapeHTML($q->param('lock_state')) || "";
my $dbh = "";
my $pos_id="";
my $now_dt = strftime "%Y-%m-%d %H:%M", localtime;
my $response_state = "OK";
my $response_text = "";
$bw->log("booking_request bike $bike, auth $auth->{c_id}, tarif $ct_tariff->{barcode}, requested bike:",$bike,"");
#state and lock_state is only defined if requestes incl. occupied
$bw->log("booking_request bike to state $bike $state $lock_state, auth $auth->{c_id}, tarif $ct_tariff->{barcode}, bike:",$bike,"");
my $update_adr = {
table => "contentadr",

View file

@ -103,11 +103,17 @@ if(!$coo && !$q->param('merchant_id')){
return Apache2::Const::OK;
exit 0;
}else{
($aowner,my $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
if($aowner && ($aowner == 195 || $aowner == 185 || $aowner == 176)){
my $return_merchant = { project_id => "" };
($aowner, $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
#if($aowner && ($aowner == 195 || $aowner == 185 || $aowner == 176)){
if($return_merchant->{project_id} eq "Konstanz"){
$response->{agb_html} = "site/agb_konrad_1.html";
$response->{bike_info_html} = "site/bike_info_konrad_1.html";
}
if($return_merchant->{project_id} eq "Bayern"){
$response->{agb_html} = "site/agb_lastenradbayern_2.html";
}
}
#If param>40 || value > 400 then exit
@ -252,7 +258,7 @@ elsif($q->param('request') eq "booking_request"){
if($ct_bike->{int11} == 3){
$sig_book = $si->sig_booking(\%varenv,$authraw,$ct_bike,"","reserve");
}
$response_book = $apif->booking_request(\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$sig_book);
$response_book = $apif->booking_request($q,\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$sig_book);
}elsif(!$ct_tariff->{barcode}){
$response->{response_state} = "Failure 2089: booking bike $bike fails, no user tariff available";
$response->{response_text} = "Reservierungsfehler Fahrrad Nr. $bike. Es konnte kein Mietrad Tarif gefunden werden.";

View file

@ -43,11 +43,12 @@ sub tpl(){
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
#my $api_test = "sharee_fr01"; my $bike="FR1538";
my $api_test = "sharee_fr01"; my $bike="FR4781";#BVB test
#my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test
#my $api_test = "sharee_kn"; my $bike="KN205";
#my $api_test = "sharee_wue";
my $api_test = "sharee_wue"; my $bike="WUE5524";
#my $api_test = "sharee_sx"; my $bike="S3X1001";
#my $api_test = "sharee_ren"; my $bike="REN2";
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n";
}

View file

@ -89,19 +89,27 @@ sub tpl(){
}elsif($viewsel[1] eq "Account" && $R::sharee_edit =~ /delete_account/){
if($R::sharee_edit eq "delete_account1" && $users_sharee->{c_id}){
#
my ($ctpos,$operator_hash) = $apif->user_rentals_history($q,$users_sharee);
my $ctpos_count = 0;
my ($cttpos,$operator_hash) = $apif->user_rentals_history($q,$users_sharee);
my $pricing = {};
my $counting = {};
my $cttpos_count = 0;
my $sum = 0;
foreach my $id (keys(%$ctpos)){
$ctpos_count++;
my $gesamt = 0;
my $rabatt = "";
($gesamt,$rabatt) = $pri->price2calc($ctpos->{$id});
foreach my $id (keys(%$cttpos)){
$cttpos_count++;
if($cttpos->{$id}->{int35} && $cttpos->{$id}->{start_time} && $cttpos->{$id}->{end_time}){
($pricing,$counting) = $pri->counting_rental($varenv,$cttpos->{$id},"calc_price");
$sum += $pricing->{total_price};
}else{
my ($gesamt,$rabatt) = $pri->price2calc($cttpos->{$id});
$sum += $gesamt;
}
}
$sum = $lb->round($sum);
if($ctpos_count > 0 && $sum > 0){
print $q->div({-class=>'content2'}, "Ihr Konto ist nicht ausgeglichen ($sum). Bitte kontaktieren Sie uns damit wir Ihre Rechnungstellung beschleunigen. Anschließend können Sie Ihren Account löschen. Danke für Ihr Verständnis"),"\n";
$sum = sprintf('%.2f', $sum);
$sum =~ s/\./,/;
if($cttpos_count > 0 && $sum > 0){
print $q->div({-class=>'content2'}, "Ihr Konto ist nicht ausgeglichen, es ist ein Betrag von $sum € offen. Bitte kontaktieren Sie uns unter <a href='mailto:post\@sharee.bike'>post\@sharee.bike</a> damit wir die Rechnungstellung für sie beschleunigen. Anschließend können Sie Ihren Account löschen. Danke für Ihr Verständnis"),"\n";
print $q->div({-style=>'margin-top:1em;text-align:center;'},$q->a({-class=>"btn btn-primary btn-lg btn-block",-href=>'javascript:history.back()', -style=>"border:1px solid #$bgcolor1;background-color:#$bgcolor1;color:#fffffe;"}, "zurück")),"\n";
}else{
print $q->div({-class=>'content2'}, "Wollen Sie wirklich Ihre Daten löschen?"),"\n";

View file

@ -75,6 +75,10 @@ sub tpl(){
my $aowner = "198";
$aowner = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} if($varenv->{merchant_id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id});
#TODO substitute aowner by project
my $project = "all";
$project = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{project} if($varenv->{merchant_id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{project});
my $bonus_desc = "Bonusnummer (falls vorhanden)";
my $bonus_ak = "Ihre Bonusnummer wurde akzeptiert. Bitte beachten Sie dass der Bonustarif im Kontext des Mietradbetreibers vergeben wird. Der Tarif wird bei der Mietrad Reservierung angezeigt.";
my $bonus_avail = "Die Bonusnummer ist nicht vorhanden.";
@ -163,7 +167,14 @@ Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weit
my $sharee_agb_text = {};
$sharee_agb_text->{ct_name} = "AGB";
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb.html' style='width:100%;height:10000px;border:none;' scrolling='auto'></iframe>";
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb_konrad_1.html' style='width:100%;height:10000px;border:none;' scrolling='auto'></iframe>" if($aowner == 195 || $aowner == 185 || $aowner == 176);
#if($aowner == 195 || $aowner == 185 || $aowner == 176){
if($project eq "Konstanz"){
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb_konrad_1.html' style='width:100%;height:10000px;border:none;' scrolling='auto'></iframe>";
}
if($project eq "Bayern"){
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb_lastenradbayern_2.html' style='width:100%;height:11000px;border:none;' scrolling='auto'></iframe>";
}
my $sharee_privacy_text = {};
$sharee_privacy_text->{ct_name} = "Datenschutzhinweise";
@ -514,11 +525,11 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
if($key =~ /txt16/ && $ctrel->{c_id}){
if($R::failure =~ /^txt16/){
$autofocus = "autofocus";
$label_des = "<span style=color:$red>Der Gutscheincode ist leider nicht vorhanden. Bei nicht vorhandenen Codes das Feld bitte leer lassen.</span>";
$label_des = "<span style=color:$red>Der Gutscheincode ist nicht vorhanden.</span>";
}
elsif($R::failure =~ /conflict_txt16/){
$autofocus = "autofocus";
$label_des = "<span style=color:$red>Der Gutscheincode wurde bereits hinterlegt. Bei nicht vorhandenen Codes das Feld bitte leer lassen.</span>";
$label_des = "<span style=color:$red>Der Gutscheincode wurde bereits hinterlegt.</span>";
}else{
$required="";
$label_des = "<span style='font-weight:normal;'>$des</span>";

View file

@ -54,11 +54,12 @@ sub tpl(){
if($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test"){
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || $dbt->{website}->{$varenv->{syshost}}->{merchant_id};
#my $api_test = "sharee_kn";
#my $api_test = "sharee_kn"; my $bike="KN201";
#my $api_test = "sharee_fr01"; my $bike="FR1538";
#my $api_test = "sharee_wue";
my $api_test = "sharee_sx"; my $bike="S3X1001";
my $api_test = "sharee_wue"; my $bike="WUE5524";
#my $api_test = "sharee_sx"; my $bike="S3X1001";
#my $api_test = "sharee_ren"; my $bike="REN2";
print $q->div({-style=>'text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] ")),"\n";
}