/**
 * ***************************************************
 * Price by customer
 * ****************************************************
 */
if ($action == 'add_customer_price_confirm' && !$_POST["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
    $update_child_soc = GETPOST('updatechildprice');
    // add price by customer
    $prodcustprice->fk_soc = $socid;
    $prodcustprice->fk_product = GETPOST('prodid', 'int');
    $prodcustprice->price = price2num(GETPOST("price"), 'MU');
    $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
    $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
    $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
    $prodcustprice->recuperableonly = preg_match('/\\*/', GETPOST("tva_tx")) ? 1 : 0;
    $result = $prodcustprice->create($user, 0, $update_child_soc);
    if ($result < 0) {
        setEventMessage($prodcustprice->error, 'errors');
    } else {
        setEventMessage($langs->trans('Save'), 'mesgs');
    }
    $action = '';
}
if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $user->rights->service->creer)) {
    // Delete price by customer
    $prodcustprice->id = GETPOST('lineid');
    $result = $prodcustprice->delete($user);
    if ($result < 0) {
        setEventMessage($prodcustprice->error, 'mesgs');
    } else {
        setEventMessage($langs->trans('Delete'), 'errors');
 /**
  * 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;
     }
 }