Some mailing and sms sender fixes

This commit is contained in:
ragu 2023-07-05 06:23:29 +02:00
parent 03ade2a406
commit b32214c15d
11 changed files with 38 additions and 24 deletions

View file

@ -1460,7 +1460,7 @@ sub booking_update(){
int23 => $user_miniquest_count,
atime => "now()",
};
$rows = $dbt->update_record($dbh,$update23,$auth_prim);
$rows = $dbt->update_record($dbh,$update23,$auth_prim) if($dbt->{copri_conf}->{contributors} && $auth_prim->{c_id} !~ /$dbt->{copri_conf}->{contributors}/);
}
}#end mini_quest
@ -1990,7 +1990,7 @@ sub bikes_available(){
$return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int36}", "$tariff_content->{$tid}->{int36} € / $time_unit"];
}elsif($td_template->{$td}->{int17} && $tariff_content->{$tid}->{int17} && $tariff_content->{$tid}->{int17} > 0){
$tariff_content->{$tid}->{int17} =~ s/\./,/ if($lang eq "de");
$return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$tariff_content->{$tid}->{int17} € / Tag"];
$return->{$id}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$tariff_content->{$tid}->{int17} € / 24 Std"];
}elsif($td_template->{$td}->{time02} && $tariff_content->{$tid}->{time02} =~ /[1-9]/){
$time_unit = $dbt->time_format($tariff_content->{$tid}->{time02});
$time_unit .= " / Tag" if($dbt->{operator}->{$varenv->{dbname}}->{project} ne "Konstanz");

View file

@ -278,7 +278,7 @@ sub sig_available {
$response_out->{$bike}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int36}", "$tariff_content->{$tid}->{int36} € / $time_unit"];
}elsif($td_template->{$td}->{int17} && $tariff_content->{$tid}->{int17} && $tariff_content->{$tid}->{int17} > 0){
$tariff_content->{$tid}->{int17} =~ s/\./,/ if($lang eq "de");
$response_out->{$bike}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$tariff_content->{$tid}->{int17} € / Tag"];
$response_out->{$bike}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$tariff_content->{$tid}->{int17} € / 24 Std"];
}elsif($td_template->{$td}->{time02} && $tariff_content->{$tid}->{time02} =~ /[1-9]/){
$time_unit = $dbt->time_format($tariff_content->{$tid}->{time02});
$response_out->{$bike}->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{time02}","$time_unit / Tag"];

View file

@ -75,10 +75,13 @@ print<<EOF
</script>
EOF
;
print $q->div({-id=>'retm'},"$feedb->{message} $debug"),"\n" if($feedb->{message} && $feedb->{message} =~ /[a-z]/ && $feedb->{message} !~ /failure::/);
if($feedb->{message} && $feedb->{message} =~ /[a-z]/ && $feedb->{message} !~ /failure::/){
print $q->div({-id=>'retm'},"$feedb->{message} $debug"),"\n";
}else{
print $q->div({-id=>'retm'},"$node_meta->{node_name} angelegt $debug"),"\n" if($feedb->{i_rows});
print $q->div({-id=>'retm'},"$node_meta->{node_name} aktualisiert $debug"),"\n" if($feedb->{u_rows});
print $q->div({-id=>'retm'},"$node_meta->{node_name} gelöscht $debug"),"\n" if($feedb->{d_rows});
}
}
return;

View file

@ -672,7 +672,7 @@ sub collect_post(){
$sql = "SELECT cp.*, ct.state FROM $fetch->{table_pos} cp, $fetch->{table} ct WHERE $cp_where and cp.ct_id=ct.c_id and $ct_where order by cp.mtime ASC";#mtime aufsteigend get last (newest) entry
$sth = $dbh->prepare($sql);
}
#$bw->log("DBtank collect_post ",$sql,"") if($debug);
$bw->log("DBtank collect_post ",$sql,"") if($debug);
my $rc = $sth->execute();
my $record = { c_id => 0 };

View file

@ -82,6 +82,7 @@ sub mail_transport(){
if($dbt->{copri_conf}->{stage} ne "live"){
$mail_to = $mailxconf->{$sendref->{mailxcfg}}->{mail_to};
#$mail_to = 'admin2@sharee.bike';
$subject = "* offline Test * " . $sendref->{subject};
}
@ -104,16 +105,14 @@ sub mail_transport(){
$smtp->data();
$smtp->datasend("To: $mail_to\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("MIME-Version: 1.0\n");
$smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n");
$smtp->datasend("\n");
$smtp->datasend("\n") if(!$attachBinaryFile);
$smtp->datasend("MIME-Version: 1.0\n");
$smtp->datasend("Content-type: multipart/mixed;\n\tboundary=\"$boundary\"\n");
$smtp->datasend("\n");
$smtp->datasend("--$boundary\n");
#$smtp->datasend("Content-type: text/plain\n");
#$smtp->datasend("\nToday\'s files are attached:\n\nHave a nice day! :)\n");
$smtp->datasend("Content-Type: text/html; charset=UTF-8 \n\n");
$smtp->datasend($html);
$smtp->datasend("--$boundary\n");
$smtp->datasend("Content-Type: text/html; charset=UTF-8 \n\n");
$smtp->datasend("$html\n\n\n\n\n\n\n\n\n\n");
$smtp->datasend("\n");
if($attachBinaryFile){
@ -134,12 +133,11 @@ sub mail_transport(){
}
$smtp->datasend("\n");
close(DAT);
$smtp->datasend("--$boundary\r\n\r");
}
$smtp->datasend("--$boundary\r\n\r");
$smtp->dataend();
$smtp->quit;
} else {
print EMA $smtp->message();
}

View file

@ -535,6 +535,7 @@ sub save_contenttranspos {
$end_time = $dt1->strftime("%Y-%m-%d %H:%M:%S");
}
$bw->log("save_contenttranspos time-check: $c_id && $start_time && $end_time",$c_id,"");
if($c_id && $start_time && $end_time && $dt0 < $dtnow && $dt1 < $dtnow){
my $pref = {
@ -618,6 +619,7 @@ sub save_contenttranspos {
$ctpos2ck = $dbt->collect_post($dbh,$pref2ck);
#update bike content only if there is no later rental start
$bw->log("update bike content only if there is no later rental start: $ctpos->{cc_id} && !$ctpos2ck->{c_id}",$c_id,"");
if($ctpos->{cc_id} && !$ctpos2ck->{c_id}){
my $ctpref = {
table => "content",
@ -658,6 +660,8 @@ sub save_contenttranspos {
$feedb->{message} = "failure::Fehler, Änderung abgelehnt da Rechnung bereits gebucht";
}
}else{
$bw->log("save_contenttranspos time-check fails by: $c_id && $start_time && $end_time",$c_id,"");
}
}elsif($R::int02 && $R::int03){
$R::int02 =~ s/,/\./ if($R::int02 =~ /\,/);

View file

@ -394,7 +394,7 @@ sub fetch_rentalfeed {
$return->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int36}", "$ctpos->{int36} € / $time_unit"];
}elsif($td_template->{$td}->{int17} && $ctpos->{int17} && $ctpos->{int17} > 0){
$ctpos->{int17} =~ s/\./,/ if($lang eq "de");
$return->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$ctpos->{int17} € / Tag"];
$return->{rental_description}->{tarif_elements}->{$td} = ["$td_template->{$td}->{int17}","$ctpos->{int17} € / 24 Std"];
}elsif($td_template->{$td}->{time02} && $ctpos->{time02} =~ /[1-9]/){
$time_unit = $dbt->time_format($ctpos->{time02});
$time_unit .= " / Tag" if($dbt->{operator}->{$varenv->{dbname}}->{project} ne "Konstanz");

View file

@ -85,7 +85,12 @@ sub sms_ack_digest {
print FILE "---> request:\n" . Dumper($request);
my $ret_json = $self->get_sms_gtx($request);
my $ret_json = "";
if($sms_to =~ /^\+1/){
#no routing fix
$dbt->update_one($dbh,$ctadr,"int13=1");
}else{
$ret_json = $self->get_sms_gtx($request);
eval {
$response_in = decode_json($ret_json);
@ -95,6 +100,7 @@ sub sms_ack_digest {
print FILE "<--- failure raw response_in:\n" . Dumper($ret_json) . "\n";
warn $@;
}
}
close(FILE);