Esempio n. 1
0
//////////////////////////////
if (isset($_REQUEST['email_id'])) {
    $sugarbean->email_id = $_REQUEST['email_id'];
}
if (!$sugarbean->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
if (!isset($sugarbean->product_id) || is_null($sugarbean->product_id) || empty($sugarbean->product_id)) {
    $product = new Products();
    $product->account_id = $_REQUEST['account_id'];
    $product->account_name = $_REQUEST['account_name'];
    $product->contact_id = $_REQUEST['contact_id'];
    $product->contact_name = $_REQUEST['contact_name'];
    $product->name = $_REQUEST['product_name'];
    $product->pnum = 'PRD' . $product->generate_number('pnum', $product->table_name);
    //TO DO GENERATE NUMBER
    $product->save($GLOBALS['check_notify']);
    $sugarbean->product_id = $product->id;
} else {
    $product = new Products();
    $product->retrieve($sugarbean->product_id);
}
$sugarbean->save($GLOBALS['check_notify']);
$product->clientrequest_id = $sugarbean->id;
$product->save($GLOBALS['check_notify']);
if (isset($_REQUEST['status_action']) && !empty($_REQUEST['status_action'])) {
    $productstatus->update_product_status($_REQUEST['status_action'], $sugarbean, $old_status);
} else {
    $productstatus->update_product_status($_REQUEST['status'], $sugarbean, $old_status);
}
Esempio n. 2
0
//////////////////////////////
if (isset($_REQUEST['email_id'])) {
    $sugarbean->email_id = $_REQUEST['email_id'];
}
if (!$sugarbean->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
if (!isset($sugarbean->product_id) || is_null($sugarbean->product_id) || empty($sugarbean->product_id)) {
    $product = new Products();
    $product->account_id = $_REQUEST['account_id'];
    $product->account_name = $_REQUEST['account_name'];
    $product->contact_id = $_REQUEST['contact_id'];
    $product->contact_name = $_REQUEST['contact_name'];
    $product->name = $_REQUEST['product_name'];
    $product->number = 'PRD' . $product->generate_number('number', $product->table_name);
    //TO DO GENERATE NUMBER
    $product->save($GLOBALS['check_notify']);
    $sugarbean->product_id = $product->id;
} else {
    $product = new Products();
    $product->retrieve($sugarbean->product_id);
}
$sugarbean->save($GLOBALS['check_notify']);
$product->clientorder_id = $sugarbean->id;
$product->save($GLOBALS['check_notify']);
$sugarbean->save($GLOBALS['check_notify']);
if (isset($_REQUEST['add_component']) && $_REQUEST['add_component'] != "") {
    $_REQUEST['return_url'] = 'index.php?module=EstimateComponents&action=EditView&return_module=' . $_REQUEST['parent_bean'] . '&add_component=true&return_id=' . $sugarbean->id . '&return_action=EditView&parent_id=' . $sugarbean->id . '&parent_name=' . $sugarbean->name . '&parent_bean=' . $_REQUEST['parent_bean'];
}
//$sugarbean->status_update('',$sugarbean->id);
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->assigned_name) && empty($focus->id)) {
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
//Assign editview fileds
$xtpl->assign("ACCOUNT_NAME", $focus->account_name);
$xtpl->assign("ACCOUNT_ID", $focus->account_id);
$xtpl->assign("CONTACT_NAME", $focus->contact_name);
$xtpl->assign("CONTACT_ID", $focus->contact_id);
$xtpl->assign('description', $focus->description);
if (empty($focus->pnum)) {
    $focus->pnum = 'PRD' . $focus->generate_number('pnum', $focus->table_name);
}
$xtpl->assign("pnum", $focus->pnum);
$xtpl->assign('note', $focus->note);
$xtpl->assign('quantity', $focus->quantity);
$xtpl->assign('fsize_h', $focus->fsize_h);
$xtpl->assign('fsize_w', $focus->fsize_w);
$xtpl->assign('volume', $focus->volume);
$xtpl->assign('samples', $focus->samples);
$xtpl->assign('file', $focus->file);
$xtpl->assign("SAMPLES_OPTIONS", get_select_options_with_id($app_list_strings['product_samples_dom'], $focus->samples));
$xtpl->assign("FILE_OPTIONS", get_select_options_with_id($app_list_strings['product_file_dom'], $focus->file));
$xtpl->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['products_category_options'], $focus->category));
$xtpl->assign("PERIOD_OPTIONS", get_select_options_with_id($app_list_strings['products_period_options'], $focus->period));
$xtpl->assign("FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());