$object->fetch($line); $object->qty = $qty; $object->price_level = $price_level; $result = $object->update($user); if ($result > 0) { $mesg = '<font class="ok">' . $langs->trans("LineUpdated") . '</font>'; } else { $mesg = '<div class="error">' . $object->error . '</div>'; } } } // Generate Barcode if ($action == 'genbarcode') { $prod_id = GETPOST('prod_id', 'int'); $object = new Labelprint($db); $object->fetch(0); $result = $object->generate_barcode($prod_id); if ($result > 0) { $mesg = '<font class="ok">' . $langs->trans("BarcodeGenerated") . '</font>'; } else { $mesg = '<div class="error">' . $object->error . '</div>'; } } // Action select position object if ($action == 'confirm_position' && $confirm != 'yes') { $action = ''; } if ($action == 'confirm_position' && $confirm == 'yes') { $position = GETPOST('position', 'int'); $res += dolibarr_set_const($db, 'LAB_START', $position, 'chaine', 0, '', $conf->entity); $pdf = new pdfLabel();
$object->fetch($line); $object->qty = $qty; $object->price_level = $price_level; $result = $object->update($user); if ($result > 0) { $mesg = '<font class="ok">' . $langs->trans("LineUpdated") . '</font>'; } else { $mesg = '<div class="error">' . $object->error . '</div>'; } } } // Generate Barcode if ($action == 'genbarcode') { $prod_id = GETPOST('prod_id', 'int'); $object = new Labelprint($db); $object->fetch($line); $result = $object->generate_barcode($prod_id); if ($result > 0) { $mesg = '<font class="ok">' . $langs->trans("BarcodeGenerated") . '</font>'; } else { $mesg = '<div class="error">' . $object->error . '</div>'; } } // Action select position object if ($action == 'confirm_position' && $confirm != 'yes') { $action = ''; } if ($action == 'confirm_position' && $confirm == 'yes') { $position = GETPOST('position', 'int'); $res += dolibarr_set_const($db, 'LAB_START', $position, 'chaine', 0, '', $conf->entity); $pdf = new pdfLabel();
/** * Load an object from its id and create a new one in database * @param int $fromid Id of object to clone * @return int New id of clone */ function createFromClone($fromid) { global $user, $langs; $error = 0; $object = new Labelprint($this->db); $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++; } // End if (!$error) { $this->db->commit(); return $object->id; } else { $this->db->rollback(); return -1; } }