documents fix
This commit is contained in:
@@ -740,6 +740,7 @@ class Wiaas_Cart {
|
||||
|
||||
$documents_ids = array();
|
||||
|
||||
// Retrieve all document ids attached to cart content
|
||||
foreach ($items as $key => $item) {
|
||||
if (!isset($item['_wiaas_standard_package'])) {
|
||||
continue;
|
||||
@@ -757,16 +758,19 @@ class Wiaas_Cart {
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve all customer visible template documents attached to cart content
|
||||
$q = new WP_Query();
|
||||
$retrieved_items = $q->query(array(
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'wiaas_doc',
|
||||
'post__in' => array_keys($documents_ids),
|
||||
'meta_key' => '_wiaas_doc_visible',
|
||||
'meta_value' => 'yes', // visible to customer
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wiaas_doc_type',
|
||||
'field' => 'slug',
|
||||
'terms' => array_keys(self::$cart_doc_types),
|
||||
'terms' => array_keys(self::$cart_doc_types), // templates only
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
@@ -147,7 +147,7 @@ class Wiaas_Shop_DB {
|
||||
|
||||
$shops = array_map(function($result_row) {
|
||||
return array(
|
||||
'owner_id' => $result_row->shop_owner_id,
|
||||
'owner_id' => absint($result_row->shop_owner_id),
|
||||
'order_type' => $result_row->order_type
|
||||
);
|
||||
}, $results);
|
||||
|
||||
@@ -308,6 +308,7 @@ class Wiaas_Delivery_Process_Action {
|
||||
|
||||
$documents[] = array(
|
||||
'name' => $info['basename'],
|
||||
'extension' => $info['extension'],
|
||||
'url' => $acceptance_documents_field->get_download_url( $file_path, true )
|
||||
);
|
||||
}
|
||||
@@ -365,18 +366,25 @@ class Wiaas_Delivery_Process_Action {
|
||||
|
||||
$document = array(
|
||||
'name' => $info['basename'],
|
||||
'extension' => $info['extension'],
|
||||
'url' => $document_field->get_download_url( $file_path, true )
|
||||
);
|
||||
|
||||
$discussion_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'workflow_discussion')[0];
|
||||
$discussion_items = json_decode($action_entry[$discussion_field->id], ARRAY_A);
|
||||
|
||||
$formated_comments = array();
|
||||
$formatted_comments = array();
|
||||
|
||||
if (is_array($discussion_items)) {
|
||||
foreach ($discussion_items as $item) {
|
||||
|
||||
$formated_comments[] = $discussion_field->format_discussion_item( $item, 'text', $action_entry_id );
|
||||
$formatted = $discussion_field->format_discussion_item( $item, 'text', $action_entry_id );
|
||||
$formatted = explode("\n", $formatted);
|
||||
|
||||
$formatted_comments[] = array(
|
||||
'header' => $formatted[0],
|
||||
'value' => $formatted[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +416,7 @@ class Wiaas_Delivery_Process_Action {
|
||||
'action_id' => $action_entry['id'],
|
||||
'document' => $document,
|
||||
'status' => $status,
|
||||
'comments' => $formated_comments
|
||||
'comments' => $formatted_comments
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user