Record conversion
In the latest version the handling of record conversion (converting a Quote to a SalesOrder, or a SalesOrder to an Invoice...) has been generalized and centralized in a single place.
The list of available conversion modes is now in the table vte_convertmodes, which is managed by the class ConvertModesUtils which gives the possibility to add new conversion modes between standard or custom modules.
For example, to add a new conversion mode from module Quote, to a custom module (with products) PreOrders:
// instantiate the utils class
$CMU = ConvertModesUtils::getInstance();
// define the mapping for the fields, key is destination field, value is the source
$mapping = [
// dest => source
'vcf_1_1' => 'subject',
'description' => 'description'
];
// add the convert mode
$CMU->addConvertMode(
'quotetopreorder', // unique name for the mode, can be any string
'Quotes', // starting module
'PreOrders', // second module
'record', // the parameter in request that will pass the record id. by default "record"
'quoteid', // name of the field in the destination module with a reference to the first module, can be null
true, // if true, show the button in Quotes
5, // sequence of the button, among other conversion buttons
'handleRecordConversion', // the method to handle the conversion. You can specify a different one in the PreOrders class if you wish to do something different
$mapping // the fields mapping. products block is automatically copied
);
