$socid = $user->societe_id; } $result = restrictedArea($user, 'contrat', $id); $object = new Contrat($db); $object->fetch($id, $ref); /******************************************************************************/ /* Actions */ /******************************************************************************/ if ($action == 'setnote_public' && $user->rights->contrat->creer) { $result = $object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); if ($result < 0) { dol_print_error($db, $object->error); } } else { if ($action == 'setnote' && $user->rights->contrat->creer) { $result = $object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); if ($result < 0) { dol_print_error($db, $object->error); } } } /******************************************************************************/ /* Affichage fiche */ /******************************************************************************/ llxHeader(); $form = new Form($db); if ($id > 0 || !empty($ref)) { dol_htmloutput_mesg($mesg); $object->fetch_thirdparty(); $head = contract_prepare_head($object); $hselected = 2;
$confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); // Security check if ($user->societe_id) { $socid = $user->societe_id; } $result = restrictedArea($user, 'contrat', $id); $object = new Contrat($db); $object->fetch($id, $ref); /******************************************************************************/ /* Actions */ /******************************************************************************/ if ($action == 'setnote_public' && $user->rights->contrat->creer) { $result = $object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES), '_public'); if ($result < 0) { dol_print_error($db, $object->error); } } else { if ($action == 'setnote_private' && $user->rights->contrat->creer) { $result = $object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES), '_private'); if ($result < 0) { dol_print_error($db, $object->error); } } } /******************************************************************************/ /* Affichage fiche */ /******************************************************************************/ llxHeader();
if ($res < 0) { $mesg='<div class="error">'.$contrat->error.'</div>'; $db->rollback(); } else { $db->commit(); } } if ($_POST["action"] == 'update' && $user->rights->contrat->creer) { $db->begin(); $res=$contrat->update_note($_POST["note"],$user); if ($res < 0) { $mesg='<div class="error">'.$contrat->error.'</div>'; $db->rollback(); } else { $db->commit(); } } /******************************************************************************/ /* Affichage fiche */