Example #1
0
if ($user->societe_id) {
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
$object = new Product($db);
$error = 0;
/*
 * Actions
 */
if ($action == 'update_price' && GETPOST("cancel")) {
    $action = '';
}
if ($action == 'update_price' && !GETPOST("cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) {
    $result = $object->fetch($id);
    $error = 0;
    $maxpricesupplier = $object->min_recommended_price();
    // MultiPrix
    if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
        $newprice = '';
        $newprice_min = '';
        $newpricebase = '';
        $newvat = '';
        for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
            if (isset($_POST["price_" . $i])) {
                $level = $i;
                $newprice = price2num($_POST["price_" . $i], 'MU');
                $newprice_min = price2num($_POST["price_min_" . $i], 'MU');
                $newpricebase = $_POST["multiprices_base_type_" . $i];
                $newnpr = preg_match('/\\*/', $_POST["tva_tx_" . $i]) ? 1 : 0;
                $newvat = str_replace('*', '', $_POST["tva_tx_" . $i]);
                $newpsq = GETPOST('psqflag');