CRM - Lock fields in certain view - dynamics-crm-2013

In the entity Quote for example, there is a view on the form that shows what products have been selected for the quote, with the ability to view;
Product Name
Price Per Unit
Quantity
Discount
Extended Amount
My issue is that Product Name, Price Per Unit and Extended Amount are locked on the view therefore cannot be changed.
I would like to do the same for discount, any suggestions?

Currently, you cannot change the behavior of this default line item view so you have a few options:
Create your own quote line item view and show that in place of the system view. The drawback here is your view will not allow you to do in-line edits - you would have to open the quote item to edit each entry.
Create a synchronous plugin on the QuoteDetail entity's pre-processing add and update event which is filtered on the discount field. This plugin would simply throw an exception whenever a non-zero amount is attempted to be pushed through. This effectively makes the discount field disabled as any entry will result in an error on save.

Related

define custom WHMCS invoice status

I need to create a custom invoice status for "Disputed" payments.
I found an article that said to just modify the status column in the DB table 'tblinvoices' with the desired status, but doing this doesn't register that as a status in the sense that the invoice PDF would show "DISPUTED" instead of this and the admin view of the invoice looks like this (note the upper right-hand corner where it would normally say the status like PAID, UNPAID, DRAFT, etc. is blank) and the client view of the invoice looks like this (note the upper right-hand corner where it would normally say the status like PAID, UNPAID, DRAFT, etc. is blank) and lastly the invoice list (overall, not on the client page) shows the status as unrecognised as you can see here
Things are not displayed properly cuz of lack of language translates. You should add proper translations for newly created status in language files for user and administrator in your WHMCS installation. https://developers.whmcs.com/languages/overrides/

Automatically register payment and generate invoice when amount is zero

When pressing the "Confirm Sale" button, even if the total amount to be paid is zero (because of the 100% discount), the Register Payment popup is getting displayed - and I need to press Cancel in the popup to proceed (generate invoice & and mark it as paid).
Can I bypass displaying the popup - automatically generate the invoice and mark it as paid?
Please let me know.
Thanks.
There are two ways you can achieve this.
Write a module to overwrite the buttons named Create Invoice method and call a method to check if the total amount is zero then prepare the invoice values and automatically generate the invoice and view if needed. The rest with non-zero amount should follow the wizard path.
Create an automated action, where you can filter the SOs which are confirmed and has zero total and automatically create the invoices. You can combine this with scheduled actions to check it every X minutes or hours. This can be tricker than explained and may require some coding in the action.

How to hide out of stock products and its categories in Volusion

I have Volusion store I want to do the following, If it is possible??
If Qty = 0 (out of stock) do not display the product as well as it category.
When Qty changes display. (this will eliminate clutter)
If Product in Category = 0. Do not display the category
For example Home > New > Digital Signage has 0 products,
Then do not display the category - Until there are product in the category.
From Volusion's support article.
https://support.volusion.com/hc/en-us/articles/209957467-How-to-Use-the-Hide-When-Out-of-Stock-Option
How to Use the Hide When Out of Stock Option
When an order placed in your store causes the stock status of a product to drop to zero or below, your store will hide the product, provided the Hide When Out Of Stock setting (on the product's Advanced Info > Product Display tab) is set.
This will prevent the product from being viewed by customers on your store front until the product's stock value is incremented (either manually or through processing an RMA or purchase order). You can learn more about using the hide function by reviewing the Marking a Product as Hidden article.
Note that if any of your products have options for your customers to select from, you may wish to hide certain options when the associated product variant is out of stock, while leaving other options visible. The best way to automatically hide out-of-stock product options is by using Smart Match and the Inventory Control Grid.
Automatically Hiding When Out of Stock
Note that the Hide When Out Of Stock function only activates if the stock status of a product drops to zero or below due to a purchase. If you explicitly set the stock status to zero within a product's settings, it will not automatically trigger this setting. To manually hide a product from view on your store front, enable the Hide Product option within the Advanced Info > Product Display tab.
Furthermore, in order for products to automatically be hidden when out of stock, products need to be configured to not allow backorders. To do this, go to Settings > Config Variables and select the Checkout Variables. Make sure the Enable Back Orders check box is not selected. This will prevent Volusion from allowing any products at a stock less than 1 from being ordered and will allow the Hide When Out Of Stock variable to engage for all products.
If you have some products that you want to do this for and some you don't, you can set Enable Back Orders at a global level as described above but select the Do Not Allow Backorders check box for specific products under the Stock tab.
Note on Stock Value Updates
Briefly mentioned above, Volusion's Hide When Out Of Stock will inversely update products: Any product using this function will be automatically unhidden when the stock status for a product is updated to a positive quantity. Product stock can be updated manually from a product's settings page or automatically through the processing of an RMA or purchase order, or even through an import to your Volusion store's products table.
Also, please note that any product with Hide When Out Of Stock and Hide Product checked with a Stock Status set to Null (blank) or a positive value will be unhidden whenever any Stock Status is imported for any product in the store.
Please keep this function in mind when using this feature to prevent products you wish to remain hidden from being made available on your store front after product stock value updates.blockquote

Xrm.Page.ui.getFormType() returns 2 when create order from quote

When i am creating an order from quote, in onload Xrm.Page.ui.getFormType() returns me the value 2.
but the form is in create mode, so should return 1.
When you "win" a quote and a Sales Order is generated, there is no Create state presented by the UI - the system creates the new record in the background and then displays it. When you are presented with the new Sales Order through this process, it already has a record ID so Xrm.Page.ui.getFormType() will return 2, which is the Update state.
The only way to get the Create state (1) from Xrm.Page.ui.getFormType() would be to manually create a Sales Order. However, if you do this you will lose much of the convenience the system does automatically for you, such as copying over all fields with the same name (essentially duplicating the Quote data into the the new Sales Order).

Assign Tax Class to Products

I have (what I think is) a simple problem with my Magento tax classes. I have around 400 products in my shop and only 20 of them have a tax class assigned to it. I checked my database and the table "catalog_product_index_price" and all the products with the working tax have tax_class_id = 1 and all the not working ones have tax_class_id = 0.
So I thought I'll just update every product to tax_class_id = 1 and I'm done, but as soon as I re-indexed my prices in the Magento back-end the products got tax_class_id = 0 again.
Somewhere there must be a default, but I can't find it anywhere.
catalog_product_index_price is an index table, which is populated during reindexation process. It means that it pulls data from other tables and group them in this table for further use. That's why your changes were overridden after the reindex.
If you want to change tax_class_id for your products, the easiest option would be to use Mass Update* functionality in your admin panel. Open Manage Products section, select all products (select all), choose Update Attributes from action dropdown, and you'll be able to change Tax Class for all the products at once.
Try change it by hand by going to Catalog -> Manage Product -> Click on one -> Prices -> Tax Class.
Then have a look how it changes in the back end.
select * from catalog_product_index_price where entity_id = [[product_id]];
Best bet from here is to trace the SQL statement by changing pdo debug on by logging the sql statements: http://yauhen.yakimovich.info/blog/2011/03/21/log-all-sql-queries-in-magento/