コード例 #1
0
} elseif ($n > 0 && $sugarbean->active == 'off' && $sugarbean->default == 'on') {
    echo '<script>alert("' . $mod_strings['LBL_CANT_DEACTIVETE_DEFAULT_RATE'] . '")</script>';
    echo "<script>window.location='index.php?action=EditView&module={$sugarbean->module_dir}&record={$sugarbean->id}&return_module={$sugarbean->module_dir}';</script>";
} else {
    if (isset($_REQUEST['default']) && $_REQUEST['default'] == 'on' || $sugarbean->default == 'on') {
        $query = ' UPDATE ' . $sugarbean->table_name . ' SET ' . $sugarbean->table_name . '.default="off" WHERE ' . $sugarbean->table_name . '.default="on" AND inks_number="' . $_REQUEST['inks_number'] . '" AND pressmachine_id="' . $_REQUEST['pressmachine_id'] . '"';
        $result = $sugarbean->db->query($query, true, "Error ");
    }
    if (!$sugarbean->ACLAccess('Save')) {
        ACLController::displayNoAccess(true);
        sugar_cleanup(true);
    }
    $sugarbean->save($GLOBALS['check_notify']);
    $return_id = $sugarbean->id;
    $priceLine1 = new Pricelistline();
    $priceLine1->mark_deletedBypricelistid($return_id);
    $count = count($_POST);
    $keys = array_keys($_POST);
    $sum = 0;
    $s = 0;
    for ($i = 0; $i < $count; $i++) {
        //echo $keys[$i]."<br>";
        if (substr_count($keys[$i], "impressions_number_") > 0) {
            $index = substr($keys[$i], -1, 1);
            $data[] = array('impressions_number' => $_POST["impressions_number_" . $index], 'base_price' => $_POST["base_price_" . $index], 'step_price' => $_POST["step_price_" . $index]);
            $s = $s + 1;
            /*  */
        }
    }
    foreach ($data as $res) {
        $sortData[] = $res['impressions_number'];