mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 11:46:27 +01:00
rental deactivation on payment-fault and payment-type key change
This commit is contained in:
parent
f731aa352b
commit
5044e9bfe8
13 changed files with 229 additions and 101 deletions
|
@ -956,6 +956,17 @@ sub booking_request(){
|
|||
|
||||
#if invoice exist
|
||||
if($ctt->{c_id}){
|
||||
#if any OPOS then permit further rentals
|
||||
my $ctt_opos = { c_id => 0 };
|
||||
my $pref_opos = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
template_id => "IN::(209,218)",
|
||||
int10 => $auth->{c_id},
|
||||
state => "payment_fault",#selects Zahlungsausfall or int14 opos
|
||||
};
|
||||
$ctt_opos = $dbt->fetch_record($dbh,$pref_opos);
|
||||
|
||||
#if payment-type prepaid, then check whether balance positive
|
||||
my $sum_balance = 0;
|
||||
if($auth->{int03} && $auth->{int03} == 3){
|
||||
|
@ -986,8 +997,9 @@ sub booking_request(){
|
|||
}
|
||||
$bw->log("booking_request prepaid balance sum: $sum_balance, userID: $auth->{c_id} ",$sum_balance,"");
|
||||
}
|
||||
#Rental is only permitted if sum_balance <= 0 (in primary prepaid context positive)
|
||||
if($sum_balance <= 1){
|
||||
#Rental is only permitted if sum_balance <= 1 (in primary prepaid context positive)
|
||||
#Rental is only permitted if no invoice with payment_fault or opos
|
||||
if($sum_balance <= 1 && !$ctt_opos->{c_id}){
|
||||
#2 = "requested"
|
||||
$pos_id = $dbt->insert_pos($dbh,$ctt->{c_id},$ct_bike,$ct_station,$auth,$ct_tariff,$now_dt,$bike,"2",$owner,$sig_book);
|
||||
$bw->log("booking_request insert_pos:",$pos_id,"");
|
||||
|
@ -1040,8 +1052,15 @@ sub booking_request(){
|
|||
$response_text="Entschuldigung, es ist ein Fehler aufgetreten. Bitte kontaktieren Sie unsere hotline damit wir das Problem lösen können";
|
||||
}
|
||||
}else{
|
||||
$response_state="Failure 1593: rental is prohibited because of prepaid balance - $sum_balance";
|
||||
$response_text="Bitte überprüfen Sie Ihren Prepaid/Vorkasse Kontostand, aktuell: - $sum_balance €. Nur bei positiven Kontostand können wir das Mietradsystem für Sie freischalten.";
|
||||
if($ctt_opos->{c_id}){
|
||||
$response_state="Failure 1593: rental is prohibited because of payment_fault invoice $ctt_opos->{ct_name}";
|
||||
$response_text="Es existiert ein Problem mit einer Rechnung. Bitte melden Sie sich bei rechnung\@sharee.bike .";
|
||||
}else{
|
||||
$sum_balance = sprintf('%.2f',$sum_balance);
|
||||
$sum_balance =~ s/\./,/;
|
||||
$response_state="Failure 1594: rental is prohibited because of prepaid balance - $sum_balance";
|
||||
$response_text="Bitte überprüfen Sie Ihren Prepaid/Vorkasse Kontostand, aktuell: - $sum_balance €. Nur bei positiven Kontostand können wir das Mietradsystem für Sie freischalten.";
|
||||
}
|
||||
}#end if $sum_balance
|
||||
}
|
||||
}elsif($rentable_check == 1){
|
||||
|
@ -1698,7 +1717,7 @@ sub user_rentals_history(){
|
|||
$pref->{mtime} = ">=::(now() - interval '$month month')";
|
||||
}else{
|
||||
#2024-01-08 list not succesfully captured positions by also using ct.int14 >= 1
|
||||
$pref->{'ct.state'} = "is::null";# OR ct.int14 >= 1
|
||||
$pref->{'ct.state'} = "is::null";# ct.int04 is null OR ct.int14 >= 1
|
||||
#$pref->{'ct.int14'} = "is::null";
|
||||
}
|
||||
|
||||
|
@ -1966,7 +1985,7 @@ sub bikes_available(){
|
|||
$return->{$id}->{bike_type}->{category} = "cargo";
|
||||
$return->{$id}->{bike_type}->{wheels} = "2";
|
||||
$return->{$id}->{bike_type}->{wheels} = "3" if($record->{$id}->{txt01} =~ /drei|trike/i);
|
||||
if($record->{$id}->{energy_id} || $record->{$id}->{txt01} =~ /E-/i){
|
||||
if($record->{$id}->{energy_id}){
|
||||
$return->{$id}->{bike_type}->{engine}->{manufacturer} = "dummy";
|
||||
my $max_bars = 5;
|
||||
my $current_bars = 0;
|
||||
|
@ -2151,7 +2170,7 @@ sub bikes_all(){
|
|||
$return->{$id}->{bike_type}->{category} = "cargo";
|
||||
$return->{$id}->{bike_type}->{wheels} = "2";
|
||||
$return->{$id}->{bike_type}->{wheels} = "3" if($record->{$id}->{txt01} =~ /drei|trike/i);
|
||||
if($record->{$id}->{energy_id} || $record->{$id}->{txt01} =~ /E-/i){
|
||||
if($record->{$id}->{energy_id}){
|
||||
$return->{$id}->{bike_type}->{engine}->{manufacturer} = "dummy";
|
||||
my $max_bars = 5;
|
||||
my $current_bars = 0;
|
||||
|
@ -2201,7 +2220,7 @@ sub bikes_all(){
|
|||
return ($op_return,$record,$bikes_on_station);
|
||||
}#end bikes_all
|
||||
|
||||
#station caching for each tarif
|
||||
#station cache for each tarif
|
||||
sub stations_caching {
|
||||
my $self = shift;
|
||||
my $q = shift || "";
|
||||
|
@ -2235,7 +2254,7 @@ sub stations_available(){
|
|||
|
||||
my $authed = 0;
|
||||
$authed = 1 if(ref($auth) eq "HASH" && $auth->{c_id});
|
||||
my $authcookie = $q->param('authcookie') || $q->cookie('domcookie');
|
||||
my $authcookie = $q->param('authcookie') || $q->cookie('domcookie') || "";
|
||||
my ($bike_group,$bike_node,$user_tour,$tariff_content,$adrtarif_hash) = $self->fetch_tariff($varenv->{dbname},$auth,$authcookie,$cachme);
|
||||
|
||||
#$bw->log("fetch_tariff adrtarif_hash from $varenv->{dbname}\n",$adrtarif_hash,"");
|
||||
|
|
|
@ -941,6 +941,8 @@ elsif($q->param('request') eq "service_done"){
|
|||
#add-on to log redistribute
|
||||
my $action = "txt10=" . $bikes_allraw->{$bike_id}->{int04} . " - " . $q->param('work_val');
|
||||
$apif->service_update($q,$authraw,$node_template,$service_id,$action);
|
||||
#2024-01-12 after redistribute
|
||||
$apif->stations_caching($q,\%varenv,$authraw);
|
||||
|
||||
my ($stations_all,$stations_allraw) = $apif->stations_all($q,\%varenv,$bikes_on_station,$authraw);
|
||||
if(looks_like_number($stations_allraw->{$to_station_id}->{int04})){
|
||||
|
@ -985,8 +987,6 @@ elsif($q->param('request') eq "service_done"){
|
|||
|
||||
($response_work, $node) = $apif->service_work($pos_record,$stations_allraw,"",$node_template);
|
||||
}
|
||||
#should not be mandatory here, maybe only for bike_count
|
||||
#$apif->stations_caching($q,\%varenv,$authraw);
|
||||
|
||||
#inject oprefix
|
||||
my $op_response_work = {};
|
||||
|
|
|
@ -328,8 +328,6 @@ sub channel_map(){
|
|||
196 => "copri",#mig
|
||||
197 => "web sharee.bike",#mig
|
||||
198 => "primary",#mig
|
||||
199 => "LV API",#mig
|
||||
201 => "web Renta",#mig
|
||||
294 => "example Web",#mig
|
||||
295 => "example App",#mig
|
||||
296 => "example Op",#mig
|
||||
|
@ -683,9 +681,9 @@ sub collect_post(){
|
|||
$cp_where .= " and cp.$key $op '$value'";
|
||||
}
|
||||
}
|
||||
}elsif($key =~ /ct\.close_time|ct\.state|ct\.int14/ && $value){#used to get open invoices
|
||||
}elsif($key =~ /ct\.close_time|ct\.state|ct\.int04|ct\.int14/ && $value){#used to get open invoices
|
||||
if($key =~ /ct\.state/ && $value eq "null"){
|
||||
$ct_where .= " and ($key $op $value OR $key = '' OR ct.int14 >= 1)";
|
||||
$ct_where .= " and (ct.int04 is $value OR ct.int14 >= 1)";#all un-booked or opos
|
||||
}else{
|
||||
$ct_where .= " and $key $op $value";
|
||||
}
|
||||
|
@ -783,7 +781,9 @@ sub fetch_record(){
|
|||
#can also be "rel.main_id IN (300005,300024)"
|
||||
$where .= " and rel.$key $op $value" if($key =~ /^(parent_id|main_id|template_id|rel_id)$/ && $value);
|
||||
if($key =~ /^(ct_name$|txt\d+|uri\d+|state)$/ && $value){
|
||||
if($value =~ /length/){
|
||||
if($key eq "state" && $value eq "payment_fault"){
|
||||
$where .= " and (ct.int14 >= 1 || ct.int14 == 7)";#OPOS or Zahlungsausfall
|
||||
}elsif($value =~ /length/){
|
||||
$where .= " and $value";
|
||||
}elsif($value eq "null"){
|
||||
$where .= " and (ct.$key is null OR ct.$key = '')";
|
||||
|
@ -1621,7 +1621,7 @@ sub insert_contenttrans(){
|
|||
my $doc_name = "Rechnung";
|
||||
$doc_name = "Tagesabschluss" if($tpl_id == 209);
|
||||
$doc_name = "Prepaid Account" if($tpl_id == 219);
|
||||
$owner="199" if(!$owner);
|
||||
$owner="0" if(!$owner);
|
||||
my $paymenttype = $ctadr->{int03} || 0;
|
||||
#keep in mind int10 will be mainly used by Prelogic and Printpreview, thats because we save it also
|
||||
my $sth = $dbh->prepare("INSERT INTO contenttrans (ct_name,txt00,int10,int03,txt02,txt01,txt03,txt06,txt07,txt08,txt10,txt11,owner,itime) VALUES('$invoice_nr','$doc_name','$ctadr->{c_id}','$paymenttype','$ctadr->{txt02}','$ctadr->{txt01}','$ctadr->{txt03}','$ctadr->{txt06}','$ctadr->{txt07}','$ctadr->{txt08}','$ctadr->{txt10}','$ctadr->{txt11}','$owner','now()') RETURNING c_id");
|
||||
|
@ -1836,7 +1836,8 @@ sub search_content {
|
|||
}
|
||||
}#
|
||||
if($v_journal =~ /Tagesbericht/){
|
||||
$txt_where .= " and (ct.state ~ '[a-z]') and ct.int01 is not null and ct.close_time is null";
|
||||
#$txt_where .= " and (ct.state ~ '[a-z]') and ct.int01 is not null and ct.close_time is null";
|
||||
$txt_where .= " and ct.int04 >= 1 and ct.int01 is not null and ct.close_time is null";
|
||||
$txt_where .= " and ct.int14 is $opos" if($opos eq "null");
|
||||
}
|
||||
|
||||
|
@ -1931,11 +1932,11 @@ sub update_close_transactions {
|
|||
my $close_ref = shift;
|
||||
|
||||
#close transactions int11 close_trans reference c_id
|
||||
my $sth = $dbh->prepare("UPDATE $close_ref->{table} SET close_time='now()',int11=$close_ref->{close_id} where c_id IN (SELECT ct.c_id from $close_ref->{table} ct, relation rel where ct.c_id=rel.content_id and (ct.state ~ '[a-z]') and ct.int01 is not null and rel.main_id IN ($close_ref->{source_main_id}) and ct.close_time is null and ct.int14 is null)");
|
||||
my $sth = $dbh->prepare("UPDATE $close_ref->{table} SET close_time='now()',int11=$close_ref->{close_id} where c_id IN (SELECT ct.c_id from $close_ref->{table} ct, relation rel where ct.c_id=rel.content_id and ct.int04 >= 1 and ct.int01 is not null and rel.main_id IN ($close_ref->{source_main_id}) and ct.close_time is null and ct.int14 is null)");
|
||||
my $rows = $sth->execute();
|
||||
|
||||
#move/set to journal
|
||||
$sth = $dbh->prepare("UPDATE relation SET main_id=$close_ref->{main_id}, template_id=$close_ref->{template_id} where template_id=$close_ref->{source_template_id} and content_id IN (SELECT ct.c_id from $close_ref->{table} ct, relation rel where ct.c_id=rel.content_id and (ct.state ~ '[a-z]') and ct.int01 is not null and rel.main_id IN ($close_ref->{source_main_id}) and ct.int14 is null)");
|
||||
$sth = $dbh->prepare("UPDATE relation SET main_id=$close_ref->{main_id}, template_id=$close_ref->{template_id} where template_id=$close_ref->{source_template_id} and content_id IN (SELECT ct.c_id from $close_ref->{table} ct, relation rel where ct.c_id=rel.content_id and ct.int04 >= 1 and ct.int01 is not null and rel.main_id IN ($close_ref->{source_main_id}) and ct.int14 is null)");
|
||||
$rows = $sth->execute();
|
||||
|
||||
return $rows;
|
||||
|
|
|
@ -75,6 +75,7 @@ sub book_payment {
|
|||
table => "contenttrans",
|
||||
mtime => "now()",
|
||||
owner => $users_dms->{u_id},
|
||||
int04 => 0,
|
||||
};
|
||||
|
||||
my $node_faktura = $dbt->get_node($dbh,$dbt->{shareedms_conf}->{faktura});
|
||||
|
@ -105,17 +106,20 @@ sub book_payment {
|
|||
my $ctadr = { c_id => 0 };
|
||||
$ctadr = $dbt->fetch_tablerecord($dbh,$pref_adr) if($ctt->{int10});
|
||||
my $vde_on_fail = $ctadr->{int12} || 1;#keep last or set 1
|
||||
print EMA "Used adr c_id:$ctadr->{c_id} by ctt.int10: $ctt->{int10}\n";
|
||||
|
||||
my $sum_paid = "null";
|
||||
my $sum_operatorcredit = "null";
|
||||
my $sumgeb_teil = "null";
|
||||
my $sumgeb_bank = "null";
|
||||
my $sum_prepaid = "null";
|
||||
my $state = $R::state || "";
|
||||
$update_ctt->{state} = "$state";
|
||||
$update_ctt->{int04} = $R::int04 if(looks_like_number($R::int04));#set payment-type by "buchen"
|
||||
$update_ctt->{int14} = 2;#set OPOS
|
||||
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
my $state = $p_hash->{$update_ctt->{int04}};
|
||||
$update_ctt->{state} = "$state";#save it also to keep backwards compatibility
|
||||
print EMA "Payment-type $p_hash->{$update_ctt->{int04}} used adr c_id:$ctadr->{c_id} by ctt.int10: $ctt->{int10}\n";
|
||||
|
||||
if($R::sum_paid){
|
||||
$sum_paid = $R::sum_paid;
|
||||
$sum_paid =~ s/,/\./;
|
||||
|
@ -137,7 +141,7 @@ sub book_payment {
|
|||
$sumgeb_teil =~ s/,/\./;
|
||||
$update_ctt->{int08} = $sumgeb_teil;
|
||||
}
|
||||
#maybe, we don't use it
|
||||
#maybe, we don't need it
|
||||
if($R::sum_prepaid){
|
||||
$sum_prepaid = $R::sum_prepaid;
|
||||
$sum_prepaid =~ s/,/\./;
|
||||
|
@ -146,8 +150,8 @@ sub book_payment {
|
|||
|
||||
$feedb->{u_rows} = $dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
|
||||
#$R::state alias payment-type
|
||||
if($R::state =~ /payone/){
|
||||
#if payment-type payone
|
||||
if($update_ctt->{int04} && $update_ctt->{int04} <= 2){
|
||||
|
||||
if(!$ctt->{txt16}){
|
||||
#preauth
|
||||
|
@ -161,22 +165,23 @@ sub book_payment {
|
|||
$ctt = $dbt->fetch_record($dbh,$pref_ctt);#re-read values
|
||||
|
||||
#SEPA capture
|
||||
if($ctt->{txt16} && $R::state =~ /SEPA/){#SEPA
|
||||
if($ctt->{txt16} && $update_ctt->{int04} == 1){#SEPA
|
||||
my $payoneret = $self->captureSEPA_main($varenv,$ctadr,$ctt,$users_dms->{u_id});
|
||||
}
|
||||
#CC capture
|
||||
elsif($ctt->{txt16} && $R::state =~ /Kreditkarte/){#CC
|
||||
elsif($ctt->{txt16} && $update_ctt->{int04} == 2){#CC
|
||||
my $payoneret = $self->captureCC_main($varenv,$ctadr,$ctt,$users_dms->{u_id});
|
||||
}
|
||||
else{
|
||||
$feedb->{message} = "failure::Achtung, die payone Vorautorisierung hat keine TXID geliefert. Der Geldeinzug war somit nicht möglich (TXID:$ctt->{txt16} && $R::state).";
|
||||
$feedb->{message} = "failure::Achtung, die payone Vorautorisierung hat keine TXID geliefert. Der Geldeinzug war somit nicht möglich (TXID:$ctt->{txt16} && state: $update_ctt->{int04}|$state).";
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch, payone Geldeinzug nicht ausgeführt weil TXID bereits vorhanden. Hatte der Einzug bereits stattgefunden?";
|
||||
}
|
||||
|
||||
}
|
||||
elsif($ctt->{txt00} eq "Storno" || $state eq "Zahlungsausfall"){
|
||||
#Storno or Zahlungsausfall
|
||||
elsif($ctt->{txt00} eq "Storno" || $update_ctt->{int04} == 7){
|
||||
$update_ctt->{int14} = "null";
|
||||
$update_ctt->{pay_time} = "now()";
|
||||
$feedb->{u_rows} = $dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
|
@ -187,8 +192,15 @@ sub book_payment {
|
|||
}else{
|
||||
$feedb->{message} = "failure::Fehler, OPOS Automatik konnte nicht ausgeführt werden.";
|
||||
}
|
||||
if($update_ctt->{int04} == 7){
|
||||
$update_adr->{int12} = 2;#vde
|
||||
$dbt->update_record($dbh,$update_adr,$ctadr);
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
$dbt->update_record($dbh_primary,$update_adr,$ctadr);
|
||||
}
|
||||
}
|
||||
elsif($state eq "fehlgeschlagener Einzug"){
|
||||
#fehlgeschlagener Einzug
|
||||
elsif($update_ctt->{int04} == 6){
|
||||
$update_ctt->{int14} = "null";
|
||||
$update_ctt->{pay_time} = "now()";
|
||||
$feedb->{u_rows} = $dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
|
@ -198,8 +210,8 @@ sub book_payment {
|
|||
$update_ctt->{pay_time} = "now()";
|
||||
$feedb->{u_rows} = $dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
}
|
||||
elsif($state eq "Prepaid" && $ctadr->{c_id}){
|
||||
|
||||
#Prepaid
|
||||
elsif($update_ctt->{int04} == 3 && $ctadr->{c_id}){
|
||||
#APIshareeio APIcall
|
||||
my $shareeio_json = {
|
||||
request => "capture_prepaid",
|
||||
|
@ -600,7 +612,7 @@ sub captureSEPA_main {
|
|||
my $sequence = 1;
|
||||
$sequence = $ctt_rec->{sequence} if($ctt_rec->{sequence});
|
||||
|
||||
if($ctt->{c_id} && (!$ctt->{state} || $ctt->{int14} || $ctt_rec->{payone_reset})){
|
||||
if($ctt->{c_id} && (!$ctt->{int04} || $ctt->{int14} || $ctt_rec->{payone_reset})){
|
||||
my $amount = 0;#if payone_reset capture 0
|
||||
$amount = $ctt->{int01} * 100 if(looks_like_number($ctt->{int01}) && !$ctt_rec->{payone_reset});
|
||||
my $preauth_request = {
|
||||
|
@ -734,7 +746,7 @@ sub captureCC_main {
|
|||
my $sequence = 1;
|
||||
$sequence = $ctt_rec->{sequence} if($ctt_rec->{sequence});
|
||||
|
||||
if($ctt->{c_id} && (!$ctt->{state} || $ctt->{int14} || $ctt_rec->{payone_reset})){
|
||||
if($ctt->{c_id} && (!$ctt->{int04} || $ctt->{int14} || $ctt_rec->{payone_reset})){
|
||||
my $amount = 0;#if payone_reset capture 0
|
||||
$amount = $ctt->{int01} * 100 if(looks_like_number($ctt->{int01}) && !$ctt_rec->{payone_reset});
|
||||
my $preauth_request = {
|
||||
|
@ -930,7 +942,7 @@ sub rpc {
|
|||
|
||||
}else{#not APPROVED
|
||||
print FILE "NOT APPROVED $now_dt\n $todo: ctt.c_id=$ctt->{c_id} && ctadr.c_id=$ctadr->{c_id}" . $res->content . "\n" if($debug);
|
||||
$update_ctt->{int14} = 1 if($ctt->{state});#OPOS
|
||||
$update_ctt->{int14} = 1 if($ctt->{int04});#OPOS
|
||||
|
||||
#errormessage=Reference number already exists --> disabled
|
||||
#errormessage=Amount no longer available --> disabled
|
||||
|
@ -1021,7 +1033,6 @@ sub payone_capture {
|
|||
my $sum_paid = shift;
|
||||
my $owner = shift;
|
||||
|
||||
my $lang = "de";
|
||||
my $mandant_id = 100002;
|
||||
my $main_id = $ctt->{main_id};
|
||||
my $retval = "";
|
||||
|
@ -1030,12 +1041,20 @@ sub payone_capture {
|
|||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => $owner,
|
||||
};
|
||||
|
||||
my $update_ctt = {
|
||||
table => "contenttrans",
|
||||
mtime => "now()",
|
||||
owner => $owner,
|
||||
int01 => $sum_paid,
|
||||
int04 => 0,
|
||||
int14 => 2,
|
||||
};
|
||||
|
||||
|
@ -1058,21 +1077,33 @@ sub payone_capture {
|
|||
return $return_text;
|
||||
}
|
||||
|
||||
#set also state because we still need (payone) for some text selection TODO
|
||||
my $state = $ctt->{state} || "";
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
$state = $p_hash->{1} if($ctadr->{ct_name} =~ /\w{2}-\d+/);
|
||||
$state = $p_hash->{2} if(length($ctadr->{ct_name}) >= 19);
|
||||
if($ctadr->{ct_name} =~ /^\w{2}-\d+/){
|
||||
$state = $p_hash->{1};
|
||||
$update_ctt->{int04} = 1;
|
||||
}
|
||||
if(length($ctadr->{ct_name}) >= 19){
|
||||
$state = $p_hash->{2};
|
||||
$update_ctt->{int04} = 2;
|
||||
}
|
||||
if($ctadr->{ct_name} =~ /Prepaid-\d+/){
|
||||
$state = $p_hash->{3};
|
||||
$update_ctt->{int04} = 3;
|
||||
}
|
||||
|
||||
$update_ctt->{state} = "$state";
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt) if($update_ctt->{state});
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt) if($update_ctt->{int04});
|
||||
|
||||
#in cron we set OPOS anyway. If payone captured, it will be set int14=null
|
||||
if(!$state || $state !~ /payone/){
|
||||
if(!$update_ctt->{int04}){
|
||||
$return_text = "Payment.pm can not preauthorization because of absent payment-data in ctadr.c_id:$ctadr->{c_id}, SEPA/CC:$ctadr->{int03}, $ctadr->{ct_name}, we exit\n";
|
||||
return $return_text;
|
||||
}
|
||||
|
||||
#preauth
|
||||
if($ctadr->{ct_name} && $ctadr->{ct_name} =~ /\w{2}-\d+/ && !$ctt->{txt16}){
|
||||
if($ctadr->{ct_name} && $ctadr->{ct_name} =~ /^\w{2}-\d+/ && !$ctt->{txt16}){
|
||||
$self->preauthorizationSEPA_main($varenv,$ctadr,$ctt,$owner);
|
||||
|
||||
sleep 2;
|
||||
|
@ -1091,13 +1122,39 @@ sub payone_capture {
|
|||
$ctt = $dbt->fetch_record($dbh,$pref);
|
||||
|
||||
#SEPA capture
|
||||
if($ctadr->{ct_name} =~ /\w{2}-\d+/ && $ctt->{txt16} && $ctt->{state} =~ /SEPA/){#SEPA
|
||||
if($ctadr->{ct_name} =~ /^\w{2}-\d+/ && $ctt->{txt16} && $ctt->{int04} == 1){
|
||||
$self->captureSEPA_main($varenv,$ctadr,$ctt,$owner);
|
||||
}
|
||||
#CC capture
|
||||
elsif(length($ctadr->{ct_name}) >= 19 && $ctt->{txt16} && $ctt->{state} =~ /Kreditkarte/){#CC
|
||||
elsif(length($ctadr->{ct_name}) >= 19 && $ctt->{txt16} && $ctt->{int04} == 2){
|
||||
$self->captureCC_main($varenv,$ctadr,$ctt,$owner);
|
||||
}
|
||||
#Prepaid
|
||||
elsif($ctadr->{ct_name} =~ /Prepaid-\d+/ && $ctt->{int04} == 3){
|
||||
#APIshareeio APIcall
|
||||
my $shareeio_json = {
|
||||
request => "capture_prepaid",
|
||||
userID => "$ctadr->{c_id}",
|
||||
sum_paid => "$update_ctt->{int01}",
|
||||
invoice_reference => "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}-$ctt->{c_id}-$ctt->{ct_name}",
|
||||
};
|
||||
|
||||
my $vde_on_fail = $ctadr->{int12} || 1;#keep last or set 1
|
||||
my $response_in = {};
|
||||
$response_in = $rpcs->request_shareeio($varenv,$dbh,$ctadr,$shareeio_json);
|
||||
if($response_in->{shareeio}->{response_state} =~ /Success/i){
|
||||
$update_ctt->{int14} = "null";
|
||||
$update_ctt->{pay_time} = "now()";
|
||||
$update_adr->{int12} = "null";
|
||||
}else{
|
||||
$update_adr->{int12} = $vde_on_fail;#Vde
|
||||
}
|
||||
$update_ctt->{txt28} = $now_dt . " $state\n" . $response_in->{shareeio}->{response_state} . "\n\n" . $ctt->{txt28};
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
$dbt->update_record($dbh,$update_adr,$ctadr);
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
$dbt->update_record($dbh_primary,$update_adr,$ctadr);
|
||||
}
|
||||
else{
|
||||
$return_text = "Payment.pm can not get TXID ($ctadr->{int03} && $ctadr->{ct_name} && TXID:$ctt->{txt16})\n";
|
||||
}
|
||||
|
@ -1112,7 +1169,6 @@ sub payone_capture {
|
|||
$exit_code = $?;
|
||||
sleep 2;
|
||||
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $filesize = -s "$varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf";
|
||||
open(EMA, ">> $varenv->{logdir}/copri-print.log");
|
||||
print EMA "\n$now_dt\n$topdf --page-size A4 \"$varenv->{wwwhost}/Printpreview?printer_id=PDF\&mandant_main_id=$mandant_id\&main_id=$main_id\&ct_name2print=$ctt->{ct_name}\&c_id4trans=$ctt->{c_id}\&u_id=$owner\&pkey=$apikeyconf{pdfprinter}->{pkey}\" $varenv->{pdf}/$praefix-$ctt->{ct_name}.pdf\nreturn: $print_return\nfilesize: $filesize\nexit_code: $exit_code\n";
|
||||
|
|
|
@ -938,6 +938,7 @@ sub set_workflow {
|
|||
delete $ctt->{txt00};
|
||||
delete $ctt->{state};
|
||||
delete $ctt->{int01};
|
||||
delete $ctt->{int04};
|
||||
delete $ctt->{int14};
|
||||
delete $ctt->{int15};
|
||||
delete $ctt->{int16};
|
||||
|
@ -1043,6 +1044,7 @@ sub set_accounting2invoice {
|
|||
delete $ctt->{c_id};
|
||||
delete $ctt->{txt00};
|
||||
delete $ctt->{state};
|
||||
delete $ctt->{int04};
|
||||
delete $ctt->{itime};
|
||||
delete $ctt->{mtime};
|
||||
delete $ctt->{close_time};
|
||||
|
|
|
@ -586,13 +586,15 @@ sub operator_accounting2calc {
|
|||
my ($key,$val,$size) = split /=/,$_;
|
||||
if($key =~ /int/){
|
||||
|
||||
if($ctpos->{state} =~ /Zahlungsausfall/){
|
||||
#Zahlungsausfall
|
||||
if($ctpos->{int04} == 7){
|
||||
$oac->{int01} = $sumgeb_bank;
|
||||
$oac->{int93} = $sumgeb_bank * -1 if($key eq "int01");#Entgelt TeilRad
|
||||
$oac->{int93} = sprintf('%.3f', $oac->{int93});
|
||||
}
|
||||
|
||||
if($ctpos->{state} =~ /Lastschrift|Überweisung/){
|
||||
#Lastschrift|Überweisung
|
||||
if($ctpos->{int04} == 1 || $ctpos->{int04} == 4){
|
||||
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} if($key eq "int01");#Entgelt TeilRad
|
||||
$oac->{int93} = sprintf('%.3f', $oac->{int93});
|
||||
$oac->{int94} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int02");#po Disagio %
|
||||
|
@ -604,7 +606,7 @@ sub operator_accounting2calc {
|
|||
$oac->{int97} = 0;
|
||||
}
|
||||
|
||||
if($ctpos->{state} =~ /Kreditkarte/){
|
||||
if($ctpos->{int04} == 2){
|
||||
$oac->{int93} = $oac->{int01} / 100 * $ctf->{$key} if($key eq "int01");#Entgelt TeilRad
|
||||
$oac->{int93} = sprintf('%.3f', $oac->{int93});
|
||||
$oac->{int94} = $oac->{int01} / 100 * $ctf->{$key} * -1 if($key eq "int03");#po Disagio %
|
||||
|
@ -644,13 +646,14 @@ sub collect_prepaid {
|
|||
};
|
||||
|
||||
if($ctadr->{c_id}){
|
||||
#all un-booked or opos
|
||||
my $posref = {
|
||||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "all",
|
||||
keyfield => "c_id",
|
||||
ca_id => "$ctadr->{c_id}",
|
||||
'ct.state' => "is::null",
|
||||
'ct.state' => "is::null",#selects int04 is null OR int14 >= 1
|
||||
'ct.close_time' => "is::null",
|
||||
};
|
||||
my $cttpos = { c_id => 0 };
|
||||
|
@ -715,7 +718,7 @@ sub primary_sum_prepaid {
|
|||
fetch => "all",
|
||||
keyfield => "c_id",
|
||||
ca_id => "$auth->{c_id}",
|
||||
'ct.state' => "is::null",
|
||||
'ct.int04' => "is::null",
|
||||
};
|
||||
my $prepaid_pos = { c_id => 0 };
|
||||
$prepaid_pos = $dbt->collect_post($dbh,$pref) if($auth->{c_id});
|
||||
|
|
|
@ -221,6 +221,7 @@ EOF
|
|||
$journal = "<span style='color:silver;background-color:white;'>Journal </span>" if($ctt_rel->{$id}->{template_id} == 209);
|
||||
my $rel_opos = "";
|
||||
$rel_opos = "<span class='bi bi-record2' style='color:Maroon;'></span>" if($ctt_rel->{$id}->{int14});
|
||||
$rel_opos = "<span class='bi bi-record2' style='color:Olive;'></span>" if($ctt_rel->{$id}->{int04} == 7);
|
||||
print $q->div({-style=>"position:absolute;top:$toppx;right:10px;font-size:0.91em;background-color:$rel_color"}, "$journal ", $q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$ctt_rel->{$id}->{node_name}?ct_trans=open\&c_id4trans=$ctt_rel->{$id}->{c_id}\&tpl_id4trans=$ctt_rel->{$id}->{template_id}\&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $rel_opos $ctt_rel->{$id}->{txt00} $varenv->{praefix}-$ctt_rel->{$id}->{ct_name} ]")),"\n";
|
||||
$top += 22;
|
||||
}
|
||||
|
|
|
@ -316,6 +316,7 @@ sub tpl(){
|
|||
my $toppx = $top . "px";
|
||||
my $rel_opos = "";
|
||||
$rel_opos = "<span class='bi bi-record2' style='color:Maroon;'></span>" if($cttrans->{$id}->{int14});
|
||||
$rel_opos = "<span class='bi bi-record2' style='color:Olive;'></span>" if($cttrans->{$id}->{int04} == 7);
|
||||
print $q->div({-style=>"position:absolute;top:$toppx;right:20px;"}, " TXID $cttrans->{$id}->{txt16} ",$q->span({-style=>"background-color:#f7ae37"},$q->a({-class=>"linknav",-href=>"/$dbt->{shareedms_conf}->{parent_node}/Faktura/$cttrans->{$id}->{node_name}?ct_trans=open\&c_id4trans=$cttrans->{$id}->{c_id}\&tpl_id4trans=$cttrans->{$id}->{template_id}\&owner=$users_dms->{u_id}",-title=>"Faktura Terminal öffnen"},"[ $rel_opos $cttrans->{$id}->{node_name} #$cttrans->{$id}->{ct_name} ]"))),"\n";
|
||||
$top += 22;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ sub tpl(){
|
|||
my $coo = $q->cookie(-name=>'domcookie') || "";
|
||||
my $opdir_dms = "$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv{dbname}}->{dir_dms}" || "";
|
||||
my $xjournal = $dbt->get_node($dbh,$dbt->{shareedms_conf}->{xjournal});
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
|
||||
$path =~ s/\/login|\/user|\/manager|\/admin|\/$//;
|
||||
my $user_agent = $q->user_agent();
|
||||
|
@ -611,7 +612,6 @@ EOF
|
|||
print $q->td({-class=>'search_line'},$but->selector("s_$key","120px","$s_val",@_users)),"\n";
|
||||
}elsif($key =~ /state/){
|
||||
my @_states = ("");
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
foreach my $s_key (sort keys (%{ $p_hash })) {
|
||||
push @_states, "$p_hash->{$s_key}";
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ EOF
|
|||
print $q->td({-style=>"font-size:0.71em;padding:0;border:0px solid green;",-colspan=>"$tdcal",-nowrap=>"1"},"$day4month"),"\n";
|
||||
}
|
||||
|
||||
my $sum_saldo="0";my $sum_opos="0";my $sum_abb="0";my $sum_ueb="0";my $sum_success="0";my $sum_SEPApayone="0";my $sum_CCpayone="0";my $sum_ausfall="0";my $sum_gutschrift="0";my $sum_einzugfail="0";my $sum_entgelt="0";my $sum_abr="0";my $close_time="";my $payment_time="";
|
||||
my $sum_saldo="0";my $sum_opos="0";my $sum_prepaid="0";my $sum_ueb="0";my $sum_success="0";my $sum_SEPApayone="0";my $sum_CCpayone="0";my $sum_ausfall="0";my $sum_gutschrift="0";my $sum_einzugfail="0";my $sum_entgelt="0";my $sum_abr="0";my $close_time="";my $payment_time="";
|
||||
my $nr=0;my $nx=0;
|
||||
|
||||
#BIG LOOP loop content table
|
||||
|
@ -762,24 +762,26 @@ EOF
|
|||
}
|
||||
|
||||
#summarize
|
||||
$sum_saldo += $ct4rel->{$id}->{int16} if($ct4rel->{$id}->{state});
|
||||
#alias state
|
||||
if($ct4rel->{$id}->{int04}){
|
||||
$sum_saldo += $ct4rel->{$id}->{int16};
|
||||
|
||||
if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Zahlungsausfall/){
|
||||
if($ct4rel->{$id}->{int04} == 7){
|
||||
$sum_ausfall += $ct4rel->{$id}->{int01};
|
||||
}elsif($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /fehlgeschlagen/i){
|
||||
}elsif($ct4rel->{$id}->{int04} == 6){
|
||||
$sum_einzugfail += $ct4rel->{$id}->{int01};
|
||||
}elsif($ct4rel->{$id}->{state} && $ct4rel->{$id}->{int14} >= 1){
|
||||
}elsif($ct4rel->{$id}->{int14} >= 1){
|
||||
$sum_opos += $ct4rel->{$id}->{int01};
|
||||
}else{
|
||||
$sum_abb += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Abbuchung/);
|
||||
$sum_ueb += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Überweisung/);
|
||||
$sum_SEPApayone += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /SEPA.*payone/);
|
||||
$sum_CCpayone += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Kreditkarte.*payone/);
|
||||
}else{
|
||||
$sum_SEPApayone += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{int04} == 1);
|
||||
$sum_CCpayone += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{int04} == 2);
|
||||
$sum_prepaid += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{int04} == 3);
|
||||
$sum_ueb += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{int04} == 4);
|
||||
}
|
||||
$sum_gutschrift += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{int04} == 5);
|
||||
$sum_entgelt += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{int04} == 9);
|
||||
$sum_abr -= $ct4rel->{$id}->{int02} if($ct4rel->{$id}->{int04} == 8);
|
||||
}
|
||||
$sum_gutschrift += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Gutschrift/);
|
||||
$sum_entgelt += $ct4rel->{$id}->{int01} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Entgelt/);
|
||||
$sum_abr -= $ct4rel->{$id}->{int02} if($ct4rel->{$id}->{state} && $ct4rel->{$id}->{state} =~ /Abrechnung/);
|
||||
#
|
||||
|
||||
$c_id4csv .= "$ct4rel->{$id}->{c_id},";
|
||||
$ct4rel->{$id}->{ct_name} = $q->unescapeHTML($ct4rel->{$id}->{ct_name}) || "";
|
||||
|
@ -804,7 +806,8 @@ EOF
|
|||
if($users_dms_primary->{int03} == 2 && $users_dms->{int03} == 2){
|
||||
my $checked = 0;
|
||||
|
||||
if($R::accounting_select && $node_meta->{template_id} == 209 && $ct4rel->{$id}->{int01} > 0 && $ct4rel->{$id}->{state} =~ /payone/i && !$ct4rel->{$id}->{int14} && $ct4rel->{$id}->{int16} == 0 && !$ct4rel->{$id}->{txt22} && $ct4rel->{$id}->{int18} eq "1"){
|
||||
#autoselect succesfull payone payments
|
||||
if($R::accounting_select && $node_meta->{template_id} == 209 && $ct4rel->{$id}->{int01} > 0 && $ct4rel->{$id}->{int04} && $ct4rel->{$id}->{int04} <= 2 && !$ct4rel->{$id}->{int14} && $ct4rel->{$id}->{int16} == 0 && !$ct4rel->{$id}->{txt22} && $ct4rel->{$id}->{int18} eq "1"){
|
||||
$checked = 1;
|
||||
}
|
||||
|
||||
|
@ -984,9 +987,6 @@ EOF
|
|||
$ct4rel->{$id}->{end_time} = $lb->time4de($ct4rel->{$id}->{end_time},"1") if($ct4rel->{$id}->{end_time});
|
||||
print $q->td({-class=>'tdtxt',-style=>"$txtstyle $set_style", -nowrap=>1},"$ct4rel->{$id}->{start_time} - $ct4rel->{$id}->{end_time}"),"\n";
|
||||
}elsif($key =~ /int01/ && ($node_meta->{parent_id} == $dbt->{shareedms_conf}->{faktura} || $node_meta->{main_id} == $dbt->{shareedms_conf}->{faktura})){
|
||||
if($ct4rel->{$id}->{state} eq "Kassenbestand"){
|
||||
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},""),"\n";
|
||||
}else{
|
||||
my $betrag = "";
|
||||
if($ct4rel->{$id}->{$key}){
|
||||
$betrag = $ct4rel->{$id}->{$key};
|
||||
|
@ -996,7 +996,6 @@ EOF
|
|||
$betrag = $ct4rel->{$id}->{$key} if($v_journal);
|
||||
$betrag =~ s/\./,/;
|
||||
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style",-nowrap=>1},"$betrag"),"\n";
|
||||
}
|
||||
}elsif($key =~ /int02/ && $ct4rel->{$id}->{state} eq "Tagesabschluss"){
|
||||
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},""),"\n";
|
||||
}elsif($key =~ /int03/ && "$table" eq "contenttrans"){
|
||||
|
@ -1008,12 +1007,13 @@ EOF
|
|||
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},"$ct4rel->{$id}->{$key} $close $payment"),"\n";
|
||||
}elsif($key =~ /owner/){
|
||||
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},"$u_name"),"\n";
|
||||
}elsif($key =~ /state/){
|
||||
}elsif($key =~ /state/){#int04 state key
|
||||
my $order_state = "";
|
||||
$order_state = "$ct4rel->{$id}->{txt22}" if($ct4rel->{$id}->{txt22});
|
||||
$order_state = "$ct4rel->{$id}->{txt22},<br />" if($ct4rel->{$id}->{txt22} && $ct4rel->{$id}->{$key});
|
||||
my $capture_state = "<span>$ct4rel->{$id}->{$key}</span>";
|
||||
$capture_state = "<span style='color:Maroon;'>$ct4rel->{$id}->{$key}</span>" if($ct4rel->{$id}->{int14} >= 1);
|
||||
$order_state = "$ct4rel->{$id}->{txt22},<br />" if($ct4rel->{$id}->{txt22} && $p_hash->{$ct4rel->{$id}->{int04}});
|
||||
my $capture_state = "<span>$p_hash->{$ct4rel->{$id}->{int04}}</span>";
|
||||
$capture_state = "<span style='color:Maroon;'>$p_hash->{$ct4rel->{$id}->{int04}}</span>" if($ct4rel->{$id}->{int14} >= 1);
|
||||
$capture_state = "<span style='color:Olive;'>$p_hash->{$ct4rel->{$id}->{int04}}</span>" if($ct4rel->{$id}->{int04} == 7);
|
||||
print $q->td({-class=>'tdint',-style=>"$txtstyle $set_style"},"$order_state $capture_state"),"\n";
|
||||
}elsif($ct4rel->{$id}->{template_id} =~ /205|225/ && $key eq "int10"){#bike_state
|
||||
my $colorize = "";
|
||||
|
@ -1205,6 +1205,14 @@ EOF
|
|||
print $q->td({-class=>'tdint',-colspan=>"$m"},"Überweisung Summe");
|
||||
print $q->td({-class=>'tdint',-colspan=>"1",-nowrap=>"1"},"$sum_ueb €");
|
||||
}
|
||||
if($sum_prepaid != 0){
|
||||
$sum_prepaid = sprintf('%.2f',$sum_prepaid);
|
||||
$sum_success += $sum_prepaid;
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"background-color:silver;"},""),"\n";
|
||||
print $q->td({-class=>'tdint',-colspan=>"$m"},"Prepaid Summe");
|
||||
print $q->td({-class=>'tdint',-colspan=>"1",-nowrap=>"1"},"$sum_prepaid €");
|
||||
}
|
||||
if($sum_SEPApayone != 0){
|
||||
$sum_SEPApayone = sprintf('%.2f',$sum_SEPApayone);
|
||||
$sum_success += $sum_SEPApayone;
|
||||
|
|
|
@ -302,29 +302,36 @@ sub tpl(){
|
|||
if($users_dms_primary->{u_id} && $users_dms_primary->{int03} == 2){
|
||||
my @_paymentstate = ("");
|
||||
my $kind_of_payment = "";
|
||||
my @_payment_valxx = ("");#new
|
||||
my $setdefault_payment = "";#new
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
#we need it for both
|
||||
print $q->hidden(-name=>'sum_operatorcredit', -override=>'1',-value=>"$sum_operatorcredit");
|
||||
print $q->hidden(-name=>'sum_paid', -override=>'1',-value=>"$sum_paid");
|
||||
if($ctt->{template_id} != 208){#not equal Abrechnung
|
||||
push @_paymentstate, "Entgelt TeilRad GmbH";
|
||||
if($ctt->{state} && $ctt->{int01}){
|
||||
push @_payment_valxx, "9:(9) $p_hash->{9}";
|
||||
if($ctt->{int04} && $ctt->{int01}){
|
||||
$kind_of_payment = "$ctt->{state}";
|
||||
$setdefault_payment = 9;
|
||||
$ctt->{int01} =~ s/\./,/;
|
||||
my $style = "color:red;" if($ctt->{int01} ne $sum_paid);
|
||||
my $opos = "";
|
||||
$opos = "OPOS" if($ctt->{int14} && $ctt->{int14} > 0);
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> $vibuchen_mtime \"$ctt->{state}\" $ctt->{int01} €"),"\n";
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> $vibuchen_mtime \"$p_hash->{$ctt->{int04}}\" $ctt->{int01} €"),"\n";
|
||||
}
|
||||
}
|
||||
else{
|
||||
push @_paymentstate, "Betreiber Abrechnung";
|
||||
if($ctt->{state} && $ctt->{int02}){
|
||||
push @_payment_valxx, "8:(8) $p_hash->{8}";
|
||||
if($ctt->{int04} && $ctt->{int02}){
|
||||
$kind_of_payment = "$ctt->{state}";
|
||||
$setdefault_payment = 8;
|
||||
$ctt->{int02} =~ s/\./,/;
|
||||
my $style = "color:red;" if($ctt->{int02} ne $sum_operatorcredit);
|
||||
my $opos = "";
|
||||
$opos = "OPOS" if($ctt->{int14} && $ctt->{int14} > 0);
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Buchung $vibuchen_mtime \"$ctt->{state}\" $ctt->{int02} €"),"\n";
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Buchung $vibuchen_mtime \"$p_hash->{$ctt->{int04}}\" $ctt->{int02} €"),"\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +342,8 @@ sub tpl(){
|
|||
": PDF drucken ",$but->checkbox("1","print_pdf","1","PDF drucken",""),
|
||||
" – eMail senden ",$but->checkbox("1","send_invoice","$send_invoice_checkbox","eMail $ctt->{txt00}",""),
|
||||
" – Zahlungsart ",
|
||||
$but->selector("state","250px",$kind_of_payment,@_paymentstate),
|
||||
#$but->selector("state","250px",$kind_of_payment,@_paymentstate),
|
||||
$but->selector_class("int04","","",$setdefault_payment,@_payment_valxx),
|
||||
$but->singlesubmit1("set_state","buchen")),
|
||||
"\n";
|
||||
}
|
||||
|
|
|
@ -558,48 +558,70 @@ EOF
|
|||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"");
|
||||
|
||||
if($users_dms_primary->{u_id}){
|
||||
my $kind_of_payment = "";
|
||||
my @_paymentstate = ("");
|
||||
my $kind_of_payment = "";#old
|
||||
my @_paymentstate = ("");#old
|
||||
my @_payment_valxx = ("");#new
|
||||
my $setdefault_payment = "";#new
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
foreach my $s_key (sort keys (%{ $p_hash })) {
|
||||
push @_paymentstate, "$p_hash->{$s_key}";
|
||||
if($ctt->{state}){
|
||||
#$kind_of_payment = $p_hash->{$s_key} if($ctt->{int03} == $s_key);
|
||||
$kind_of_payment = $ctt->{state};
|
||||
if($s_key <= 7){
|
||||
push @_paymentstate, "$p_hash->{$s_key}";
|
||||
push @_payment_valxx, "$s_key:($s_key) $p_hash->{$s_key}";
|
||||
}
|
||||
if($ctt->{state} || $ctt->{int04}){
|
||||
$kind_of_payment = $ctt->{state} if($ctt->{state});
|
||||
$setdefault_payment = $ctt->{int04} if($ctt->{int04});
|
||||
}
|
||||
elsif($ctt->{txt00} eq "Storno"){
|
||||
$kind_of_payment = $p_hash->{6};
|
||||
$setdefault_payment = 6;
|
||||
}
|
||||
elsif($ctt->{int06} && $ctt->{int06} >= 3 || $ctt->{ct_name} =~ /\d-\d/){
|
||||
#default to Überw.
|
||||
$kind_of_payment = $p_hash->{4};
|
||||
$setdefault_payment = 4;
|
||||
}
|
||||
elsif($ctadr->{int03}){
|
||||
$kind_of_payment = $p_hash->{1} if($ctadr->{ct_name} =~ /\w{2}-\d+/);
|
||||
$kind_of_payment = $p_hash->{2} if(length($ctadr->{ct_name}) >= 19);
|
||||
$kind_of_payment = $p_hash->{3} if($ctadr->{ct_name} =~ /Prepaid-\d+/);
|
||||
if($ctadr->{ct_name} =~ /\w{2}-\d+/){
|
||||
$kind_of_payment = $p_hash->{1};
|
||||
$setdefault_payment = 1;
|
||||
}
|
||||
if(length($ctadr->{ct_name}) >= 19){
|
||||
$kind_of_payment = $p_hash->{2};
|
||||
$setdefault_payment = 2;
|
||||
}
|
||||
if($ctadr->{ct_name} =~ /Prepaid-\d+/){
|
||||
$kind_of_payment = $p_hash->{3};
|
||||
$setdefault_payment = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
#only prepaid on primary
|
||||
@_paymentstate = ("Prepaid") if($varenv->{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
|
||||
if($ctt->{state} && $ctt->{int01}){
|
||||
if($varenv->{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
||||
@_paymentstate = ("Prepaid");
|
||||
@_payment_valxx = ("3:(3) Prepaid");
|
||||
$setdefault_payment = 3;
|
||||
}
|
||||
if($ctt->{int04} && $ctt->{int01}){
|
||||
$ctt->{int01} =~ s/\./,/;
|
||||
my $style = "color:red;" if($ctt->{int01} ne $sum_paid);
|
||||
$vibuchen_mtime = $lb->time4de($ctt->{pay_time},1) if($ctt->{pay_time});
|
||||
my $opos = "";
|
||||
$opos = "OPOS" if($ctt->{int14} && $ctt->{int14} > 0);
|
||||
if($ctt->{int16} && ($ctt->{int16} == 1 || $ctt->{int16} == 2)){
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Summe $ctt->{int01} € gebucht per \"$ctt->{state}\" | Payone Saldo $ctt->{int16} € | $vibuchen_mtime "),"\n";
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Summe $ctt->{int01} € gebucht per \"$p_hash->{$ctt->{int04}}\" | Payone Saldo $ctt->{int16} € | $vibuchen_mtime "),"\n";
|
||||
}else{
|
||||
my $fibutext = "";
|
||||
$fibutext .= "<span style='color:silver;'>(Bank Gebühr $ctt->{int07})</span>" if($ctt->{int07});
|
||||
$fibutext .= "<span style='color:silver;'>(TeilRad Gebühr $ctt->{int08})</span>" if($ctt->{int08});
|
||||
#$fibutext .= "<span style='color:silver;'>(Prepaid $ctt->{int09})</span>" if($ctt->{int09});
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Summe $ctt->{int01} € $fibutext gebucht per \"$ctt->{state}\" | $vibuchen_mtime "),"\n";
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:red;'>$opos</span> Summe $ctt->{int01} € $fibutext gebucht per \"$p_hash->{$ctt->{int04}}\" | $vibuchen_mtime "),"\n";
|
||||
}
|
||||
}else{
|
||||
print $q->div({-style=>"padding:0.5em;font-size:0.81em;width:98%;text-align:right;"},"<span style='color:silver;'>Summe ist nicht gebucht!</span>"),"\n";
|
||||
}
|
||||
|
||||
if($ctadr->{ct_name} =~ /Prepaid-\d+/ && $varenv->{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname} && (!$ctt->{state} || $ctt->{int14})){
|
||||
if($ctadr->{ct_name} =~ /Prepaid-\d+/ && $varenv->{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname} && (!$ctt->{int04} || $ctt->{int14})){
|
||||
my $presaldo = $sum_prepaid - $sum_paid;
|
||||
$presaldo = sprintf('%.2f', $presaldo);
|
||||
my $precolor = "red";
|
||||
|
@ -615,7 +637,8 @@ EOF
|
|||
": PDF drucken ",$but->checkbox("1","print_pdf","1","PDF drucken",""),
|
||||
" – eMail senden ",$but->checkbox("1","send_invoice","$send_invoice_checkbox","eMail $ctt->{txt00}",""),
|
||||
" – Zahlungsart/Status ",
|
||||
$but->selector("state","250px",$kind_of_payment,@_paymentstate),
|
||||
#$but->selector("state","250px",$kind_of_payment,@_paymentstate),
|
||||
$but->selector_class("int04","","",$setdefault_payment,@_payment_valxx),
|
||||
$but->singlesubmit1("set_state","buchen")),
|
||||
"\n";
|
||||
|
||||
|
|
|
@ -23,13 +23,14 @@ use POSIX;
|
|||
use CGI ':standard';
|
||||
use Lib::Config;
|
||||
use Mod::DBtank;
|
||||
use Mod::APIfunc;
|
||||
use Data::Dumper;
|
||||
|
||||
my $q = new CGI;
|
||||
my $cf = new Config;
|
||||
my %varenv = $cf->envonline("$syshost");
|
||||
my $dbt = new DBtank;
|
||||
my $lang = "de";
|
||||
my $apif = new APIfunc;
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
my $dbh = "";
|
||||
|
||||
|
@ -43,7 +44,6 @@ my $pref = {
|
|||
fetch => "all",
|
||||
keyfield => "c_id",
|
||||
int10 => "2",
|
||||
owner => "!=::199",#don't select LV api requested bikes
|
||||
start_time => "<=::(now() - interval '$interval_min minutes')",
|
||||
};
|
||||
my $record_cp = $dbt->fetch_tablerecord($dbh,$pref);
|
||||
|
@ -61,14 +61,19 @@ my $update_cc = {
|
|||
|
||||
my $rows = 0;
|
||||
foreach my $id (sort { $record_cp->{$a}->{c_id} <=> $record_cp->{$b}->{c_id} } keys (%$record_cp)){
|
||||
my $record = { c_id => 0 };
|
||||
$record->{c_id} = $record_cp->{$id}->{c_id};
|
||||
#contenttranspos
|
||||
$rows = $dbt->update_record($dbh,$update_cp,$record);
|
||||
my $record_cpone = { c_id => 0 };
|
||||
$record_cpone->{c_id} = $record_cp->{$id}->{c_id};
|
||||
$update_cp->{int04} = $record_cp->{$id}->{int06};#set end-station to start-station
|
||||
$rows = $dbt->update_record($dbh,$update_cp,$record_cpone);
|
||||
|
||||
if($rows > 0 && $record_cp->{$id}->{cc_id}){
|
||||
$record->{c_id} = $record_cp->{$id}->{cc_id};
|
||||
#content
|
||||
my $record = { c_id => 0 };
|
||||
$record->{c_id} = $record_cp->{$id}->{cc_id};
|
||||
$dbt->update_record($dbh,$update_cc,$record);
|
||||
my $authraw = { c_id => 0 };
|
||||
$apif->stations_caching($q,\%varenv,$authraw);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ sub tpl(){
|
|||
print $q->div({-style=>'margin-top:1em;text-align:center;'},"<button type='submit' name='sharee_edit' value='save_account' class='btn btn-primary btn-lg btn-block' style='border:1px solid #$bgcolor1;background-color:#$bgcolor1;'>$varenv->{cms}->{'iframe-next'}->{txt}</button>"),"\n";
|
||||
|
||||
}
|
||||
print $q->div({-class=>'content2', -style=>'padding-top:50px;font-size:0.81em;'}, "$varenv->{cms}->{'iframe-prepaid-footer'}->{txt}"),"\n";
|
||||
|
||||
print "</div>\n";
|
||||
print $q->end_form,"\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue