function update

This commit is contained in:
magepeopleteam 2021-05-03 08:51:16 +00:00
parent 124232f80d
commit e9ef623822
1 changed files with 60 additions and 27 deletions

View File

@ -492,34 +492,59 @@ if (!function_exists('mep_attendee_extra_service_create')) {
function mep_check_attendee_exist_before_create($order_id,$event_id){
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
$pending_status_filter = array(
'key' => 'ea_order_status',
'value' => 'pending',
'compare' => '='
);
$hold_status_filter = array(
'key' => 'ea_order_status',
'value' => 'on-hold',
'compare' => '='
);
$processing_status_filter = array(
'key' => 'ea_order_status',
'value' => 'processing',
'compare' => '='
);
$completed_status_filter = array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
);
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_order_id',
'value' => $order_id,
'compare' => '='
)
),
array(
'relation' => 'AND',
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_order_id',
'value' => $order_id,
'compare' => '='
),
array(
'key' => 'ea_order_status',
'value' => 'pending',
'compare' => '='
)
'relation' => 'OR',
$pending_status_filter,
$hold_status_filter,
$processing_status_filter,
$completed_status_filter
)
)
);
$loop = new WP_Query($args);
)
);
$loop = new WP_Query($args);
return $loop->post_count;
}
@ -564,14 +589,18 @@ function mep_check_attendee_exist_before_create($order_id,$event_id){
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
foreach ($user_info_arr as $_user_info) {
if($check_before_create < count($user_info_arr)){
mep_attendee_create('user_form',$order_id,$event_id,$_user_info);
}
}
}else{
foreach($event_ticket_info_arr as $tinfo){
for ($x = 1; $x <= $tinfo['ticket_qty']; $x++) {
mep_attendee_create('billing',$order_id,$event_id,$tinfo);
if($check_before_create < count($event_ticket_info_arr)){
mep_attendee_create('billing',$order_id,$event_id,$tinfo);
}
}
}
@ -599,13 +628,17 @@ function mep_check_attendee_exist_before_create($order_id,$event_id){
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
foreach ($user_info_arr as $_user_info) {
if($check_before_create < count($user_info_arr)){
mep_attendee_create('user_form',$order_id,$event_id,$_user_info);
}
}
}else{
foreach($event_ticket_info_arr as $tinfo){
for ($x = 1; $x <= $tinfo['ticket_qty']; $x++) {
mep_attendee_create('billing',$order_id,$event_id,$tinfo);
if($check_before_create < count($event_ticket_info_arr)){
mep_attendee_create('billing',$order_id,$event_id,$tinfo);
}
}
}