I am working on modifying the out of the box module, Quotes (renamed Estimates) so that all newly created quotes are assigned to Administrator by default no matter what user is logged in and creating quotes.
I have been able to follow the post: #22760 Change Default Assigned To so that when I create a new quote/estimate the assigned to field does auto populate with Administrator. But when I click on save, the assigned to field changes to whoever Iām logged in as (not administrator).
I was able to fix this issue by adding this line to AOS_Quotes.php in the custom/modules/AOS_Quotes directory: $assigned_user_id=$_POST[ā1ā];
I added this line in the save function:
function save($check_notify = false)
{
global $sugar_config;
if (empty($this->id) || $this->new_with_id
|| (isset($_POST['duplicateSave']) && $_POST['duplicateSave'] == 'true')) {
if (isset($_POST['group_id'])) {
unset($_POST['group_id']);
}
if (isset($_POST['product_id'])) {
unset($_POST['product_id']);
}
if (isset($_POST['service_id'])) {
unset($_POST['service_id']);
}
$assigned_user_id=$_POST['1'];
So now the assigned to user displays as administrator and saves as administrator when anyone other than administrator creates a new quote/estimate.
However, this only works when I go to the Quotes/Estimates module and click on create quote/estimate. It does not work if I go to the customer account and then the subpanel quote/estimate and click create (which I believe is quick create).
https://pasteboard.co/I3gwZAO.jpg
Thank you
Versions:
SuiteCRM 7.10.7
PHP 7.2
SQL Server 2014
Windows Server 2012 R2
Chrome 71.0.3578.98