mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-11 14:27:28 +02:00
Refactoring user registration payment methodes
This commit is contained in:
parent
dc89bed086
commit
da31898968
28 changed files with 974 additions and 2750 deletions
|
@ -1902,7 +1902,7 @@ sub bikes_available(){
|
|||
$return->{$id}->{station} = "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{int04}";
|
||||
$return->{$id}->{aa_ride} = "0";
|
||||
$return->{$id}->{aa_ride} = "1" if($record_st->{$record->{$id}->{int04}}->{int42});
|
||||
$return->{$id}->{uri_operator} = "$varenv->{wwwhost}";
|
||||
$return->{$id}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
||||
($return->{$id}->{gps}->{latitude},$return->{$id}->{gps}->{longitude}) = split(/,/,$record->{$id}->{txt06});
|
||||
$return->{$id}->{bike} = "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{barcode}";
|
||||
|
||||
|
@ -2084,7 +2084,7 @@ sub bikes_all(){
|
|||
foreach my $id (sort { $record->{$a}->{barcode} <=> $record->{$b}->{barcode} } keys (%$record)){
|
||||
if(1==1){
|
||||
$bikes_on_station->{$record->{$id}->{int04}}->{bike_ist} += 1;
|
||||
$return->{$id}->{uri_operator} = "$varenv->{wwwhost}";
|
||||
$return->{$id}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
||||
$return->{$id}->{station} = "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{int04}";
|
||||
($return->{$id}->{gps}->{latitude},$return->{$id}->{gps}->{longitude}) = split(/,/,$record->{$id}->{txt06});
|
||||
$return->{$id}->{bike} = "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{barcode}";
|
||||
|
@ -2302,7 +2302,7 @@ sub stations_available(){
|
|||
$return->{$id}->{capacity} = "$record->{$id}->{int05}" || "1";
|
||||
|
||||
$return->{$id}->{station} = "$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{int04}";
|
||||
$return->{$id}->{uri_operator} = "$varenv->{wwwhost}";
|
||||
$return->{$id}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
||||
($return->{$id}->{gps}->{latitude},$return->{$id}->{gps}->{longitude}) = split(/,/,$record->{$id}->{txt06});
|
||||
my $description = $q->unescapeHTML($record->{$id}->{txt01}) || "";
|
||||
$return->{$id}->{description} = "$description";
|
||||
|
@ -2497,7 +2497,7 @@ sub stations_all(){
|
|||
}
|
||||
}
|
||||
|
||||
$return->{$id}->{uri_operator} = "$varenv->{wwwhost}";
|
||||
$return->{$id}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
||||
($return->{$id}->{gps}->{latitude},$return->{$id}->{gps}->{longitude}) = split(/,/,$record->{$id}->{txt06});
|
||||
if($record->{$id}->{description}){
|
||||
my $description = $q->unescapeHTML($record->{$id}->{txt01}) || "";
|
||||
|
@ -2940,6 +2940,16 @@ sub auth_verify(){
|
|||
$update_primary->{txt26} = $q->escapeHTML($user_agent) if($user_agent);
|
||||
}
|
||||
|
||||
#check prepaid account
|
||||
if($auth_primary->{int03} == 3){
|
||||
my $prepaidhash = { prepaid_total => 0 };
|
||||
$prepaidhash = $pri->collect_prepaid($dbh_primary,$auth_primary) if($auth_primary->{c_id});
|
||||
if(!$prepaidhash->{prepaid_total} || $prepaidhash->{prepaid_total} < 0){
|
||||
my $vde = $auth_primary->{int12} || 1;
|
||||
$update_primary->{int12} = $vde;
|
||||
}
|
||||
}
|
||||
|
||||
my $rows = $dbt->update_record($dbh_primary,$update_primary,$auth_primary);
|
||||
$auth_primary = $dbt->fetch_record($dbh_primary,$authref);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ my $response = {
|
|||
apiserver => "$apiserver",
|
||||
response => "$respreq",
|
||||
uri_primary => "$dbt->{primary}->{sharee_primary}->{primaryApp}",
|
||||
copri_version => "4.1.23.22",
|
||||
copri_version => "4.1.23.23",
|
||||
user_id => "",
|
||||
authcookie => "",
|
||||
new_authcoo => "0",
|
||||
|
|
|
@ -171,6 +171,7 @@ sub handler {
|
|||
#update adr also on primary
|
||||
my $dbh_primary = $dbt->dbconnect($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
$dbt->update_record($dbh_primary,$update_adr,$ctadr);
|
||||
print FILE Dumper($update_adr) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,13 +47,17 @@ sub handler {
|
|||
my $debug=1;
|
||||
my $user_agent = $q->user_agent();
|
||||
my $dbh = "";
|
||||
|
||||
$bw->log("APIvelo POST:\n--> user-agent: '$user_agent' to syshost: $varenv{syshost}\n",$q,"");
|
||||
my %headers = map { $_ => $q->http($_) } $q->http();
|
||||
#$bw->log("APIvelo POST:\n--> user-agent: '$user_agent' to syshost: $varenv{syshost}\n",$q,"");
|
||||
|
||||
print $q->header(-type => "application/json", -charset => "utf-8", -'Access-Control-Allow-Origin' => "*");
|
||||
|
||||
open(FILE,">>$varenv{logdir}/APIvelo.log") if($debug);
|
||||
print FILE "\n*** $now_dt user-agent: '$user_agent' to syshost: $varenv{syshost}\n" if($debug);
|
||||
#print FILE "headers:" . Dumper(%headers) . "\n";
|
||||
for my $header ( keys %headers ) {
|
||||
print FILE "$header: $headers{$header}\n";
|
||||
}
|
||||
print FILE "<=== veloDUMP\n " . Dumper($q) . "\n" if($debug);
|
||||
print FILE "<=== DUMP postdata:\n " . Dumper($q->param('POSTDATA')) . "\n" if($debug);
|
||||
|
||||
|
@ -68,7 +72,7 @@ eval {
|
|||
#- int30=velofactur station ID
|
||||
#- int31=velofactur slot ID
|
||||
|
||||
my $jrout = $json->pretty->encode({ fakturjson => $response_in });
|
||||
my $jrout = $json->pretty->encode($response_in);
|
||||
print FILE "<=== JSON POST from velofactur:\n$jrout\n" if($debug);
|
||||
|
||||
my $record_cc = { c_id => 0 };
|
||||
|
@ -118,7 +122,7 @@ eval {
|
|||
#$update_cc->{int29} = 1;
|
||||
}
|
||||
|
||||
$rows = $dbt->update_record($dbh_operator,$update_cc,$record_cc);
|
||||
#$rows = $dbt->update_record($dbh_operator,$update_cc,$record_cc);
|
||||
$bw->log("velofactur updates dbname: $sharee_operator, c_id=$record_cc->{c_id} by fakturjson $response_in->{Typ} | rows:$rows",$update_cc,"");
|
||||
print FILE "---> velofactur updates dbname: $sharee_operator, c_id=$record_cc->{c_id} by fakturjson $response_in->{Typ} | rows:$rows\n" . Dumper($update_cc) . "\n" if($debug);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ sub isuser_rentable {
|
|||
my $varenv = shift;
|
||||
|
||||
my $rentable_check=0;
|
||||
if($auth->{int03} && $auth->{ct_name} && ($auth->{int03} == 1 && $auth->{ct_name} =~ /\w{2}-\d+/) || ($auth->{int03} == 2 && length($auth->{ct_name}) >= 19) || ($auth->{int03} == 3 && $auth->{ct_name} =~ /Prepay-\d+/i)){
|
||||
if($auth->{int03} && $auth->{ct_name} && ($auth->{int03} == 1 && $auth->{ct_name} =~ /\w{2}-\d+/) || ($auth->{int03} == 2 && length($auth->{ct_name}) >= 19) || ($auth->{int03} == 3 && $auth->{ct_name} =~ /Prepaid-\d+/i)){
|
||||
$rentable_check=1;
|
||||
if($auth->{txt08} && $auth->{int04} == 1 && $auth->{int13} == 1 && !$auth->{int12} && $auth->{int14}){
|
||||
$rentable_check=2;#if 2 then everything should be alright. rental is enabled
|
||||
|
|
|
@ -429,27 +429,47 @@ sub collect_node {
|
|||
return ($nodes,$rows);
|
||||
}
|
||||
|
||||
#only used by dead_relation
|
||||
sub collect_relation {
|
||||
#collect main_ids
|
||||
sub collect_noderec {
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $where = shift || "1=1";
|
||||
my $main_id = shift;
|
||||
|
||||
my $sth = $dbh->prepare("SELECT * FROM relation where $where");
|
||||
my $rc = $sth->execute();
|
||||
my $rel = $sth->fetchall_hashref("rel_id");
|
||||
return $rel;
|
||||
my $main_ids = "$main_id,";
|
||||
my ($main_collect,$rows) = $self->collect_node($dbh,$main_id);
|
||||
if(ref($main_collect) eq "HASH"){
|
||||
foreach my $id (keys (%$main_collect)){
|
||||
if($main_collect->{$id}->{node_name}){
|
||||
$main_ids .= "$main_collect->{$id}->{main_id},";
|
||||
my ($main_collect2,$rows) = $self->collect_node($dbh,$main_collect->{$id}->{main_id}) if($main_collect->{$id}->{main_id});
|
||||
if(ref($main_collect2) eq "HASH"){
|
||||
foreach my $id (keys (%$main_collect2)){
|
||||
$main_ids .= "$main_collect2->{$id}->{main_id},";
|
||||
my ($main_collect3,$rows) = $self->collect_node($dbh,$main_collect2->{$id}->{main_id}) if($main_collect2->{$id}->{main_id});
|
||||
if(ref($main_collect3) eq "HASH"){
|
||||
foreach my $id (keys (%$main_collect3)){
|
||||
$main_ids .= "$main_collect3->{$id}->{main_id},";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$main_ids =~ s/,$//;
|
||||
return $main_ids;
|
||||
}
|
||||
|
||||
#not used
|
||||
sub collect_relct {
|
||||
#collect relation nodes
|
||||
sub collect_rel4nodes(){
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $ref = shift;
|
||||
my $sth = $dbh->prepare("SELECT * FROM relation rel, $ref->{table} c where rel.content_id > 0 and rel.template_id=224 and rel.content_id=c.c_id order by rel.content_id");
|
||||
my $main_ids = shift;
|
||||
|
||||
my $sth = $dbh->prepare("SELECT * FROM relation rel, nodes nd where rel.main_id=nd.main_id and parent_id IN ($main_ids)");
|
||||
my $rc = $sth->execute();
|
||||
my $rel = $sth->fetchall_hashref("rel_id");
|
||||
return $rel;
|
||||
my $rel4nd = $sth->fetchall_hashref("rel_id");
|
||||
return $rel4nd;
|
||||
}
|
||||
|
||||
# Nodes einer Ebene mit relation
|
||||
|
@ -582,21 +602,6 @@ sub fetch_rel4tpl4nd(){
|
|||
return $rel;
|
||||
}
|
||||
|
||||
#azn time worktime from Von Bis
|
||||
sub select_worktime {
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $fetch = shift;
|
||||
|
||||
my $sql = "SELECT $fetch->{end_at} - $fetch->{start_at} AS worktime FROM $fetch->{table} where ct_id = $fetch->{ct_id} and barcode = $fetch->{barcode} and $fetch->{end_at} is not null and $fetch->{start_at} is not null";
|
||||
my $sth = $dbh->prepare($sql);
|
||||
my $rc = $sth->execute();
|
||||
my $record = $sth->fetchrow_hashref();
|
||||
$bw->log("DBtank select_worktime: ",$sql,"") if($debug);
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
#all accounting position of contenttrans
|
||||
sub collect_contenttrans(){
|
||||
my $self = shift;
|
||||
|
@ -1190,6 +1195,28 @@ sub delete_content(){
|
|||
return $rows;
|
||||
}
|
||||
|
||||
#collect content with contenttranspos
|
||||
sub collect_postime(){
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $table = shift;
|
||||
my $start_date_time = shift;
|
||||
my $end_date_time = shift;
|
||||
my $start_date2 = shift || "";
|
||||
my $end_date2 = shift || "";
|
||||
|
||||
$start_date_time =~ s/,/./g;
|
||||
$end_date_time =~ s/,/./g;
|
||||
my $where = "where cp.cc_id=c.c_id";
|
||||
$where .= " and cp.start_time >= $start_date_time";
|
||||
$where .= " and cp.end_time <= $end_date_time";
|
||||
$where .= " and (cp.start_time >= '$start_date2' OR cp.end_time >= '$start_date2')" if($start_date2 && $end_date2);
|
||||
my $sth = $dbh->prepare("SELECT cp.* from content c, $table cp $where order by cp.end_time");
|
||||
my $rc = $sth->execute();
|
||||
my $ct = $sth->fetchall_hashref("cc_id");
|
||||
return $ct;
|
||||
}
|
||||
|
||||
|
||||
#collect contenttranspos with contenttrans
|
||||
sub collect_transpos {
|
||||
|
@ -1563,7 +1590,7 @@ sub insert_pos(){
|
|||
if($ct->{template_id} && $ct->{template_id} == 205){#Leihrad_list
|
||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt01,txt08,txt02,txt09,txt12,itime,start_time,end_time,int01,int02,int03,int06,txt05,txt06,txt07,int10,int12,template_id,int13,owner,int07,txt04,int09,int17,int15,int11,int18,int19,txt17,txt18,int20,int25,int29,int34,txt22,txt11,int35,int36,int37,int42,time01,time02) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$ct->{txt01}','$user_name','$ct->{txt02}','$ctadr->{txt09}','$prefix',now(),now(),'$endRental','1','$unit_price','$menge','$start_station','$ct->{txt06}','$ct->{txt06}','$ct->{txt07}','$status','$from_main_id','$from_template_id','$deviceId','$owner','$rabatt','$tariff_desc','$tariff_nr','$daymax_price','$abo_price','$ct->{int11}','$sharing_type','$bike_charge','$ct->{txt17}','$ct->{txt18}','1','$trackon','$bike_type_id','$staff','$sig_book->{bikeId}','$sig_book->{rentalId}','$unit_price1','$unit_price2','$start_price','$aa_station','$unit_time','$free_time') RETURNING c_id");
|
||||
}else{
|
||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int01,int02,int03,txt01,int10,int12,int16,template_id,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$user_name','$ctadr->{txt09}',now(),'1','$unit_price','1','$ct->{txt01}','0','$from_main_id','$fibumark','$from_template_id','$owner') RETURNING c_id");
|
||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,itime,int01,int02,int03,txt01,int10,int12,int16,template_id,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$user_name',now(),'1','$unit_price','1','$ct->{txt01}','0','$from_main_id','$fibumark','$from_template_id','$owner') RETURNING c_id");
|
||||
}
|
||||
my $rows = $sth->execute();
|
||||
my $last_id;
|
||||
|
@ -1675,7 +1702,7 @@ sub evaluationsfragen {
|
|||
}
|
||||
|
||||
#search table content.
|
||||
sub search_content(){
|
||||
sub search_content {
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $searchref = shift;
|
||||
|
@ -1683,14 +1710,12 @@ sub search_content(){
|
|||
my $users_dms = shift;
|
||||
my $main_ids = shift || 0;
|
||||
my $tplids = shift || 0;
|
||||
my $ct_ids = shift || 0;
|
||||
my $v_journal = shift || "";
|
||||
my $ck4ex = shift || "";
|
||||
|
||||
my $table = $node_meta->{ct_table};
|
||||
$main_ids =~ s/,$//;
|
||||
$tplids =~ s/,$//;
|
||||
$ct_ids =~ s/,$//;
|
||||
$ck4ex =~ s/\s/,/g;
|
||||
$ck4ex =~ s/,$//;
|
||||
|
||||
|
@ -1706,12 +1731,11 @@ sub search_content(){
|
|||
my $debug=0;
|
||||
$debug=1;
|
||||
open(FILE,">>$varenv{logdir}/Liste3.log") if($debug);
|
||||
print FILE "*** $stamp_time Libenzdb.search_content3 ***\n" if($debug);
|
||||
print FILE "*** $stamp_time search_content3 ***\n" if($debug);
|
||||
print FILE Dumper($searchref) if($debug);
|
||||
print FILE "$table,$node_meta->{node_name},$owner,$sort_updown,$main_ids,$tplids,$ct_ids,$v_journal,$ck4ex\n" if($debug);
|
||||
print FILE "$table,$node_meta->{node_name},$owner,$sort_updown,$main_ids,$tplids,$v_journal,$ck4ex\n" if($debug);
|
||||
close(FILE) if($debug);
|
||||
|
||||
|
||||
my $table_pos = $searchref->{table_pos} || "";
|
||||
my $txt_where;
|
||||
my $cptxt_where;
|
||||
|
@ -1726,23 +1750,22 @@ sub search_content(){
|
|||
$opref->{$key} = "=";
|
||||
($opref->{$key}, $valref->{$key}) = split(/::/, $searchref->{$key}) if($searchref->{$key} =~ /::/);
|
||||
if($key =~ /table_pos/){
|
||||
$table_pos = $valref->{$key};
|
||||
$table_pos = $valref->{$key};
|
||||
}
|
||||
if($key =~ /c_id|int\d+|barcode|time|sort|owner/){
|
||||
$searchref->{$key} =~ s/,/./g;
|
||||
if($searchref->{$key} =~ /(\<\=|\>\=|\<|\>|\=)/){
|
||||
$opref->{$key} = $1;
|
||||
$opref->{$key} = $1;
|
||||
}
|
||||
if($searchref->{$key} =~ /([-0-9\.]+)/){
|
||||
$valref->{$key} = $1;
|
||||
$valref->{$key} = $1;
|
||||
}
|
||||
if($searchref->{$key} =~ /null/){
|
||||
$opref->{$key} = "is";
|
||||
$opref->{$key} = "is";
|
||||
}
|
||||
chomp($valref->{$key});
|
||||
}
|
||||
$valref->{$key} = $q->escapeHTML($valref->{$key});
|
||||
#print $key . ":" . $opref->{$key} . ":" . $valref->{$key} . "\n";
|
||||
|
||||
if($table_pos =~ /contentpos|contentadrpos|users/){
|
||||
if($key =~ /ct_name/){
|
||||
|
@ -1756,46 +1779,36 @@ sub search_content(){
|
|||
if($key eq "ct_name" && $valref->{$key} =~ /^\d+$/){
|
||||
$txt_where .= " and (ct.$key ilike '$valref->{$key}' OR ct.barcode $opref->{$key} $valref->{$key})";
|
||||
}elsif($key eq "ct_name"){
|
||||
$txt_where .= " and ct.$key ilike '$valref->{$key}%'";
|
||||
$txt_where .= " and ct.$key ilike '$valref->{$key}%'";
|
||||
}elsif($key =~ /_id|barcode|int\d+|sort|owner/ && (looks_like_number($valref->{$key}) || $valref->{$key} =~ /null|0/)){
|
||||
$txt_where .= " and ct.$key $opref->{$key} $valref->{$key}";
|
||||
}elsif($key =~ /txt|uri/){
|
||||
$txt_where .= " and ct.$key ilike '%$valref->{$key}%'";
|
||||
}elsif($key eq "state"){
|
||||
#searchs also order_state
|
||||
$txt_where .= " and (ct.state ilike '%$valref->{$key}%' OR ct.txt22 ilike '%$valref->{$key}%')";
|
||||
$txt_where .= " and (ct.state ilike '%$valref->{$key}%' OR ct.txt22 ilike '%$valref->{$key}%')";
|
||||
}elsif($key =~ /byte/){
|
||||
$txt_where .= " and ct.$key = '\\x$valref->{$key}'";
|
||||
}
|
||||
|
||||
#sum pos doesn't work anymore
|
||||
#if($key =~ /int01/ && $table eq "contenttrans" && looks_like_number($valref->{$key})){
|
||||
#$cpgroup_where .= " group by cp.ct_id HAVING sum(cp.int02) $opref->{$key} $valref->{$key}";
|
||||
#}
|
||||
}
|
||||
|
||||
#if($key =~ /end_/ && $key =~ /time$/){
|
||||
#$valref->{$key} .= " 23:59" if($valref->{$key} !~ /\d:\d/);
|
||||
#}
|
||||
|
||||
|
||||
if(!$v_journal){
|
||||
if($table_pos =~ /contentpos|contentadrpos|users/ && $key =~ /mtime/ && $valref->{$key} =~ /\d+\.\d+\.\d+/){
|
||||
$cptxt_where .= " and cp.mtime >= '$valref->{$key}'" if($key =~ /start/);
|
||||
$cptxt_where .= " and cp.mtime < '$valref->{$key}'" if($key =~ /end/);
|
||||
$cptxt_where .= " and cp.mtime >= '$valref->{$key}'" if($key =~ /start/);
|
||||
$cptxt_where .= " and cp.mtime < '$valref->{$key}'" if($key =~ /end/);
|
||||
}
|
||||
elsif($table_pos =~ /contentpos|contentadrpos|users/ && $key eq "template_id_pos" && $valref->{$key}){
|
||||
$cptxt_where .= " and cp.template_id = $valref->{$key}";
|
||||
$cptxt_where .= " and cp.template_id = $valref->{$key}";
|
||||
}
|
||||
elsif($key =~ /mtime/ && $valref->{$key} =~ /\d+\.\d+\.\d+/){
|
||||
$txt_where .= " and ct.mtime >= '$valref->{$key}'" if($key =~ /start/);
|
||||
$txt_where .= " and ct.mtime < '$valref->{$key}'" if($key =~ /end/);
|
||||
$txt_where .= " and ct.mtime >= '$valref->{$key}'" if($key =~ /start/);
|
||||
$txt_where .= " and ct.mtime < '$valref->{$key}'" if($key =~ /end/);
|
||||
}
|
||||
|
||||
}elsif($v_journal){
|
||||
if($key =~ /itime/ && $valref->{$key} =~ /\d+\.\d+\.\d+/){
|
||||
$txt_where .= " and ct.itime >= '$valref->{$key}'" if($key =~ /start/);
|
||||
$txt_where .= " and ct.itime < '$valref->{$key}'" if($key =~ /end/);
|
||||
$txt_where .= " and ct.itime >= '$valref->{$key}'" if($key =~ /start/);
|
||||
$txt_where .= " and ct.itime < '$valref->{$key}'" if($key =~ /end/);
|
||||
}
|
||||
if($key =~ /start_mtime/ && $valref->{$key} =~ /^\d+$/){
|
||||
$txt_where .= " and ct.int11 = '$valref->{$key}'";#int11 = c_id-abschluss key
|
||||
|
@ -1822,7 +1835,6 @@ 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.int14 is $opos" if($opos eq "null");
|
||||
|
@ -1838,10 +1850,6 @@ sub search_content(){
|
|||
$sth = $dbh->prepare("SELECT cp.* FROM contenttranspos cp WHERE cp.ct_id IN (SELECT ct.c_id FROM relation rel, contenttrans ct WHERE rel.content_id=ct.c_id and rel.main_id IN ($main_ids) and rel.template_id IN ($tplids) $txt_where) $cptxt_where ORDER BY cp.$cp_scol $updown");
|
||||
}elsif($valref->{long_rent} || $valref->{start_date_time} =~ /^\d+\.\d+\.\d+/ || $valref->{end_date_time} =~ /^\d+\.\d+\.\d+/ || $cpgroup_where){
|
||||
$sth = $dbh->prepare("SELECT * FROM relation rel, $table ct WHERE rel.content_id=ct.c_id and rel.main_id IN ($main_ids) and rel.template_id IN ($tplids) $txt_where and c_id IN (SELECT cp.ct_id from contenttranspos cp WHERE 1=1 $cptxt_where $cpgroup_where) ORDER BY $scol $updown LIMIT $limit OFFSET $offset");
|
||||
}elsif($v_journal && $ct_ids){#and executes ct_ids
|
||||
$ct_ids = 0 if(!$ct_ids);
|
||||
$sth = $dbh->prepare("SELECT * FROM relation rel, $table ct WHERE rel.content_id=ct.c_id and rel.main_id IN ($main_ids) and rel.template_id IN ($tplids) and rel.content_id IN ($ct_ids) $txt_where ORDER BY $scol $updown LIMIT $limit OFFSET $offset");
|
||||
|
||||
}elsif($table_pos && $table_pos eq "contentpos"){
|
||||
$sth = $dbh->prepare("SELECT cp.* FROM contentpos cp WHERE cp.cc_id IN (SELECT ct.c_id FROM relation rel, content ct WHERE rel.content_id=ct.c_id and rel.main_id IN ($main_ids) and rel.template_id IN ($tplids) $txt_where) $cptxt_where ORDER BY cp.$scol $updown LIMIT $limit OFFSET $offset");
|
||||
}elsif($table_pos && $table_pos eq "contentadrpos"){
|
||||
|
@ -1856,7 +1864,6 @@ sub search_content(){
|
|||
}else{
|
||||
$sth = $dbh->prepare("SELECT * FROM relation rel, $table ct WHERE rel.content_id=ct.c_id and rel.main_id IN ($main_ids) and rel.template_id IN ($tplids) $txt_where ORDER BY $scol $updown LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
my $rc = $sth->execute();
|
||||
my $s_id = "c_id";
|
||||
$s_id = "u_id" if($table_pos && $table_pos eq "users");
|
||||
|
|
|
@ -38,7 +38,7 @@ sub handler {
|
|||
my $cf = new Config;
|
||||
my $ml = new Mlogic;
|
||||
my $bw = new Basework;
|
||||
my $tk = new Shareework;
|
||||
my $shwo = new Shareework;
|
||||
my $dbt = new DBtank;
|
||||
my $apif = new APIfunc;
|
||||
my $but = new Buttons;
|
||||
|
@ -195,8 +195,8 @@ sub handler {
|
|||
$apif->authout($q,$coo);
|
||||
|
||||
#create_account. 2. inserts contentadr
|
||||
my $tinkc_id = $tk->create_account($aowner);
|
||||
($returnwww,$feedb) = $tk->save_account($q,$tinkc_id,\%varenv,$aowner);
|
||||
my $shareec_id = $shwo->create_account($aowner);
|
||||
($returnwww,$feedb) = $shwo->save_account($q,$shareec_id,\%varenv,$aowner);
|
||||
|
||||
#Like login_sharee, redundant
|
||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||
|
@ -218,8 +218,8 @@ sub handler {
|
|||
|
||||
#if user-pw authorized, then ignore conflict_ because it matches exist user-data
|
||||
#should be result to Uhps page
|
||||
if($tinkc_id && $returnwww && $returnwww =~ /conflict_txt07|conflict_txt08/){
|
||||
$return = $tk->delete_account($tinkc_id,$users_dms->{u_id});
|
||||
if($shareec_id && $returnwww && $returnwww =~ /conflict_txt07|conflict_txt08/){
|
||||
$return = $shwo->delete_account($shareec_id,$users_dms->{u_id});
|
||||
$apif->authout($q,$coo) if($coo);
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Anmelden?conflict_failure=1");
|
||||
exit 0;
|
||||
|
@ -353,9 +353,9 @@ sub handler {
|
|||
my $delete_key = "delete_adr";
|
||||
$feedb->{message} = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&c_id=$R::c_id ::löschen";
|
||||
}elsif($R::c_id && $R::base_edit eq "delete_adr"){
|
||||
$return = $tk->delete_account($R::c_id,$users_dms->{u_id});
|
||||
$return = $shwo->delete_account($R::c_id,$users_dms->{u_id});
|
||||
}elsif($R::c_id && $R::base_edit eq "save_adr"){
|
||||
($returnwww,$feedb) = $tk->save_account($q,$R::c_id,\%varenv,$users_dms->{u_id});
|
||||
($returnwww,$feedb) = $shwo->save_account($q,$R::c_id,\%varenv,$users_dms->{u_id});
|
||||
}
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Kunden Stammdaten\" verweigert.";
|
||||
|
@ -540,12 +540,15 @@ sub handler {
|
|||
|
||||
#save_account. 3. updates contentadr
|
||||
if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_account/){
|
||||
($returnwww,$feedb) = $tk->save_account($q,$users_sharee->{c_id},\%varenv,$aowner);
|
||||
($returnwww,$feedb) = $shwo->save_account($q,$users_sharee->{c_id},\%varenv,$aowner);
|
||||
}
|
||||
|
||||
if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_transact/){
|
||||
$returnwww = $tk->save_transact($q,$users_sharee->{c_id},$coo,$aowner);
|
||||
$returnwww = $shwo->save_transact($q,$users_sharee->{c_id},$coo,$aowner);
|
||||
}
|
||||
#we do it in PayoneLink.pm
|
||||
#if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /generate_payonelink/){
|
||||
# $returnwww = $pay->generate_payonelink($q,\%varenv,$users_sharee,$R::prepaid_id,$R::prepaid_amount,$aowner);
|
||||
#}
|
||||
|
||||
if($returnwww && $returnwww =~ /failure::(.*)/){
|
||||
$returnwww =~ s/::/=/g;
|
||||
|
@ -554,10 +557,8 @@ sub handler {
|
|||
if($returnwww =~ /txt22|txt23/){
|
||||
#should be result to Uhps page
|
||||
if($returnwww =~ /conflict_txt22/){
|
||||
$return = $tk->delete_account($users_sharee->{c_id},$users_dms->{u_id});
|
||||
$apif->authout($q,$coo) if($coo);
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Anmelden?conflict_failure=1$session_and");
|
||||
exit 0;
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}?cum=1\&conflict_failure=1$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}?cum=1$session_and\&$returnwww");
|
||||
}elsif($returnwww =~ /int03/){
|
||||
|
@ -586,7 +587,6 @@ sub handler {
|
|||
print FILE "$_=$val\n";
|
||||
$payone_return .= "$_=$val\n";# if($_ =~ /error|message/i);
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
|
@ -637,10 +637,10 @@ sub handler {
|
|||
#int12=0 should be set after capture success in payment module
|
||||
|
||||
if(($users_sharee->{int04} != 1) && ($users_sharee->{txt08} =~ /\w\@\w/)){
|
||||
$tk->emailack(\%varenv,$users_sharee->{c_id});
|
||||
$shwo->emailack(\%varenv,$users_sharee->{c_id});
|
||||
}
|
||||
if(($users_sharee->{int13} != 1) && ($users_sharee->{txt07} =~ /\d{9}/ && length($users_sharee->{txt07}) <= 16)){
|
||||
$tk->smsack($users_sharee);
|
||||
$shwo->smsack($users_sharee);
|
||||
}
|
||||
close(FILE) if($debug);
|
||||
}else{
|
||||
|
@ -657,6 +657,9 @@ sub handler {
|
|||
$dbt->update_record($dbh,$update_adr,$users_sharee) if($users_sharee->{c_id} > 0);
|
||||
$dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update");
|
||||
}
|
||||
|
||||
print FILE Dumper($update_adr) . "\n" if($debug);
|
||||
close(FILE);
|
||||
}#end payone response with pseudocardpan
|
||||
}
|
||||
|
||||
|
@ -668,10 +671,10 @@ sub handler {
|
|||
print FILE "trigger confirm-code request by $R::sharee_edit\n" if($debug);
|
||||
|
||||
if(($users_sharee->{int04} != 1 && $R::sharee_edit =~ /send_email/) && ($users_sharee->{txt08} =~ /\w\@\w/)){
|
||||
$tk->emailack(\%varenv,$users_sharee->{c_id});
|
||||
$shwo->emailack(\%varenv,$users_sharee->{c_id});
|
||||
}
|
||||
if(($users_sharee->{int13} != 1 && $R::sharee_edit =~ /send_sms/) && ($users_sharee->{txt07} =~ /\d{9}/ && length($users_sharee->{txt07}) <= 16)){
|
||||
$tk->smsack($users_sharee);
|
||||
$shwo->smsack($users_sharee);
|
||||
}
|
||||
close(FILE) if($debug);
|
||||
}#send confirm code
|
||||
|
@ -771,7 +774,7 @@ sub handler {
|
|||
|
||||
if($R::email && $R::sharee_edit =~ /password_forgotten/){
|
||||
my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co
|
||||
$tk->send_password(\%varenv,$R::email,$hw_id,$aowner);
|
||||
$shwo->send_password(\%varenv,$R::email,$hw_id,$aowner);
|
||||
}
|
||||
|
||||
#redirections
|
||||
|
|
|
@ -18,7 +18,6 @@ use CGI::Carp qw(fatalsToBrowser);
|
|||
use Calendar::Simple;
|
||||
use Date::Calc qw(:all);
|
||||
use Mod::Callib;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::Buttons;
|
||||
use Lib::Config;
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
|
@ -26,7 +25,6 @@ use Scalar::Util qw(looks_like_number);
|
|||
my $cf = new Config;
|
||||
my $cb = new Callib;
|
||||
my $but = new Buttons;
|
||||
my $db = new Libenzdb;
|
||||
my $q = new CGI;
|
||||
|
||||
#my $pi = new Image::Magick;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,6 @@ use CGI::Carp qw(fatalsToBrowser);
|
|||
use Scalar::Util qw(looks_like_number);
|
||||
use Lib::Config;
|
||||
use Mod::Buttons;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
|
||||
sub new {
|
||||
|
@ -32,7 +31,6 @@ sub mobox(){
|
|||
my $q = new CGI;
|
||||
my $cf = new Config;
|
||||
my $but = new Buttons;
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
$q->import_names('R');
|
||||
my @keywords = $q->param;
|
||||
|
|
|
@ -3,20 +3,19 @@ package Payment;
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
#Adapted from Prelogic Rechnung "buchen" and "print_pdf"
|
||||
#Adapted from payone_post.pl
|
||||
#
|
||||
#enable for syntax check
|
||||
#use lib "/var/www/copri-bike/shareedms-primary/src";
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use CGI; # only for debugging
|
||||
use CGI;
|
||||
use Digest::SHA qw(hmac_sha256_base64);
|
||||
use JSON;
|
||||
my $json = JSON->new->allow_nonref;
|
||||
use LWP::UserAgent;
|
||||
use URI::Encode;
|
||||
my $uri_encode = URI::Encode->new( { encode_reserved => 1 } );
|
||||
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use Lib::Config;
|
||||
use Mod::Callib;
|
||||
|
@ -921,7 +920,6 @@ sub rpc {
|
|||
}
|
||||
print FILE "payone RPC end\n\n" if($debug);
|
||||
|
||||
close(FILE) if($debug);
|
||||
#set contentadr owner and mtime only if vde or payone-return will be set by payone id's
|
||||
if((($update_adr->{int12} && $update_adr->{int12} > 0) || $update_adr->{txt28}) && ($owner == 178 || $owner == 179)){
|
||||
$update_adr->{owner} = "$owner";
|
||||
|
@ -930,12 +928,15 @@ sub rpc {
|
|||
|
||||
if($ctadr->{c_id} > 0){
|
||||
$dbt->update_record($dbh,$update_adr,$ctadr);
|
||||
print FILE Dumper($update_adr) . "\n" if($debug);
|
||||
#2023-04-11 set it global by update adr also on primary
|
||||
#disabled, because isuser_rentable will be only used by operator rental
|
||||
#my $dbh_primary = $dbt->dbconnect($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
#$dbt->update_record($dbh_primary,$update_adr,$ctadr);
|
||||
}
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt) if($ctt->{c_id} > 0);
|
||||
|
||||
close(FILE) if($debug);
|
||||
return $payoneret;
|
||||
}
|
||||
|
||||
|
@ -1020,23 +1021,12 @@ sub payone_capture {
|
|||
return $return_text;
|
||||
}
|
||||
|
||||
my $state = $ctt->{state};
|
||||
if($dbt->{shareedms_conf}->{payment_state}){
|
||||
my @_paymentstate = split(/\|/,$dbt->{shareedms_conf}->{payment_state});
|
||||
if($ctadr->{ct_name} =~ /\w{2}-\d+/){
|
||||
$state = "$_paymentstate[0]";
|
||||
}else{
|
||||
undef $_paymentstate[0];
|
||||
}
|
||||
if(length($ctadr->{ct_name}) >= 19){
|
||||
$state = "$_paymentstate[1]";
|
||||
}else{
|
||||
undef $_paymentstate[1];
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
$update_ctt->{state} = "$state";
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt);
|
||||
$dbt->update_record($dbh,$update_ctt,$ctt) if($update_ctt->{state});
|
||||
|
||||
#in cron we set OPOS anyway. If payone captured, it will be set int14=null
|
||||
if(!$state || $state !~ /payone/){
|
||||
|
@ -1101,6 +1091,138 @@ sub payone_capture {
|
|||
return ($retval,$return_text);
|
||||
}
|
||||
|
||||
#Request "payone-link"
|
||||
sub generate_payonelink {
|
||||
my $self = shift;
|
||||
my $varenv = shift;
|
||||
my $ctadr = shift;
|
||||
my $prepaidhash = shift || {};
|
||||
my $prepaid_amount = shift || 0;
|
||||
my $owner = shift || 0;
|
||||
|
||||
my $payonelink_conf = $dbt->{payonelink_conf} || {};
|
||||
my $ret_json = {};
|
||||
my $response_in = {};
|
||||
my $dbh = "";
|
||||
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
open(FILE,">>$varenv->{logdir}/payonelink.log");
|
||||
print FILE "\n*** $now_dt 'generate_payonelink' ctadr:$ctadr->{c_id}|$ctadr->{txt08}\n";
|
||||
|
||||
my $prepaid_amount2 = 0;
|
||||
$prepaid_amount2 = $1 if($prepaid_amount =~ /^(\d+)/);
|
||||
|
||||
if($ctadr->{c_id} && $prepaidhash->{prepaid_id} && $prepaid_amount2 >= 5){
|
||||
|
||||
my $lastname = $ctadr->{txt01};
|
||||
(my $firstname,$lastname) = split(/\s+/,$ctadr->{txt01}) if($ctadr->{txt01} =~ /\w\s+\w/i);
|
||||
chomp($firstname);
|
||||
chomp($lastname);
|
||||
my $city = $ctadr->{txt06};
|
||||
(my $zip, $city) = split(/\s+/,$ctadr->{txt06}) if($ctadr->{txt06} =~ /[\w\d]\s+[\w\d]/i);
|
||||
chomp($zip);
|
||||
chomp($city);
|
||||
|
||||
my $currency = "EUR";
|
||||
my $amount = 0;
|
||||
$amount = $prepaid_amount2 * 100 if($prepaid_amount2);
|
||||
my $pay_request = {
|
||||
intent => 'authorization',
|
||||
active => 1,
|
||||
paymentMethods => ['visa', 'mastercard', 'paypal', 'sofort', 'paydirekt', 'giropay', 'sepa'],
|
||||
userId => "$ctadr->{c_id}",
|
||||
email => "$ctadr->{txt08}",
|
||||
firstName => "$firstname",
|
||||
lastName => "$lastname",
|
||||
country => "$ctadr->{txt10}",
|
||||
language => "de_DE",
|
||||
reference => "$prepaidhash->{prepaid_id}",
|
||||
shoppingCart => [{
|
||||
type => "prepaid",
|
||||
number => "$prepaidhash->{number}",
|
||||
price => $amount,
|
||||
quantity => 1,
|
||||
description => "$prepaidhash->{description}",
|
||||
vatRate => 19
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
my $datahash = $payonelink_conf->{merchantId} . $payonelink_conf->{accountId} . $payonelink_conf->{portalId} . $payonelink_conf->{mode} . $prepaidhash->{prepaid_id} . $amount . $currency;
|
||||
|
||||
my $paytoken = hmac_sha256_base64($datahash, $payonelink_conf->{portalKey});
|
||||
|
||||
#my $whole_json = { %$payonelink_conf, %$pay_request};
|
||||
#my $rest_json = encode_json($whole_json);
|
||||
my $rest_json = encode_json(\%{ $pay_request });
|
||||
|
||||
print FILE "rest_json:\n" . Dumper($rest_json) . "\n";
|
||||
|
||||
($ret_json, my $ret_status) = $self->rpc_postjson($paytoken,$rest_json);
|
||||
eval {
|
||||
$response_in = decode_json($ret_json);
|
||||
print FILE "<--- payonelink response_in with status_line: $ret_status\n" . Dumper($response_in);
|
||||
print FILE $ret_json . "\n";
|
||||
|
||||
#expecting something like this:
|
||||
#return "https://onelink.pay1.de/p/YNEVNS4N1N5JXTFLYPMQJ5PVADEEZ0UL?lang=de_DE";
|
||||
};
|
||||
if ($@){
|
||||
print FILE "<--- failure payonelink raw response_in with status_line: $ret_status\n" . Dumper($ret_json) . "\n";
|
||||
#warn $@;
|
||||
print FILE "warn:" . $@ . "\n";
|
||||
}
|
||||
|
||||
}else{
|
||||
$ret_json = "failure:: $ctadr->{c_id} && $prepaidhash->{prepaid_id} && $prepaid_amount2 >= 5";
|
||||
}
|
||||
|
||||
close FILE;
|
||||
return $ret_json;
|
||||
}#end Request "send_payone_link"
|
||||
|
||||
#JSON POST to onelink
|
||||
sub rpc_postjson {
|
||||
my $self = shift;
|
||||
my $paytoken = shift;
|
||||
my $rest_json = shift || "";
|
||||
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
|
||||
my $ua = LWP::UserAgent->new(
|
||||
ssl_opts => {
|
||||
SSL_version => 'TLSv12:!SSLv2:!SSLv3:!TLSv1:!TLSv11',
|
||||
}
|
||||
);
|
||||
|
||||
$ua->agent("sharee payone jsonPOST API");
|
||||
my $bytes = 100000;
|
||||
$ua->max_size( $bytes );
|
||||
$ua->default_header( 'Authorization' => "payone-hmac-sha256 $paytoken" );
|
||||
print Dumper($ua);
|
||||
|
||||
#local TEST
|
||||
my $endpoint = "https://shareeapp-fr01.copri-bike.de/APIvelo";
|
||||
#my $endpoint = "https://onelink.pay1.de/api/v1/payment-links/";
|
||||
|
||||
my $req = HTTP::Request->new(POST => "$endpoint");
|
||||
$req->content_type('application/json');
|
||||
$req->content($rest_json);
|
||||
my $res = $ua->request($req);
|
||||
|
||||
if ($res->is_success) {
|
||||
#print $res->content;
|
||||
#print $res->status_line, "\n";
|
||||
return ($res->content, $res->status_line);
|
||||
}else {
|
||||
#print $res->status_line, "\n";
|
||||
return ("", $res->status_line);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ my $debug=1;
|
|||
sub prepaid_request {
|
||||
my $self = shift;
|
||||
my $dbh = shift;
|
||||
my $ctadr = shift;
|
||||
my $ctadr = shift || {};
|
||||
my $owner = shift;
|
||||
|
||||
my $feedb = {
|
||||
|
@ -61,6 +61,7 @@ sub prepaid_request {
|
|||
message => "",
|
||||
};
|
||||
|
||||
if($ctadr->{c_id}){
|
||||
my $pref_ctt = {
|
||||
table => "contenttrans",
|
||||
fetch => "one",
|
||||
|
@ -76,6 +77,13 @@ sub prepaid_request {
|
|||
my $ct_id = $dbt->insert_contenttrans($dbh,$ctadr,"300023","219","----","$owner");
|
||||
$pref_ctt->{c_id} = $ct_id;
|
||||
$ctt_prepaid = $dbt->fetch_record($dbh,$pref_ctt) if($pref_ctt->{c_id});
|
||||
my $update_adr = {
|
||||
table => "contentadr",
|
||||
mtime => "now()",
|
||||
owner => "$owner",
|
||||
c_id => "$ctadr->{c_id}",
|
||||
};
|
||||
$dbt->update_one($dbh,$update_adr,"ct_name='Prepaid-$ctt_prepaid->{c_id}'");
|
||||
}
|
||||
|
||||
my $pos_id = 0;
|
||||
|
@ -107,13 +115,14 @@ sub prepaid_request {
|
|||
|
||||
$cttpos->{c_id} = $dbt->insert_pos($dbh,$ctt_prepaid->{c_id},$ct,"",$ctadr,"","","","0",$owner,"");
|
||||
$dbt->update_one($dbh,{table => 'contenttranspos',c_id => $cttpos->{c_id}},"barcode = $cttpos->{c_id},ct_name = '$cttpos->{c_id}'");
|
||||
$feedb->{prepaid_id} = $ctt_prepaid->{c_id} . "-" . $cttpos->{c_id};
|
||||
}
|
||||
}
|
||||
|
||||
$feedb->{prepaid_account} = $ctt_prepaid->{c_id};
|
||||
$feedb->{prepaid_id} = $cttpos->{c_id};
|
||||
$feedb->{prepaid_account} = $ctt_prepaid->{c_id};
|
||||
}
|
||||
}
|
||||
return $feedb;
|
||||
}
|
||||
}#end prepaid_request
|
||||
|
||||
#select rentals for messaging user if bike > 12h ... occupied
|
||||
sub longterm_occupied {
|
||||
|
@ -612,13 +621,10 @@ sub insert_contenttranspos {
|
|||
my $cc_part = { c_id => 0 };
|
||||
$cc_part = $dbt->fetch_record($dbh,$pref_cc) if($R::c_id || $R::json_select);
|
||||
|
||||
my $pref_adr = {
|
||||
table => "contentadr",
|
||||
fetch => "one",
|
||||
c_id => "$ctt->{int10}",
|
||||
my $ctadr = {
|
||||
c_id => $ctt->{int10},
|
||||
txt01 => $ctt->{txt01},
|
||||
};
|
||||
my $ctadr = { c_id => 0 };
|
||||
$ctadr = $dbt->fetch_tablerecord($dbh,$pref_adr) if($ctt->{int10});
|
||||
|
||||
if($cc_part->{c_id}){
|
||||
$cc_part->{int02} = "0" if(!$cc_part->{int02});
|
||||
|
|
|
@ -44,6 +44,52 @@ sub round(){
|
|||
return $rounded;
|
||||
}
|
||||
|
||||
#collect prepaid
|
||||
sub collect_prepaid {
|
||||
my $self = shift;
|
||||
my $dbh = shift;
|
||||
my $ctadr = shift || {};
|
||||
|
||||
my $prepaidhash = {
|
||||
prepaid_total => 0,
|
||||
prepaid_id => 0,
|
||||
};
|
||||
|
||||
if($ctadr->{c_id}){
|
||||
my $posref = {
|
||||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "all",
|
||||
keyfield => "c_id",
|
||||
ca_id => "$ctadr->{c_id}",
|
||||
'ct.state' => "is::null",
|
||||
'ct.close_time' => "is::null",
|
||||
};
|
||||
my $cttpos = { c_id => 0 };
|
||||
$cttpos = $dbt->collect_post($dbh,$posref);
|
||||
#TODO negative counting booked operator invoices
|
||||
foreach my $id (sort { $cttpos->{$b}->{c_id} <=> $cttpos->{$a}->{c_id} } keys(%$cttpos)){
|
||||
#print $cttpos->{$id}->{barcode} . ":" . $cttpos->{$id}->{int02},"<br>";
|
||||
|
||||
if($cttpos->{$id}->{barcode} && $cttpos->{$id}->{int02} == 0){
|
||||
$prepaidhash->{prepaid_id} = $cttpos->{$id}->{ct_id} . "-" . $cttpos->{$id}->{c_id};
|
||||
$prepaidhash->{number} = $cttpos->{$id}->{c_id};
|
||||
$prepaidhash->{description} = $cttpos->{$id}->{txt01};
|
||||
}
|
||||
#if($cttpos->{$id}->{barcode} && $cttpos->{$id}->{int02} > 0){
|
||||
# $prepaidhash->{prepay_id_payed} = $cttpos->{$id}->{int02};
|
||||
#}
|
||||
if($cttpos->{$id}->{int02} > 0){
|
||||
$prepaidhash->{prepaid_total} += $cttpos->{$id}->{int02};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$bw->log("Pricing prepaidhash:",$prepaidhash,"");
|
||||
return $prepaidhash;
|
||||
}
|
||||
|
||||
|
||||
#for one freed rental
|
||||
#depends on operator, only 1 rental get freed_time
|
||||
sub count_freedrental {
|
||||
|
|
|
@ -560,11 +560,11 @@ sub save_account(){
|
|||
print FILE "account_check iban:$iban, c_id:$account_check->{c_id} && $account_check->{c_id} != $c_id\n" if($debug);
|
||||
if($account_check->{c_id} && $account_check->{c_id} != $c_id){
|
||||
my $encoded_val = $uri_encode->encode($iban);
|
||||
$ret_conflict = "failure::conflict_txt22=$encoded_val#top";
|
||||
}
|
||||
$ret_conflict = "failure::conflict_txt22\&txt22=$encoded_val#top";
|
||||
}else{
|
||||
|
||||
my $payone_mival = $payone->managemandate_main(\%varenv,$ctadr,"",$owner);
|
||||
if($payone_mival && $payone_mival =~ /\w{2}-\d+/){
|
||||
my $payone_mival = $payone->managemandate_main(\%varenv,$ctadr,"",$owner);
|
||||
if($payone_mival && $payone_mival =~ /\w{2}-\d+/){
|
||||
#define fictiv invoice to get 1 € test
|
||||
my $epoche = time();
|
||||
my $ctt = {
|
||||
|
@ -594,12 +594,13 @@ sub save_account(){
|
|||
}else{
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#prepaid
|
||||
elsif($ctadr->{int03} == 3){
|
||||
$feedb = $pl->prepaid_request($dbh,$ctadr,$owner);
|
||||
$u_rows = $dbt->update_one($dbh,$update_adr,"ct_name='Prepay-$feedb->{prepaid_account}'");#Vde
|
||||
}
|
||||
#prepaid, will be requested in PayoneLink.pm
|
||||
#elsif($ctadr->{int03} == 3){
|
||||
# $feedb = $pl->prepaid_request($dbh,$ctadr,$owner);
|
||||
#}
|
||||
|
||||
if($R::txt04 && $R::confirm_txt04 && $R::txt04 ne $R::confirm_txt04){
|
||||
$ret = "failure::confirm_txt04#top";
|
||||
|
|
|
@ -353,10 +353,17 @@ EOF
|
|||
$pay_state = " | receivable: $ctt->{int19}. Einzug im PMI prüfen!" if($ctt->{txt16} && $ctt->{int16} == 0 && $ctt->{int18} == 0 && looks_like_number($ctt->{int19}) && $ctt->{int01} != $ctt->{int19});
|
||||
my $pay_sequence = "";
|
||||
$pay_sequence = " | sequencenr: $ctt->{int18}" if($ctt->{int18});
|
||||
my @_paymentstate = split(/\|/,$dbt->{shareedms_conf}->{payment_state});
|
||||
|
||||
my $kind_of_payment = "fehlt";
|
||||
$kind_of_payment = "$_paymentstate[0]" if($ctadr->{int03} == 1);
|
||||
$kind_of_payment = "$_paymentstate[1]" if($ctadr->{int03} == 2);
|
||||
my $p_hash = $dbt->{shareedms_conf}->{payment_state2};
|
||||
foreach my $s_key (sort keys (%{ $p_hash })) {
|
||||
if($ctt->{state} && $ctt->{int03}){
|
||||
$kind_of_payment = $p_hash->{$s_key} if($ctt->{int03} == $s_key);
|
||||
}
|
||||
elsif($ctadr->{int03}){
|
||||
$kind_of_payment = $p_hash->{$s_key} if($ctadr->{int03} == $s_key);
|
||||
}
|
||||
}
|
||||
my $payteaser = "";
|
||||
if($ctadr->{txt28}){
|
||||
$payteaser = substr($ctadr->{txt28},0,50) . " ...";
|
||||
|
|
|
@ -19,7 +19,6 @@ use Lib::Config;
|
|||
use Mod::Buttons;
|
||||
use Mod::Libenz;
|
||||
use Mod::Prelib;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Date::Calc qw(:all);
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
|
@ -50,7 +49,6 @@ sub tpl(){
|
|||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $pl = new Prelib;
|
||||
my $db = new Libenzdb;
|
||||
my $but = new Buttons;
|
||||
my $dbt = new DBtank;
|
||||
my $apif = new APIfunc;
|
||||
|
@ -124,11 +122,11 @@ sub tpl(){
|
|||
my $cttpos_trans = {};
|
||||
my $cttpos_theft = {};
|
||||
if(($node_meta->{ct_table} eq "content") && ($node_meta->{tpl_id} == 205) && (!$start_chck && !$end_chck)){
|
||||
my $cttpos1 = $db->collect_postime("contenttranspos","$search_startdt","$search_enddt","$start_date_time","$end_date_time");
|
||||
my $cttpos1 = $dbt->collect_postime($dbh,"contenttranspos","$search_startdt","$search_enddt","$start_date_time","$end_date_time");
|
||||
foreach my $key (keys %$cttpos1){
|
||||
$cttpos_trans->{"trans_" . $key} = $cttpos1->{$key};
|
||||
}
|
||||
#my $cttpos2 = $db->collect_postime("contenttheftpos","$search_startdt","$search_enddt","$start_date_time","$end_date_time");
|
||||
#my $cttpos2 = $dbt->collect_postime($dbh,"contenttheftpos","$search_startdt","$search_enddt","$start_date_time","$end_date_time");
|
||||
#foreach my $key (keys %$cttpos2){
|
||||
# $cttpos_theft->{"theft_" . $key} = $cttpos2->{$key};
|
||||
#}
|
||||
|
@ -175,8 +173,6 @@ sub tpl(){
|
|||
my ($daymarker,$raster_mmpx,$day4month) = $lb->month_line($users_dms);
|
||||
my $rows = 0;
|
||||
|
||||
my $ctf = $db->get_content1("contentuser","$dbt->{sharedms_conf}->{parent_id}");
|
||||
|
||||
my $c_id4csv = "";
|
||||
my $ct4rel = {};
|
||||
my $ct4rel_parts = {};
|
||||
|
@ -207,13 +203,19 @@ sub tpl(){
|
|||
$feedb->{message} .= ">>> Datum Eingabefehler: $date <<<" if($end_chck);
|
||||
my ($c_dd,$c_mm,$c_yy) = split(/\./,$date);
|
||||
}
|
||||
|
||||
my $update_users = {
|
||||
table => "users",
|
||||
change => "no_time",
|
||||
u_id => $users_dms->{u_id}
|
||||
};
|
||||
|
||||
my $export = "";
|
||||
my $ck4ex = "@R::ck4ex" || "";
|
||||
$export = "check4export" if($R::ck4ex);
|
||||
if($export || $ck4ex){
|
||||
$db->users_up("time4csv","$time",$users_dms->{u_id});
|
||||
$users_dms = $db->select_users($users_dms->{u_id});
|
||||
$dbt->update_one($dbh,$update_users,"time4csv='$time'");
|
||||
$users_dms = $dbt->select_users($dbh,$users_dms->{u_id});
|
||||
}
|
||||
|
||||
my $searchref = {
|
||||
|
@ -225,7 +227,6 @@ sub tpl(){
|
|||
opos => "",
|
||||
};
|
||||
my $tplids = "$tpl_id," || 0;
|
||||
my $main_ids = "";
|
||||
|
||||
#Faktura actions
|
||||
if($node_meta->{template_id} =~ /208|209|218|219/){
|
||||
|
@ -293,10 +294,7 @@ sub tpl(){
|
|||
$searchref->{limit} = 1000;
|
||||
}
|
||||
|
||||
|
||||
$main_ids = "$main_id,";
|
||||
$main_ids .= $db->collect_noderec($main_id,$lang,"nothing");
|
||||
$main_ids =~ s/,$//;
|
||||
my $main_ids .= $dbt->collect_noderec($dbh,$main_id);
|
||||
|
||||
#path-line
|
||||
my $redirect = "";
|
||||
|
@ -358,20 +356,7 @@ EOF
|
|||
my $s_ct_name = $q->escapeHTML($R::s_ct_name) || "";
|
||||
my $s_barcode = $q->escapeHTML($R::s_barcode) || "";
|
||||
|
||||
my $relnod = "";
|
||||
$relnod = $db->collect_rel4nodes($main_ids,"","","rel_id");
|
||||
|
||||
my $j_exist = $db->get_node4multi("300011",$lang);
|
||||
|
||||
my $nodes = "";
|
||||
if($main_ids){
|
||||
$nodes = $db->collect_node2($main_ids);
|
||||
}else{
|
||||
$lb->failure("Fehler! Es fehlen wichtige Einstellungen. ....journal-ID!");
|
||||
}
|
||||
my $ct_ids = "";
|
||||
my $last_ab = {};
|
||||
|
||||
my $relnod = $dbt->collect_rel4nodes($dbh,$main_ids);
|
||||
my $channel_map = $dbt->channel_map();
|
||||
my $mapref = {};
|
||||
my $ct_users = $dbt->users_map($dbh,$mapref);#get serviceAPP and DMS users from contentadr
|
||||
|
@ -437,7 +422,14 @@ EOF
|
|||
|
||||
#it will takes only one dataset
|
||||
if($node_meta->{ct_table} eq "contenttrans" && $c_id4trans && $c_id4trans =~ /^\d+$/ && (($users_dms->{faksum}) || ($full_url ne $referer) || ($node_meta->{tpl_id} == 209 && $v_journal && !$R::detail_search))){
|
||||
$ct4rel = $db->collect_cid($table,$lang,$tplids,$R::rel_id,$R::barcode,"c_id",$c_id4trans);
|
||||
my $pref_ct = {
|
||||
table => "contenttrans",
|
||||
fetch => "all",
|
||||
keyfield => "c_id",
|
||||
c_id => $c_id4trans,
|
||||
};
|
||||
$ct4rel = $dbt->fetch_record($dbh,$pref_ct);
|
||||
|
||||
}elsif(!$start_chck && !$end_chck){
|
||||
|
||||
#collect search keys
|
||||
|
@ -478,13 +470,13 @@ EOF
|
|||
$tk->sigstation_cupdate($return2copri->{stations});
|
||||
}
|
||||
}
|
||||
$ct4rel = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tplids","$ct_ids",$v_journal,$ck4ex);
|
||||
$ct4rel = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tplids",$v_journal,$ck4ex);
|
||||
$feedb = $pl->export_csv($node_meta,$users_dms,$ct4rel,$bike_nodes,$coo) if($ck4ex);
|
||||
|
||||
if($node_meta->{node_name} eq "Faktura" || $tplids =~ /218/){
|
||||
my $v_journalparts = "";
|
||||
$v_journalparts = $v_journal . "_parts";
|
||||
$ct4rel_parts = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tplids","$ct_ids",$v_journalparts,$ck4ex);
|
||||
$ct4rel_parts = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tplids",$v_journalparts,$ck4ex);
|
||||
}
|
||||
|
||||
}#end $ct4rel collect
|
||||
|
@ -617,7 +609,11 @@ EOF
|
|||
}elsif($key =~ /owner/){
|
||||
print $q->td({-class=>'search_line'},$but->selector("s_$key","120px","$s_val",@_users)),"\n";
|
||||
}elsif($key =~ /state/){
|
||||
my @_states = split(/\|/,$dbt->{shareedms_conf}->{payment_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}";
|
||||
}
|
||||
my @_orderstates = split(/\|/,$dbt->{shareedms_conf}->{order_state});
|
||||
push (@_states,@_orderstates);
|
||||
print $q->td({-class=>'search_line'},$but->selector("s_$key","120px","$s_val",@_states)),"\n";
|
||||
|
@ -1275,7 +1271,7 @@ EOF
|
|||
}
|
||||
|
||||
if($users_dms->{u_id}){
|
||||
if($v_journal eq "Tagesbericht" && $j_exist->{main_id}){
|
||||
if($v_journal eq "Tagesbericht"){
|
||||
print $q->Tr();
|
||||
print $q->td({-style=>"background-color:silver;"},""),"\n";
|
||||
print $q->td({-style=>"background-color:silver;",-class=>'tdsum',-colspan=>"$m"},"Tagesbericht abschließen, Übertrag in das Verkaufsjournal"),"\n";
|
||||
|
|
|
@ -12,7 +12,6 @@ use CGI ':standard';
|
|||
use Lib::Config;
|
||||
use Mod::Buttons;
|
||||
use Mod::Libenz;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
|
||||
sub new {
|
||||
|
@ -31,66 +30,61 @@ sub tpl(){
|
|||
my $q = new CGI;
|
||||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
my $but = new Buttons;
|
||||
my %ib = $but->ibuttons();
|
||||
my %varenv = $cf->envonline();
|
||||
my $script = $q->script_name();
|
||||
my $path_info = $q->path_info();
|
||||
my $path = $path_info;
|
||||
#with meta_host,
|
||||
if("$varenv{metahost}"){
|
||||
$path = "$script" . "$path_info";
|
||||
$script="";
|
||||
}
|
||||
$path =~ s/\/user|\/manager|\/admin//;
|
||||
my $lang = "de";
|
||||
my $dbh = "";
|
||||
my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname});
|
||||
my $users_dms_primary = { u_id => 0 };
|
||||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"and int08 >= 1");
|
||||
|
||||
my $rel = {};
|
||||
my $ct = {};
|
||||
if($node_meta->{ct_table} eq "contentuser"){
|
||||
#Firma alias Kunden-Faktura and Operator-Faktura config
|
||||
my $ref = {
|
||||
table => $node_meta->{ct_table},
|
||||
fetch => "one",
|
||||
main_id => $node_meta->{main_id},
|
||||
template_id => $node_meta->{tpl_id},
|
||||
c_id => ">::0",
|
||||
};
|
||||
#Kunden-Faktura and Operator-Faktura config
|
||||
if(($node_meta->{template_id} =~ /196|201/) && $users_dms_primary->{int08} >= 1){
|
||||
$rel = $db->get_rel4tpl($node_meta->{main_id},$lang,"","$node_meta->{template_id}","","",">0");
|
||||
$ct = $db->get_content1("contentuser",$rel->{content_id});
|
||||
$ct = $dbt->fetch_record($dbh,$ref);
|
||||
}elsif($node_meta->{template_id} == 197 && $users_dms->{int08} >= 1){
|
||||
$rel = $db->get_rel4tpl($node_meta->{main_id},$lang,"","197","","",">0");
|
||||
$ct = $db->get_content1("contentuser",$rel->{content_id});
|
||||
$ct = $dbt->fetch_record($dbh,$ref);
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Keine Zugriffsberechtigung";
|
||||
}
|
||||
}
|
||||
|
||||
my $tpl = $db->get_tpl($rel->{template_id});
|
||||
my $tpl = $dbt->get_tpl($dbh,$ct->{template_id});
|
||||
my @tpl_order = split /,/,$tpl->{tpl_order};
|
||||
my $u_name = $dbt->sys_username($dbh,$ct->{owner});
|
||||
$ct->{mtime} = $lb->time4de($ct->{mtime},"1");
|
||||
|
||||
print "<div id='Content4conf'>";
|
||||
print $q->div({-class=>"copri_header",-style=>"background-color:#cccccc;"},"Pfad: $path");
|
||||
print $q->div({-class=>"copri_header",-style=>"background-color:#cccccc;"},"$path");
|
||||
print $q->div({-style=>'background-color:silver;height:10px;'},""),"\n";
|
||||
print $q->start_form();
|
||||
|
||||
#Content
|
||||
print $q->start_table({-border=>'0', -width=>'100%',-align=>'center', -cellpadding=>'3', -cellspacing=>'0'});
|
||||
if($feedb->{message} !~ /failure/){
|
||||
if($ct->{c_id} > 0 && $feedb->{message} !~ /failure/){
|
||||
print $q->Tr();
|
||||
if($R::config2edit){
|
||||
print "<td class='ct_editline'>";
|
||||
print $q->hidden(-name=>'owner',-override=>'1', -value=>"$users_dms->{u_id}");
|
||||
print $q->hidden(-name=>'c_id',-override=>'1', -value=>"$ct->{c_id}");
|
||||
print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$rel->{rel_id}");
|
||||
print $q->hidden(-name=>'main_id',-override=>'1', -value=>"$rel->{main_id}");
|
||||
print $q->hidden(-name=>'rel_id',-override=>'1', -value=>"$ct->{rel_id}");
|
||||
print $q->hidden(-name=>'main_id',-override=>'1', -value=>"$ct->{main_id}");
|
||||
print $but->singlesubmit7("rel_edit","save_user","$ib{save}");
|
||||
print "</td>\n";
|
||||
}else{
|
||||
print "<td class='ct_editline'>";
|
||||
print $q->a({-class=>"editnav",-href=>"$script$path?config2edit=1",-title=>'bearbeiten'}, $q->span({-class=>"bi bi-file-earmark-text-fill", -style=>'font-size:1.5em;'}));
|
||||
print $q->a({-class=>"editnav",-href=>"?config2edit=1",-title=>'bearbeiten'}, $q->span({-class=>"bi bi-file-earmark-text-fill", -style=>'font-size:1.5em;'}));
|
||||
print "</td>\n";
|
||||
}
|
||||
print $q->td({-style=>"background-color:white;padding-right:10px;border-bottom: 1px solid silver;text-align:right;font-size:12px;"}, "$u_name / $ct->{mtime}");
|
||||
|
@ -138,7 +132,7 @@ sub tpl(){
|
|||
print "</div>";
|
||||
|
||||
my $debug = "";
|
||||
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | c_id: $ct->{c_id} | tpl_id: $tpl->{tpl_id} | rel_id: $rel->{rel_id})";
|
||||
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | c_id: $ct->{c_id} | tpl_id: $tpl->{tpl_id} | rel_id: $ct->{rel_id})";
|
||||
print $q->div({-style=>'z-index:10;font-size:13px;'},"$debug"),"\n" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
||||
|
||||
return $feedb;
|
||||
|
|
|
@ -16,7 +16,6 @@ use Encode;
|
|||
use Lib::Config;
|
||||
use Mod::Buttons;
|
||||
use Mod::Libenz;
|
||||
use Mod::Libenzdb;
|
||||
use Mod::DBtank;
|
||||
use Mod::APIfunc;
|
||||
use Storable;
|
||||
|
@ -45,7 +44,6 @@ sub tpl(){
|
|||
my $now_db = strftime("%d.%m.%Y %H:%M:%S",localtime(time));
|
||||
my $cf = new Config;
|
||||
my $lb = new Libenz;
|
||||
my $db = new Libenzdb;
|
||||
my $dbt = new DBtank;
|
||||
my $apif = new APIfunc;
|
||||
my $but = new Buttons;
|
||||
|
@ -57,7 +55,6 @@ sub tpl(){
|
|||
my $lang = "de";
|
||||
my $dbh = "";
|
||||
|
||||
my $parent_node4rel = $db->get_node4rel($node_meta->{parent_id},"","","null");
|
||||
my %ib = $but->ibuttons();
|
||||
my $opdir_dms = "$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv{dbname}}->{dir_dms}" || "";
|
||||
|
||||
|
@ -117,10 +114,8 @@ sub tpl(){
|
|||
my ($c_dd,$c_mm,$c_yy) = split(/\./,$date);
|
||||
}
|
||||
|
||||
#because of search we need parents
|
||||
my $main_ids = $parent_node4rel->{main_id};
|
||||
my $tpl_ids = $parent_node4rel->{template_id};
|
||||
|
||||
my $main_ids = $node_meta->{parent_id};
|
||||
my $tpl_ids = $node_meta->{tpl_id};
|
||||
my $table = "content";
|
||||
$searchref->{table_pos} = "contentpos";
|
||||
if($node_meta->{tpl_id} == 194 || $node_meta->{tpl_id} == 199){
|
||||
|
@ -215,7 +210,6 @@ EOF
|
|||
|
||||
my $ct4rel = {};
|
||||
if(!$start_chck && !$end_chck && $main_ids && $tpl_ids){
|
||||
#$rows = $db->count_content($searchref->{table_pos},"$main_ids","$tpl_ids");
|
||||
|
||||
#collect search keys.
|
||||
foreach my $postkey (@keywords){
|
||||
|
@ -242,7 +236,7 @@ EOF
|
|||
}
|
||||
}
|
||||
|
||||
$ct4rel = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tpl_ids","","",$ck4ex);
|
||||
$ct4rel = $dbt->search_content($dbh,$searchref,$node_meta,$users_dms,"$main_ids","$tpl_ids","",$ck4ex);
|
||||
}else{
|
||||
$feedb->{message} = "failure::Abbruch. Keine Zugriffsberechtigung";
|
||||
}
|
||||
|
|
|
@ -555,25 +555,24 @@ EOF
|
|||
$users_dms_primary = $dbt->select_users($dbh_primary,$users_dms->{u_id},"");
|
||||
|
||||
if($users_dms_primary->{u_id}){
|
||||
my @_paymentstate = split(/\|/,$dbt->{shareedms_conf}->{payment_state});
|
||||
push @_paymentstate, "";
|
||||
my $kind_of_payment = "";
|
||||
if($ctadr->{int03} == 1 && ($ctadr->{ct_name} =~ /PO-\d+/ || $ctadr->{ct_name} =~ /TM-\d+/)){
|
||||
$kind_of_payment = "$_paymentstate[0]";
|
||||
}else{
|
||||
undef $_paymentstate[0];
|
||||
}
|
||||
if($ctadr->{int03} == 2 && length($ctadr->{ct_name}) >= 19){
|
||||
$kind_of_payment = "$_paymentstate[1]";
|
||||
}else{
|
||||
undef $_paymentstate[1];
|
||||
}
|
||||
|
||||
if($ctt->{state} && $ctt->{int01}){
|
||||
$kind_of_payment = "$ctt->{state}";
|
||||
}elsif($ctt->{int06} && $ctt->{int06} >= 3 || $ctt->{ct_name} =~ /\d-\d/){
|
||||
#default to Überw.
|
||||
$kind_of_payment = "$_paymentstate[2]";
|
||||
my @_paymentstate = ("");
|
||||
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};
|
||||
}
|
||||
elsif($ctt->{int06} && $ctt->{int06} >= 3 || $ctt->{ct_name} =~ /\d-\d/){
|
||||
#default to Überw.
|
||||
$kind_of_payment = $p_hash->{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($ctt->{state} && $ctt->{int01}){
|
||||
|
|
|
@ -121,9 +121,9 @@ sub post_velo {
|
|||
my $Befehl = shift;
|
||||
|
||||
#local TEST
|
||||
#my $endpoint = "https://shareeapp-primary.copri-bike.de/APIvelo";
|
||||
my $endpoint = "https://shareeapp-fr01.copri-bike.de/APIvelo";
|
||||
#LIVE
|
||||
my $endpoint = "https://cockpit.velofactur.de/api/portal/befehl";
|
||||
#my $endpoint = "https://cockpit.velofactur.de/api/portal/befehl";
|
||||
|
||||
|
||||
my %json;
|
||||
|
@ -133,6 +133,8 @@ sub post_velo {
|
|||
$json{Befehl} = "$Befehl";
|
||||
my $rest_json = encode_json(\%json);
|
||||
|
||||
print FILE "rest_json:\n" . Dumper($rest_json) . "\n";
|
||||
|
||||
my $ret_json = post2velo_cloud("","$endpoint",$rest_json);
|
||||
#
|
||||
eval {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue