Faktura warning workflow refactor

This commit is contained in:
ragu 2023-02-10 12:04:30 +01:00
parent 8547c6efa4
commit 814692903f
11 changed files with 175 additions and 160 deletions

View file

@ -80,7 +80,8 @@ sub loop_sharees {
#if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $op_name->{project}))){
#to reduce request time by ($return_merchant->{project_id} eq "Freiburg") we do it only for shareeweb-sharee.copri.eu
if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || $return_merchant->{project_id} eq "Freiburg" || ($return_merchant->{project_id} eq $op_name->{project}))){
#if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || $return_merchant->{project_id} eq "Freiburg" || ($return_merchant->{project_id} eq $op_name->{project}))){
if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || $return_merchant->{merchant_id} eq $globalconf{website}->{'shareeweb-sharee'}->{merchant_id} || ($return_merchant->{project_id} eq $op_name->{project}))){
#$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $op_name->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $op_name->{project} || $users_serviceapp->{u_id} > 0)\n","","");
$ret_json = $self->fetch_operator_json("$op_name->{operatorApp}/APIjsonserver",$rest);

View file

@ -557,9 +557,14 @@ sub singlesubmit3(){
# without grafic
sub singlesubmit7(){
my $self = shift;
my ($function,$b_name,$title,$set_style,$jscript,$ebutton) = @_;
$ebutton = "ebutton" if(!$ebutton);
my ($b_img,$a_key);
my $function = shift;
my $b_name = shift;
my $title = shift || "";
my $set_style = shift || "";
my $jscript = shift || "";
my $autofocus = shift || "";
my $b_img = "";;
$b_img = "Barcode" if("$b_name" =~ /barcode/);
$b_img = "Copy" if("$b_name" =~ /copy/);
$b_img = "Relate" if("$b_name" =~ /relate/);
@ -567,7 +572,6 @@ sub singlesubmit7(){
$b_img = "Delete" if("$b_name" =~ /delete|remove/);
$b_img = "Delete" if("$b_name" =~ /delete_media/);
$b_img = "Save" if("$b_name" =~ /save|service_done|_contenttverpos/);
$a_key = "y" if("$b_name" =~ /save/);
$b_img = "Text & State Save" if("$b_name" =~ /save_text/);
$b_img = "Delete All" if("$b_name" =~ /delete_all/);
$b_img = "Search" if("$b_name" =~ /search/);
@ -588,11 +592,11 @@ sub singlesubmit7(){
my $button = "<span style='width:25px;height=15px;'>&nbsp;</span>";
if($b_name){
if("$b_name" =~ /delete/){
$button = "<button type='submit' onClick=\"return confirm('Wirklich löschen?')\" class='$ebutton' style='$set_style' name='$function' value='$b_name' title='$title'>$b_img</button>";
$button = "<button type='submit' onClick=\"return confirm('Wirklich löschen?')\" class='ebutton' style='$set_style' name='$function' value='$b_name' title='$title'>$b_img</button>";
}elsif($jscript){
$button = "<button type='submit' onClick='javascript:$jscript' class='$ebutton' style='$set_style' name='$function' value='$b_name' title='$title'>$b_img</button>";
$button = "<button type='submit' onClick='javascript:$jscript' class='ebutton' style='$set_style' name='$function' value='$b_name' title='$title'>$b_img</button>";
}else{
$button = "<button type='submit' class='$ebutton' style='$set_style' name='$function' value='$b_name' title='$title' accesskey='$a_key'>$b_img</button>";
$button = "<button type='submit' class='ebutton' style='$set_style' name='$function' value='$b_name' title='$title' $autofocus>$b_img</button>";
}
}
return $button;

View file

@ -394,7 +394,10 @@ sub handler {
}elsif($R::detail_search && $R::detail_search eq "operator_accounting"){
my $ck4ex = "@R::ck4ex" || "";
$return = $pl->operator_accounting($q,$users_dms,$users_sharee,$R::accounting_type,$ck4ex);
}elsif($R::ct_trans){
}elsif($R::ct_trans || $R::v_abschluss || $R::trans2edit){
if($R::ct_trans ne "open" && looks_like_number($R::c_id4trans) && !$R::v_abschluss && !$R::trans2edit){
$feedb = $pl->save_text2contenttrans($q,$users_dms,$R::c_id4trans);
}
$return .= "|";
$return .= $pre->preinit($users_dms,$lang);#transactions logic
}

View file

@ -165,9 +165,17 @@ sub save_text2contenttrans {
if($ctt->{c_id}){
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);
#empty warn_time if warnstate not set
if(!$R::int06){
if(!$R::int06 && $R::txt00 eq "Rechnung"){
$dbt->update_one($dbh,$update_ctt,"warn_time=null",$c_id);
}
if($R::txt22 && $R::txt22 eq "Zahlungseingang"){
$dbt->update_one($dbh,$update_ctt,"int14=null",$c_id);
$dbt->update_one($dbh,$update_ctt,"pay_time=now()",$c_id);
}
if($R::txt22 && $R::txt22 eq "Zahlung offen"){
$dbt->update_one($dbh,$update_ctt,"int14=1",$c_id);
$dbt->update_one($dbh,$update_ctt,"pay_time=null",$c_id);
}
}
$feedb->{u_rows} = $u_rows;
@ -504,13 +512,13 @@ sub set_workflow {
delete $ctt->{txt22};
delete $ctt->{txt23};
delete $ctt->{txt25};
delete $ctt->{txt28};
delete $ctt->{txt30};
delete $ctt->{itime};
delete $ctt->{mtime};
delete $ctt->{close_time};
delete $ctt->{invoice_time};
delete $ctt->{pay_time};
delete $ctt->{warn_time};
my $insert_ctt = {
%$ctt,
@ -556,9 +564,10 @@ sub set_workflow {
}
$db->update_users4trans($c_idnew,"218","",$users_dms->{u_id});
my $uri_path = $dbt->recurse_node($dbh,$node->{main_id});
print "$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows\n";
print redirect("$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows");
#my $uri_path = $dbt->recurse_node($dbh,$node->{main_id});
#print "$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows\n";
#print redirect("$varenv{wwwhost}/$uri_path?return=$i_rows-$u_rows-$d_rows");
print redirect("$varenv{wwwhost}/DMS/Faktura?ct_trans=open\&c_id4trans=$c_idnew\&tpl_id4trans=218\&owner=$users_dms->{u_id}\&offset=$R::offset\&limit=$R::limit\&return=$i_rows-$u_rows-$d_rows");
exit 0;
}#end set_workflow

View file

@ -84,25 +84,10 @@ sub preinit(){
if(!$users_dms->{u_id}){
return "failure::Fehler<br /> Die Anwender Authentifikation wurde unterbrochen.";
return "failure::Fehler<br /> Die Sitzung wurde unterbrochen.";
}
#Mindestmengenanzeige #ist in Liste.pm implementiert
#if(!$R::detail_search && $path =~ /root$/ && "$R::redirected" ne "1"){
# my $repath = $lb->shortcut2("$path","$users_dms->{u_id}");
#print redirect("$varenv{wwwhost}$script$repath?redirected=1&detail_search=1&s_int03=<=0");
#exit 0;
#}els
#topmenu shortcut handling
#if(!$R::no_redirect && !$R::detail_search && $path =~ /^\/([\w-\s]+)\/([\w-\s]+)$|root$/ && "$R::redirected" ne "1"){
# my $repath = $lb->shortcut2("$path","$users_dms->{u_id}");
# if("$repath" ne "$path"){
# print redirect("$varenv{wwwhost}$script$repath?redirected=1\&return=0-0-0|$i_rows-$u_rows-$d_rows");
# exit 0;
# }
#}
if(!looks_like_number($R::c_id4trans) || !looks_like_number($R::tpl_id4trans)){
if((!looks_like_number($R::c_id4trans) || !looks_like_number($R::tpl_id4trans)) && $R::ct_trans !~ /delete_trans/ && !$R::v_abschluss){
print FILE Dumper($q);
return "failure::Fehler<br /> Daten ID's nicht vollständig ($R::c_id4trans || $R::tpl_id4trans)";
}
@ -500,8 +485,8 @@ sub preinit(){
$d_rows += $db->delete_content($table,$ctt->{c_id});
$db->update_users4trans("0","0","",$users_dms->{u_id});
print $q->div({-class=>'elementwhite'},"2... redirecting to ... or CLICK ", $q->a({href=>"$varenv{wwwhost}$script$path"},"$varenv{wwwhost}$script$path"));
print redirect("$varenv{wwwhost}$script$path?redirected=1\&return=0-0-0|$i_rows-$u_rows-$d_rows");
print $q->div({-class=>'elementwhite'},"2... redirecting to ... or CLICK ", $q->a({href=>"$varenv{wwwhost}$script$path"},"$varenv{wwwhost}/DMS/Faktura"));
print redirect("$varenv{wwwhost}/DMS/Faktura?redirected=1\&return=0-0-0|$i_rows-$u_rows-$d_rows");
exit 0;
}
@ -569,8 +554,8 @@ sub preinit(){
owner => $users_dms->{u_id},
};
print FILE "c_id4trans:$R::c_id4trans,tpl_id4trans:$R::tpl_id4trans by condition: ($node_faktura->{invoice_nr} > 0) && ($ctt->{ct_name} !~ /\d/ || $R::set_main_id != $rel->{main_id})\n";
if($node_faktura->{invoice_nr} > 0 && $ctt->{c_id} > 0 && ($ctt->{ct_name} !~ /\d/ || $R::set_main_id != $rel->{main_id})){
print FILE "c_id4trans:$R::c_id4trans,tpl_id4trans:$R::tpl_id4trans by condition: ($node_faktura->{invoice_nr} > 0) && $ctt->{ct_name} !~ /\d/)\n old-relation $rel->{main_id} \n new-relation $R::set_main_id\n";
if($node_faktura->{invoice_nr} > 0 && $ctt->{c_id} > 0 && $ctt->{ct_name} !~ /\d/){
my $nextNr = $node_faktura->{invoice_nr};
$update_ctt->{ct_name} = "$nextNr";
@ -587,7 +572,6 @@ sub preinit(){
$update_ctt->{txt00} = $node->{node_name};
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);
print FILE "invoice_nr:$invoice_nr,c_id4trans:$R::c_id4trans,tpl_id4trans:$R::tpl_id4trans by condition: ($node_faktura->{invoice_nr} > 0) && ($ctt->{ct_name} !~ /\d/ || $R::set_main_id != $rel->{main_id})\n";
}
@ -609,7 +593,7 @@ sub preinit(){
}
$update_ctt->{state} = "$state";
$update_ctt->{int14} = 2 if($state =~ /payone/);#set OPOS
$update_ctt->{int14} = 2;#set OPOS
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);
if($state =~ /payone/){
@ -631,10 +615,10 @@ sub preinit(){
$ctt = $db->get_content1("contenttrans",$ctt->{c_id});
}
if($ctadr->{int03} == 1 && $ctadr->{ct_name} =~ /\w{2}-\d+/){
if($ctadr->{ct_name} =~ /\w{2}-\d+/){
my $payoneret = $payone->preauthorizationSEPA_main(\%varenv,$ctadr,$ctt,$users_dms->{u_id});
sleep 2;
}elsif($ctadr->{int03} == 2 && length($ctadr->{ct_name}) >= 19){
}elsif(length($ctadr->{ct_name}) >= 19){
my $payoneret = $payone->preauthorizationCC_main(\%varenv,$ctadr,$ctt,$users_dms->{u_id});
sleep 2;
}
@ -663,8 +647,11 @@ sub preinit(){
#}else{
#return "failure::Payone Geldeinzug nicht ausgeführt. Hat der Einzug bereits stattgefunden?";
}
}else{
$db->updater($table,"c_id",$ctt->{c_id},"int14","null","","","","","");
}elsif($ctt->{txt00} eq "Storno" || $state eq "Zahlungsausfall"){
$update_ctt->{int14} = "null";
$update_ctt->{pay_time} = "now()";
$u_rows += $dbt->update_record($dbh,$update_ctt,$ctt);
$db->updater($table,"ct_name",$ctt->{barcode},"int14","null","","","","","");#delete OPOS also on basic invoice
}
}

View file

@ -407,12 +407,11 @@ td {
$mandat_nr = " Mandatsreferenz: $ctt->{txt26}" if($ctt->{txt26} =~ /\w{2}-/);
my $invoice_time = $ctt->{invoice_time} || $ctt->{mtime};
#my $update_ctt = {
# table => "contenttrans",
# pay_time => "$invoice_time",
# };
#necersarry for non payone capture
#$dbt->update_record($dbh,$update_ctt,$ctt) if(!$ctt->{pay_time});
my $update_ctt = {
table => "contenttrans",
invoice_time => "$invoice_time",
};
$dbt->update_record($dbh,$update_ctt,$ctt);
my $mtime = $lb->time4de("$invoice_time","");
my $position = "";