// Update all child soc print '<tr><td width="15%">'; print $langs->trans('ForceUpdateChildPriceSoc'); print '</td>'; print '<td>'; print '<input type="checkbox" name="updatechildprice" value="1"/>'; print '</td>'; print '</tr>'; print '</table>'; print '<center><br><input type="submit" class="button" value="' . $langs->trans("Save") . '"> '; print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '"></center>'; print '<br></form>'; } elseif ($action == 'edit_customer_price') { // Edit mode print_fiche_titre($langs->trans('PriceByCustomer')); $result = $prodcustprice->fetch(GETPOST('lineid', 'int')); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '" method="POST">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="update_customer_price_confirm">'; print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">'; print '<table class="border" width="100%">'; print '<tr>'; print '<td>' . $langs->trans('Product') . '</td>'; $staticprod = new Product($db); $staticprod->fetch($prodcustprice->fk_product); print "<td>" . $staticprod->getNomUrl(1) . "</td>"; print '</tr>'; // VAT
/** * Load an object from its id and create a new one in database * * @param int $fromid of object to clone * @return int id of clone */ function createFromClone($fromid) { global $user, $langs; $error = 0; $object = new Productcustomerprice($this->db); $object->context['createfromclone'] = 'createfromclone'; $this->db->begin(); // Load source object $object->fetch($fromid); $object->id = 0; $object->statut = 0; // Clear fields // ... // Create clone $result = $object->create($user); // Other options if ($result < 0) { $this->error = $object->error; $error++; } if (!$error) { } unset($object->context['createfromclone']); // End if (!$error) { $this->db->commit(); return $object->id; } else { $this->db->rollback(); return -1; } }