diff --git a/copri4/main/src/Mod/Prelogic.pm b/copri4/main/src/Mod/Prelogic.pm
index 523e913..bbd25ce 100755
--- a/copri4/main/src/Mod/Prelogic.pm
+++ b/copri4/main/src/Mod/Prelogic.pm
@@ -205,16 +205,7 @@ sub preinit(){
};
$ctt = $dbt->fetch_tablerecord($dbh,$pref_ctt);
}
- my $ctadr = { c_id => 0 };
- if(looks_like_number($ctt->{int10})){
- my $pref_adr = {
- table => "contentadr",
- fetch => "one",
- c_id => $ctt->{int10},
- };
- $ctadr = $dbt->fetch_tablerecord($dbh,$pref_adr);
- }
-
+ my $ctadr = { c_id => $ctt->{int10} };
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct,"",$ctadr,"","","","0",$users_dms->{u_id},"");
$i_rows += 1 if($pos_id > 0);
diff --git a/copri4/main/src/Mod/Pricing.pm b/copri4/main/src/Mod/Pricing.pm
index ac19b6d..e551242 100755
--- a/copri4/main/src/Mod/Pricing.pm
+++ b/copri4/main/src/Mod/Pricing.pm
@@ -64,7 +64,7 @@ sub count_freedrental {
open(FILE,">>$varenv->{logdir}/count_freedrental.log") if($debug);
print FILE "\n*-->$today4db $varenv->{dbname}\n" if($debug);
print FILE Dumper($q) if($debug);
- print FILE "--> c_id:$pos->{c_id} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} > 0\n" if($debug);
+ print FILE "--> pos.c_id:$pos->{c_id}, user:$pos->{ca_id}, bike:$pos->{ct_name} rental_minute_all: $pricing->{rentalog}->{rental_minute_all} > 0\n" if($debug);
#freed mangement will be only dony on accountable rental
if($pricing->{rentalog}->{rental_minute_all} > 0){
@@ -88,7 +88,8 @@ sub count_freedrental {
my ($nyear,$nmon,$nday) = Add_Delta_YMD($year,$mon,$day, 0,0,1);
$pref_pos->{time_range} = "((start_time >= '$year-$mon-$day' and start_time < '$nyear-$nmon-$nday' and start_time != end_time) OR int10=3)";
}
- my $record_pos = $dbt->fetch_tablerecord($dbh,$pref_pos);
+ my $record_pos = { c_id => 0 };
+ $record_pos = $dbt->fetch_tablerecord($dbh,$pref_pos);
foreach my $pid (sort { $record_pos->{$a}->{c_id} <=> $record_pos->{$b}->{c_id} } keys (%$record_pos)){
$freed_count++;
print FILE "if($freed_count > 1 && $pos->{c_id} != $record_pos->{$pid}->{c_id})\n" if($debug);
diff --git a/copri4/main/src/Tpl/BaseEdit.pm b/copri4/main/src/Tpl/BaseEdit.pm
index 57a2cc4..20b5afa 100755
--- a/copri4/main/src/Tpl/BaseEdit.pm
+++ b/copri4/main/src/Tpl/BaseEdit.pm
@@ -974,6 +974,7 @@ EOF
::user_name:: → Kunden Name
::app_name:: → App Name
::invoice_nr:: → Faktura Beleg Nr
+ ::sum_total:: → Rechnungsbetrag Summe €
::invoice_name:: → Faktura PDF Name
::txid:: → Payone TXID
::signature:: → eMail Signature
diff --git a/copri4/main/src/scripts/mailTransportcms.pl b/copri4/main/src/scripts/mailTransportcms.pl
index d6de3f8..570ab46 100755
--- a/copri4/main/src/scripts/mailTransportcms.pl
+++ b/copri4/main/src/scripts/mailTransportcms.pl
@@ -178,6 +178,18 @@ sub send_invoice {
};
my $ctt = { c_id => 0 };
$ctt = $dbt->fetch_tablerecord($dbh,$fetchctt);
+ $ctt->{fibu_user} = "";
+ if($ctt->{owner} > 1000){
+ my $adref = {
+ table => "contentadr",
+ fetch => "one",
+ template_id => "202",
+ c_id => $ctt->{owner},
+ };
+ my $fibu_owner = $dbt->fetch_record($dbh,$adref);
+ $ctt->{fibu_user} = "$fibu_owner->{txt01}" if($fibu_owner->{txt01});
+ }
+
$sendref = prepare_content($sendref,$ctadr,$uadr,$ctt,$varenv{cms}->{$cms_message_key}->{txt},$with_pdf);
@@ -472,12 +484,17 @@ sub prepare_content {
$app_name = $dbt->{operator}->{$varenv{dbname}}->{app_name};
my $invoice_name = "";
my $invoice_nr = "";
+ my $sum_total = "";
my $sharee_ticket = "";
+ my $fibu_user = "";
if(ref($ctt) eq "HASH" && $ctt->{ct_name}){
$invoice_name = "$ctt->{txt00}-$varenv{dbname}-$ctt->{ct_name}.pdf";
$sendref->{attachment} = "$invoice_name" if($with_pdf);
$invoice_nr = "$varenv{dbname}-$ctt->{ct_name}";
+ $sum_total = "$ctt->{int01}";
+ $sum_total =~ s/\./,/;
$sharee_ticket = "[$invoice_nr]";
+ $fibu_user = "\n$ctt->{fibu_user}\n" if($ctt->{fibu_user});
}
my $subject = "TeilRad Mietradsystem";#default
@@ -487,7 +504,7 @@ sub prepare_content {
$cms_prim =~ s/\n//;
my $signature = <{txt01}
$uadr->{txt03}
$uadr->{txt06}
@@ -511,6 +528,7 @@ EOF
$sendref->{message} =~ s/::user_name::/$ctadr->{txt01}/g;
$sendref->{message} =~ s/::app_name::/$app_name/g;
$sendref->{message} =~ s/::invoice_nr::/\$invoice_nr\<\/b\>/g if($invoice_nr);
+ $sendref->{message} =~ s/::sum_total::/\$sum_total €\<\/b\>/g if($sum_total);
$sendref->{message} =~ s/::invoice_name::/$invoice_name/g if($invoice_name);
$sendref->{message} =~ s/::txid::/$ctt->{txt16}/;
$sendref->{message} =~ s/::email_temppassword::/\$ctadr->{txt04}\<\/b\>/g;