diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4a2002bc090b6..1d7f3a890091d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -68,14 +68,14 @@ function Form($DB) /** * Output key field for an editable field * - * @param string $text Text of label - * @param string $htmlname Name of select field - * @param string $preselected Preselected value for parameter - * @param string $paramkey Key of parameter (unique if there is several parameter to show) - * @param string $paramvalue Value of parameter - * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data (string by default, email, ...) - * @return string HTML edit field + * @param string $text Text of label or key to translate + * @param string $htmlname Name of select field + * @param string $preselected Value to show/edit + * @param string $paramkey Key of parameter for Url (unique if there is several parameter to show). In most cases "id". + * @param string $paramvalue Value of parameter for Url + * @param boolean $perm Permission to allow button to edit parameter + * @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day', ...) + * @return string HTML edit field * TODO no GET or POST in class file, use a param */ function editfieldkey($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string') @@ -91,17 +91,17 @@ function editfieldkey($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$ } /** - * Output val field for an editable field + * Output val field for an editable field * - * @param string $text Text of label (not used in this function) - * @param string $htmlname Name of select field - * @param string $preselected Preselected value for parameter - * @param string $paramkey Key of parameter (unique if there is several parameter to show) - * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'email', 'text', 'day', ...) - * @param string $editvalue Use this value instead $preselected - * @return string HTML edit field - * TODO no GET or POST in class file, use a param + * @param string $text Text of label (not used in this function) + * @param string $htmlname Name of select field + * @param string $preselected Value to show/edit + * @param string $paramkey Key of parameter (unique if there is several parameter to show) + * @param boolean $perm Permission to allow button to edit parameter + * @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day', ...) + * @param string $editvalue Use this value instead $preselected + * @return string HTML edit field + * TODO no GET or POST in class file, use a param */ function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='') { @@ -118,11 +118,11 @@ function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$ $ret.=''; if (in_array($typeofdata,array('string','email'))) { - $ret.=''; + $ret.=''; } - else if ($typeofdata == 'text') + else if ($typeofdata == 'text' || $typeofdata == 'textarea') { - $ret.=''; + $ret.=''; } else if ($typeofdata == 'day') { @@ -136,22 +136,23 @@ function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$ } else { - if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1); - if ($typeofdata == 'day') $ret.=dol_print_date($preselected,'day'); + if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1); + elseif ($typeofdata == 'day') $ret.=dol_print_date($preselected,'day'); + elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($preselected); else $ret.=$preselected; } return $ret; } /** - * Output edit in place form + * Output edit in place form * - * @param string $value Value to show/edit - * @param string $htmlname DIV ID (field name) - * @param int $condition Condition to edit - * @param string $inputType Type of input - * @param string $inputOption Input option - * @return string HTML edit in place + * @param string $value Value to show/edit + * @param string $htmlname DIV ID (field name) + * @param int $condition Condition to edit + * @param string $inputType Type of input + * @param string $inputOption Input option + * @return string HTML edit in place */ function editInPlace($value, $htmlname, $condition, $inputType='textarea', $inputOption='') { diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index beae197579b53..38a150a52a446 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -56,6 +56,7 @@ $object = new Fichinter($db); + /* * Actions */ @@ -219,6 +220,18 @@ $result=$object->set_description($user,$_POST['description']); if ($result < 0) dol_print_error($db,$object->error); } +if ($action == 'setnote_public') +{ + $object->fetch($id); + $result=$object->update_note_public($_POST['note_public']); + if ($result < 0) dol_print_error($db,$object->error); +} +if ($action == 'setnote_private') +{ + $object->fetch($id); + $result=$object->update_note($_POST['note_private']); + if ($result < 0) dol_print_error($db,$object->error); +} // Add line if ($action == "addline" && $user->rights->ficheinter->creer) @@ -802,35 +815,12 @@ print ''; // Description (must be a textarea and not html must be allowed (used in list view) - print ''; - if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) - { - print $langs->trans('Description'); - print ''; - print $form->editInPlace($object->description, 'description', $user->rights->ficheinter->creer && $object->statut == 0, 'textarea'); - } - else - { - print ''; - if ($action != 'editdescription' && $object->statut == 0) print ''; - print '
'; - print $langs->trans('Description'); - print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; - print ''; - if ($action == 'editdescription') - { - print '
'; - print ''; - print ''; - print '
'; - print ''; - print '
'; - } - else - { - print dol_nl2br($object->description); - } - } + print ''; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $langs->trans('Description'); + else print $form->editfieldkey("Description",'description',$object->description,'id',$object->id,$object->statut == 0 && $user->rights->ficheinter->creer,'textarea'); + print ''; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $form->editInPlace($object->description, 'description', $user->rights->ficheinter->creer && $object->statut == 0, 'textarea'); + else print $form->editfieldval("Description",'description',$object->description,'id',$object->id,$object->statut == 0 && $user->rights->ficheinter->creer,'textarea'); print ''; print ''; @@ -868,17 +858,23 @@ print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; // Public note - print ''.$langs->trans("NotePublic").''; - print ''; - print $form->editInPlace($object->note_public, 'note_public', $user->rights->ficheinter->creer, 'textarea'); + print ''; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $langs->trans('NotePublic'); + else print $form->editfieldkey("NotePublic",'note_public',$object->note_public,'id',$object->id,$user->rights->ficheinter->creer,'textarea'); + print ''; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $form->editInPlace($object->note_public, 'note_public', $user->rights->ficheinter->creer, 'textarea'); + else print $form->editfieldval("NotePublic",'note_public',$object->note_public,'id',$object->id,$user->rights->ficheinter->creer,'textarea'); print ""; // Private note if (! $user->societe_id) { - print ''.$langs->trans("NotePrivate").''; - print ''; - print $form->editInPlace($object->note_private, 'note_private', $user->rights->ficheinter->creer, 'textarea'); + print ''; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $langs->trans('NotePrivate'); + else print $form->editfieldkey("NotePrivate",'note_private',$object->note_private,'id',$object->id,$user->rights->ficheinter->creer,'textarea'); + print ''; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $form->editInPlace($object->note_private, 'note_private', $user->rights->ficheinter->creer, 'textarea'); + else print $form->editfieldval("NotePrivate",'note_private',$object->note_private,'id',$object->id,$user->rights->ficheinter->creer,'textarea'); print ""; }