####  WST Quoting Module readme 
Quoting Module Integration for Preferred Machine, LLC Created by World Source Tech, LLC using FreeScout ticketing API.
Contact: help@projects.worldsourcetech.com 

0. Conventions
    a) WST files, additions, and modifications are preceeded in comments by "### WST" 

1. Core Files for ERP that have been edited:

    a) editOrders.php 
        i) all modifications have been highlighed within comments to identify a the change just like below:
            eg: "### WST ADDITION FOR QUOTE REQUEST TRACKING ###" 
        ii) The end of the modification is shown with a commented "###"

    b) updateOrder.php
    
    c) menu.php
        i) We added the menu items for Quote Request, Quote Request Reporting, and New Quote Request in the Sales Menu Category


2. Database Modifications

    a) Add New Table for Quote Requests to realte sales orders to Requests
        i) TABLE: quotes_have_requests 
        ii) File db.sql in this folder has CREATE TABLE statement ready to go for schema ebdb 
       

3. Core Files Have been Added

    a) quoteRequests.php
    b) quoteRequestDetails.php
    c) quoteRequestReporting.php 
    d) searchCustomers.php
    e) searchAllOrders.php
    f) getQuoteDetails.php

4. Vendor Folder for Most Functions

    a) vendors/wstModules/quoting 
    b) vendors/wstModules/quoting/ajax
       i) vendors/wstModules/quoting/ajax/reports
    c) vendors/wstModules/quoting/js

5. Usage 
 i) The ticketing system uses the freescout api to read emails from quotes@preferredmachinellc.com (or whatever other email is setup) and display them in the ERP
 ii) Users can reply to any email directly from the ERP, they can modify the status to Pending, Closed, Spam, or Active, and can attach and existing Sales Order to the quote request or creqte a new one to relate to the request.
 iii) Walk in / phone quote requests can be generated via "Create New" feature where the request is generated in house by an employ and the customer or "Walk In" is selected. Then, a sales order can be created from the request which will tie the request to the sales order for reporting purposes.
 iv) **new feature (switch pending and active status meanings) Freescout defaults to new inbound emails as active, and replies as pending - Preferred decided to reverse this convention - we have made this reversal in the drop down selects for status and in the commented
     a) To modify the status of a quoteRequest, send a POST request to /vendor/wstModules/quotes/ajax/updateStatusOnly with the following POST values;
        1) $_POST['conversation'] the conversation id.
        2) $_POST['newStatus']; the new status [only 4 options currently] (active,pending,closed,spam)
        3) $user = $_POST['user']; the userID making the request
        4) $switch = $_POST['switch']; should be 'true' in most cases unless you switched the value/text for pending/active already on the front end.
v) **new feature highlight a previously closed ticket that has been reopned by customer reply 
    a) When a ticket is set to closed by preferred (or if chris) it is tagged "closedbypreferred" 
       1) If a customer replies to this ticket it will move back to pending and be highlighted with red text
       2) Replying to the ticket will remove this red-status and remove the closedbypreferred status unless it is re-closed 
        


 6. Important notes
 i) From time to time an new gmail application password may need to be generated and input into freescout (as per Gmail policy)
   a) This link explains how to generate the app password: https://support.google.com/mail/answer/185833?hl=en-GB 
   b) You can then login to https://worldsourcedev.com/freescout and update the mailbox imap connection setting for password 
     i) You can also just email help@projects.worldsourcetech.com to submit a ticket and we can do this for you.
     ii) You will know this needs to be done if no quote requests are showing on any of the quote request screens - indicating the mailbox could not be authenticated ( a new pw is needed) - a text error message should also show indicating this. 