mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-10 05:56:27 +02:00
coupon adding masscode
This commit is contained in:
parent
dd9be5f40e
commit
de85786bc0
4 changed files with 38 additions and 12 deletions
|
@ -714,14 +714,31 @@ sub save_transact(){
|
|||
|
||||
my $ctt = { c_id => 0 };
|
||||
$ctt = $dbt->fetch_record($dbh_operator,$pref);
|
||||
if($ctt->{c_id} > 0){
|
||||
#TODO, fetch coupon in user context to restrict mass inserts
|
||||
$pos_id = $dbt->insert_pos($dbh_operator,$ctt->{c_id},$ct,$ctadr_operator,"",$now_dt,$ct->{ct_name},"0",$owner);
|
||||
}else{
|
||||
my $ct_id = $dbt->insert_contenttrans($dbh_operator,$ctadr_operator,"300008","218","----",$owner);
|
||||
$pos_id = $dbt->insert_pos($dbh_operator,$ct_id,$ct,$ctadr_operator,"",$now_dt,$ct->{ct_name},"0",$owner);
|
||||
}
|
||||
|
||||
|
||||
my $posref = {
|
||||
table => "contenttrans",
|
||||
table_pos => "contenttranspos",
|
||||
fetch => "one",
|
||||
keyfield => "c_id",
|
||||
ca_id => "$ctadr->{c_id}",
|
||||
ct_name => "ilike::$valxx",
|
||||
};
|
||||
my $cttpos = { c_id => 0 };
|
||||
$cttpos = $dbt->collect_post($dbh_operator,$posref);
|
||||
|
||||
#check if user has still coupon used
|
||||
if(!$cttpos->{c_id}){
|
||||
if($ctt->{c_id} > 0){
|
||||
$pos_id = $dbt->insert_pos($dbh_operator,$ctt->{c_id},$ct,$ctadr_operator,"",$now_dt,$valxx,"0",$owner);
|
||||
}else{
|
||||
my $ct_id = {c_id => 0};
|
||||
$ct_id = $dbt->insert_contenttrans($dbh_operator,$ctadr_operator,"300008","218","----",$owner);
|
||||
$pos_id = $dbt->insert_pos($dbh_operator,$ct_id,$ct,$ctadr_operator,"",$now_dt,$valxx,"0",$owner);
|
||||
}
|
||||
}else{
|
||||
$ret = "failure::conflict_txt16#top";
|
||||
}
|
||||
|
||||
if($pos_id){
|
||||
$ret = "success::txt16";
|
||||
$dbt->update_content4comp($dbh_operator,$ct->{c_id},"-","1");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue