mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 23:26:29 +02:00
Service-config save_template_desc
This commit is contained in:
parent
de85786bc0
commit
89e28f308f
8 changed files with 110 additions and 36 deletions
|
@ -164,7 +164,7 @@ sub handler {
|
|||
owner => "$owner",
|
||||
int01 => $q->escapeHTML($xmlref->{userID}),
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update,$record);
|
||||
my $rows = $dbt->update_record($dbh,$update,$record_e);
|
||||
|
||||
}elsif($xmlref->{todo} eq "update_LVuser" && $record->{c_id}){
|
||||
|
||||
|
|
|
@ -494,14 +494,20 @@ sub radiobox(){
|
|||
#$but->radiobox2("$key","$ctrel->{$key}","$a","$b","$c")
|
||||
sub radiobox2(){
|
||||
my $self = shift;
|
||||
my ($key,$val,$a_name,$b_name,$c_name) = @_;
|
||||
my $a_checked;
|
||||
my $b_checked;
|
||||
my $c_checked;
|
||||
my $key = shift;
|
||||
my $val = shift;
|
||||
my $a_name = shift || "";
|
||||
my $b_name = shift || "";
|
||||
my $c_name = shift || "";
|
||||
my $a_checked = "";
|
||||
my $b_checked = "";
|
||||
my $c_checked = "";
|
||||
$a_checked = "checked" if(!$val);
|
||||
$b_checked = "checked" if($val==1);
|
||||
$c_checked = "checked" if($val==2);
|
||||
my $checkb = "$a_name <input type='radio' name='$key' value='0' $a_checked> $b_name <input type='radio' name='$key' value='1' $b_checked>";
|
||||
my $checkb = "";
|
||||
$checkb .= " $a_name <input type='radio' name='$key' value='0' $a_checked>" if($a_name);
|
||||
$checkb .= " $b_name <input type='radio' name='$key' value='1' $b_checked>" if($b_name);
|
||||
$checkb .= " $c_name <input type='radio' name='$key' value='2' $c_checked>" if($c_name);
|
||||
return $checkb;
|
||||
}
|
||||
|
|
|
@ -841,9 +841,13 @@ sub update_one(){
|
|||
if($update->{table} eq "relation" && $update->{rel_id}){
|
||||
$where = "where rel_id = $update->{rel_id}";
|
||||
}
|
||||
if($update->{table} eq "template" && $update->{tpl_id}){
|
||||
$where = "where tpl_id = $update->{tpl_id}";
|
||||
}
|
||||
|
||||
|
||||
my $one = $one_in;
|
||||
if($update->{table} =~ /^users|relation|node/){
|
||||
if($update->{table} =~ /^users|relation|node|template/){
|
||||
$one .= ",change='now()'";
|
||||
}else{
|
||||
$one .= ",mtime='now()'";
|
||||
|
|
|
@ -147,7 +147,7 @@ sub handler {
|
|||
};
|
||||
$dbt->update_one($dbh,$update_users,"cookie='$coo'") if($users_dms->{u_id});
|
||||
|
||||
print redirect("$varenv{wwwhost}$path");
|
||||
print redirect("$varenv{wwwhost}");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ sub handler {
|
|||
}elsif($R::rel_edit eq "new_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->new_relation($R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "save_ctuser" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = "failure::under development, $node_meta->{tpl_name}";
|
||||
#$return = $pl->save_service_desc($users_dms);
|
||||
#$return = "failure::under development, $node_meta->{tpl_name}";
|
||||
$return = $pl->save_service_desc($R::c_id,$users_dms);
|
||||
}elsif($R::rel_edit && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pm->maininit($users_dms);
|
||||
}
|
||||
|
|
|
@ -458,24 +458,51 @@ sub set_usertarif {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
#save service-config
|
||||
sub save_service_desc {
|
||||
my $self = shift;
|
||||
my $c_id = shift;
|
||||
my $users_dms = shift;
|
||||
my @keywords = $q->param;
|
||||
my $dbh = "";
|
||||
my $c_tplid = {c_id => $c_id};
|
||||
my $update_ctuser = {
|
||||
table => "contentuser",
|
||||
template_id => "199",
|
||||
mtime => "now()",
|
||||
owner => "$users_dms->{u_id}",
|
||||
};
|
||||
|
||||
my @tpl_desc = ();
|
||||
my $update_template = {
|
||||
table => "template",
|
||||
tpl_id => "$c_id",
|
||||
owner => "$users_dms->{u_id}",
|
||||
};
|
||||
|
||||
open(FILE,">>$varenv{logdir}/save_service_desc.log") if($debug);
|
||||
print FILE "\n*Prelib--> $now_dt | ctpl_id $c_id | owner: $users_dms->{u_id}\n" if($debug);
|
||||
|
||||
my $tpl_order_desc = "c_id=ID=4=0=0,mtime=Zeitstempel=6=0=0,owner=von=3=0=0,barcode=Rad=3=0=0,txt01=Aufgaben=area5-8=0=0";
|
||||
foreach(@keywords){
|
||||
my @val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("@val");
|
||||
|
||||
if($_ =~ /txt\d/){
|
||||
print $_ . ":" . $valxx . "<br>\n";
|
||||
#@tpl_desc = $q->param($_);
|
||||
$valxx =~ s/\s/=/g;
|
||||
print FILE $_ . ":" . $valxx . "<br>\n";
|
||||
#txt01:int01=Reifen-Bremse-Lampe=checkbox=10=2
|
||||
if($_ =~ /txt\d+/ && $valxx =~ /int\d+=\w+/){
|
||||
$update_ctuser->{$_} = "$valxx";
|
||||
$tpl_order_desc .= ",$valxx";
|
||||
}
|
||||
}
|
||||
#my $tpl_obj = join('=',@tpl_desc);
|
||||
#print $tpl_obj . "<br> \n";
|
||||
print FILE "update contentuser c_id:$c_id\n" . Dumper($update_ctuser) . "\n";
|
||||
print FILE "update template tpl_id:$c_id\n" . $tpl_order_desc . "\n";
|
||||
|
||||
my $rows = 0;
|
||||
$rows = $dbt->update_record($dbh,$update_ctuser,$c_tplid);
|
||||
$rows = $dbt->update_one($dbh,$update_template,"tpl_order='$tpl_order_desc'");
|
||||
|
||||
close(FILE) if($debug);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -726,6 +726,8 @@ sub save_transact(){
|
|||
my $cttpos = { c_id => 0 };
|
||||
$cttpos = $dbt->collect_post($dbh_operator,$posref);
|
||||
|
||||
#for now used only for LNdW
|
||||
if($operator_conf->{database}->{dbname} eq "sharee_kn"){
|
||||
#check if user has still coupon used
|
||||
if(!$cttpos->{c_id}){
|
||||
if($ctt->{c_id} > 0){
|
||||
|
@ -738,6 +740,7 @@ sub save_transact(){
|
|||
}else{
|
||||
$ret = "failure::conflict_txt16#top";
|
||||
}
|
||||
}
|
||||
|
||||
if($pos_id){
|
||||
$ret = "success::txt16";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue