FIX_Revert subcription invoice details save method
This commit is contained in:
parent
11eae83e0f
commit
0bca631a03
@ -570,17 +570,17 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
|
|||||||
|
|
||||||
$check_existing_customer_id = $subModel->where('invoice_id',$invoice_id)->findAll();
|
$check_existing_customer_id = $subModel->where('invoice_id',$invoice_id)->findAll();
|
||||||
//dd($check_existing_customer_id);
|
//dd($check_existing_customer_id);
|
||||||
if($check_existing_customer_id){
|
// if($check_existing_customer_id){
|
||||||
unset($data['created_by']);
|
// unset($data['created_by']);
|
||||||
log_message('info',json_encode($subscription_data));
|
// log_message('info',json_encode($subscription_data));
|
||||||
$where = ['invoice_id'=>$invoice_id];
|
// $where = ['invoice_id'=>$invoice_id];
|
||||||
$subModel->updateData($subscription_data,$where);//update the data
|
// $subModel->updateData($subscription_data,$where);//update the data
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
//insert the data
|
// //insert the data
|
||||||
unset($data['updated_by']);
|
// unset($data['updated_by']);
|
||||||
$model->insertSubscriptionData($subscription_data);
|
$model->insertupdateSubscriptionData($subscription_data,$invoice_status);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -350,9 +350,25 @@ public function getJoinedData($where, $orderby = [])
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertSubscriptionData($data)
|
public function insertupdateSubscriptionData($data,$invoice_status)
|
||||||
{
|
{
|
||||||
return $this->db->table('subscription')->insert($data);
|
if (!empty($data)) {
|
||||||
|
$invoice_id = $data['invoice_id'];
|
||||||
|
$customer_id = $data['customer_id'];
|
||||||
|
$scheme_id = $data['scheme_id'];
|
||||||
|
$data['isactive'] = $invoice_status === 'Approved' ? 1 : 0 ;
|
||||||
|
$where = ['invoice_id' => $invoice_id]; // invoice id refer with srinivasan // initally invoice id, scheme id and customer id
|
||||||
|
$query = $this->db->table('subscription')->select('sub_id')->where($where)->get()->getRow();
|
||||||
|
|
||||||
|
if (!empty($query)) {
|
||||||
|
unset($data['created_by']);
|
||||||
|
return $this->db->table('subscription')->where('sub_id', $query->sub_id)->update($data);
|
||||||
|
} else {
|
||||||
|
unset($data['updated_by']);
|
||||||
|
return $this->db->table('subscription')->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***********************REPORT**********************
|
// ***********************REPORT**********************
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user