예제 #1
0
파일: note.php 프로젝트: nrjacker4/crm-php
$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_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();
예제 #2
0
$result = restrictedArea($user, 'contrat',$id,'');


$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);


/******************************************************************************/
/*                     Actions                                                */
/******************************************************************************/

if ($_POST["action"] == 'update_public' && $user->rights->contrat->creer)
{
	$db->begin();

	$res=$contrat->update_note_public($_POST["note_public"],$user);
	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();