diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-cart.php b/backend/app/plugins/wiaas/includes/class-wiaas-cart.php index df8c358..d6d2838 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-cart.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-cart.php @@ -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 ) ) )); diff --git a/backend/app/plugins/wiaas/includes/db/class-wiaas-shop-db.php b/backend/app/plugins/wiaas/includes/db/class-wiaas-shop-db.php index 83bbd75..5885d68 100644 --- a/backend/app/plugins/wiaas/includes/db/class-wiaas-shop-db.php +++ b/backend/app/plugins/wiaas/includes/db/class-wiaas-shop-db.php @@ -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); diff --git a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php index 2917221..a977dfc 100644 --- a/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php +++ b/backend/app/plugins/wiaas/includes/delivery-process/class-wiaas-delivery-process-action.php @@ -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 ); } diff --git a/frontend/src/actions/orders/customerAcceptanceActions.js b/frontend/src/actions/orders/customerAcceptanceActions.js index 7fec4e1..e3a4bd2 100644 --- a/frontend/src/actions/orders/customerAcceptanceActions.js +++ b/frontend/src/actions/orders/customerAcceptanceActions.js @@ -12,6 +12,7 @@ import { updateMessages } from '../notification/notificationActions'; import HtmlClient from '../../helpers/HtmlClient'; +import { fromWiaasCustomerAcceptance } from '../../helpers/ProcessHelper'; const htmlClient = new HtmlClient(); @@ -32,7 +33,11 @@ export const fetchCustomerAcceptance = (idOrder) => { }) .then(response => { if (response.data) { - dispatch(recieveCustomerAcceptance(response.data)); + dispatch( + recieveCustomerAcceptance( + fromWiaasCustomerAcceptance(response.data) + ) + ); } }) .catch(error => { diff --git a/frontend/src/actions/orders/customerQuestionnairesActions.js b/frontend/src/actions/orders/customerQuestionnairesActions.js index 5a86e86..6631ddd 100644 --- a/frontend/src/actions/orders/customerQuestionnairesActions.js +++ b/frontend/src/actions/orders/customerQuestionnairesActions.js @@ -1,6 +1,8 @@ import { API_SERVER } from '../../config'; +import { fromWiaasCustomerQuestionnaire } from '../../helpers/ProcessHelper'; + import { UPLOAD_CUSTOMER_QUESTIONNAIRE, @@ -41,7 +43,8 @@ export const fetchCustomerQuestionnaires = (idOrder) => { }) .then(response => { if (typeof response.data !== 'undefined') { - dispatch(receiveCustomerQuestionnaires(response.data)); + const questionnairesData = response.data.map(cData => fromWiaasCustomerQuestionnaire(cData)); + dispatch(receiveCustomerQuestionnaires(questionnairesData)); } }) .catch(error => { diff --git a/frontend/src/containers/cart/components/CartUploadDocument.jsx b/frontend/src/containers/cart/components/CartUploadDocument.jsx index 7d87618..67b71e7 100644 --- a/frontend/src/containers/cart/components/CartUploadDocument.jsx +++ b/frontend/src/containers/cart/components/CartUploadDocument.jsx @@ -70,10 +70,10 @@ class CartUploadDocument extends Component {
+ Drag and drop or click to replace {uploadedDocument.name}.{uploadedDocument.extension} +
+To upload multiple files, please pack the files to one zip-file and upload the zip-file
) : ( @@ -81,9 +81,10 @@ class CartUploadDocument extends Component {Drag and drop or click to upload file -
+ +To upload multiple files, please pack the files to one zip-file and upload the zip-file
) } diff --git a/frontend/src/containers/coMarket/components/CoMarketCatalogSelect.jsx b/frontend/src/containers/coMarket/components/CoMarketCatalogSelect.jsx index 4f519cf..19c63fc 100644 --- a/frontend/src/containers/coMarket/components/CoMarketCatalogSelect.jsx +++ b/frontend/src/containers/coMarket/components/CoMarketCatalogSelect.jsx @@ -25,10 +25,10 @@ class CoMarketCatalogSelect extends Component { } componentWillReceiveProps(nextProps){ - // if(nextProps.activeModule==='cart' && nextProps.shops && nextProps.cartItems && nextProps.cartItems.length > 0){ - // const cartShop = this.props.shops.find( shop => { return shop.id === this.props.cartItems[0].idCommercialLead }); - // nextProps.dispatch(selectShop(cartShop)); - // } + if(nextProps.activeModule==='cart' && nextProps.shops && nextProps.cartItems && nextProps.cartItems.length > 0){ + const cartShop = nextProps.shops.find( shop => { return shop.id === nextProps.cartItems[0].idCommercialLead }); + nextProps.dispatch(selectShop(cartShop)); + } if(nextProps.shops && nextProps.idCommercialLead && nextProps.activeModule === 'co-market'){ const shop = nextProps.shops.find( shop => {return shop.id === nextProps.idCommercialLead }); diff --git a/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx b/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx index 0d2c570..98defb4 100644 --- a/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx +++ b/frontend/src/containers/orders/components/process/CustomerAcceptance.jsx @@ -139,6 +139,7 @@ class CustomerAcceptance extends Component { activeClassName="upload-file-accept" onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(step.idOrder, acceptedFiles, rejectedFiles)}}>To upload multiple files, please pack the files to one zip-file and upload the zip-file
{comment.value}
To upload multiple files, please pack the files to one zip-file and upload the zip-file
@@ -79,12 +81,21 @@ class ValidateQuestionnaireItem extends Component {{comment.value}
+