diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 1808f400e23..a169ec7aa61 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -410,7 +410,7 @@ else if ($id) // Public note print ''.$langs->trans("NotePublic").''; print ''; - print $form->editInPlace(($object->note_public ? dol_nl2br($object->note_public) : " "), 'note_public', $object->element); + print $form->editInPlace(($object->note_public ? dol_nl2br($object->note_public) : " "), 'note_public', $user->rights->deplacement->creer); print ""; // Private note @@ -418,7 +418,7 @@ else if ($id) { print ''.$langs->trans("NotePrivate").''; print ''; - print $form->editInPlace(($object->note_private ? dol_nl2br($object->note_private) : " "), 'note', $object->element); + print $form->editInPlace(($object->note_private ? dol_nl2br($object->note_private) : " "), 'note', $user->rights->deplacement->creer); print ""; } diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 96ea34f3936..c287e8ce67a 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -49,6 +49,8 @@ if((isset($_GET['field']) && ! empty($_GET['field'])) $field = GETPOST('field'); $fk_element = GETPOST('fk_element'); + if ($element == 'fichinter') $element = 'ficheinter'; + if ($user->rights->$element->lire || $user->rights->$element->read) { $object = new GenericObject($db); diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index f14537066ca..147f5888d9c 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -52,6 +52,8 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) $value = GETPOST('value'); $type = GETPOST('type'); + if ($element == 'fichinter') $element = 'ficheinter'; + if ($user->rights->$element->creer || $user->rights->$element->write) { $object = new GenericObject($db); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index db8265ddfbb..f1efc7b0cdf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -147,17 +147,17 @@ class Form * * @param string $value Value to show/edit * @param string $htmlname DIV ID (field name) - * @param string $element Type of element + * @param int $condition Condition to edit * @param string $area Type of edit * @return string HTML edit in place */ - function editInPlace($value, $htmlname, $element, $type='area') + function editInPlace($value, $htmlname, $condition, $type='area') { global $user; $out=''; - if ($user->rights->$element->creer || $user->rights->$element->write) + if ($condition) { $out.= '
'; $out.= $value; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 61b1776a279..98fcb0d37ac 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -80,7 +80,8 @@ class Fichinter extends CommonObject /** - * Create a intervention into data base + * Create an intervention into data base + * * @return int <0 if KO, >0 if OK */ function create() @@ -169,10 +170,11 @@ class Fichinter extends CommonObject } /** - * Update a intervention + * Update an intervention + * * @return int <0 if KO, >0 if OK */ - function update($user) + function update() { if (! is_numeric($this->duree)) { $this->duree = 0; } if (! dol_strlen($this->fk_project)) { $this->fk_project = 0; } @@ -204,8 +206,9 @@ class Fichinter extends CommonObject /** * Fetch a intervention - * @param rowid Id of intervention - * @param ref Ref of intervention + * + * @param int $id Id of intervention + * @param string $ref Ref of intervention * @return int <0 if ko, >0 if ok */ function fetch($rowid,$ref='') diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index e2632b4302c..a750a8e848d 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -159,7 +159,7 @@ if ($action == 'update') $object->description = $_POST["description"]; $object->ref = $ref; - $object->update($user); + $object->update(); } /* @@ -619,7 +619,7 @@ if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_AD * View */ -$html = new Form($db); +$form = new Form($db); $formfile = new FormFile($db); llxHeader(); @@ -694,7 +694,7 @@ if ($action == 'create') print ''.$langs->trans("DefaultModel").''; print ''; $liste=ModelePDFFicheinter::liste_modeles($db); - print $html->selectarray('model',$liste,$conf->global->FICHEINTER_ADDON_PDF); + print $form->selectarray('model',$liste,$conf->global->FICHEINTER_ADDON_PDF); print ""; // Public note @@ -727,7 +727,7 @@ if ($action == 'create') print '
'; print ''; print ''; print '
'.$langs->trans("ThirdParty").''; - $html->select_societes('','socid','',1,1); + $form->select_societes('','socid','',1,1); print '
'; @@ -761,36 +761,41 @@ else if ($id > 0 || ! empty($ref)) // Confirmation de la suppression de la fiche d'intervention if ($action == 'delete') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); if ($ret == 'html') print '
'; } // Confirmation validation if ($action == 'validate') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); if ($ret == 'html') print '
'; } // Confirmation de la validation de la fiche d'intervention if ($action == 'modify') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); if ($ret == 'html') print '
'; } // Confirmation de la suppression d'une ligne d'intervention if ($action == 'ask_deleteline') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$_GET["line_id"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$_GET["line_id"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); if ($ret == 'html') print '
'; } + + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $user->rights->ficheinter->creer) + { + include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxeditinplace.tpl.php'); + } print ''; // Ref print ''; // Third party @@ -845,11 +850,11 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; @@ -857,6 +862,21 @@ else if ($id > 0 || ! empty($ref)) // Statut print ''; + + // Public note + print ''; + print '"; + + // Private note + if (! $user->societe_id) + { + print ''; + print '"; + } print "
'.$langs->trans("Ref").''; - print $html->showrefnav($object,'ref','',1,'ref','ref'); + print $form->showrefnav($object,'ref','',1,'ref','ref'); print '
'; if ($action == 'classify') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); + $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); } print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NotePublic").''; + print $form->editInPlace(($object->note_public ? dol_nl2br($object->note_public) : " "), 'note_public', $user->rights->ficheinter->creer); + print "
'.$langs->trans("NotePrivate").''; + print $form->editInPlace(($object->note_private ? dol_nl2br($object->note_private) : " "), 'note_private', $user->rights->ficheinter->creer); + print "
"; @@ -967,12 +987,12 @@ else if ($id > 0 || ! empty($ref)) // Date d'intervention print ''; - $html->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); print ''; // Duration print ''; - $html->select_duration('duration',$objp->duree); + $form->select_duration('duration',$objp->duree); print ''; print ''; @@ -1025,12 +1045,12 @@ else if ($id > 0 || ! empty($ref)) $timearray=dol_getdate(mktime()); if (empty($_POST['diday'])) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); else $timewithnohour=dol_mktime($_POST['dihour'],$_POST['dimin'],$_POST['disec'],$_POST['dimonth'],$_POST['diday'],$_POST['diyear']); - $html->select_date($timewithnohour,'di',1,1,0,"addinter"); + $form->select_date($timewithnohour,'di',1,1,0,"addinter"); print ''; // Duration print ''; - $html->select_duration('duration',(empty($_POST["durationhour"]) && empty($_POST["durationmin"]))?3600:(60*60*$_POST["durationhour"]+60*$_POST["durationmin"])); + $form->select_duration('duration',(empty($_POST["durationhour"]) && empty($_POST["durationmin"]))?3600:(60*60*$_POST["durationhour"]+60*$_POST["durationmin"])); print ''; print '';