change site parameter

This commit is contained in:
ragu 2023-01-27 06:55:30 +01:00
parent 38a72a3eed
commit 7ce6cb6230
10 changed files with 47 additions and 46 deletions

View file

@ -42,7 +42,6 @@ sub loop_sharees {
my $authraw = shift; my $authraw = shift;
my $return_merchant = shift || ""; my $return_merchant = shift || "";
my @keywords = $q->param; my @keywords = $q->param;
#my $project = $return_merchant->{project_id} || "all";
#only request keys which initated by sharee primary requests to operator #only request keys which initated by sharee primary requests to operator
my $rest_hash = {}; my $rest_hash = {};
@ -67,25 +66,28 @@ sub loop_sharees {
my @user_group = (); my @user_group = ();
my @user_tour = (); my @user_tour = ();
my $fetch_hash = {}; my $fetch_hash = {};
while (my ($key, $value) = each %{ $globalconf{operator} }) { while (my ($key, $op_name) = each %{ $globalconf{operator} }) {
my $ret_json = ""; my $ret_json = "";
#shareetool, to loop only operators who is the shareetool by usersconf enabled #shareetool, to loop only operators who is the shareetool by usersconf enabled
my $users_serviceapp = { u_id => 0 }; my $users_serviceapp = { u_id => 0 };
if($return_merchant->{aowner} && $return_merchant->{aowner} == 187 && $value->{database}->{dbname} && $authraw->{txt17} =~ /$value->{database}->{dbname}/){ if($return_merchant->{aowner} && $return_merchant->{aowner} == 187 && $op_name->{database}->{dbname} && $authraw->{txt17} =~ /$op_name->{database}->{dbname}/){
my $dbh_operator = $dbt->dbconnect_extern($value->{database}->{dbname}); my $dbh_operator = $dbt->dbconnect_extern($op_name->{database}->{dbname});
$users_serviceapp = $dbt->select_users($dbh_operator,$authraw->{c_id},"and int09=1"); $users_serviceapp = $dbt->select_users($dbh_operator,$authraw->{c_id},"and int09=1");
$bw->log("shareetool select_users $return_merchant->{aowner} on $value->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},""); $bw->log("shareetool select_users $return_merchant->{aowner} on $op_name->{database}->{dbname} $authraw->{c_id} $authraw->{txt17}",$users_serviceapp->{u_id},"");
} }
#every sharee client must have a merchant_id which associate a project #every sharee client must have a merchant_id which associate a project
if($value->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $value->{project}))){ #if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || ($return_merchant->{project_id} eq $op_name->{project}))){
#$bw->log("--> LOOP-start ($return_merchant->{merchant_id}) jsonclient loop_sharees $key by operatorApp: $value->{operatorApp}, netloc: $netloc if($return_merchant->{project_id} eq $value->{project} || $users_serviceapp->{u_id} > 0)\n","",""); #TODO, to reduce request time by ($return_merchant->{project_id} eq "Freiburg") do it only for shareeweb-sharee.copri.eu
$ret_json = $self->fetch_operator_json("$value->{operatorApp}/APIjsonserver",$rest); if($op_name->{operatorApp} && ($users_serviceapp->{u_id} || $return_merchant->{project_id} eq "Freiburg" || ($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);
#print Dumper($ret_json); #print Dumper($ret_json);
if($ret_json){ if($ret_json){
push(@uri_operator_array, $value->{operatorApp}); push(@uri_operator_array, $op_name->{operatorApp});
eval { eval {
my $response_in = ""; my $response_in = "";
$response_in = decode_json($ret_json); $response_in = decode_json($ret_json);
@ -121,7 +123,7 @@ sub loop_sharees {
warn $@; warn $@;
} }
}else{ }else{
$bw->log("NO json from Operator:",$value->{operatorApp},""); $bw->log("NO json from Operator:",$op_name->{operatorApp},"");
} }
#$bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,""); #$bw->log("--> LOOP-end jsonclient loop_sharees user_group:\n",\@user_group,"");
} }

View file

@ -76,11 +76,11 @@ my $response = {
user_group => [], user_group => [],
user_tour => [], user_tour => [],
response_state => "OK, nothing todo", response_state => "OK, nothing todo",
agb_html => "site/agb_sharee_2.html", agb_html => "$dbt->{project_conf}->{Freiburg}->{agb_html}",
privacy_html => "site/privacy_sharee_2.html", privacy_html => "$dbt->{project_conf}->{Freiburg}->{privacy_html}",
impress_html => "site/impress_1.html", impress_html => "$dbt->{project_conf}->{Freiburg}->{impress_html}",
tariff_info_html => "site/tariff_info.html", tariff_info_html => "$dbt->{project_conf}->{Freiburg}->{tariff_info_html}",
bike_info_html => "site/bike_info_sharee_1.html", bike_info_html => "$dbt->{project_conf}->{Freiburg}->{bike_info_html}",
lang => "de", lang => "de",
last_used_operator => { last_used_operator => {
operator_name => "sharee.bike | TeilRad GmbH", operator_name => "sharee.bike | TeilRad GmbH",
@ -110,14 +110,14 @@ if(!$coo && !$q->param('merchant_id')){
($aowner, $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id')); ($aowner, $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
#if($aowner && ($aowner == 195 || $aowner == 185 || $aowner == 176)){ #if($aowner && ($aowner == 195 || $aowner == 185 || $aowner == 176)){
if($return_merchant->{project_id} eq "Konstanz"){ if($return_merchant->{project_id} eq "Konstanz"){
$response->{agb_html} = "site/agb_konrad_1.html"; $response->{agb_html} = "$dbt->{project_conf}->{Konstanz}->{agb_html}";
$response->{bike_info_html} = "site/bike_info_konrad_1.html"; $response->{bike_info_html} = "$dbt->{project_conf}->{Konstanz}->{bike_info_html}";
} }
if($return_merchant->{project_id} eq "Bayern"){ if($return_merchant->{project_id} eq "Bayern"){
$response->{agb_html} = "site/agb_lastenradbayern_220804.html"; $response->{agb_html} = "$dbt->{project_conf}->{Bayern}->{agb_html}";
$response->{bike_info_html} = "site/bike_info_bayern.html"; $response->{privacy_html} = "$dbt->{project_conf}->{Bayern}->{privacy_html}";
$response->{privacy_html} = "site/privacy_lastenradbayern.html"; $response->{tariff_info_html} = "$dbt->{project_conf}->{Bayern}->{tariff_info_html}";
$response->{tariff_info_html} = "site/tarif_info_lastenradbayern_220804.html"; $response->{bike_info_html} = "$dbt->{project_conf}->{Bayern}->{bike_info_html}";
} }
} }

View file

@ -568,7 +568,7 @@ sub singlesubmit7(){
$b_img = "Delete" if("$b_name" =~ /delete_media/); $b_img = "Delete" if("$b_name" =~ /delete_media/);
$b_img = "Save" if("$b_name" =~ /save|service_done|_contenttverpos/); $b_img = "Save" if("$b_name" =~ /save|service_done|_contenttverpos/);
$a_key = "y" if("$b_name" =~ /save/); $a_key = "y" if("$b_name" =~ /save/);
$b_img = "Text Save" if("$b_name" =~ /save_text/); $b_img = "Text & State Save" if("$b_name" =~ /save_text/);
$b_img = "Delete All" if("$b_name" =~ /delete_all/); $b_img = "Delete All" if("$b_name" =~ /delete_all/);
$b_img = "Search" if("$b_name" =~ /search/); $b_img = "Search" if("$b_name" =~ /search/);
$b_img = "New" if("$b_name" =~ /^new/); $b_img = "New" if("$b_name" =~ /^new/);

View file

@ -73,7 +73,7 @@ sub dbconnect_extern {
my $database = "dbi:Pg:dbname=$value->{database}->{dbname};host=$value->{database}->{host};port=$value->{database}->{port};options='$value->{database}->{options}'"; my $database = "dbi:Pg:dbname=$value->{database}->{dbname};host=$value->{database}->{host};port=$value->{database}->{port};options='$value->{database}->{options}'";
$database .= ";sslmode=$value->{database}->{sslmode}" if($value->{database}->{sslmode} && $value->{database}->{host} ne "localhost"); $database .= ";sslmode=$value->{database}->{sslmode}" if($value->{database}->{sslmode} && $value->{database}->{host} ne "localhost");
my $dbh = DBI->connect($database, $value->{database}->{user}, $value->{database}->{passwd},{ RaiseError => 0, AutoCommit => 1 }); my $dbh = DBI->connect($database, $value->{database}->{user}, $value->{database}->{passwd},{ RaiseError => 0, AutoCommit => 1 });
$bw->log("--> dbconnect_extern success --> $database, $value->{database}->{user}, $value->{database}->{passwd}",$database,""); #$bw->log("--> dbconnect_extern success --> $database, $value->{database}->{user}, $value->{database}->{passwd}",$database,"");
$dbh->do("set CLIENT_ENCODING TO 'iso-8859-1'") if($client_encoding && $client_encoding eq "iso-8859-1"); $dbh->do("set CLIENT_ENCODING TO 'iso-8859-1'") if($client_encoding && $client_encoding eq "iso-8859-1");
return $dbh if($dbh); return $dbh if($dbh);
} }

View file

@ -804,7 +804,7 @@ sub handler {
#feedb will be the new hashed return. todo refactoring #feedb will be the new hashed return. todo refactoring
if(ref($return) eq "HASH"){ if(ref($return) eq "HASH"){
$feedb = $return; $feedb = $return;
}else{ }elsif($return =~ /failure::/){
$feedb->{message} = $return; $feedb->{message} = $return;
} }
$ml->tpl($node_meta,$users_dms,$mode,\%varenv,$users_sharee,$feedb); $ml->tpl($node_meta,$users_dms,$mode,\%varenv,$users_sharee,$feedb);

View file

@ -45,7 +45,7 @@ sub mail_connect {
Port => 465, Port => 465,
Hello => 'sharee.bike', Hello => 'sharee.bike',
Timeout => 30, Timeout => 30,
Debug => 1, Debug => 0,
SSL => 1, SSL => 1,
); );
@ -152,7 +152,7 @@ sub mail_transport(){
print EMA "\n\n"; print EMA "\n\n";
close EMA; close EMA;
$bw->log("Success send_mail","",""); $bw->log("done mailing with state:","$ret","");
return $ret; return $ret;
}#end mail_send }#end mail_send

View file

@ -544,7 +544,13 @@ EOF
}else{ }else{
undef $_paymentstate[1]; undef $_paymentstate[1];
} }
$kind_of_payment = "$ctt->{state}" if($ctt->{state} && $ctt->{int01});
if($ctt->{state} && $ctt->{int01}){
$kind_of_payment = "$ctt->{state}";
}elsif($ctt->{int06} && $ctt->{int06} >= 3){
#default to Überw.
$kind_of_payment = "$_paymentstate[2]";
}
if($ctt->{state} && $ctt->{int01}){ if($ctt->{state} && $ctt->{int01}){
$ctt->{int01} =~ s/\./,/; $ctt->{int01} =~ s/\./,/;
@ -556,7 +562,7 @@ EOF
if(!$ctt->{close_time}){ if(!$ctt->{close_time}){
my $send_invoice_checkbox = 1; my $send_invoice_checkbox = 1;
$send_invoice_checkbox = 0 if($ctt->{txt30}); $send_invoice_checkbox = 0 if($ctt->{txt30} || $ctt->{ct_name} =~ /\d-\d/);
print $q->div({-class=>'element6',-style=>'float:right;'}, print $q->div({-class=>'element6',-style=>'float:right;'},
"buchen incl. drucken ",$but->checkbox("print_pdf","ct_trans","1","PDF drucken",""), "buchen incl. drucken ",$but->checkbox("print_pdf","ct_trans","1","PDF drucken",""),
" eMail Versand ",$but->checkbox("1","send_invoice","$send_invoice_checkbox","eMail $ctt->{txt00}",""), " eMail Versand ",$but->checkbox("1","send_invoice","$send_invoice_checkbox","eMail $ctt->{txt00}",""),

View file

@ -387,7 +387,7 @@ sub get_positions {
my $theftmove_count = 0; my $theftmove_count = 0;
foreach my $resp (sort { $a->{id} <=> $b->{id} } (@{ $response_in })) { foreach my $resp (sort { $a->{id} <=> $b->{id} } (@{ $response_in })) {
print FILE "$resp->{id} shareeTime: $today | serverTime: $resp->{serverTime} | ilockit get_positions movement: $theft_record_detect->{barcode} | $record_cc->{$id}->{int13} eq $resp->{deviceId} && $resp->{speed} > 0 && $resp->{attributes}->{distance})\n"; print FILE "$resp->{id} shareeTime: $today | serverTime: $resp->{serverTime} | ilockit get_positions movement: $theft_record_detect->{barcode} | $record_cc->{$id}->{int13} eq $resp->{deviceId} && speed:$resp->{speed} && distance:$resp->{attributes}->{distance})\n";
#if($record_cc->{$id}->{int13} eq $resp->{deviceId} && $resp->{speed} > 0 && $resp->{attributes}->{distance} >= 200){ #if($record_cc->{$id}->{int13} eq $resp->{deviceId} && $resp->{speed} > 0 && $resp->{attributes}->{distance} >= 200){
if($record_cc->{$id}->{int13} eq $resp->{deviceId}){ if($record_cc->{$id}->{int13} eq $resp->{deviceId}){
$theftmove_count++;#count if move holds on for min 2 times $theftmove_count++;#count if move holds on for min 2 times
@ -422,12 +422,13 @@ sub get_positions {
my $c_id = 0; my $c_id = 0;
$c_id = $dbt->insert_contentoid($dbh,$insert); $c_id = $dbt->insert_contentoid($dbh,$insert);
print FILE "insert sub get_positions:" . Dumper($insert); print FILE "insert sub get_positions:" . Dumper($insert);
print FILE "send_alarm2hotline condition: syshost:$op_name->{syshost}, c_id:$c_id && $theftmove_count > $dbt->{copri_conf}->{theftalarm}->{move_count} && ($resp->{speed} > $dbt->{copri_conf}->{theftalarm}->{speed} || $resp->{attributes}->{distance} > $dbt->{copri_conf}->{theftalarm}->{meter})\n";
#theft mailing #theft mailing
if($c_id && $theftmove_count > $dbt->{copri_conf}->{theftalarm}->{move_count} && ($resp->{speed} > $dbt->{copri_conf}->{theftalarm}->{speed} || $resp->{attributes}->{distance} > $dbt->{copri_conf}->{theftalarm}->{meter})){ if($c_id && $theftmove_count > $dbt->{copri_conf}->{theftalarm}->{move_count} && ($resp->{speed} > $dbt->{copri_conf}->{theftalarm}->{speed} || $resp->{attributes}->{distance} > $dbt->{copri_conf}->{theftalarm}->{meter})){
#send mail #send mail
system("$dbt->{copri_conf}->{basedir}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''"); system("$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''");
print FILE "send_alarm2hotline, condition: c_id:$c_id && $theftmove_count > $dbt->{copri_conf}->{theftalarm}->{move_count} && ($resp->{speed} > $dbt->{copri_conf}->{theftalarm}->{speed} || $resp->{attributes}->{distance} > $dbt->{copri_conf}->{theftalarm}->{meter})\n"; print FILE "$dbt->{copri_conf}->{basedir}/$op_name->{syshost}/src/scripts/mailTransportcms.pl '$op_name->{syshost}' 'send_alarm2hotline' '1' '$c_id' ''\n\n";
} }
} }

View file

@ -73,7 +73,7 @@ sub tpl(){
$aowner = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} if($varenv->{merchant_id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id}); $aowner = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} if($varenv->{merchant_id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id});
#TODO substitute aowner by project #TODO substitute aowner by project
my $project = "all"; my $project = "Freiburg";#defaults to sharee
$project = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{project} if($varenv->{merchant_id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{project}); $project = $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{project} if($varenv->{merchant_id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{project});
my $bonus_desc = "Bonusnummer (falls vorhanden)"; my $bonus_desc = "Bonusnummer (falls vorhanden)";
@ -163,19 +163,10 @@ Weitere Personen aus Ihrem Haushalt profitieren jedoch ebenfalls, falls Sie weit
my $sharee_agb_text = {}; my $sharee_agb_text = {};
$sharee_agb_text->{ct_name} = "AGB"; $sharee_agb_text->{ct_name} = "AGB";
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb_sharee_2.html' style='width:100%;height:10000px;border:none;' scrolling='auto'></iframe>"; $sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/$dbt->{project_conf}->{$project}->{agb_html}' style='width:100%;height:10000px;border:none;' scrolling='auto'></iframe>";
my $sharee_privacy_text = {}; my $sharee_privacy_text = {};
$sharee_privacy_text->{ct_name} = "Datenschutzhinweise"; $sharee_privacy_text->{ct_name} = "Datenschutzhinweise";
$sharee_privacy_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/privacy_sharee_2.html' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>"; $sharee_privacy_text->{txt01} = "<iframe src='$varenv->{wwwhost}/$dbt->{project_conf}->{$project}->{privacy_html}' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>";
if($project eq "Konstanz"){
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb_konrad_1.html' style='width:100%;height:10000px;border:none;' scrolling='auto'></iframe>";
}
if($project eq "Bayern"){
$sharee_agb_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/agb_lastenradbayern_220804.html' style='width:100%;height:11000px;border:none;' scrolling='auto'></iframe>";
$sharee_privacy_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/privacy_lastenradbayern.html' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>";
}
print "<div id='Contentapp'>\n"; print "<div id='Contentapp'>\n";

View file

@ -45,6 +45,7 @@ sub tpl(){
my $node = {}; my $node = {};
my $rows = 0; my $rows = 0;
my $project = $dbt->{website}->{$varenv->{syshost}}->{project} || "Freiburg";#defaults to sharee
my $bgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{bgcolor1} || "yellow";#button background my $bgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{bgcolor1} || "yellow";#button background
my $hgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{hgcolor1} || "yellow";#hover background my $hgcolor1 = $dbt->{website}->{$varenv->{syshost}}->{hgcolor1} || "yellow";#hover background
@ -173,7 +174,7 @@ sub tpl(){
} }
print "</div>\n"; print "</div>\n";
if($dbt->{website}->{$varenv->{syshost}}->{project} eq "Bayern"){ if($project eq "Bayern"){
if($user_agent !~ /Android|Iphone/i){ if($user_agent !~ /Android|Iphone/i){
print $q->div({-style=>"text-align:left;width:100%;margin:1em 0;background-image: linear-gradient(to right, rgb(0, 156, 217) 300px, rgb(255,255,255));"},$q->img({-style=>'height:10em;', -src=>"$dbt->{website}->{$varenv->{syshost}}->{operatorWeb1}/img/Logo-LastenradBayern-01.png"})),"\n"; print $q->div({-style=>"text-align:left;width:100%;margin:1em 0;background-image: linear-gradient(to right, rgb(0, 156, 217) 300px, rgb(255,255,255));"},$q->img({-style=>'height:10em;', -src=>"$dbt->{website}->{$varenv->{syshost}}->{operatorWeb1}/img/Logo-LastenradBayern-01.png"})),"\n";
}else{ }else{
@ -200,11 +201,11 @@ sub tpl(){
my $sharee_impress_text = {}; my $sharee_impress_text = {};
$sharee_impress_text->{ct_name} = "Impressum"; $sharee_impress_text->{ct_name} = "Impressum";
$sharee_impress_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/impress_1.html' style='width:100%;height:1500px;border:none;' scrolling='auto'></iframe>"; $sharee_impress_text->{txt01} = "<iframe src='$varenv->{wwwhost}/$dbt->{project_conf}->{$project}->{impress_html}' style='width:100%;height:1500px;border:none;' scrolling='auto'></iframe>";
my $sharee_privacy_text = {}; my $sharee_privacy_text = {};
$sharee_privacy_text->{ct_name} = "Datenschutzhinweise"; $sharee_privacy_text->{ct_name} = "Datenschutzhinweise";
$sharee_privacy_text->{txt01} = "<iframe src='$varenv->{wwwhost}/site/privacy_lastenradbayern.html' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>"; $sharee_privacy_text->{txt01} = "<iframe src='$varenv->{wwwhost}/$dbt->{project_conf}->{$project}->{privacy_html}' style='width:100%;height:8000px;border:none;' scrolling='auto'></iframe>";
print <<EOF print <<EOF
<!-- Modal --> <!-- Modal -->