From cede793cc366c7484780f4cdbf1abfeab10c08ee Mon Sep 17 00:00:00 2001 From: ragu Date: Wed, 21 Jun 2023 20:21:58 +0200 Subject: [PATCH] Fix save_content. Accept-Language key --- copri4/main/src/Mod/DBtank.pm | 4 +++- copri4/main/src/Mod/Indexsharee.pm | 23 +++++++++++-------- copri4/main/src/Mod/Prelib.pm | 9 ++++---- copri4/shareeapp-operator/src/Tpl/FormEdit.pm | 5 ++-- .../src/Tpl/PayoneCCclient.pm | 2 +- .../shareeapp-operator/src/Tpl/PayoneSEPA.pm | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/copri4/main/src/Mod/DBtank.pm b/copri4/main/src/Mod/DBtank.pm index 72ffef8..9fd2d2c 100755 --- a/copri4/main/src/Mod/DBtank.pm +++ b/copri4/main/src/Mod/DBtank.pm @@ -686,6 +686,7 @@ sub collect_post(){ #fetch CMS #coalesce works only on null values +#It returns the first argument that is not null, from left to right sub fetch_cms { my $self = shift; my $dbh = shift || $dbh_intern; @@ -695,8 +696,9 @@ sub fetch_cms { my $lang = ""; $lang = lc($fetch->{lang}) if($fetch->{lang}); $langfield = "txt01" if($lang eq "de"); + $langfield = "txt02" if($lang eq "en"); $langfield = "txt03" if($lang eq "fr"); - my $sql = "SELECT ct_name, coalesce($langfield, txt01) AS txt FROM contentuser, relation where template_id=194 and c_id=content_id"; + my $sql = "SELECT ct_name, coalesce($langfield, txt02, txt01) AS txt FROM contentuser, relation where template_id=194 and c_id=content_id"; my $sth = $dbh->prepare($sql); my $rc = $sth->execute(); diff --git a/copri4/main/src/Mod/Indexsharee.pm b/copri4/main/src/Mod/Indexsharee.pm index 906cabc..4503c9c 100755 --- a/copri4/main/src/Mod/Indexsharee.pm +++ b/copri4/main/src/Mod/Indexsharee.pm @@ -55,13 +55,18 @@ sub handler { my $script = $q->script_name(); my $path = $q->path_info(); $path = "$script" . "$path"; + $path =~ s/\.html//; my $refer = $ENV{HTTP_REFERER}; my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime; my $return = ""; my $returnwww = ""; my $html_charset = "utf-8"; my $user_agent = $q->user_agent(); - $path =~ s/\.html//; + + my $lang = "en"; + $lang = $1 if($q->http('Accept-Language') =~ /^(\w+)/); + #$lang = lc($R::lang) if($R::lang); + #print $lang; my $feedb = { c_id => "", @@ -99,8 +104,6 @@ sub handler { exit 0; } - my $lang = "en"; - $lang = lc($R::lang) if($R::lang); my $dyn_js = ""; my $users_dms = {}; my $users_sharee = {}; @@ -369,8 +372,8 @@ sub handler { $return = $pl->delete_relation($q,$R::main_id,$users_dms->{u_id}); }elsif($R::rel_edit eq "new_relation" && $R::main_id && $R::main_id >= 200000){ $return = $pl->new_relation($q,$R::main_id,$users_dms->{u_id}); - }elsif($R::base_edit eq "new_content" && $R::main_id && $R::main_id >= 200000){ - $feedb = $pl->new_content($q,$users_dms); + }elsif($R::base_edit eq "new_content" && $node_meta->{main_id} && $node_meta->{main_id} >= 200000){ + $feedb = $pl->new_content($q,$users_dms,$node_meta); }elsif($R::base_edit eq "save_content"){ $feedb = $pl->save_content($q,$users_dms,$node_meta,$R::c_id) if(looks_like_number($R::c_id)); $apif->stations_caching($q,\%varenv,$users_sharee) if($node_meta->{template_id} =~ /210|205|225/); @@ -393,13 +396,13 @@ sub handler { if(($R::rel_edit || $R::base_edit) && $node_meta->{ct_table} eq "contentuser"){ $bw->log("DMS action from $users_dms->{u_id} on $node_meta->{ct_table}",$q,""); if($users_dms->{u_id} && $users_dms->{int08} == 2){ - if($R::rel_edit eq "save_ctuser" && $R::main_id && $R::main_id >= 200000){ - $return = $pl->save_service_desc($q,$R::c_id,$users_dms); + if($R::rel_edit eq "save_ctuser" && $node_meta->{main_id} && $node_meta->{main_id} >= 200000){ + $return = $pl->save_service_desc($q,$users_dms,$R::c_id); }elsif($R::rel_edit eq "save_user"){ $feedb = $pl->save_content($q,$users_dms,$node_meta,$R::c_id) if(looks_like_number($R::c_id)); - }elsif($R::base_edit eq "new_contentcms" && $R::main_id && $R::main_id >= 200000){ - $feedb = $pl->new_content($q,$users_dms); - }elsif($R::base_edit eq "save_contentcms" && $R::main_id && $R::main_id >= 200000){ + }elsif($R::base_edit eq "new_contentcms" && $node_meta->{main_id} && $node_meta->{main_id} >= 200000){ + $feedb = $pl->new_content($q,$users_dms,$node_meta); + }elsif($R::base_edit eq "save_contentcms" && $node_meta->{main_id} && $node_meta->{main_id} >= 200000){ $feedb = $pl->save_content($q,$users_dms,$node_meta,$R::c_id) if(looks_like_number($R::c_id)); }elsif($R::c_id && $R::base_edit eq "remove_chk4rel"){ my $delete_key = "delete_contentuser"; diff --git a/copri4/main/src/Mod/Prelib.pm b/copri4/main/src/Mod/Prelib.pm index 9ac44b3..41b183b 100755 --- a/copri4/main/src/Mod/Prelib.pm +++ b/copri4/main/src/Mod/Prelib.pm @@ -130,6 +130,7 @@ sub new_content { my $self = shift; my $q = shift; my $users_dms = shift; + my $node_meta = shift; $q->import_names('R'); my $dbh = ""; my $feedb = { message => "" }; @@ -138,7 +139,7 @@ sub new_content { table => "$R::ct_table", fetch => "one", template_id => "$R::template_id", - main_id => "$R::main_id", + main_id => "$node_meta->{main_id}", }; my $cc_part = { c_id => 0 }; @@ -154,11 +155,11 @@ sub new_content { barcode => "$next_barcode", ct_name => "---", template_id => "$R::template_id", - main_id => "$R::main_id", + main_id => "$node_meta->{main_id}", txt12 => "$dbt->{operator}->{$varenv{dbname}}->{oprefix}", }; my $c_idnew = 0; - $c_idnew = $dbt->insert_contentoid($dbh,$insert_ctu,"") if($R::ct_table && $R::template_id && $R::main_id); + $c_idnew = $dbt->insert_contentoid($dbh,$insert_ctu,"") if($R::ct_table && $R::template_id && $node_meta->{main_id}); if($c_idnew){ $feedb->{c_id} = $c_idnew; @@ -1264,8 +1265,8 @@ sub set_usertarif { sub save_service_desc { my $self = shift; my $q = shift; - my $c_id = shift; my $users_dms = shift; + my $c_id = shift; my @keywords = $q->param; my $dbh = ""; my $c_tplid = {c_id => $c_id}; diff --git a/copri4/shareeapp-operator/src/Tpl/FormEdit.pm b/copri4/shareeapp-operator/src/Tpl/FormEdit.pm index ab65bbb..d486676 100755 --- a/copri4/shareeapp-operator/src/Tpl/FormEdit.pm +++ b/copri4/shareeapp-operator/src/Tpl/FormEdit.pm @@ -302,12 +302,11 @@ EOF if($R::confirm_success){ print $q->div({-class=>'content_title3'},"Anmeldung bestätigt"),"\n"; }else{ - print $q->div({-class=>'content_title3'},"$tpl01->{tpl_name}"),"\n"; + print $q->div({-class=>'content_title3'},"$varenv->{cms}->{$tpl01->{tpl_name}}->{txt}"),"\n"; } if($path =~ /$varenv->{accounting_1}/){ - print $q->div({-class=>'content2'}, "Bitte füllen Sie dieses Formular vollständig aus und hinterlegen im nächsten Schritt wahlweise Ihre Lastschriftdaten (für Konten mit IBAN DE) oder Kreditkartendaten (VISA oder Mastercard). Bitte halten Sie die Daten immer auf dem neuesten Stand.

-Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterlegte E-Mail als auch auf die Mobiltelefonnummer jeweils eine Nachricht, die Sie beide zwingend bestätigen müssen."),"\n"; + print $q->div({-class=>'content2'}, "$varenv->{cms}->{'iframe-paymentdata-form'}->{txt}"),"\n"; } if($path =~ /$varenv->{accounting_2}/){ if($tpl_id == 302008){ diff --git a/copri4/shareeapp-operator/src/Tpl/PayoneCCclient.pm b/copri4/shareeapp-operator/src/Tpl/PayoneCCclient.pm index eb731ab..48b6b5c 100755 --- a/copri4/shareeapp-operator/src/Tpl/PayoneCCclient.pm +++ b/copri4/shareeapp-operator/src/Tpl/PayoneCCclient.pm @@ -46,7 +46,7 @@ sub tpl(){ print "
\n"; - print $q->div({-class=>'content_title3'},"Kreditkartendaten"),"\n"; + print $q->div({-class=>'content_title3'},"$varenv->{cms}->{'Kreditkartendaten'}->{txt}"),"\n"; print $q->div({-class=>'content2'},"Kreditkartendaten werden von uns nicht gespeichert sondern direkt an unseren Zahlungsdienstleister Payone übermittelt. Deshalb sehen Sie hier nur leere Eingabefelder."),"\n"; #print $q->div({-class=>'content2'}, "Zur Validierung Ihrer Zahlungsdaten wird eine 1,- € Testbuchung vorgenommen. Wir werden nach erfolgreicher Abbuchung den Betrag als Mietgutschrift in Ihrem Account hinterlegen."),"\n"; diff --git a/copri4/shareeapp-operator/src/Tpl/PayoneSEPA.pm b/copri4/shareeapp-operator/src/Tpl/PayoneSEPA.pm index 006f94b..f04f300 100755 --- a/copri4/shareeapp-operator/src/Tpl/PayoneSEPA.pm +++ b/copri4/shareeapp-operator/src/Tpl/PayoneSEPA.pm @@ -75,7 +75,7 @@ sub tpl(){ print "
\n"; - print $q->div({-class=>'content_title3'},"Kontoverbindung"),"\n"; + print $q->div({-class=>'content_title3'},"$varenv->{cms}->{'Kontoverbindung'}->{txt}"),"\n"; print $q->div({-class=>'content2'}, "Durch das SEPA Mandat können wir die Leihrad Buchungen bequem einziehen."),"\n"; #print $q->div({-class=>'content2'}, "Zur Validierung Ihrer Zahlungsdaten wird eine 1,- € Testbuchung vorgenommen. Wir werden nach erfolgreicher Abbuchung den Betrag als Mietgutschrift in Ihrem Account hinterlegen."),"\n";