Created
January 14, 2022 13:05
-
-
Save midoalone/d0c4cb1bb45621d3a7fb7750b9032653 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_new_sales_item_post($item, $rel_id, $rel_type) | |
{ | |
$custom_fields = false; | |
if (isset($item['custom_fields'])) { | |
$custom_fields = $item['custom_fields']; | |
} | |
$CI = &get_instance(); | |
$CI->db->insert(db_prefix() . 'itemable', [ | |
'description' => $item['description'], | |
'long_description' => nl2br($item['long_description']), | |
'qty' => $item['qty'], | |
'rate' => number_format($item['rate'], get_rate_decimals_place(), '.', ''), | |
'rel_id' => $rel_id, | |
'rel_type' => $rel_type, | |
'item_order' => $item['order'], | |
'unit' => $item['unit'], | |
]); | |
$id = $CI->db->insert_id(); | |
if ($custom_fields !== false) { | |
handle_custom_fields_post($id, $custom_fields); | |
} | |
return $id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment