示例#1
0
    	if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
		{
			$object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ;
			$result = -1 ;
		}
		else
		{
			// Insert line
			$result = $object->addline(
	                $desc,
	                $pu_ht,
	                $_POST["pqty"],
	                $tva_tx,
	                $localtax1_tx,
	                $localtax2_tx,
	                $_POST["idprod"],
	                $_POST["premise"],
	                $date_start,
	                $date_end,
					$price_base_type,
					$pu_ttc,
					$info_bits
	                );
		}

		if ($result > 0)
		{
		/*
			// Define output language
			$outputlangs = $langs;
			$newlang='';
                             }
                             if (!empty($newlang)) {
                                 $outputlangs = new Translate("", $conf);
                                 $outputlangs->setDefaultLang($newlang);
                             }
                             $label = !empty($prod->multilangs[$outputlangs->defaultlang]["libelle"]) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
                         } else {
                             $label = $lines[$i]->product_label;
                         }
                         if ($conf->global->PRODUIT_DESC_IN_FORM) {
                             $desc .= $lines[$i]->desc && $lines[$i]->desc != $lines[$i]->libelle ? dol_htmlentitiesbr($lines[$i]->desc) : '';
                         }
                     } else {
                         $desc = dol_htmlentitiesbr($lines[$i]->desc);
                     }
                     $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->date_start, $lines[$i]->date_end, 'HT', 0, $lines[$i]->info_bits, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht);
                     if ($result < 0) {
                         $error++;
                         break;
                     }
                 }
             }
         } else {
             setEventMessage($srcobject->error, 'errors');
             $error++;
         }
     } else {
         setEventMessage($object->error, 'errors');
         $error++;
     }
 } else {