diff --git a/copri4/main/css/local_style20230105.css b/copri4/main/css/local_style20240206.css similarity index 97% rename from copri4/main/css/local_style20230105.css rename to copri4/main/css/local_style20240206.css index f7a5216..23e45ea 100755 --- a/copri4/main/css/local_style20230105.css +++ b/copri4/main/css/local_style20240206.css @@ -8,7 +8,7 @@ html { html,body { background-color: #d9d6ce; color: #3f3f3f; - font-family:'Arial'; + font-family:Roboto, "Helvetica Neue", Helvetica, sans-serif; background-repeat: no-repeat; background-position: right bottom; background-attachment: fixed; @@ -21,7 +21,6 @@ html,body { } div { - font-family: Arial,sans-serif; font-size: 1em; } @@ -313,14 +312,6 @@ div#Oline { .ebutton2:hover { background-color:white; } -/*.ebutton3 { - font-size:1.2em; - border: 1px solid silver; - color:gray; - margin: 0px 15px; - padding:5px 50px; -} -*/ .ebutton3 { font-size:1.1em; @@ -335,26 +326,22 @@ div#Oline { .ebutton3:hover { background-color:white; } + .ebutton4 { - animation: blinkb 5s infinite; - font-size:1em; - border: 1px solid silver; - color:black; - padding:1px 15px; + border:1px solid #5c5c5c; + background-color:#5c5c5c; + color:#fffffe; } -.ebutton4:hover { - background-color:white; - color:black; +.ebutton4:hover { + border:1px solid #d9d6ce; + background-color:#d9d6ce; } -.ebutton5 { - animation: blinkb 5s infinite; -} -/* Standard syntax */ -@keyframes blinkb { - from {background-color: #a7a18f;} - to {background-color: #dcdcdc;} +.ebutton4:active { + border:1px solid #d9d6ce; + background-color:#d9d6ce; } + /* e wie Edit inputFelder */ .etxt { font-size:100%; @@ -883,6 +870,13 @@ div#Container_txt1 { .elinkbutton2:visited { color: #000000;} .elinkbutton2:hover { color: #000000;} +.elinkbutton4 { + padding:0 2px; + color:#5c5c5c; +} +.elinkbutton4:hover { color:#d9d6ce;} + + .cal { text-decoration: none; color:black; @@ -1011,7 +1005,6 @@ ul#TopNavi li { ul#TopNavi a { margin: 0; padding: 0em 3em; border: 1px solid white; - font-family:Arial,sans-serif; text-decoration: none; font-weight: normal; color: white; } diff --git a/copri4/main/src/Mod/APIfunc.pm b/copri4/main/src/Mod/APIfunc.pm index fb71c37..a01e63b 100755 --- a/copri4/main/src/Mod/APIfunc.pm +++ b/copri4/main/src/Mod/APIfunc.pm @@ -27,7 +27,7 @@ use Mod::DBtank; use Mod::Callib; use Mod::Basework; use Mod::Pricing; -#use Mod::APIsigclient;#no! +use Mod::MailTransport; use Data::Dumper; use Sys::Hostname; my $json = JSON->new->allow_nonref; @@ -37,7 +37,7 @@ my $dbt = new DBtank; my $cal = new Callib; my $bw = new Basework; my $pri = new Pricing; -#my $si = new APIsigclient; +my $mailtrans = new MailTransport; sub new { my $class = shift; @@ -454,16 +454,18 @@ sub service_insert(){ my $insert_contentpos = { table => "contentpos", cc_id => $crecord_content->{c_id}, - #int03 => $c_id, #yes, c_id from contentadrpos to make backlink + ct_name => $bike, barcode => $crecord_content->{barcode}, int04 => $crecord_content->{int04}, owner => $owner, template_id => $node_template_contentpos->{template_id}, mtime => "now()", }; - #$update->{int01} = 1 if($q->param('bike_broken'));#TODO. what should else be done if bike_broken $insert_contentpos->{txt01} = $q->escapeHTML($q->param('message')) if($q->param('message')); my $c_id_contentpos = $dbt->insert_contentoid($dbh,$insert_contentpos,""); + if($crecord_content->{fleed_email} && $crecord_content->{fleed_email} =~ /\w\@\w/){ + $mailtrans->mail_feedback2garage($crecord_content,$insert_contentpos); + } } } } @@ -727,11 +729,7 @@ sub service_work { my $dt1 = DateTime->now; my $return={}; - my $mapref = { - int09 => 1, - }; - #my $users_map = $dbt->users_map($dbh,$mapref);#get serviceAPP users - my $users_map = $dbt->users_map($dbh,"");#get all serviceAPP users (also without service key) + my $users_map = $dbt->users_map($dbh,{ int09 => 1 }); my $channel_map = $dbt->channel_map(); my @tpl_order = (); @@ -1577,7 +1575,7 @@ sub smartlock { #only by system=Ilockit if($record_pos->{int11} eq "2" && $q->param('voltage') && $q->param('voltage') =~ /(\d+)/){ $update_cc->{int14} = $1; - $self->service_automatic($q,"") if($1 <= 60); + $self->service_automatic($q,$varenv,"") if($1 <= 60); } my $update_pos = { @@ -1647,6 +1645,7 @@ sub smartlock { sub service_automatic { my $self = shift; my $q = shift || ""; + my $varenv = shift; my $current_percent = shift || 0; my $station_id = ""; @@ -2681,10 +2680,10 @@ sub fetch_tariff(){ #shareetool user_tour if($auth_operator->{c_id} && $merchant_id && $dbt->{merchant_ids}->{$merchant_id}->{id} && $dbt->{merchant_ids}->{$merchant_id}->{id} == 187){ my $users_serviceapp = $dbt->select_users($dbh,$auth_operator->{c_id},"and int09=1"); - if($users_serviceapp->{int09} && $users_serviceapp->{txt07}){ - $users_serviceapp->{txt07} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g; - @user_tour = ($users_serviceapp->{txt07}); - @user_tour = split(/\s/,$users_serviceapp->{txt07}) if($users_serviceapp->{txt07} =~ /\s/); + if($users_serviceapp->{int09} && $users_serviceapp->{txt12}){ + $users_serviceapp->{txt12} =~ s/(\d+)/$dbt->{operator}->{$dbname}->{oprefix}$1/g; + @user_tour = ($users_serviceapp->{txt12}); + @user_tour = split(/\s/,$users_serviceapp->{txt12}) if($users_serviceapp->{txt12} =~ /\s/); } }#end user_tour @@ -2831,6 +2830,10 @@ sub fetch_bike_tariff { elsif($tariff_content->{$id}->{int18} && $tariff_content->{$id}->{int18} == 2 && $tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode}){ push(@txt30, "$tariff_content->{$id}->{barcode}"); } + #add private tarif for dmsuser + elsif($tariff_content->{$id}->{int18} && $tariff_content->{$id}->{int18} == 3 && $tariff_content->{$id}->{int12} && $tariff_content->{$id}->{barcode} && $auth->{int09}){ + push(@txt30, "$tariff_content->{$id}->{barcode}"); + } } } $bw->log("booking_request NO user tariff defined, update user account to fallback default public or private or hidden",\@txt30,""); @@ -2982,7 +2985,7 @@ sub auth_verify(){ }elsif($auth_primary->{txt17}){ $operator_hash{$auth_primary->{txt17}} = 1; } - $operator_hash{$varenv{dbname}} = 1 if($varenv{dbname} ne "sharee_lv");#LastenVelo dbname will be only set by xml + $operator_hash{$varenv{dbname}} = 1; my @operator_array = keys %operator_hash; #$bw->log("auth_verified update operator keys by array: @operator_array",\%operator_hash,""); @@ -3126,7 +3129,6 @@ sub auth_verify(){ $return->{user_tour} = $user_tour; $return->{debuglevel} = "$record->{int11}" if($record->{int11}); $return->{Ilockit_admin} = "$record->{int19}" if($record->{int19}); - $return->{response_text} = "Danke, die Anmeldebestätigung war erfolgreich."; } }else{ #$bw->log("auth_verified on operator anchor FAILS by dbname $varenv{dbname}, no authcookie, dump \$q",$q,""); diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm index 36f8a32..9e5f2e3 100755 --- a/copri4/main/src/Mod/DBtank.pm +++ b/copri4/main/src/Mod/DBtank.pm @@ -281,14 +281,24 @@ sub users_map(){ my $dbh = shift || $dbh_intern; my $mapref = shift || ""; - my $and = ""; + my $where = "ct.c_id=u.u_id"; if(ref($mapref) eq "HASH"){ foreach my $key (keys (%$mapref)){ - $and = " and u.$key=$mapref->{$key}" if($key =~ /int/); + if($mapref->{$key}){ + my $op = "="; + my $value = $mapref->{$key}; + ($op, $value) = split(/::/, $mapref->{$key}) if($mapref->{$key} =~ /::/); + + if($key =~ /int/){ + $where .= " and u.$key=$value"; + }elsif($key eq "u_id" && $op =~ /IN/){ + $where .= " and u.$key $op $value"; + } + } } } - my $sql = "SELECT ct.* FROM contentadr ct, users u WHERE ct.c_id=u.u_id $and"; + my $sql = "SELECT ct.* FROM contentadr ct, users u WHERE $where"; my $sth = $dbh->prepare($sql); my $rc = $sth->execute(); my $users_rec = $sth->fetchall_hashref('c_id'); @@ -299,13 +309,12 @@ sub users_map(){ #booking channel id's -#TODO migrate all to global.cfg sub channel_map(){ my $self = shift; my $channel = { #167 => "sig cmd", 168 => "shareeio", - 169 => "sigo connector", + #169 => "sigo connector", 172 => "reserve timeout", #173 => "merchant fallback",#mig 174 => "cronjob bonus", @@ -324,14 +333,14 @@ sub channel_map(){ 188 => "sys API", 192 => "web Bayern", #193 => "web demo",#mig - 195 => "web konrad",#mig and import + #195 => "web konrad",#mig and import 196 => "copri",#mig - 197 => "web sharee.bike",#mig + #197 => "web sharee.bike",#mig 198 => "primary",#mig - 294 => "example Web",#mig - 295 => "example App",#mig - 296 => "example Op",#mig - 298 => "example Pr",#mig + #294 => "example Web",#mig + #295 => "example App",#mig + #296 => "example Op",#mig + #298 => "example Pr",#mig }; return $channel; } @@ -821,9 +830,12 @@ sub fetch_record(){ } } - #ct.* because of nd.txt01 and ct.txt01 . - #TODO drop "lang" then set nd.* should be possible - my $sql = "SELECT ct.*,rel.*,nd.node_name,nd.parent_id,nd.type_id,nd.energy_id,nd.archive FROM $fetch->{table} ct, relation rel, nodes nd $where $order"; + my $sql = ""; + if($fetch->{table} eq "content"){ + $sql = "SELECT ct.*,rel.*,nd.node_name,nd.parent_id,nd.type_id,nd.energy_id,nd.archive,nd.fleed_name,nd.fleed_hours,nd.fleed_email,nd.fleed_phone FROM $fetch->{table} ct, relation rel, nodes nd $where $order"; + }else{ + $sql = "SELECT ct.*,rel.*,nd.node_name,nd.parent_id FROM $fetch->{table} ct, relation rel, nodes nd $where $order"; + } #$bw->log("DBtank fetch_record : ",$sql,"") if($debug); my $sth = $dbh->prepare($sql); my $rc = $sth->execute(); @@ -1058,7 +1070,7 @@ sub insert_users { my $u_id = shift; my $owner = shift; - my $sql = "INSERT INTO users (u_id,itime,mtime,owner) VALUES ('$u_id','now()','now()','$owner')"; + my $sql = "INSERT INTO users (u_id,itime,mtime,iowner,owner) VALUES ('$u_id','now()','now()','$owner','$owner')"; my $sth = $dbh->prepare($sql); my $rows = $sth->execute(); $bw->log("DBtank INSERT DMS users $rows",$sql,"") if($debug); @@ -1776,6 +1788,8 @@ sub search_content { $cptxt_where .= " and cp.$key ilike '%$valref->{$key}%'"; }elsif($key =~ /barcode|int|owner/ && (looks_like_number($valref->{$key}) || $valref->{$key} eq "null")){ $cptxt_where .= " and cp.$key $opref->{$key} $valref->{$key}"; + }elsif($key =~ /barcode|int|owner|_id/ && $opref->{$key} =~ /IN/){ + $cptxt_where .= " and cp.$key $opref->{$key} $valref->{$key}"; } }else{ if($key eq "ct_name" && $valref->{$key} =~ /^\d+$/){ diff --git a/copri4/main/src/Mod/Indexsharee.pm b/copri4/main/src/Mod/Indexsharee.pm index 5751558..38c0c89 100755 --- a/copri4/main/src/Mod/Indexsharee.pm +++ b/copri4/main/src/Mod/Indexsharee.pm @@ -74,7 +74,6 @@ sub handler { }; - #$mode is used to set GUI features like "maintainer" contextmenue my $modes = $dbt->{shareedms_conf}->{modes}; my $mode = ""; if($R::mode && length($R::mode) >= 5 && $R::mode =~ /($modes)/){ @@ -128,6 +127,11 @@ sub handler { ($api_return,$users_sharee) = $apif->auth_verify($q,$coo,""); + if($R::email && $R::sharee_edit =~ /password_forgotten/){ + my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff)); + $shwo->send_password(\%varenv,$R::email,$hw_id,$aowner); + } + #login-screen should only be available if auth_verify fails if($R::login_sharee || $R::login_dms){ @@ -142,25 +146,25 @@ sub handler { ($api_return,$users_sharee) = $apif->auth_verify($q,$author->{authcookie},""); #print "$author->{authcookie},$users_sharee->{c_id}"; exit; - #5. domcookie by authcookie substr (cut first 15 chars), AND also sessionid if($author->{authcookie} && length($author->{authcookie}) > 30){ # take last 21 chars $coo = substr $author->{authcookie}, 15; my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo); print $q->header(-charset=>"$html_charset", -cookie=>$cookie); - #DMS login if($users_sharee->{c_id} && $varenv{orga} eq "dms" && $R::login_dms eq "Login" && $coo && length($coo) > 20){ $users_dms = $dbt->select_users($dbh,$users_sharee->{c_id}); - my $update_users = { + if($users_dms->{u_id}){ + my $update_users = { table => "users", owner => $aowner, u_id => $users_dms->{u_id} - }; - $dbt->update_one($dbh,$update_users,"cookie='$coo'") if($users_dms->{u_id}); + }; + $dbt->update_one($dbh,$update_users,"cookie='$coo'"); - print redirect("$varenv{wwwhost}"); - exit 0; + print redirect("$varenv{wwwhost}"); + exit 0; + } } } } @@ -181,12 +185,7 @@ sub handler { $users_dms = $dbt->select_users($dbh,$users_sharee->{c_id},"and cookie='$coo'"); } - if($varenv{dbname} eq $dbt->{primary}->{sharee_primary}->{database}->{dbname}){ - $varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $q->escapeHTML($lang) }); - }else{ - my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}); - $varenv{cms} = $dbt->fetch_cms($dbh_primary,{ lang => $q->escapeHTML($lang) }); - } + $varenv{cms} = $dbt->fetch_cms($dbh,{ lang => $q->escapeHTML($lang) }); #Save anyway on create ... and hopefully delete it later if($R::sharee_edit && $R::sharee_edit =~ /create_account/ && $R::txt04 && $R::txt04 =~ /\w+/ && $R::txt08 && $R::txt08 =~ /\w+\@\w+/){ @@ -195,8 +194,8 @@ sub handler { $apif->authout($q,$coo); #create_account. 2. inserts contentadr - my $shareec_id = $shwo->create_account($aowner); - ($returnwww,$feedb) = $shwo->save_account($q,$shareec_id,\%varenv,$aowner); + my $shareec_id = $shwo->create_account($dbh,$aowner); + ($returnwww,$feedb) = $shwo->save_account($dbh,$q,$shareec_id,\%varenv,$aowner); #Like login_sharee, redundant my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co @@ -308,6 +307,12 @@ sub handler { #DMS & Tools if($varenv{orga} eq "dms" && $users_dms->{u_id}){ + #just for pw renew + if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_account/){ + ($returnwww,$feedb) = $shwo->save_account($dbh,$q,$users_sharee->{c_id},\%varenv,$aowner); + ($api_return,$users_sharee) = $apif->auth_verify($q,$coo,""); + } + my $update_users = { table => "users", change => "no_time", @@ -355,7 +360,7 @@ sub handler { }elsif($R::c_id && $R::base_edit eq "delete_adr"){ $return = $shwo->delete_account($R::c_id,$users_dms->{u_id}); }elsif($R::c_id && $R::base_edit eq "save_adr"){ - ($returnwww,$feedb) = $shwo->save_account($q,$R::c_id,\%varenv,$users_dms->{u_id}); + ($returnwww,$feedb) = $shwo->save_account($dbh,$q,$R::c_id,\%varenv,$users_dms->{u_id}); } }else{ $feedb->{message} = "failure::Abbruch. Schreibender Zugriff \"Kunden Stammdaten\" verweigert."; @@ -369,8 +374,9 @@ sub handler { if($R::u_id && $R::base_edit eq "remove_chk4rel"){#users my $delete_key = "delete_dmsusers"; $feedb->{message} = "failure::Datensatz wirklich löschen. ::?base_edit=$delete_key\&exit_box2=1\&u_id=$R::u_id ::löschen"; - }elsif(($R::u_id || $R::c_idadr) && $R::base_edit =~ /_dmsusers/){ - my $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/); + }elsif($R::base_edit =~ /new_dmsusers|save_dmsusers|delete_dmsusers/){ + my $u_id = 0; + $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/); $u_id = $1 if($R::c_idadr && $R::c_idadr =~ /(\d+)/ && $R::base_edit eq "new_dmsusers"); $feedb = $pl->manage_dmsusers($q,\%varenv,$R::base_edit,$u_id,$users_dms); } @@ -536,15 +542,13 @@ sub handler { $users_dms = $dbt->select_users($dbh,$users_dms->{u_id},"");#just to get update after save - #none DMS hosts ---------------------------------------------------- - }elsif($varenv{orga} ne "dms"){ - - - + } + #web frame + elsif($varenv{orga} ne "dms"){ #save_account. 3. updates contentadr if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_account/){ - ($returnwww,$feedb) = $shwo->save_account($q,$users_sharee->{c_id},\%varenv,$aowner); + ($returnwww,$feedb) = $shwo->save_account($dbh,$q,$users_sharee->{c_id},\%varenv,$aowner); } if($users_sharee->{c_id} && $R::sharee_edit && $R::sharee_edit =~ /save_transact/){ $returnwww = $shwo->save_transact($q,$users_sharee->{c_id},$coo,$aowner); @@ -556,8 +560,6 @@ sub handler { if($returnwww && $returnwww =~ /failure::(.*)/){ $returnwww =~ s/::/=/g; - ($api_return,$users_sharee) = $apif->auth_verify($q,$coo,""); - if($returnwww =~ /txt22|txt23/){ #should be result to Uhps page if($returnwww =~ /conflict_txt22/){ @@ -616,7 +618,7 @@ sub handler { ($api_return,$users_sharee) = $apif->auth_verify($q,$coo,""); #payment_ack - system("$dbt->{copri_conf}->{basedir}/$varenv{syshost}/src/scripts/payment_ack.pl '$varenv{syshost}' 'payment_ackCC' '$users_sharee->{c_id}' '$aowner'"); + system("$dbt->{copri_conf}->{basedir}/$varenv{syshost}/src/scripts/payment_ack.pl '$varenv{syshost}' 'payment_ackCC' '$users_sharee->{c_id}' '$aowner' &"); if(1==1){ open(FILE,">>$varenv{logdir}/confirm.log") if($debug); @@ -647,122 +649,8 @@ sub handler { }#end payone response with pseudocardpan } - - #send confirm codes - if($users_sharee->{c_id} && $users_sharee->{txt34} && length($users_sharee->{txt34}) > 10 && $payable_check && $R::sharee_edit && $R::sharee_edit =~ /save_account|send_email|send_sms/){ - open(FILE,">>$varenv{logdir}/confirm.log") if($debug); - print FILE "\n\n*--> $now_dt done by $0\n" if($debug); - 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/)){ - $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)){ - $shwo->smsack($users_sharee); - } - close(FILE) if($debug); - }#send confirm code - - #email and sms acknowledgments, check and save confirm states - if($R::confirm_userid && $R::confirm_userid =~ /^\d+$/ && ($R::confirm_code && length($R::confirm_code) >= 5 || $R::confirm_smscode && length($R::confirm_smscode) >= 5)){ - my $update_adr = { - table => "contentadr", - mtime => "now()", - owner => $aowner, - }; - - #keep in mind, for now and just for testing confirm codes are just c_id - open(FILE,">>$varenv{logdir}/confirm.log") if($debug); - print FILE "\n\n*--> $now_dt done by $0\n" if($debug); - print FILE "confirm_userid:$R::confirm_userid\nconfirm_code:$R::confirm_code\nconfirm_smscode:$R::confirm_smscode\n" if($debug); - $R::confirm_code =~ s/\s//g; - $R::confirm_smscode =~ s/\s//g; - my $confirm_code = $q->escapeHTML($R::confirm_code); - my $confirm_smscode = $q->escapeHTML($R::confirm_smscode); - - #confirm email - if($confirm_code){ - my $authref = { - table => "contentadr", - fetch => "one", - c_id => $R::confirm_userid, - txt34 => "ilike::$confirm_code%", - }; - my $confirmed_email = { c_id => 0 }; - $confirmed_email = $dbt->fetch_tablerecord($dbh,$authref); - - if($confirmed_email->{c_id}){ - $update_adr->{c_id} = $confirmed_email->{c_id}; - $dbt->update_one($dbh,$update_adr,"int04=1"); - #save verified email - $dbt->update_one($dbh,$update_adr,"txt32='$confirmed_email->{txt08}'"); - print FILE "confirmed_email: $confirmed_email->{c_id} update because confirm_code:$confirm_code\n" if($debug); - - #after mailAck, delete all douple adr with no mailAck - my $authref = { - table => "contentadr", - fetch => "all", - keyfield => "c_id", - txt08 => "ilike::" . $q->escapeHTML($confirmed_email->{txt08}), - }; - my $ctadr = $dbt->fetch_tablerecord($dbh,$authref); - foreach my $aid (keys(%$ctadr)){ - if(!$ctadr->{$aid}->{int04}){ - $dbt->delete_content("contentadr",$ctadr->{$aid}->{c_id}); - print FILE "c_id $ctadr->{$aid}->{c_id} $confirmed_email->{txt08} delete because of dopplel\n" if($debug); - } - } - } - } - #confirm sms - if($confirm_smscode){ - my $authref = { - table => "contentadr", - fetch => "one", - c_id => $R::confirm_userid, - txt34 => "ilike::%$confirm_smscode", - }; - my $confirmed_sms = { c_id => 0 }; - $confirmed_sms = $dbt->fetch_tablerecord($dbh,$authref); - - if($confirmed_sms->{c_id}){ - $update_adr->{c_id} = $confirmed_sms->{c_id}; - $dbt->update_one($dbh,$update_adr,"int13=1"); - #save verified telnr - $dbt->update_one($dbh,$update_adr,"txt33='$confirmed_sms->{txt07}'"); - print FILE "confirmed_sms: $confirmed_sms->{c_id} update because confirm_smscode:$confirm_smscode\n" if($debug); - } - } - - ($api_return,$users_sharee) = $apif->auth_verify($q,"",$users_sharee->{c_id}) if($users_sharee->{c_id}); - - if($users_sharee->{int04} && $users_sharee->{int13}){ - $dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update"); - }else{ - my $field = "int13"; - $field = "int04" if(!$users_sharee->{int04}); - print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=5$session_and\&failure=$field#top"); - exit 0; - } - - if(!$coo){ - print FILE "c_id: $users_sharee->{c_id} empty auth because of no cookie\n" if($debug); - $users_sharee = { c_id => 0 }; - } - close(FILE) if($debug); - if($users_sharee->{c_id} && $users_sharee->{int04} && $users_sharee->{int13}){ - print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?confirm_success=1$session_and"); - exit 0; - } - }#end confirm - - if($R::email && $R::sharee_edit =~ /password_forgotten/){ - my $hw_id = unpack ('H*', pack('Nc', time, $$ % 0xff));#old $co - $shwo->send_password(\%varenv,$R::email,$hw_id,$aowner); - } - - #redirections - if($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/$varenv{profile}/ || $path =~ /$varenv{mandant}\/Account/)){ + #redirections + if($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/$varenv{profile}/ || $path =~ /$varenv{mandant}\/Account/)){ if($R::sharee_edit && $R::sharee_edit =~ /save_account/){ $returnwww =~ s/::/=/g if($returnwww && $returnwww =~ /success::\w+/); @@ -807,10 +695,9 @@ sub handler { exit 0; } } - } - #redirect used by App user profile button - #elsif($session && $users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){ - elsif(1==1 && $users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){ + } + #redirect used by App user profile button + elsif(1==1 && $users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){ if(!$users_sharee->{int14}){ print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=4$session_and\&$returnwww"); exit 0; @@ -821,9 +708,57 @@ sub handler { print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=4$session_and\&$returnwww"); exit 0; } + } + }#end web frame + + + #@all + ($api_return,$users_sharee) = $apif->auth_verify($q,"",$users_sharee->{c_id}); + #send confirm codes + if($users_sharee->{c_id} && $users_sharee->{txt34} && length($users_sharee->{txt34}) > 10 && ($users_sharee->{int04} != 1 || $users_sharee->{int13} != 1) && ($R::sharee_edit && $R::sharee_edit =~ /save_account|send_email|send_sms/ || $R::base_edit && $R::base_edit eq "save_dmsusers")){ + open(FILE,">>$varenv{logdir}/confirm.log") if($debug); + print FILE "\n\n*--> $now_dt done by default\n" if($debug); + print FILE "confirm-code request by sharee_edit:$R::sharee_edit or base_edit:$R::base_edit\n" if($debug); + print FILE "$users_sharee->{txt08}:$users_sharee->{int04} || $users_sharee->{txt07}:$users_sharee->{int13}\n" if($debug); + + if($users_sharee->{int04} != 1 && ($users_sharee->{txt08} =~ /\w\@\w/)){ + $shwo->emailack(\%varenv,$users_sharee->{c_id}); } - ### - } + if($users_sharee->{int13} != 1 && ($users_sharee->{txt07} =~ /\d{9}/ && length($users_sharee->{txt07}) <= 16)){ + $shwo->smsack($users_sharee); + } + close(FILE) if($debug); + }#send confirm code + + #email and sms acknowledgments, check and save confirm code states + if($users_sharee->{c_id} == $R::confirm_userid && ($R::confirm_code && length($R::confirm_code) >= 5 || $R::confirm_smscode && length($R::confirm_smscode) >= 5)){ + + $shwo->code_confirmation($q,\%varenv,$aowner); + $dbt->update_operatorsloop($varenv{dbname},$users_sharee->{c_id},"update"); + ($api_return,$users_sharee) = $apif->auth_verify($q,"",$users_sharee->{c_id}); + + if(!$users_sharee->{int04} || !$users_sharee->{int13}){ + my $field = "int13"; + $field = "int04" if(!$users_sharee->{int04}); + if($varenv{orga} eq "dms"){ + print redirect("$varenv{wwwhost}/$dbt->{shareedms_conf}->{parent_node}/$dbt->{shareedms_conf}->{start}/?failure=$field#top"); + }else{ + print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=5$session_and\&failure=$field#top"); + } + exit 0; + } + + if($users_sharee->{c_id} && $users_sharee->{int04} && $users_sharee->{int13}){ + if($varenv{orga} eq "dms"){ + print redirect("$varenv{wwwhost}/$dbt->{shareedms_conf}->{parent_node}/$dbt->{shareedms_conf}->{start}/?confirm_success=1"); + }else{ + print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?confirm_success=1$session_and"); + } + exit 0; + } + }#end confirm + + #Printpreview if($view =~ /Printpreview/){ diff --git a/copri4/main/src/Mod/Libenz.pm b/copri4/main/src/Mod/Libenz.pm index d5e0982..d74a1f0 100755 --- a/copri4/main/src/Mod/Libenz.pm +++ b/copri4/main/src/Mod/Libenz.pm @@ -629,9 +629,6 @@ sub newline(){ } # Rounding like "Kaufmannsrunden" -# Descr. http://de.wikipedia.org/wiki/Rundung -# Inspired by -# http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q4.13.html sub round(){ my $self = shift; my ($amount) = @_; diff --git a/copri4/main/src/Mod/MailTransport.pm b/copri4/main/src/Mod/MailTransport.pm index 866411a..45aa2f9 100755 --- a/copri4/main/src/Mod/MailTransport.pm +++ b/copri4/main/src/Mod/MailTransport.pm @@ -33,6 +33,26 @@ my $q = new CGI; my $bw = new Basework; my $dbt = new DBtank; +#mailxcfg shareeconf/mailx.cfg +#hash data to send +sub sendrefhash { + my $self = shift; + + my $sendref = { + mailxcfg => "mailx_default", + syshost => "", + mail_from => "", + mail_to => "", + mail_bcc => "", + c_id => 0, + subject => "", + message => "", + signature => "", + attachment => "", + }; + return $sendref; +} + sub mail_connect { my $self = shift; my $sendref = shift; @@ -158,4 +178,22 @@ sub mail_transport(){ return $ret; }#end mail_send + +#we use just db-selector hashes +sub mail_feedback2garage { + my $self = shift; + my $crecord_content = shift; + my $contentpos = shift; + my $sendref = $self->sendrefhash(); + + $sendref->{mail_to} = $crecord_content->{fleed_email}; + $sendref->{subject} = "sharee.bike Werkstatt Meldung"; + $sendref->{message} = "Es ist folgende sharee.bike App-Meldung zu Mietrad $contentpos->{ct_name} an Station $contentpos->{int04} eingegangen:\n\n$contentpos->{txt01}\n\nFreundliche Grüße,\nIhr sharee.bike Mietradsystem"; + $sendref->{message} =~ s/\n/\
/g;#TOD prepare_content + + my ($smtp,$mailxconf) = $self->mail_connect($sendref); + my $ret = $self->mail_transport($smtp,$mailxconf,$sendref); + return $ret; +} + 1; diff --git a/copri4/main/src/Mod/Modalbox3.pm b/copri4/main/src/Mod/Modalbox3.pm index 0eb0e22..622181a 100755 --- a/copri4/main/src/Mod/Modalbox3.pm +++ b/copri4/main/src/Mod/Modalbox3.pm @@ -44,7 +44,7 @@ sub mobox3(){ my $title = "Content Editor \"$node_meta->{tpl_name}\""; $title = "Parts Editor" if($node_meta->{ct_table} eq "content"); $title = "Kunden Editor" if($node_meta->{ct_table} eq "contentadr"); - $title = "DMS-Account Zugriffsberechtigung" if($node_meta->{ct_table} eq "users"); + $title = "DMS-Account Editor" if($node_meta->{ct_table} eq "users"); $title = "Service Editor" if($node_meta->{ct_table} eq "contentpos"); $title = "Rental Editor" if($node_meta->{ct_table} eq "contenttranspos"); my $height = $node_meta->{tpl_height} || "990"; diff --git a/copri4/main/src/Mod/NodeEdit.pm b/copri4/main/src/Mod/NodeEdit.pm index aec6abe..1b5661e 100755 --- a/copri4/main/src/Mod/NodeEdit.pm +++ b/copri4/main/src/Mod/NodeEdit.pm @@ -155,11 +155,7 @@ sub admin_tpl(){ print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; print $q->td({-class=>'content1_cms', -colspan=>'1'}, $but->checkbox("1","$key","$node_meta->{$key}")),"\n"; print $q->hidden(-name=>"$key",-override=>1,-value=>"null"); - }elsif($key eq "hotline_email"){ - print $q->Tr(); - print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; - print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n"; - }elsif($key eq "hotline_phone"){ + }elsif($key =~ /fleed_/){ print $q->Tr(); print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n"; diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index a9f0c3f..062416f 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -20,6 +20,7 @@ use Mod::Libenz; use Mod::DBtank; use Mod::Basework; use Mod::Pricing; +use Mod::Shareework; use Mod::APIsigclient; use Data::Dumper; @@ -28,6 +29,7 @@ my $lb = new Libenz; my $dbt = new DBtank; my $bw = new Basework; my $pri = new Pricing; +my $shwo = new Shareework; my $si = new APIsigclient; sub new { @@ -190,7 +192,7 @@ sub manage_dmsusers { my $q = shift; my $varenv = shift; my $base_edit = shift; - my $u_id = shift; + my $u_id = shift || 0; my $users_dms = shift || {}; my $owner = $users_dms->{u_id} || 0; my $table = "users"; @@ -198,40 +200,156 @@ sub manage_dmsusers { my @keywords = $q->param; my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; - my $feedb = { message => "", i_rows => 0, u_rows => 0, d_rows => 0 }; + my $dbh = ""; + my $feedb = { + u_id => "", + message => "", + i_rows => 0, + u_rows => 0, + d_rows => 0 + }; $bw->log("manage_dmsusers",$q,""); - my $dbh = ""; + open(FILE,">>$varenv->{logdir}/dmsusers.log"); + print FILE "\n*-->$now_dt | $varenv->{dbname} | $base_edit\n"; + print FILE Dumper($q) . "\n"; + + my $auth_primary = { c_id => 0 }; + my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}); + + my $ctadr = { c_id => 0 }; + my $users = { u_id => 0 }; my $adref = { - table => "contentadr", - fetch => "one", - template_id => "202", - c_id => "$u_id", + table => "contentadr", + fetch => "one", + template_id => "202", }; - my $ctadr = $dbt->fetch_record($dbh,$adref); - - #users have to be exist only if DMS activated my $uref = { - table => "users", - fetch => "one", - u_id => "$u_id", + table => "users", + fetch => "one", }; - my $users = $dbt->fetch_tablerecord($dbh,$uref); - #datahash on update - my $dmsusers = { + if($u_id){ + $adref->{c_id} = "$u_id"; + $ctadr = $dbt->fetch_record($dbh,$adref); + $uref->{u_id} = "$u_id"; + $users = $dbt->fetch_tablerecord($dbh,$uref); + } + + if(ref($users) eq "HASH" && $users->{u_id} && (!$ctadr->{c_id} || $base_edit eq "delete_dmsusers")){ + print FILE "delete DMS user from $varenv->{dbname} | c_id: $ctadr->{c_id}\n"; + $feedb->{d_rows} = $dbt->delete_content($dbh,"users",$users->{u_id}); + if($ctadr->{c_id}){ + $adref->{c_id} = $ctadr->{c_id}; + $dbt->update_one($dbh,$adref,"int07=null"); + $dbt->update_one($dbh,$adref,"int09=null"); + } + } + #insert if user search matches + elsif($ctadr->{c_id} && !$users->{u_id} && $base_edit eq "new_dmsusers"){ + print FILE "insert DMS user to $varenv->{dbname} | c_id $ctadr->{c_id}\n"; + $feedb->{u_id} = $dbt->insert_users($dbh,$ctadr->{c_id},$owner); + $adref->{c_id} = $ctadr->{c_id}; + $dbt->update_one($dbh,$adref,"int07=100"); + $dbt->update_one($dbh,$adref,"int09=1"); + } + #check user exist and insert + elsif(!$users->{u_id} && $R::txt08 && $R::txt08 =~ /\w\@\w/ && $base_edit eq "save_dmsusers"){ + print FILE "search for insert DMS user to $varenv->{dbname} | email: $R::txt08\n"; + $adref->{txt08} = "ilike::" . $q->escapeHTML($R::txt08); + $adref->{int05} = 1; + $ctadr = $dbt->fetch_record($dbh,$adref); + + #if adr local doesn't exist + if(!$ctadr->{c_id}){ + + $auth_primary = $dbt->fetch_record($dbh_primary,$adref); + + #if adr primary doesn't exist, then insert + if(!$auth_primary->{c_id}){ + my $shareec_id = 0; + $shareec_id = $shwo->create_account($dbh_primary,$owner); + $adref->{c_id} = $shareec_id; + + #delete non address object elements before saving in contentadr + foreach(@keywords){ + if($_ =~ /^txt\d+|^int\d+/){ + $q->delete($_) if($_ !~ /txt0\d/); + } + } + $shwo->save_account($dbh_primary,$q,$shareec_id,$varenv,$owner); + $auth_primary = $dbt->fetch_record($dbh_primary,$adref) if($adref->{c_id}); + } + + print FILE "INSERT adr from record_primary to operator by dbname $varenv->{dbname} | pri $auth_primary->{c_id}\n"; + if($auth_primary->{c_id}){ + #procedure like booking_request + my %operator_hash = (); + if($auth_primary->{txt17} && $auth_primary->{txt17} =~ /\w\s\w/){#append DB's + %operator_hash = map { $_ => 1 } split(/\s+/,$auth_primary->{txt17}); + }elsif($auth_primary->{txt17}){ + $operator_hash{$auth_primary->{txt17}} = 1; + } + $operator_hash{$varenv->{dbname}} = 1; + my @operator_array = keys %operator_hash; + + my $update_primary = { + table => "contentadr", + txt17 => "@operator_array", + txt19 => "$varenv->{dbname}", + atime => "now()", + owner => $owner, + }; + my $rows = $dbt->update_record($dbh_primary,$update_primary,$auth_primary); + $auth_primary = $dbt->fetch_record($dbh_primary,$adref); + if($auth_primary->{c_id} && $auth_primary->{txt17} && $auth_primary->{txt17} =~ /$varenv->{dbname}/){ + #insert + my $c_id = 0; + print FILE "INSERT adr from record_primary by operator_array @operator_array | pri $auth_primary->{c_id}\n"; + my $insert = { + %$auth_primary, + table => "contentadr", + mtime => 'now()', + owner => "198", + }; + $c_id = $dbt->insert_contentoid($dbh,$insert,"reset_adropkeys"); + $feedb->{u_id} = $dbt->insert_users($dbh,$auth_primary->{c_id},$owner); + $adref->{c_id} = $c_id; + $dbt->update_one($dbh,$adref,"int07=100"); + $dbt->update_one($dbh,$adref,"int09=1"); + } + } + }elsif($ctadr->{c_id}){ + $uref->{u_id} = $ctadr->{c_id}; + $users = $dbt->fetch_tablerecord($dbh,$uref) if($uref->{u_id}); + if(!$users->{u_id}){ + print FILE "insert DMS user to $varenv->{dbname} | c_id: $ctadr->{c_id}\n"; + $feedb->{u_id} = $dbt->insert_users($dbh,$ctadr->{c_id},$owner); + $adref->{c_id} = $ctadr->{c_id}; + $dbt->update_one($dbh,$adref,"int07=100"); + $dbt->update_one($dbh,$adref,"int09=1"); + }else{ + $feedb->{message} = "failure::Fehler, der DMS-Account existiert bereits."; + } + } + + if($ctadr->{c_id}){ + $uref->{u_id} = $ctadr->{c_id}; + $users = $dbt->fetch_tablerecord($dbh,$uref); + $feedb->{u_id} = $users->{u_id}; + } + } + + #Final save dms users data + if(ref($users) eq "HASH" && $users->{u_id} && $ctadr->{c_id} && $ctadr->{c_id} == $users->{u_id} && $base_edit eq "save_dmsusers"){ + print FILE "update DMS user to $varenv->{dbname} | c_id: $ctadr->{c_id}\n"; + my $users_update = { table => "users", mtime => "now()", owner => "$owner", - u_id => "$u_id", - }; - if(ref($users) eq "HASH" && $users->{u_id} && (!$ctadr->{c_id} || $base_edit eq "delete_dmsusers")){ - $bw->log("delete DMS user from $varenv->{dbname}",$ctadr->{c_id},""); - $feedb->{d_rows} = $dbt->delete_content($dbh,"users",$u_id); - $dbt->update_one($dbh,$adref,"int07=null"); - $dbt->update_one($dbh,$adref,"int09=null"); - }elsif(ref($users) eq "HASH" && $users->{u_id} && $ctadr->{c_id} && $ctadr->{c_id} == $users->{u_id} && $base_edit eq "save_dmsusers"){ - $bw->log("update DMS user to $varenv->{dbname}",$ctadr->{c_id},""); + u_id => "$users->{u_id}", + }; + foreach(@keywords){ my $val = $q->param($_); my $valxx = $q->escapeHTML("$val"); @@ -239,21 +357,24 @@ sub manage_dmsusers { if($_ =~ /^int\d+/){ $valxx =~ s/,/./g; $valxx = 0 if(!looks_like_number($valxx));# set to 0 for using == operator - $feedb->{u_rows} = $dbt->update_one($dbh,$dmsusers,"$_=$valxx"); + $feedb->{u_rows} = $dbt->update_one($dbh,$users_update,"$_=$valxx"); }elsif($_ =~ /^txt\d+/){ my @val = $q->param($_); $valxx = $q->escapeHTML("@val"); - $feedb->{u_rows} = $dbt->update_one($dbh,$dmsusers,"$_='$valxx'"); + $feedb->{u_rows} = $dbt->update_one($dbh,$users_update,"$_='$valxx'"); } } - - }elsif($ctadr->{c_id} && !$users->{u_id} && $base_edit eq "new_dmsusers"){ - $bw->log("insert DMS user to $varenv->{dbname}",$ctadr->{c_id},""); - $feedb->{i_rows} = $dbt->insert_users($dbh,$ctadr->{c_id},$owner); - $dbt->update_one($dbh,$adref,"int07=100"); - $dbt->update_one($dbh,$adref,"int09=1"); + + #delete non address object elements before saving in contentadr + foreach(@keywords){ + if($_ =~ /^txt\d+|^int\d+/){ + $q->delete($_) if($_ !~ /txt0\d/); + } + } + $shwo->save_account($dbh_primary,$q,$ctadr->{c_id},$varenv,$owner); } + close(FILE); return $feedb; }#end manage_dmsusers @@ -1235,7 +1356,7 @@ sub save_relation { }elsif($_ =~ /type_id|energy_id|archive/ && $valxx){ $u_rows = $dbt->update_one($dbh,$update_node,"$_=$valxx"); $valxx = "null" if(!$valxx || $valxx eq "null"); - }elsif($_ =~ /hotline_email|hotline_phone/){ + }elsif($_ =~ /fleed_/){ $u_rows = $dbt->update_one($dbh,$update_node,"$_='$valxx'"); }elsif($_ =~ /node_public/){ $valxx = "t" if($valxx eq "1" || $valxx eq "t"); @@ -1337,147 +1458,6 @@ sub delete_relation { return $ret; } -#sharee Bonusnummer with Tarif automatic -sub set_usertarif { - my $self = shift; - my $dbh = shift; - my $dbname = shift; - my $adr_bonus = shift; - my $bonus_collect = shift || {}; - - open(FILE,">>$varenv{logdir}/save_account.log") if($debug); - print FILE "\n*Prelib--> $now_dt| dbname: $dbname | c_id: $adr_bonus->{c_id} | txt15: $adr_bonus->{txt15}\n" if($debug); - - my $oprefix = $dbt->{operator}->{$dbname}->{oprefix}; - my $ret = $adr_bonus->{ret}; - my $i = 0; - my $dbh_operator = $dbt->dbconnect_extern($dbname);#operator connect - - my $tariff_all = { barcode => 0, int18 => 0}; - my $tariff = { - table => "content", - fetch => "all", - keyfield => "barcode", - template_id => "210",#Tariff tpl_id - }; - $tariff_all = $dbt->fetch_record($dbh_operator,$tariff); - - my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}); - my $adref = { - table => "contentadr", - fetch => "one", - template_id => "202", - c_id => "$adr_bonus->{c_id}", - }; - - my $adr_primary = { c_id => 0 }; - $adr_primary = $dbt->fetch_record($dbh_primary,$adref) if($adr_bonus->{c_id}); - - #collect Tarif with prefix saving on primary - my %prim_tarif_hash = (); - if($adr_primary->{txt30} && $adr_primary->{txt30} =~ /\w\s\w/){ - %prim_tarif_hash = map { $_ => 1 } split(/\s+/,$adr_primary->{txt30}); - }elsif($adr_primary->{txt30}){ - $prim_tarif_hash{$adr_primary->{txt30}} = 1; - } - - #first delete operator tarif in prim_tarif_hash. we will fill up downunder - foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){ - print FILE "--> Cleanup operator specific prim_tarif_hash: $tariff_all->{$rid}->{barcode}\n"; - delete $prim_tarif_hash{$oprefix . $tariff_all->{$rid}->{barcode}}; - } - - if($adr_bonus->{txt15} =~ /\w+/){ - if(1==1){ - my %tarif_hash = (); - my @new_txt30 = (); - - #collect multiple tarif by bonusnr - my $pref_cc = { - table => "content", - keyfield => "c_id", - fetch => "all", - template_id => "228", - int03 => ">::0", - ct_name => "ilike::$adr_bonus->{txt15}", - }; - - $bonus_collect = $dbt->fetch_record($dbh_operator,$pref_cc) if(ref($bonus_collect->{1}) ne "HASH"); - - foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){ - $tarif_hash{$sourcetarif} = 1; - #additional and only! save privat or hidden tarif to primary to get caching - if($tariff_all->{$sourcetarif}->{int18} == 3 || $tariff_all->{$sourcetarif}->{int18} == 4){ - $prim_tarif_hash{$oprefix . $sourcetarif} = 1; - } - - } - - print FILE "Prelib bonus_collect by request txt15: $adr_bonus->{txt15}\n"; - foreach my $id (keys (%$bonus_collect)){ - $i++; - print FILE "$i)-1-> loop bonus_collect and find $bonus_collect->{$id}->{ct_name} = $adr_bonus->{txt15}\n|==>Take and insert Tarif $bonus_collect->{$id}->{int22}\n" if($debug); - $tarif_hash{$bonus_collect->{$id}->{int22}} = 1; - - #additional and only! save privat or hidden tarif to primary to get caching - if($tariff_all->{$bonus_collect->{$id}->{int22}}->{int18} == 3 || $tariff_all->{$bonus_collect->{$id}->{int22}}->{int18} == 4){ - $prim_tarif_hash{$oprefix . $bonus_collect->{$id}->{int22}} = 1; - } - - if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22}){ - print FILE "$i)-2-> delete if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22})\n" if($debug); - delete $tarif_hash{$bonus_collect->{$id}->{int21}}; - delete $prim_tarif_hash{$oprefix . $bonus_collect->{$id}->{int21}}; - print FILE "$i)-3-> delete done $bonus_collect->{$id}->{int21}\n" if($debug); - } - - } - @new_txt30 = keys %tarif_hash; - if(@new_txt30){ - print FILE "Final -3-> txt30: @new_txt30\n" if($debug); - $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@new_txt30'"); - $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'"); - - #collect Tarif with prefix saving on primary - my @prim_txt30 = keys %prim_tarif_hash; - $u_rows = $dbt->update_one($dbh_primary,$adr_bonus,"txt30='@prim_txt30'"); - - } - $ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/); - } - - }else{ - - print FILE "-4-> update Tarif txt30: @{$adr_bonus->{txt30_array}}\n" if($debug); - $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@{$adr_bonus->{txt30_array}}'"); - $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15=''"); - - #collect Tarif with prefix saving on primary - #delete bonus tarif on primary if not defined by operator - #additional and only! save privat or hidden tarif to primary to get caching - foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){ - foreach(@{$adr_bonus->{txt30_array}}){ - if($tariff_all->{$rid}->{barcode} == $_ && ($tariff_all->{$_}->{int18} == 3 || $tariff_all->{$_}->{int18} == 4)){ - print FILE "--> Adding private/hidden key on operator to primary: $_\n"; - $prim_tarif_hash{$oprefix . $_} = 1; - } - } - } - - my @prim_txt30 = keys %prim_tarif_hash; - $u_rows = $dbt->update_one($dbh_primary,$adr_bonus,"txt30='@prim_txt30'"); - - $ret = "failure::txt30#top3" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/); - } - - #if bonus value doesn't match - if($adr_bonus->{txt15} && $i == 0){ - print FILE "-5-> failure txt15: ''\n" if($debug); - $ret = "failure::txt15#top4"; - } - close(FILE) if($debug); - return $ret; -} #save service-config sub save_service_desc { diff --git a/copri4/main/src/Mod/RPCshareeio.pm b/copri4/main/src/Mod/RPCshareeio.pm old mode 100644 new mode 100755 diff --git a/copri4/main/src/Mod/Shareework.pm b/copri4/main/src/Mod/Shareework.pm index 681b39c..6ef9a71 100755 --- a/copri4/main/src/Mod/Shareework.pm +++ b/copri4/main/src/Mod/Shareework.pm @@ -22,7 +22,6 @@ use Digest::MD5 qw(md5 md5_hex); use Digest::SHA qw(sha1_base64 sha256_base64); use Scalar::Util qw(looks_like_number); use URI::Encode; -use Mod::Prelib; use Mod::Basework; use Mod::Payment; #use Mod::MailTransport; @@ -34,7 +33,6 @@ my $but = new Buttons; my $lb = new Libenz; my $dbt = new DBtank; my $apif = new APIfunc; -my $pl = new Prelib; my $bw = new Basework; my $payone = new Payment; #my $mailtrans = new MailTransport; @@ -115,8 +113,8 @@ sub delete_account { #create_account is alwas done on primary first sub create_account(){ my $self = shift; + my $dbh = shift || ""; my $owner = shift; - my $dbh = ""; my $insert_adr = { table => "contentadr", @@ -139,6 +137,7 @@ sub create_account(){ #sharee save_account is always done on primary first sub save_account(){ my $self = shift; + my $dbh = shift || ""; my $q = shift; my $c_id = shift; my $varmerch = shift || ""; @@ -146,7 +145,7 @@ sub save_account(){ my $table = "contentadr"; $q->import_names('R'); my @keywords = $q->param; - + my $debug=1; my $feedb = { u_rows => 0, prepaid_id => 0, @@ -157,9 +156,6 @@ sub save_account(){ $bw->log("save_account by merchant_id $varmerch->{merchant_id}, project_id $varmerch->{project_id} on dbname $varenv{dbname}",$q,""); - my $debug=1; - my $dbh = "";#keep in mind, empty dbh defaults to local copri-instance dbname - open(FILE,">>$varenv{logdir}/save_account.log") if($debug); #Always on sharee_primary @@ -224,6 +220,7 @@ sub save_account(){ my $pwmd5 = md5_hex($valxx) || ""; my $pwsha256=sha256_base64($pwmd5) || ""; $update_adr->{txt04} = "$pwsha256" if(length($pwsha256) > 20); + $update_adr->{int06} = "null";#pw renewd } } #operators, only if saved by operator DMS @@ -382,7 +379,7 @@ sub save_account(){ $ctadr_operator = $dbt->fetch_record($dbh_operator,$authref); print FILE "Bonusnr set_usertarif done by primary:\n" . Dumper($adr_bonus) . "\n"; - $ret = $pl->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus,$bonus_collect); + $ret = $self->set_usertarif($dbh,$operator_conf->{database}->{dbname},$adr_bonus,$bonus_collect); #count down only if not file greped with static kn c_id and not still used print FILE "bonus_record update_content4comp by: $bonus_record->{c_id} > 3 && $bonus_record->{int03} > 0 && (!$ctadr_operator->{txt15} || $bonus_record->{ct_name} !~ /$ctadr_operator->{txt15}/i)\n"; @@ -420,7 +417,7 @@ sub save_account(){ ret => $ret, }; print FILE "Bonusnr set_usertarif done by operator:\n" . Dumper($adr_bonus) . "\n"; - $ret = $pl->set_usertarif($dbh,$varenv{dbname},$adr_bonus,""); + $ret = $self->set_usertarif($dbh,$varenv{dbname},$adr_bonus,""); } #phonenr }elsif($_ eq "txt07"){ @@ -567,12 +564,13 @@ sub save_account(){ if($payone_mival && $payone_mival =~ /\w{2}-\w+/){ #payment_ack - system("$dbt->{copri_conf}->{basedir}/$varenv{syshost}/src/scripts/payment_ack.pl '$varenv{syshost}' 'payment_ackSEPA' '$ctadr->{c_id}' '$owner'"); + system("$dbt->{copri_conf}->{basedir}/$varenv{syshost}/src/scripts/payment_ack.pl '$varenv{syshost}' 'payment_ackSEPA' '$ctadr->{c_id}' '$owner' &"); $vde_on_fail = 0 if($vde_on_fail != 2); $u_rows = $dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde }else{ $u_rows = $dbt->update_one($dbh,$update_adr,"int12=$vde_on_fail");#Vde + $ret = "failure::txt22#top"; } } @@ -611,6 +609,149 @@ sub save_account(){ return ($ret,$feedb); }#end save_account +#sharee Bonusnummer with Tarif automatic +sub set_usertarif { + my $self = shift; + my $dbh = shift; + my $dbname = shift; + my $adr_bonus = shift; + my $bonus_collect = shift || {}; + my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; + my %varenv = $cf->envonline(); + my $debug=1; + open(FILE,">>$varenv{logdir}/save_account.log") if($debug); + print FILE "\n*set_usertarif --> $now_dt| dbname: $dbname | c_id: $adr_bonus->{c_id} | txt15: $adr_bonus->{txt15}\n" if($debug); + + my $oprefix = $dbt->{operator}->{$dbname}->{oprefix}; + my $ret = $adr_bonus->{ret}; + my $i = 0; + my $dbh_operator = $dbt->dbconnect_extern($dbname);#operator connect + + my $tariff_all = { barcode => 0, int18 => 0}; + my $tariff = { + table => "content", + fetch => "all", + keyfield => "barcode", + template_id => "210",#Tariff tpl_id + }; + $tariff_all = $dbt->fetch_record($dbh_operator,$tariff); + + my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}); + my $adref = { + table => "contentadr", + fetch => "one", + template_id => "202", + c_id => "$adr_bonus->{c_id}", + }; + + my $adr_primary = { c_id => 0 }; + $adr_primary = $dbt->fetch_record($dbh_primary,$adref) if($adr_bonus->{c_id}); + + #collect Tarif with prefix saving on primary + my %prim_tarif_hash = (); + if($adr_primary->{txt30} && $adr_primary->{txt30} =~ /\w\s\w/){ + %prim_tarif_hash = map { $_ => 1 } split(/\s+/,$adr_primary->{txt30}); + }elsif($adr_primary->{txt30}){ + $prim_tarif_hash{$adr_primary->{txt30}} = 1; + } + #first delete operator tarif in prim_tarif_hash. we will fill up downunder + foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){ + print FILE "--> Cleanup operator specific prim_tarif_hash: $tariff_all->{$rid}->{barcode}\n"; + delete $prim_tarif_hash{$oprefix . $tariff_all->{$rid}->{barcode}}; + } + + if($adr_bonus->{txt15} =~ /\w+/){ + if(1==1){ + my %tarif_hash = (); + my @new_txt30 = (); + + #collect multiple tarif by bonusnr + my $pref_cc = { + table => "content", + keyfield => "c_id", + fetch => "all", + template_id => "228", + int03 => ">::0", + ct_name => "ilike::$adr_bonus->{txt15}", + }; + + $bonus_collect = $dbt->fetch_record($dbh_operator,$pref_cc) if(ref($bonus_collect->{1}) ne "HASH"); + + foreach my $sourcetarif (@{$adr_bonus->{txt30_array}}){ + $tarif_hash{$sourcetarif} = 1; + #additional and only! save privat or hidden tarif to primary to get caching + if($tariff_all->{$sourcetarif}->{int18} == 3 || $tariff_all->{$sourcetarif}->{int18} == 4){ + $prim_tarif_hash{$oprefix . $sourcetarif} = 1; + } + + } + + print FILE "set_usertarif bonus_collect by request txt15: $adr_bonus->{txt15}\n"; + foreach my $id (keys (%$bonus_collect)){ + $i++; + print FILE "$i)-1-> loop bonus_collect and find $bonus_collect->{$id}->{ct_name} = $adr_bonus->{txt15}\n|==>Take and insert Tarif $bonus_collect->{$id}->{int22}\n" if($debug); + $tarif_hash{$bonus_collect->{$id}->{int22}} = 1; + + #additional and only! save privat or hidden tarif to primary to get caching + if($tariff_all->{$bonus_collect->{$id}->{int22}}->{int18} == 3 || $tariff_all->{$bonus_collect->{$id}->{int22}}->{int18} == 4){ + $prim_tarif_hash{$oprefix . $bonus_collect->{$id}->{int22}} = 1; + } + + if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22}){ + print FILE "$i)-2-> delete if($bonus_collect->{$id}->{int21} && $bonus_collect->{$id}->{int21} != $bonus_collect->{$id}->{int22})\n" if($debug); + delete $tarif_hash{$bonus_collect->{$id}->{int21}}; + delete $prim_tarif_hash{$oprefix . $bonus_collect->{$id}->{int21}}; + print FILE "$i)-3-> delete done $bonus_collect->{$id}->{int21}\n" if($debug); + } + + } + @new_txt30 = keys %tarif_hash; + if(@new_txt30){ + print FILE "Final -3-> txt30: @new_txt30\n" if($debug); + $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@new_txt30'"); + $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15='$adr_bonus->{txt15}'"); + + #collect Tarif with prefix saving on primary + my @prim_txt30 = keys %prim_tarif_hash; + $u_rows = $dbt->update_one($dbh_primary,$adr_bonus,"txt30='@prim_txt30'"); + + } + $ret = "failure::txt30#top2" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/); + } + + }else{ + + print FILE "-4-> update Tarif txt30: @{$adr_bonus->{txt30_array}}\n" if($debug); + $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt30='@{$adr_bonus->{txt30_array}}'"); + $u_rows = $dbt->update_one($dbh_operator,$adr_bonus,"txt15=''"); + + #collect Tarif with prefix saving on primary + #delete bonus tarif on primary if not defined by operator + #additional and only! save privat or hidden tarif to primary to get caching + foreach my $rid (sort { $tariff_all->{$a}->{barcode} <=> $tariff_all->{$b}->{barcode} } keys (%$tariff_all)){ + foreach(@{$adr_bonus->{txt30_array}}){ + if($tariff_all->{$rid}->{barcode} == $_ && ($tariff_all->{$_}->{int18} == 3 || $tariff_all->{$_}->{int18} == 4)){ + print FILE "--> Adding private/hidden key on operator to primary: $_\n"; + $prim_tarif_hash{$oprefix . $_} = 1; + } + } + } + + my @prim_txt30 = keys %prim_tarif_hash; + $u_rows = $dbt->update_one($dbh_primary,$adr_bonus,"txt30='@prim_txt30'"); + + $ret = "failure::txt30#top3" if(!$adr_bonus->{txt30_array} || $adr_bonus->{txt30_array} !~ /\d/); + } + #if bonus value doesn't match + if($adr_bonus->{txt15} && $i == 0){ + print FILE "-5-> failure txt15: ''\n" if($debug); + $ret = "failure::txt15#top4"; + } + close(FILE) if($debug); + return $ret; +}#end set_usertarif + + #coupon alias Gutschein sub save_transact(){ my $self = shift; @@ -795,6 +936,89 @@ sub emailack { return; } +#email and sms acknowledgments, check and save confirm code states +sub code_confirmation { + my $self = shift; + my $q = shift; + my $varenv = shift; + my $aowner = shift; + $q->import_names('R'); + my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; + my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}); + + my $update_adr = { + table => "contentadr", + mtime => "now()", + owner => $aowner, + }; + + #keep in mind, for now and just for testing confirm codes are just c_id + open(FILE,">>$varenv->{logdir}/confirm.log"); + print FILE "\n\n*--> $now_dt done by code_confirmation\n"; + print FILE "confirm_userid:$R::confirm_userid\nconfirm_code:$R::confirm_code\nconfirm_smscode:$R::confirm_smscode\n"; + $R::confirm_code =~ s/\s//g; + $R::confirm_smscode =~ s/\s//g; + my $confirm_code = $q->escapeHTML($R::confirm_code); + my $confirm_smscode = $q->escapeHTML($R::confirm_smscode); + + #confirm email + if($confirm_code){ + my $authref = { + table => "contentadr", + fetch => "one", + c_id => $R::confirm_userid, + txt34 => "ilike::$confirm_code%", + }; + my $confirmed_email = { c_id => 0 }; + $confirmed_email = $dbt->fetch_tablerecord($dbh_primary,$authref); + + if($confirmed_email->{c_id}){ + $update_adr->{c_id} = $confirmed_email->{c_id}; + $dbt->update_one($dbh_primary,$update_adr,"int04=1"); + #save verified emailcode + $dbt->update_one($dbh_primary,$update_adr,"txt32='$confirmed_email->{txt08}'"); + print FILE "confirmed_email: $confirmed_email->{c_id} update because confirm_code:$confirm_code\n"; + + #after mailAck, delete all douple adr with no mailAck + my $authref = { + table => "contentadr", + fetch => "all", + keyfield => "c_id", + txt08 => "ilike::" . $q->escapeHTML($confirmed_email->{txt08}), + }; + my $ctadr = $dbt->fetch_tablerecord($dbh_primary,$authref); + foreach my $aid (keys(%$ctadr)){ + if(!$ctadr->{$aid}->{int04}){ + $dbt->delete_content("contentadr",$ctadr->{$aid}->{c_id}); + print FILE "c_id $ctadr->{$aid}->{c_id} $confirmed_email->{txt08} delete because of dopplel\n"; + } + } + } + } + #confirm sms + if($confirm_smscode){ + my $authref = { + table => "contentadr", + fetch => "one", + c_id => $R::confirm_userid, + txt34 => "ilike::%$confirm_smscode", + }; + my $confirmed_sms = { c_id => 0 }; + $confirmed_sms = $dbt->fetch_tablerecord($dbh_primary,$authref); + + if($confirmed_sms->{c_id}){ + $update_adr->{c_id} = $confirmed_sms->{c_id}; + $dbt->update_one($dbh_primary,$update_adr,"int13=1"); + #save verified smscode + $dbt->update_one($dbh_primary,$update_adr,"txt33='$confirmed_sms->{txt07}'"); + print FILE "confirmed_sms: $confirmed_sms->{c_id} update because confirm_smscode:$confirm_smscode\n"; + } + } + close(FILE); + return; +}#end code_confirmation + + #Password forgotten send email sub send_password { my $self = shift; @@ -826,9 +1050,14 @@ sub send_password { mtime => "now()", owner => "$owner", txt04 => "$pwsha256", + int06 => 1, }; - $dbt->update_record($dbh,$update_primary,$ctadr) if($c_id > 0); - system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_password' '$c_id' '' '$coo'"); + if($c_id > 0){ + my $dbh_primary = $dbt->dbconnect_extern($dbt->{primary}->{sharee_primary}->{database}->{dbname}); + $dbt->update_record($dbh_primary,$update_primary,$ctadr); + $dbt->update_operatorsloop($varenv->{dbname},$c_id,"update"); + system("$dbt->{copri_conf}->{basedir}/$varenv->{syshost}/src/scripts/mailTransportcms.pl '$varenv->{syshost}' 'send_password' '$c_id' '' '$coo'"); + } } return; } @@ -896,3 +1125,4 @@ sub sigstation_cupdate { 1; + diff --git a/copri4/main/src/Tpl/BaseEdit.pm b/copri4/main/src/Tpl/BaseEdit.pm index e02547d..527c6de 100755 --- a/copri4/main/src/Tpl/BaseEdit.pm +++ b/copri4/main/src/Tpl/BaseEdit.pm @@ -65,9 +65,14 @@ sub tpl(){ $c_id = $1 if($R::c_id && $R::c_id =~ /(\d+)/); $c_id = $feedb->{c_id} if($feedb->{c_id}); - my $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/); + my $u_id = ""; + $u_id = $1 if($R::u_id && $R::u_id =~ /(\d+)/); $u_id = $1 if($R::c_idadr && $R::c_idadr =~ /(\d+)/ && $R::base_edit eq "new_dmsusers"); - my ($edit,$copy_key,$save_key,$relate_key,$move_key,$delete_key); + $u_id = $feedb->{u_id} if($feedb->{u_id}); + my $edit = ""; + my $save_key = ""; + my $move_key = ""; + my $delete_key = ""; my $tpl = {}; my @tpl_order = (); my $edit_template = ""; @@ -107,7 +112,8 @@ sub tpl(){ $save_key = "save_content"; $edit_template = "$ctrel->{template_id}"; $tpl = $dbt->get_tpl($dbh,$edit_template); - }elsif($node_meta->{ct_table} eq "contentadr" && $node_meta->{tpl_id} && $c_id){ + } + elsif($node_meta->{ct_table} eq "contentadr" && $node_meta->{tpl_id} && $c_id){ my $ref = { table => "$node_meta->{ct_table}", fetch => "one", @@ -122,31 +128,34 @@ sub tpl(){ $save_key = "save_adr"; $edit_template = "$ctrel->{template_id}" . "000"; $tpl = $dbt->get_tpl($dbh,$edit_template); - }elsif($node_meta->{ct_table} eq "users" && $node_meta->{tpl_id} == 198 && $u_id){ + } + elsif($node_meta->{ct_table} eq "users" && $node_meta->{tpl_id} == 198){ 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 int03=2"); - $tpl = $dbt->get_tpl($dbh,$node_meta->{tpl_id}); + $edit_template = $node_meta->{tpl_id} . "000"; + $tpl = $dbt->get_tpl($dbh,$edit_template); #only if user is also a primary DMS user with invoice rw if(!$users_dms_primary->{u_id} || $users_dms_primary->{int03} != 2){ $tpl->{tpl_order} =~ s/int02=[\w\s\+\&=]+,//; $tpl->{tpl_order} =~ s/int03=[\w\s\+\&=]+,//; } + $edit = "base_edit"; + $save_key = "save_dmsusers"; - my $ref = { + if($u_id){ + my $ref = { table => "$node_meta->{ct_table}", fetch => "one", u_id => "$u_id", }; - $ctrel = $dbt->fetch_tablerecord($dbh,$ref); - print $q->hidden(-name=>'u_id',-override=>'1', -value=>"$ctrel->{u_id}"); + $ctrel = $dbt->fetch_tablerecord($dbh,$ref); - $edit = "base_edit"; - $save_key = "save_dmsusers"; - #print Dumper($node_meta->{tpl_id}) . "\n u_id:" . $u_id; - # - }elsif($node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 199){ + print $q->hidden(-name=>'u_id',-override=>'1', -value=>"$ctrel->{u_id}"); + } + } + elsif($node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 199){ my $ref = { table => "$node_meta->{ct_table}", fetch => "one", @@ -161,7 +170,8 @@ sub tpl(){ $save_key = "save_ctuser"; $tpl = $dbt->get_tpl($dbh,$node_meta->{tpl_id}); - }elsif($node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 194 && $c_id){ + } + elsif($node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 194 && $c_id){ my $ref = { table => "$node_meta->{ct_table}", fetch => "one", @@ -176,7 +186,8 @@ sub tpl(){ $save_key = "save_contentcms"; $tpl = $dbt->get_tpl($dbh,$node_meta->{tpl_id}); - }elsif($node_meta->{ct_table} eq "contenttranspos" && $node_meta->{tpl_id} == 221){ + } + elsif($node_meta->{ct_table} eq "contenttranspos" && $node_meta->{tpl_id} == 221){ my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; my $pref = { table => "contenttrans", @@ -212,7 +223,8 @@ sub tpl(){ $tpl_id = 223 if($cttpos->{template_id} && $cttpos->{template_id} =~ /224|229|219/); $tpl = $dbt->get_tpl($dbh,$tpl_id); - }else{ + } + else{ print $q->div("Es konnten keine Daten gefunden werden"),"\n"; return "failure::Error, no table selected"; } @@ -560,8 +572,7 @@ EOF print $q->td({-class=>'content1_cms'}," "),"\n"; } - }#end edit position - + } #service-config elsif($node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 199){ my ($key,$tplkey,$des,$size,$service_interval,$service_type) = split /=/,$_; @@ -589,8 +600,61 @@ EOF print $q->td({-class=>'content1_cms'},"Intervall",$q->textfield(-class=>'etxt', -style=>"width:2em;",-name=>"$key", -default=>"$desc_intervall", -override=>'1'),"Tage"),"\n"; print $q->td({-class=>'content1_cms'},$but->radiobox2("$key","$desc_type","","weich","hart")),"\n"; } + } + #dms-users + elsif($node_meta->{ct_table} eq "users" && $node_meta->{tpl_id} == 198){ + my ($key,$des,$size,$postdes) = split /=/,$_; + $des .= " ($key)" if($users_dms->{u_id} eq $varenv->{superu_id}); - }else{ + $ctrel->{$key} = $q->unescapeHTML("$ctrel->{$key}"); + $ctrel->{$key} = $lb->newline($ctrel->{$key},"",1); + my $ctadr = { c_id => 0 }; + if($ctrel->{u_id}){ + my $adref = { + table => "contentadr", + fetch => "one", + template_id => "202", + c_id => $ctrel->{u_id}, + }; + $ctadr = $dbt->fetch_record($dbh,$adref); + } + + if($key eq "u_id"){ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; + print $q->td({-class=>'content1_cms',-colspan=>2}, "$ctrel->{$key}"),"\n"; + }elsif($key =~ /^txt\d+/){ + if($size eq "select_multiple"){ #user defined service_tour alias user_tour + my $height = scalar(@_service_valxx); + print $q->Tr(); + print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des"); + print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector2("$key","50px;","$height",$ctrel->{$key},@_service_valxx)); + } + elsif($size =~ /area/){ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms',-colspan=>1},"$des"),"\n"; + print $q->td({-class=>'content1_cms', -colspan=>'3'},$q->textarea(-class=>"etxt", -style=>'border: 1px solid silver; height:7em; width:25em;', -name=>"txt11", -override=>'1',-default=>"$ctrel->{txt11}")),"\n"; + + } + else{ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; + print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$ctadr->{$key}")),"\n"; + } + } + elsif($key =~ /int/ && $size =~ /\w\+\w/){ + if($des =~ /Waren/){ + print $q->Tr(); + print $q->td({-class=>'left_italic_cms',-colspan=>1},$q->b("DMS Zugriffsrechte")),"\n"; + } + my ($a,$b,$c) = split /\+/,$size; + print $q->Tr(); + print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; + print $q->td({-class=>'content1_cms',-colspan=>1},$but->radiobox2("$key","$ctrel->{$key}","$a","$b","$c")),"\n"; + } + } + #defaults to content and contentadr edit + else{ my ($key,$des,$size,$postdes) = split /=/,$_; my $w = $size . "em"; $w = "15em" if($size eq "readonly"); @@ -617,26 +681,8 @@ EOF print $q->Tr(); print $q->td({-class=>'left_italic_cms'},"$des"),"\n"; print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:$w;color:grey;",-name=>"$key", -default=>"$ctrel->{$key}", -readonly=>1)),"\n"; - }elsif($key eq "u_id" && $size eq "readonly"){ - my $adref = { - table => "contentadr", - fetch => "one", - template_id => "202", - c_id => "$ctrel->{$key}", - }; - my $ctadr = $dbt->fetch_record($dbh,$adref); - - print $q->Tr(); - print $q->td({-class=>'left_italic_cms'},"ID"),"\n"; - print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$ctrel->{$key}", -readonly=>1)),"\n"; - print $q->Tr(); - print $q->td({-class=>'left_italic_cms'},"Vorname Name"),"\n"; - print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"", -default=>"$ctadr->{txt01}", -readonly=>1)),"\n"; - print $q->Tr(); - print $q->td({-class=>'left_italic_cms'},"eMail (Login)"),"\n"; - print $q->td({-class=>'content1_cms',-colspan=>2},$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"", -default=>"$ctadr->{txt08}", -readonly=>1)),"\n"; - - }elsif($key eq "ct_name"){ + } + elsif($key eq "ct_name"){ #blank Teilenummer my $ct_name = $ctrel->{$key}; if(($node_meta->{ct_table} eq "content") && ($tpl->{tpl_order} =~ /barcode/) && ("$ct_name" eq "$ctrel->{barcode}")){ @@ -837,13 +883,7 @@ EOF } elsif($key =~ /txt/ && "$size" =~ /select/){ if($size =~ /_multiple/){ - if($key =~ /txt07/ && $node_meta->{tpl_id} eq "198"){ #user defined service_tour alias user_tour - my $height = scalar(@_service_valxx); - print $q->Tr(); - print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des"); - print $q->td({-class=>'content1_cms',-colspan=>'1'},$but->selector2("$key","50px;","$height",$ctrel->{$key},@_service_valxx)); - } - elsif($key =~ /txt07/ && $node_meta->{tpl_id} eq "225"){ # station defined Service Tour + if($key =~ /txt07/ && $node_meta->{tpl_id} eq "225"){ # station defined Service Tour my $height = scalar(@_service_valxx); print $q->Tr(); print $q->td({-class=>'left_italic_cms',-style=>'vertical-align:top;',-colspan=>'1'},"$des"); @@ -1029,8 +1069,6 @@ EOF ::txid:: → Payone TXID
::bike:: → Mietrad (PrefixNummer)
::total_price:: → Mietpreis €
- ::hotline_email:: → hotline eMail Adresse
- ::hotline_phone:: → hotline Telefonnr.
::signature:: → eMail-footer Signature
::konrad_signature:: → konrad eMail-footer Signature
"),"\n"; diff --git a/copri4/main/src/Tpl/Calorin.pm b/copri4/main/src/Tpl/Calorin.pm index ba37e2a..245271a 100755 --- a/copri4/main/src/Tpl/Calorin.pm +++ b/copri4/main/src/Tpl/Calorin.pm @@ -31,7 +31,10 @@ sub new { #Template sub tpl(){ - my ($node_meta,$users_dms,$u_group,$return) = @_; + my $node_meta = shift; + my $users_dms = shift; + my $feedb = shift || {}; + my $q = new CGI; my $cf = new Config; my $lb = new Libenz; @@ -41,35 +44,23 @@ sub tpl(){ my $dbt = new DBtank; my $pri = new Pricing; - my $lang = "de"; - my @tpl_order = ('c_id=ID=5=Datensatz ID (nur intern)','date_time=Mietzeit','txt08=Name=15','int06=Start Station=5','int04=End Station=5','barcode=Bike Nr.=5','int12=Group=select','int10=Rental State=select','int20=Lock State=select','owner=User=select','txt23=Comment=15'); - push (@tpl_order, "txt24=debug,log,device,HW") if($users_dms->{int03} >= 1); - my %varenv = $cf->envonline(); my %ib = $but->ibuttons(); - 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=""; - } + my $path = $q->path_info(); + my $table = "contenttrans"; + my $u_name = $q->escapeHTML("$R::u_name"); + my $dbh = ""; - $path =~ s/\/user|\/manager|\/admin//; my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; + my @tpl_order = ('c_id=ID=5=Datensatz ID (nur intern)','date_time=Mietzeit','txt08=Name=15','int06=Start Station=5','int04=End Station=5','barcode=Bike Nr.=5','int12=Group=select','int10=Rental State=select','int20=Lock State=select','owner=User=select','txt23=Comment=15'); + push (@tpl_order, "txt24=debug,log,device,HW") if($users_dms->{int03} >= 1); 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},""); - my $table = "contenttrans"; - my $u_name = $q->escapeHTML("$R::u_name"); - my $dbh = ""; - + my $ct_users = $dbt->users_map($dbh,""); my $channel_map = $dbt->channel_map(); - my $mapref = {}; - my $ct_users = $dbt->users_map($dbh,$mapref);#get serviceAPP and DMS users from contentadr my @_users = (":user"); foreach my $id (sort { $channel_map->{$a} cmp $channel_map->{$b} } keys (%$channel_map)){ @@ -90,11 +81,11 @@ sub tpl(){ } } - my $bnode = { #template_id => 205,#Leihrad_liste - parent_id => 200013,#Waren - fetch => "all", - keyfield => "main_id", - }; + my $bnode = { + parent_id => $dbt->{shareedms_conf}->{waren}, + fetch => "all", + keyfield => "main_id", + }; my $part_nodes = $dbt->fetch_rel4tpl4nd($dbh,$bnode); my $pref_ct = { diff --git a/copri4/main/src/Tpl/Liste3.pm b/copri4/main/src/Tpl/Liste3.pm index 32b5a19..59706b7 100755 --- a/copri4/main/src/Tpl/Liste3.pm +++ b/copri4/main/src/Tpl/Liste3.pm @@ -62,17 +62,7 @@ sub tpl(){ my $referer = $q->referer(); $referer =~ s/\?.*//; my $full_url = $q->url( -path_info => 1 ); - #print "$referer|$full_url\n"; - my $script = $q->script_name(); - my $path_info = $q->path_info(); - my $path = $path_info; - #with meta_host, - if("$varenv{metahost}"){ - $path = "$script" . "$path"; - $script=""; - } - my $feedb = { message => "" }; - my $lang = "de"; + my $path = $q->path_info(); my $now_db = strftime("%d.%m.%Y %H:%M:%S",localtime(time)); my $dbh = ""; my $debug = 0; @@ -360,8 +350,7 @@ EOF 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 + my $ct_users = $dbt->users_map($dbh,""); my @_users = (""); foreach my $id (sort { $channel_map->{$a} cmp $channel_map->{$b} } keys (%$channel_map)){ @@ -379,11 +368,12 @@ EOF } } - my $node = { template_id => 205, - parent_id => 200013, - fetch => "all", - keyfield => "main_id", - }; + my $node = { + template_id => 205, + parent_id => $dbt->{shareedms_conf}->{waren}, + fetch => "all", + keyfield => "main_id", + }; my $bike_nodes = $dbt->fetch_rel4tpl4nd($dbh,$node); my $tariff_all = {}; my $tariff = { @@ -837,7 +827,7 @@ EOF } my $search_key = "s_barcode=$ct4rel->{$id}->{barcode}";#bike $search_key = "s_int04=$ct4rel->{$id}->{int04}" if($ct4rel->{$id}->{template_id} == 225);#station - print $q->a({-class=>"editnav",-href=>"$path/$node_names?detail_search=1\&$search_key",-title=>"zur Liste der Rad $ct4rel->{$id}->{barcode} Servicearbeiten"}, $q->span({-class=>"bi bi-wrench"})); + print $q->a({-class=>"editnav",-href=>"/$dbt->{shareedms_conf}->{parent_node}$path/$node_names?detail_search=1\&$search_key",-title=>"zur Liste der Rad $ct4rel->{$id}->{barcode} Servicearbeiten"}, $q->span({-class=>"bi bi-wrench"})); } ## print "\n"; @@ -866,7 +856,7 @@ EOF if(1==1 && $table eq "content" && ($ct4rel->{$id}->{template_id} =~ /205|225/)){ my $search_key = "s_barcode=$ct4rel->{$id}->{barcode}";#bike $search_key = "s_int04=$ct4rel->{$id}->{int04}" if($ct4rel->{$id}->{template_id} == 225);#station - print $q->td({-class=>'tdtxt',-colspan=>1,-style=>"$set_style", -nowrap=>1}, $q->a({-class=>"editnav",-href=>"$path/$node_names?detail_search=1\&$search_key",-title=>"zur Liste der Rad $ct4rel->{$id}->{barcode} Servicearbeiten $ct4rel->{$id}->{main_id}"},"$node_names")), "\n"; + print $q->td({-class=>'tdtxt',-colspan=>1,-style=>"$set_style", -nowrap=>1}, $q->a({-class=>"editnav",-href=>"/$dbt->{shareedms_conf}->{parent_node}$path/$node_names?detail_search=1\&$search_key",-title=>"zur Liste der Rad $ct4rel->{$id}->{barcode} Servicearbeiten $ct4rel->{$id}->{main_id}"},"$node_names")), "\n"; }else{ print $q->td({-class=>'tdtxt',-colspan=>1,-style=>"$set_style", -nowrap=>1},"$ct4rel->{$id}->{txt00}"),"\n"; } diff --git a/copri4/main/src/Tpl/SubListe.pm b/copri4/main/src/Tpl/SubListe.pm index 69d0a03..4628d4a 100755 --- a/copri4/main/src/Tpl/SubListe.pm +++ b/copri4/main/src/Tpl/SubListe.pm @@ -52,12 +52,10 @@ sub tpl(){ my %varenv = $cf->envonline(); my $path = $q->path_info(); my $coo = $q->cookie(-name=>'domcookie') || ""; - my $lang = "de"; my $dbh = ""; my %ib = $but->ibuttons(); my $opdir_dms = "$dbt->{copri_conf}->{basedir}/$dbt->{operator}->{$varenv{dbname}}->{dir_dms}" || ""; - my $s_owner_id = ""; my $offset = $R::offset || "0"; my $limit = $R::limit || 250; @@ -70,9 +68,19 @@ sub tpl(){ export => "", opos => "", }; + + 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},""); + + my $ct_users_primary = {}; + my @_users_primary = (); + $ct_users_primary = $dbt->users_map($dbh_primary); + @_users_primary = join(",", keys %{$ct_users_primary}); my $channel_map = $dbt->channel_map(); - my $mapref = {}; - my $ct_users = $dbt->users_map($dbh,$mapref);#get serviceAPP and DMS users from contentadr + #my $ct_users = $dbt->users_map($dbh,{ u_id => "NOT IN::(@_users_primary)" }); + my $ct_users = $dbt->users_map($dbh,{ }); + my @_users = (""); foreach my $id (sort { $channel_map->{$a} cmp $channel_map->{$b} } keys (%$channel_map)){ @@ -147,8 +155,6 @@ sub tpl(){ $tpl_ids = $node_meta->{tpl_id}; } elsif($node_meta->{tpl_id} == 198){ - 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 int03=2"); #only if user is also a primary DMS user with invoice rw @@ -197,7 +203,12 @@ EOF if(!$searchref->{table_pos} && $users_dms->{"col_sort_$searchref->{table}"}){ $searchref->{scol} = $users_dms->{"col_sort_$searchref->{table}"}; } - $searchref->{scol} = "u_id" if($node_meta->{template_id} == 198); + if($node_meta->{template_id} == 198){ + $searchref->{scol} = "u_id"; + if(!$users_dms_primary->{u_id} && scalar(@_users_primary) > 0){ + $searchref->{u_id} = "NOT IN::(@_users_primary)"; + } + } $users_dms->{"sort_updown_$searchref->{table_pos}"} = "down" if(!$users_dms->{"sort_updown_$searchref->{table_pos}"}); #print Dumper($node_meta); @@ -318,7 +329,7 @@ EOF print $but->singlesubmit2glyph("$edit","$new_key","$ib{$new_key}","background-color:$node_meta->{bg_color};"),"\n"; print $q->hidden(-id=>'c_idadr', -name=>"c_idadr", -override=>'1'),"\n"; print $q->hidden(-id=>'vorname_name', -name=>"vorname_name", -override=>'1'),"\n"; - print $q->textfield(-style=>'border:1px solid grey;height:25px;width:80%;',-id=>"json_selectadr",-name=>"json_selectadr", -placeholder=>'Neuer DMS-Account', -value=>""),"\n"; + print $q->textfield(-style=>'border:1px solid grey;height:25px;width:80%;',-id=>"json_selectadr",-name=>"json_selectadr", -placeholder=>'Vorname Name (aus Kunden)', -value=>""),"\n"; print "\n"; }elsif($node_meta->{tpl_id} !~ /195|199/){ diff --git a/copri4/main/src/Tpl/TransPositionen.pm b/copri4/main/src/Tpl/TransPositionen.pm index 3ebe794..7bb016b 100755 --- a/copri4/main/src/Tpl/TransPositionen.pm +++ b/copri4/main/src/Tpl/TransPositionen.pm @@ -51,13 +51,11 @@ sub tpl(){ my %ib = $but->ibuttons(); my $today = strftime "%d.%m.%Y",localtime; my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; - my $channel_map = $dbt->channel_map(); my $coo = $q->cookie(-name=>'domcookie') || ""; my $dbh = ""; - my $lang = "de"; - my $mapref = {}; - my $ct_users = $dbt->users_map($dbh,$mapref);#get serviceAPP and DMS users from contentadr + my $channel_map = $dbt->channel_map(); + my $ct_users = $dbt->users_map($dbh); my $tc=0; my $txt20 = $R::txt20 || $ctt->{txt20} || "";#Leistungsdatum my $int05 = $R::int05 || $ctt->{int05} || "";#manuell diff --git a/copri4/shareeapp-operator/src/Tpl/RentalData.pm b/copri4/shareeapp-operator/src/Tpl/RentalData.pm index c92faeb..2dde838 100755 --- a/copri4/shareeapp-operator/src/Tpl/RentalData.pm +++ b/copri4/shareeapp-operator/src/Tpl/RentalData.pm @@ -38,7 +38,7 @@ sub tpl { my $submenu = new AccountSubmenu; my $path = $q->path_info(); my $dbh = ""; - my $red = "red"; + my $red = "#c83434"; my $coo = $q->cookie(-name=>'domcookie') || $R::sessionid; my $session=""; @@ -115,13 +115,11 @@ sub tpl { $debug_message = "($R::failure || $ctadr->{txt31})" if($debug); $catch_failure=1; print $q->div({-class=>'content2', -style=>"clear:both;color:$red"}, "* $varenv->{cms}->{'iframe-one-error'}->{txt} $debug_message"),"\n"; + print $q->div({-class=>'content2'}, "$varenv->{cms}->{'iframe-complete-confirmation'}->{txt} $debug_message"),"\n"; } #confirm code manage - if($catch_failure && (!$ctadr->{int04} && !$ctadr->{int13}) && ($tpl_id =~ /^2$|302004/) && ($path =~ /$varenv->{accounting_3}/)){ - $debug_message = "$catch_failure && (!$ctadr->{int04} || !$ctadr->{int13}) && $tpl_id" if($debug); - print $q->div({-class=>'content2'}, "$varenv->{cms}->{'iframe-complete-confirmation'}->{txt} $debug_message"),"\n"; - }elsif((!$ctadr->{int04} || !$ctadr->{int13}) && ($tpl_id =~ /^2$|302004/) && ($path =~ /$varenv->{accounting_3}/)){ + if((!$ctadr->{int04} || !$ctadr->{int13}) && ($tpl_id =~ /^2$|302004/) && ($path =~ /$varenv->{accounting_3}/)){ print $q->start_form(-name=>'accountscreen', -action=>"/$varenv->{mandant}/Account/$varenv->{accounting_3}$session"),"\n"; print $q->hidden(-name=>"sessionid",-override=>1,-value=>"$R::sessionid"); @@ -166,7 +164,7 @@ sub tpl { my $payable_check=0; $payable_check = $bw->isuser_rentable($ctadr,$varenv); - if($payable_check <= 1){ + if($payable_check < 1){ print $q->div({-class=>'content2',-style=>"color:$red"}, "$varenv->{cms}->{'iframe-payAck-failure'}->{txt}"),"\n"; } diff --git a/copri4/shareedms-operator/src/Lib/Mlogic.pm b/copri4/shareedms-operator/src/Lib/Mlogic.pm index 9dd6378..863fd80 100755 --- a/copri4/shareedms-operator/src/Lib/Mlogic.pm +++ b/copri4/shareedms-operator/src/Lib/Mlogic.pm @@ -11,12 +11,14 @@ use CGI ':standard'; use Config::General; use Mod::Buttons; use Mod::Basework; +use Mod::Shareework; use Mod::Libenz; use Mod::DBtank; use POSIX; use Data::Dumper; my $bw = new Basework; +my $shwo = new Shareework; my $lb = new Libenz; my $dbt = new DBtank; my $but = new Buttons; @@ -55,6 +57,7 @@ sub tpl(){ my $view_root = $viewsel[0] || ""; my $parent_id = $node_meta->{parent_id}; my $main_id = $node_meta->{main_id}; + my $red = "#c83434"; my $coprihome = "c o p r i "; $coprihome .= " home" if($dbt->{primary}->{$varenv->{dbname}}->{title}); @@ -65,9 +68,114 @@ sub tpl(){ $title .= $dbt->{website}->{$varenv->{syshost}}->{title} if($dbt->{website}->{$varenv->{syshost}}->{title}); $title .= " (devel $varenv->{dbname})" if($dbt->{copri_conf}->{stage} eq "test"); + #Ack codes or pw renew-prompt + if($users_dms->{u_id} && $users_sharee->{c_id} && (!$users_sharee->{int04} || !$users_sharee->{int13} || $users_sharee->{int06})){ + print "
\n"; + print $q->div({-id=>'Headerlogin'},$q->a({-class=>'elinkbutton1',-href=>"$dbt->{primary}->{sharee_primary}->{primaryApp}",-target=>'_blank'},"$users_sharee->{txt08} "), $q->span({-id=>"owner", -style=>"color:silver"}, "($users_dms->{u_id})")),"\n"; + print $q->div({-id=>'Headerlogin'},$q->a({-href=>"logout",-title=>'logout'},$q->span({-class=>"bi bi-door-open", -style=>'font-size:1em;color:white;padding-right:1em;'}))),"\n"; + print "
\n"; - ###User Panel - if($users_dms->{u_id}){ + print "
\n"; + print $q->start_multipart_form(-id=>'authform', -name=>'loginscreen'),"\n"; + print $q->hidden(-name=>"merchant_id",-override=>1,-value=>"$varenv->{merchant_id}") if($varenv->{merchant_id}); + print $q->hidden(-name=>"sessionid",-override=>1,-value=>"$R::sessionid") if($R::sessionid); + + print "
\n"; + print $q->div({-class=>'content2', -nowrap=>1}, $q->img({ -style=>"height:25px",-src=>"$varenv->{head_logo}"}),"Operator Login – $title"),"\n"; + + #pw renewe-prompt + if($users_sharee->{int06}){ + my $key = "txt04"; + my $des = $varenv->{cms}->{"iframe-form-302.$key"}->{txt}; + my $label_des="* $des"; + print $q->div({-class=>'content2'}, "$varenv->{cms}->{'iframe-renew-pw'}->{txt}"),"\n"; + + if($R::failure && $R::failure =~ /confirm_txt04/){ + $label_des = "$varenv->{cms}->{'iframe-repeat-pw-failure'}->{txt}"; + } + print $q->label({-for=>"$key", -style=>'padding-top:1.5em;'},"$label_des"),"\n"; + print "
\n"; + print $q->label({-for=>"confirm_$key"},"* $varenv->{cms}->{'iframe-repeat-pw'}->{txt}"),"\n"; + print "\n"; + print $q->div({-style=>'text-align:left;color:grey;'}, "", "$varenv->{cms}->{'iframe-show-pw'}->{txt}"),"\n"; + print $q->div({-style=>'margin-top:2em;text-align:center;'},""),"\n"; + + }elsif(!$users_sharee->{int04} || !$users_sharee->{int13}){ + my $acktext = "$varenv->{cms}->{'iframe-confirmation-codes-sent'}->{txt}"; + $acktext = "$varenv->{cms}->{'iframe-sms-confirmation-code-sent'}->{txt}" if($users_sharee->{int04} && !$users_sharee->{int13}); + $acktext = "$varenv->{cms}->{'iframe-email-confirmation-code-sent'}->{txt}" if(!$users_sharee->{int04} && $users_sharee->{int13}); + print $q->div({-class=>'content2'}, "$acktext $varenv->{cms}->{'iframe-successful-confirmation'}->{txt}"),"\n"; + if(!$users_sharee->{int04}){ + my $des = "$varenv->{cms}->{'iframe-email-code'}->{txt}"; + my $key = "confirm_code"; + my $label_des="* $des"; + $varenv->{cms}->{'iframe-correct-input'}->{txt} =~ s/::input::/$des/; + $label_des = "$varenv->{cms}->{'iframe-correct-input'}->{txt}" if($R::failure); + print $q->label({-for=>"$key", -style=>'padding-top:1em;'},"$label_des"),"\n"; + print "\n"; + print $q->div({-class=>'content2'}, " $varenv->{cms}->{'iframe-if-email-code-not-received'}->{txt}",$q->a({-class=>'elinkbutton4',-href=>"$varenv->{wwwhost}?sharee_edit=send_email"},"$varenv->{cms}->{'iframe-request-email-code'}->{txt}")),"\n"; + }else{ + print $q->div({-class=>'content2', -style=>'color:gray;'}, "* $varenv->{cms}->{'iframe-email-code-already-entered'}->{txt}"),"\n"; + } + if(!$users_sharee->{int13}){ + my $des = "$varenv->{cms}->{'iframe-sms-code'}->{txt}"; + my $key = "confirm_smscode"; + my $label_des="* $des"; + $varenv->{cms}->{'iframe-correct-input'}->{txt} =~ s/::input::/$des/; + $label_des = "$varenv->{cms}->{'iframe-correct-input'}->{txt}" if($R::failure); + print $q->label({-for=>"$key", -style=>'padding-top:1em;'},"$label_des"),"\n"; + print "\n"; + print $q->div({-class=>'content2'}, " $varenv->{cms}->{'iframe-if-sms-code-not-received'}->{txt}",$q->a({-class=>'elinkbutton4',-href=>"$varenv->{wwwhost}?sharee_edit=send_sms"},"$varenv->{cms}->{'iframe-request-sms-code'}->{txt}")),"\n"; + }else{ + print $q->div({-class=>'content2', -style=>'color:gray;'}, "* $varenv->{cms}->{'iframe-sms-code-already-entered'}->{txt}"),"\n"; + } + print $q->div({-style=>'margin-top:2em;text-align:center;'},""),"\n"; + } + print "
\n"; + print $q->end_form,"\n"; + print "
"; + } + #mainlogin + elsif(!$users_dms->{u_id}){ + + print "
\n"; + print $q->start_multipart_form(-id=>'authform', -name=>'loginscreen'),"\n"; + print $q->hidden(-name=>"merchant_id",-override=>1,-value=>"$varenv->{merchant_id}") if($varenv->{merchant_id}); + print $q->hidden(-name=>"sessionid",-override=>1,-value=>"$R::sessionid") if($R::sessionid); + + print "
\n"; + print $q->div({-class=>'content2', -nowrap=>1}, $q->img({ -style=>"height:25px",-src=>"$varenv->{head_logo}"}),"Operator Login – $title"),"\n"; + + #ask email + if($R::coccessor eq "pwmail"){ + print $q->div({-class=>'content2'}, "$varenv->{cms}->{'iframe-we-need-email'}->{txt}"),"\n"; + print $q->label({-for=>'E-Mail'},""),"\n"; + print $q->textfield(-class=>'form-control', -name=>'email', -value=>'', -override=>1, -type=>'email',-class=>'form-control', -id=>'Email', -placeholder=>'E-Mail Adresse', -required=>1, -autofocus=>1),"\n"; + + print $q->div({-style=>'margin-top:1em;text-align:center;'},""),"\n"; + + + } + #login + else{ + print $q->div({-style=>'color:#c83434'},"Login failure"),"\n" if("$R::login_dms" eq "Login" && !$users_dms->{u_id}); + if($R::sharee_edit eq "password_forgotten"){ + $varenv->{cms}->{'iframe-email-sent'}->{txt} =~ s/::email::/$R::email/; + print $q->div({-class=>'content2'}, "$varenv->{cms}->{'iframe-email-sent'}->{txt}"),"\n"; + } + print $q->label({-for=>'Userid'},""),"\n"; + print $q->textfield(-class=>'form-control', -name=>'user_id', -value=>'', -override=>1, -type=>'email',-class=>'form-control', -id=>'Userid', -placeholder=>'NutzerIn', -required=>1, -autofocus=>1),"\n"; + print $q->label({-for=>'PW'},""),"\n"; + print $q->password_field(-class=>'form-control', -name=>'user_pw', -value=>'', -override=>1, -type=>'password',-class=>'form-control', -id=>'PW', -placeholder=>'Passwort', -required=>1),"\n"; + print $q->div({-style=>'margin:1em 0;'},""),"\n"; + + print $q->div({-class=>'content2'},$q->a({-class=>'elinkbutton4', -href=>"?coccessor=pwmail"}, "Neues Passwort anfordern")),"\n"; + } + print "
\n"; + print $q->end_form,"\n"; + print "
"; + } + elsif($users_dms->{u_id} && $main_id){ ###header start print "
\n"; @@ -95,44 +203,13 @@ sub tpl(){ print $q->div({-id=>'Headerlogin',-style=>"background-color:#f7ae37;"},$q->a({-class=>'elinkbutton1',-title=>"Faktura Terminal öffnen",-href=>"$varenv->{wwwhost}/DMS/Faktura?ct_trans=open\&c_id4trans=$users_dms->{c_id4trans}\&tpl_id4trans=$users_dms->{tpl_id4trans}\&owner=$users_dms->{owner}\&offset=$offset\&limit=$limit\&relids=$R::relids\&no_redirect=1"}," Faktura \#$ctrel->{ct_name} $ctrel->{txt01}", $q->span({-id=>"c_id4trans", -style=>"color:#f7ae37"}, "$users_dms->{c_id4trans}"))) if($ctrel->{ct_name}); } - print $q->div({-id=>'Headerlogin'},"$users_sharee->{txt08} ", $q->span({-id=>"owner", -style=>"color:silver"}, "($users_dms->{u_id})")),"\n"; + print $q->div({-id=>'Headerlogin'},$q->a({-class=>'elinkbutton1',-href=>"$dbt->{primary}->{sharee_primary}->{primaryApp}",-target=>'_blank'},"$users_sharee->{txt08} "), $q->span({-id=>"owner", -style=>"color:silver"}, "($users_dms->{u_id})")),"\n"; print $q->div({-id=>'Headerlogin'},$q->a({-href=>"logout",-title=>'logout'},$q->span({-class=>"bi bi-door-open", -style=>'font-size:1em;color:white;padding-right:1em;'}))),"\n"; print "
"; print ""; - } - #end user panel - ###header end + ###header end - - #Mainlogin - if(!$users_dms->{u_id}){ - - print "
\n"; - - print $q->start_multipart_form(-id=>'authform', -name=>'loginscreen'),"\n"; - print $q->hidden(-name=>"merchant_id",-override=>1,-value=>"$varenv->{merchant_id}") if($varenv->{merchant_id}); - print $q->hidden(-name=>"sessionid",-override=>1,-value=>"$R::sessionid") if($R::sessionid); - - print "
\n"; - #Login - print $q->div({-class=>'content2', -nowrap=>1}, $q->img({ -style=>"height:25px",-src=>"$varenv->{head_logo}"}),"Operator Login – $title"),"\n"; - print $q->div({-style=>'color:#c83434'},"Login failure"),"\n" if("$R::login_dms" eq "Login" && !$users_dms->{u_id}); - print $q->label({-for=>'Userid'},""),"\n"; - print $q->textfield(-class=>'form-control', -name=>'user_id', -value=>'', -override=>1, -type=>'email',-class=>'form-control', -id=>'Userid', -placeholder=>'NutzerIn', -required=>1, -autofocus=>1),"\n"; - print $q->label({-for=>'PW'},""),"\n"; - print $q->password_field(-class=>'form-control', -name=>'user_pw', -value=>'', -override=>1, -type=>'password',-class=>'form-control', -id=>'PW', -placeholder=>'Passwort', -required=>1),"\n"; - print $q->div({-style=>'margin-top:1em;'},""),"\n"; - - print "
\n"; - print $q->end_form,"\n"; - #print $q->span({-style=>'color:white;'},"merchant_id:$varenv->{merchant_id}"),"\n"; - print "
"; - - exit 0; - } - - if($users_dms->{u_id} && $main_id){ - + if($main_id >= "100000"){ my $mstyle=""; @@ -294,7 +371,7 @@ sub tpl(){ } $debug = "syshost: $varenv->{syshost}, merchant_id: $varenv->{merchant_id}, (c_id4trans:$users_dms->{c_id4trans} && tpl_id4trans:$users_dms->{tpl_id4trans}) $node_meta->{tpl_name},$node_meta->{tpl_id},$node_meta->{ct_table},$parent_id,$main_id, permissions: ($users_dms->{int01},$users_dms->{int02},$users_dms->{int03},$users_dms->{int07},$users_dms->{int08},$users_dms->{int09})" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id}); - print $q->div({-style=>'position:fixed;bottom:0%;right:1%;z-index:10;padding:2px;font-size:13px;'},"$debug",$q->a({-style=>'color:black;text-decoration: none;',-href=>'https://sharee.bike',-target=>'_blank'},"sharee.bike © TeilRad GmbH 2023")),"\n"; + print $q->div({-style=>'position:fixed;bottom:0%;right:1%;z-index:10;padding:2px;font-size:13px;'},"$debug",$q->a({-style=>'color:black;text-decoration: none;',-href=>'https://sharee.bike',-target=>'_blank'},"sharee.bike © TeilRad GmbH 2024")),"\n"; print $q->div({-style=>'padding: 30px 0 0 0;'}, ""), "\n"; $self->tplselect($node_meta,$users_dms,$mode,$varenv,$feedb); @@ -338,7 +415,7 @@ sub tplselect(){ $feedb = &Liste3::tpl($node_meta,$users_dms,$mode,$feedb); }elsif($node_meta->{ct_table} =~ /contenttranspos|contenttheftpos/){ require "Tpl/Calorin.pm"; - &Calorin::tpl($node_meta,$users_dms,$mode,$feedb); + &Calorin::tpl($node_meta,$users_dms,$feedb); } #print Dumper($feedb); #exit;