I know how to add new action menu button with custom code, but I can’t find out how and where to customize the common ‘duplicate’ function of the action menu of a module detailed view.
For instance, I want to customize the prefilled value of the ‘valid until date’ of a quote when duplicating it from an existing one.
Is there a way to to that?
But one class is called EditView and the other extends ViewEdit, so something is escaping me here. I don’t have time now to do any additional searching, but I do hope that with this help you can find it out for yourself.
I could then find out an easy way to customize as an example the ‘expiration’ prefilled value when duplicating a quote, by modifying the file ‘modules/AOS_Quotes/views/view.edit.php’ (or place a copy in 'custom/modules/AOS_Quotes/views/ directory to be upgrade safe).
I just replaced the function display():
function display(){
$this->populateQuoteTemplates();
parent::display();
}
by this one:
function display(){
$this->populateQuoteTemplates();
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true' ) {
$this->bean->expiration=date('d/m/Y', strtotime("+30 days"));
}
parent::display();
}
I am not sure it is the best way to do this, but it works.