$result = $object->fetch($id, $ref); $objectid = $object->id; $id = $object->id; } /* * Actions */ if ($cancel) { $action = ''; } // Action association d'un sousproduit if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer)) { $error = 0; for ($i = 0; $i < $_POST["max_prod"]; $i++) { if ($_POST["prod_qty_" . $i] > 0) { if ($object->add_sousproduit($id, $_POST["prod_id_" . $i], $_POST["prod_qty_" . $i], $_POST["prod_incdec_" . $i]) > 0) { //var_dump($id.' - '.$_POST["prod_id_".$i].' - '.$_POST["prod_qty_".$i]);exit; $action = 'edit'; } else { $error++; $action = 're-edit'; if ($object->error == "isFatherOfThis") { setEventMessage($langs->trans("ErrorAssociationIsFatherOfThis"), 'errors'); } else { setEventMessage($object->error, 'errors'); } } } else { if ($object->del_sousproduit($id, $_POST["prod_id_" . $i]) > 0) { $action = 'edit'; } else {
/* * Actions */ // Action association d'un sousproduit if ($action == 'add_prod' && $cancel <> $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { $error=0; for($i=0;$i<$_POST["max_prod"];$i++) { // print "<br> : ".$_POST["prod_id_chk".$i]; if($_POST["prod_id_chk".$i] != "") { if($product->add_sousproduit($id, $_POST["prod_id_".$i],$_POST["prod_qty_".$i]) > 0) { $action = 'edit'; } else { $error++; $action = 're-edit'; if ($product->error == "isFatherOfThis") $mesg = $langs->trans("ErrorAssociationIsFatherOfThis"); else $mesg=$product->error; } } else { if ($product->del_sousproduit($id, $_POST["prod_id_".$i]) > 0) {