if ($action == 'confirm_clone' && $confirm != 'yes') { $action = ''; } if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->tax->charges->creer) { $db->begin(); $originalId = $id; $object = new ChargeSociales($db); $object->fetch($id); if ($object->id > 0) { $object->paye = 0; $object->id = $object->ref = null; if (GETPOST('clone_for_next_month') != '') { $object->date_ech = strtotime('+1month', $object->date_ech); $object->periode = strtotime('+1month', $object->periode); } if ($object->check()) { $id = $object->create($user); if ($id > 0) { $db->commit(); $db->close(); header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit; } else { $id = $originalId; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } } else { $db->rollback(); dol_print_error($db, $object->error);