Invoice on work mailing. Check iban if still exist with vde. Station selector on edit

This commit is contained in:
ragu 2023-07-13 12:10:45 +02:00
parent a3d251e643
commit 1744cd35a3
15 changed files with 234 additions and 110 deletions

View file

@ -111,16 +111,6 @@ sub delete_account {
return "$i_rows-$u_rows-$d_rows";
}
sub check_account(){
my $self = shift;
my ($column2,$op2,$content2,$column3,$op3,$content3) = @_;
my $table = "contentadr";
$content2 = $q->escapeHTML("$content2");
my $account_check = $db->get_like2sort("contentadr","","","$column2","$op2","$content2","$column3","$op3","$content3");
return $account_check;
}
#create_account is alwas done on primary first
sub create_account(){
my $self = shift;
@ -440,8 +430,17 @@ sub save_account(){
if($valxx !~ /\w\@\w/){
$ret = "failure::$_#top";
}else{
my $account_check = &check_account("","txt08","ilike",$valxx,"c_id","!=",$c_id);
print FILE "$account_check->{c_id} && $account_check->{c_id} != $c_id\n" if($debug);
my $pref_ac = {
table => "contentadr",
fetch => "one",
txt08 => "ilike::$valxx",
c_id => "!=::$c_id",
order => "mtime",
};
my $account_check = $dbt->fetch_tablerecord($dbh,$pref_ac);
#my $account_check = $self->check_account("txt08","ilike",$valxx,"c_id","!=",$c_id);
print FILE "account_check email:$valxx, 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($valxx);
$ret_conflict = "failure::conflict_$_=$encoded_val#top";
@ -525,6 +524,22 @@ sub save_account(){
my $vde_on_fail = $ctadr->{int12} || 3;#keep last or set 3
#check if iban from another user has Vde
my $pref_ac = {
table => "contentadr",
fetch => "one",
txt22 => "$iban",
int12 => ">=::1",
c_id => "!=::$c_id",
order => "mtime",
};
my $account_check = $dbt->fetch_tablerecord($dbh,$pref_ac);
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";
}
my $payone_mival = $payone->managemandate_main(\%varenv,$ctadr,"",$owner);
if($payone_mival && $payone_mival =~ /\w{2}-\d+/){
#define fictiv invoice to get 1 € test